var openStationApp_osSettings=function(qs){"use strict";const al="desktop-mode";function ln(){return window.wp?.i18n}function d(s,e=al){return ln()?.__(s,e)??s}function F(s,...e){const t=ln()?.sprintf;if(t)return t(s,...e);let o=0;return s.replace(/%(?:(\d+)\$)?[sd]/g,(i,n)=>{const r=n?Number.parseInt(n,10)-1:o++;return String(e[r]??"")})}const ll="desktop-mode-os-settings",Fs=1920,Vs=1080,cl=40,dl=300,gs="custom-gradient",ne="custom-image",ul="galaxy",Te="custom",cn=[{id:"pulse",label:"Pulse",value:"#f252fc"},{id:"nebula",label:"Nebula",value:"#ec9bff"},{id:"sirius",label:"Sirius",value:"#9af2ff"},{id:"lagoon",label:"Lagoon",value:"#9f98ff"},{id:"starlight",label:"Starlight",value:"#fffbff"},{id:"wp-blue",label:"WordPress Blue",value:"#2271b1"},{id:"indigo",label:"Indigo",value:"#3858e9"},{id:"teal",label:"Teal",value:"#04a4cc"},{id:"emerald",label:"Emerald",value:"#059669"},{id:"amber",label:"Amber",value:"#d97706"},{id:"rose",label:"Rose",value:"#e11d48"}];function De(){const e=window.wp?.os?.config?.accentColors;if(!Array.isArray(e)||e.length===0)return cn;const t=[];for(const o of e)o&&typeof o=="object"&&typeof o.id=="string"&&typeof o.label=="string"&&typeof o.value=="string"&&o.id!==""&&o.label!==""&&/^#[0-9a-f]{3,8}$/i.test(o.value)&&t.push({id:o.id,label:o.label,value:o.value});return t.length>0?t:cn}function dn(){const e=window.wp?.os?.config?.defaultWallpaper;return typeof e=="string"&&e!==""?e:ul}const un=[{id:"compact",label:"Compact",width:48,icon:18},{id:"default",label:"Default",width:56,icon:20},{id:"large",label:"Large",width:72,icon:26}],hn=[{id:"sharp",label:"Sharp",value:0},{id:"default",label:"Default",value:8},{id:"round",label:"Round",value:16}],pn=[{id:"static",label:"Static"},{id:"dynamic",label:"Dynamic"},{id:"hidden",label:"Hidden"}],js=[{id:"static",label:"Static"},{id:"dynamic",label:"Dynamic"}],gn=[{id:"bottom",label:"Bottom"},{id:"left",label:"Left"},{id:"right",label:"Right"}],hl=[{id:"unified",label:"Unified"},{id:"classic",label:"Split"}],Ks=ll;function ge(){return window.wp?.os}function P(){return ge().getOsSettings()}function E(s){ge()?.updateOsSettings(s,{windowId:Ks})}function pl(){ge()?.resetOsSettings({windowId:Ks})}function fn(s){return ge()?.subscribeOsSettings(s)??(()=>{})}function bn(s){const e=ge()?.desktopThemes?.applyRecommendedOsSettings(s)??{};return Object.keys(e).length>0}function mn(){try{ge()?.refreshMenu?.()}catch{}}function gl(s,e,t="dashicons-admin-settings"){const o=ge();if(o?.windowManager?.open){o.windowManager.open({id:o.deriveWindowId?o.deriveWindowId(s):s,url:s,title:e,icon:t});return}window.open(s,"_blank","noopener")}function Bs(){return window.openStationConfig??{}}const vn="__openStationSharedStores";function fl(){const s=window;let e=s[vn];return e||(e=new Map,s[vn]=e),e}function J(s,e){const t=fl();let o=t.get(s);o||(o={state:e(),listeners:new Set,rebuild:e},t.set(s,o));const i={get state(){return o.state},set state(n){o.state=n},getState(){return o.state},notify(){for(const n of Array.from(o.listeners))try{n(o.state)}catch(r){console.error(`[desktop-mode/shared-store:${s}] subscriber threw:`,r)}},subscribe(n){return o.listeners.add(n),()=>{o.listeners.delete(n)}},setState(n){const r=o.state;if(typeof r!="object"||r===null){console.warn(`[desktop-mode/shared-store:${s}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(r,n),i.notify()},reset(){const n=o.rebuild(),r=o.state;if(typeof r=="object"&&r!==null&&typeof n=="object"&&n!==null){const a=r;for(const l of Object.keys(a))delete a[l];Object.assign(a,n)}else o.state=n;o.listeners.clear()}};return i}const _n="X-WP-Nonce";function bl(s,e){const t=ml();if(!t)return e;const o=vl(s);if(!o||!_l(o))return e;const i=e?.headers??(typeof Request<"u"&&s instanceof Request?s.headers:void 0),n=new Headers(i??{});return n.has(_n)?e:(n.set(_n,t),{...e??{},headers:n})}function ml(){if(typeof window>"u")return;const e=window.openStationConfig?.restNonce;return typeof e=="string"&&e.length>0?e:void 0}function vl(s){try{const e=typeof window<"u"&&window.location?window.location.href:void 0;return typeof s=="string"?new URL(s,e):s instanceof URL?s:typeof Request<"u"&&s instanceof Request?new URL(s.url,e):null}catch{return null}}function _l(s){return typeof window>"u"||!window.location||s.origin!==window.location.origin?!1:!!(s.pathname.includes("/wp-json/")||s.searchParams.has("rest_route"))}function wn(s,e,t={}){const o=window.wp?.os?.fetch;if(typeof o=="function")return o(s,e,t);const i=bl(s,e);return fetch(s,i)}class yn extends Error{constructor(e,t){super(e||t.serverMessage||`HTTP ${t.status}`),this.name="RestError",this.status=t.status,this.code=t.code,this.data=t.data,this.serverMessage=t.serverMessage??""}}function xn(s){return s instanceof yn}function wl(s){const e=typeof s=="object"&&s!==null?s:void 0;return{code:typeof e?.code=="string"?e.code:void 0,data:e?.data,serverMessage:typeof e?.message=="string"?e.message:""}}function yl(s,e,t=""){return new yn(t,{status:s,...wl(e)})}async function xe(s,e=""){let t=null;try{t=await s.json()}catch{t=null}return yl(s.status,t,e)}const kn=J("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"})),$n=kn.state.registry,An=kn.state.listeners;function xl(s){return $n.get(s)}function Gs(){return Array.from($n.values())}function kl(s){return An.add(s),()=>{An.delete(s)}}function En(){const s=window.wp?.hooks;if(!s)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 s}function fe(s,e,...t){return En().applyFilters(s,e,...t)}function be(s,...e){En().doAction(s,...e)}const V={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"};function Sn(s,e){if(!s||typeof s!="object")return["def (not an object)"];const t=s,o=[];for(const i of e)i.valid(t)||o.push(`${i.field} (${i.message})`);return o}class $l extends Error{constructor(e,t,o){super(`[openstation] ${e} registration rejected — fields: `+t.join(", ")+"."),this.name="RegistrationError",this.kind=e,this.errors=t,this.def=o}}function Xs(s,e,t){if(e.length!==0)throw new $l(s,e,t)}const re=[[0,0],[100,0],[100,100],[0,100]],Al=48,El=80,Zs=6,Ys=8,Cn=4,In=3,Rn=64,Js=105,ae=2;function Ln(s){return`${Math.round(s*1e3)/1e3}%`}function le(s){return s.slice().reverse()}function Pe(s,e,t,o){return[[s,e],[t,e],[t,o],[s,o]]}function Sl(s,e,t,o){const i=[];for(let n=0;n{t.push(`${Ln(i[0])} ${Ln(i[1])}`)};for(const i of s)o(i);if(e.length>0){o(s[0]);for(const i of e){for(const n of i)o(n);o(i[0]),o(s[0])}}return`polygon( ${t.join(", ")} )`}function Tn(s){return Q(re,[le(Sl(50,50,s,Al))])}function Dn(s){return Q(re,[le(Pe(50-s,-ae,50+s,100+ae))])}function Pn(s){const e=100/Zs,t=[];for(let o=0;o`${bs(i)} ${bs(n)}`).join(" L ")} Z`),e?o.setAttribute("fill","#fff"):(o.setAttribute("fill",Un[s%Un.length]),o.setAttribute("stroke",Wl),o.setAttribute("stroke-width",String(Hl)),o.setAttribute("vector-effect","non-scaling-stroke"),o.setAttribute("stroke-linejoin","round")),o}function Vl(){const s=`os-iris-${++Ul}`,e=document.createElementNS($e,"svg");e.setAttribute("viewBox",`0 0 ${eo} ${eo}`),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("aria-hidden","true"),e.style.width="100%",e.style.height="100%",e.style.display="block";const t=document.createElementNS($e,"defs"),o=document.createElementNS($e,"mask");o.setAttribute("id",s);const i=document.createElementNS($e,"g"),n=document.createElementNS($e,"g");n.setAttribute("mask",`url(#${s})`);const r=[];for(let l=0;lr.map(({el:u,index:h})=>{const p=ql(h),g=bs(p.x*Hn),b=bs(p.y*Hn);return u.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${g}px, ${b}px )`}],{duration:l.duration,easing:l.easing,delay:l.delay,fill:"both"})})}}const ms="none",Fn=J("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),so=Fn.state.registry,oo=Fn.state.listeners,Vn=/^[a-z0-9_/-]+$/;function jn(s){const e=/^\s*([a-zA-Z-]+)\s*\(/.exec(s);return e?e[1].toLowerCase():""}const jl=0;function Kn(s,e){const t=[],o=typeof s.from=="string"&&s.from.trim()!=="",i=typeof s.to=="string"&&s.to.trim()!=="";if(o||t.push(`${e}.from (missing — the clip-path covering the window)`),i||t.push(`${e}.to (missing — the clip-path uncovering the window)`),o&&i){const n=jn(s.from),r=jn(s.to);n===""||r===""?t.push(`${e}.from|to (must be shape functions, e.g. \`inset( … )\` or \`polygon( … )\` — bare keywords like \`none\` cannot be animated)`):n!==r&&t.push(`${e}.from|to (must use the same shape function to interpolate — got \`${n}()\` and \`${r}()\`)`)}return t}function Kl(s){if(typeof KeyframeEffect!="function")return!0;try{return new KeyframeEffect(null,null,{easing:s}),!0}catch{return!1}}function G(s){const e=[];if(!s||typeof s!="object")e.push("def (not an object)");else{typeof s.id!="string"||s.id.trim()===""?e.push("id (missing)"):Vn.test(s.id.trim().toLowerCase())?s.id.trim().toLowerCase()===ms&&e.push('id ("none" is reserved)'):e.push(`id (must match ${Vn} — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof s.label!="string"||s.label.trim()==="")&&e.push("label (missing)");const o=s.render!==void 0,i=Array.isArray(s.layers),n=s.from!==void 0||s.to!==void 0;o&&typeof s.render!="function"?e.push("render (not a function)"):o&&(i||n)?e.push("render|layers|from|to (supply exactly one of: a from/to pair, a layers array, or a render function)"):o||(i&&n?e.push("layers|from|to (supply EITHER a single from/to pair OR a layers array, not both)"):i?(s.layers.length===0&&e.push("layers (empty — supply at least one matched pair)"),s.layers.forEach((r,a)=>{if(!r||typeof r!="object"){e.push(`layers[ ${a} ] (not an object)`);return}e.push(...Kn(r,`layers[ ${a} ]`))})):e.push(...Kn(s,"").map(r=>r.replace(/^\./,"")))),s.easing!==void 0&&(typeof s.easing!="string"||s.easing.trim()===""?e.push("easing (not a non-empty string)"):Kl(s.easing)||e.push("easing (not an easing the browser can parse — `Element.animate()` would throw at play time, with the covering surface already over the window)"))}Xs("WindowReveal",e,s);const t=s.id.trim().toLowerCase();so.set(t,{...s,id:t}),Xl()}function io(){const s=Array.from(so.values()),e=fe(V.WINDOW_REVEALS,s);return Array.isArray(e)?e:(typeof console<"u"&&console.warn("[openstation] `os.window-reveals` filter returned a non-array; falling back to registry list."),s)}function Bl(s){return so.has(s)}function Gl(s){return oo.add(s),()=>{oo.delete(s)}}function Xl(){const s=Array.from(oo);for(const e of s)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] window-reveal registry listener threw:",t)}}G({id:"sweep",label:d("Sweep"),description:d("A straight edge travels across the window, uncovering the page behind it."),...zl(),duration:420}),G({id:"iris",label:d("Iris"),description:d("The page opens out from the centre of the window, like a camera shutter."),...Cl(),duration:520}),G({id:"curtain",label:d("Curtain"),description:d("Two panels part from the middle of the window and slide off the sides."),...Il(),duration:480}),G({id:"blinds",label:d("Blinds"),description:d("Six horizontal slats retract at once, letting the page through between them."),...Rl(),duration:560}),G({id:"diagonal",label:d("Diagonal"),description:d("A slanted edge sweeps off the trailing corner of the window."),...Ol(),duration:460}),G({id:"rise",label:d("Rise"),description:d("The page rises into the window from the bottom edge upward."),...Ml(),duration:440}),G({id:"shutter",label:d("Shutter"),description:d("Two panels part from the middle of the window and slide off the top and bottom."),...Ll(),duration:480}),G({id:"slats",label:d("Slats"),description:d("Eight vertical slats retract at once, letting the page through between them."),...Tl(),duration:560}),G({id:"diamond",label:d("Diamond"),description:d("The page opens out from the centre of the window through a growing rhombus."),...Dl(),duration:520}),G({id:"mosaic",label:d("Mosaic"),description:d("The page arrives as a grid of tiles, each opening out from its own centre."),...Pl(),duration:600}),G({id:"obturator",label:d("Camera shutter"),description:d("Six wedges slide aside in unison, opening a hexagonal aperture from the centre like the iris of a camera lens."),render:Vl,duration:720,edgeLag:0}),G({id:"radar",label:d("Radar"),description:d("A spoke sweeps a full turn around the centre of the window, uncovering the page behind it."),...Nl(),duration:760});const Bn={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},Gn=["dockRailRenderer","windowReveal","accent"],Xn={windowRevealDuration:{min:80,max:4e3}},Zl=/^[a-z0-9_-]+$/;[...Object.keys(Bn),...Gn,...Object.keys(Xn)];function Zn(s){if(!s||typeof s!="object"||Array.isArray(s))return{};const e=s,t={},o={};for(const[i,n]of Object.entries(Bn)){const r=e[i];typeof r=="string"&&n.includes(r)&&(t[i]=r)}for(const i of Gn){const n=e[i];typeof n=="string"&&Zl.test(n)&&(t[i]=n)}for(const[i,n]of Object.entries(Xn)){const r=e[i];typeof r=="number"&&Number.isFinite(r)&&(o[i]=Math.min(n.max,Math.max(n.min,Math.round(r))))}return{...t,...o}}function Yn(s){const e=Zn(s);return typeof e.dockRailRenderer=="string"&&xl(e.dockRailRenderer)===void 0&&delete e.dockRailRenderer,typeof e.windowReveal=="string"&&e.windowReveal!==ms&&!Bl(e.windowReveal)&&delete e.windowReveal,typeof e.accent=="string"&&!De().some(t=>t.id===e.accent)&&delete e.accent,e}const Yl=/^[a-z0-9_-]+$/,Jn=128;function Jl(s){return typeof s!="string"||s===""||s.length>2048?!1:s.startsWith("dashicons-")||s.startsWith("https://")||s.startsWith("http://")||s.startsWith("data:image/")}function Qn(s){if(!s||typeof s!="object")return null;const e=s,t=typeof e.slug=="string"?e.slug:"";if(!Yl.test(t))return null;const o={};if(e.icons&&typeof e.icons=="object"){let l=0;for(const[u,h]of Object.entries(e.icons)){if(l>=Jn)break;u===""||!Jl(h)||(o[u]=h,l+=1)}}const i={};if(e.tokens&&typeof e.tokens=="object")for(const[l,u]of Object.entries(e.tokens))typeof u=="string"&&(i[l]=u);const n=[];if(Array.isArray(e.fonts))for(const l of e.fonts)typeof l=="string"&&l!==""&&n.push(l);const r={};if(e.iconColors&&typeof e.iconColors=="object"){let l=0;for(const[u,h]of Object.entries(e.iconColors)){if(l>=Jn)break;u===""||typeof h!="string"||h===""||(r[u]=h,l+=1)}}const a=l=>typeof e[l]=="string"?e[l]:"";return{id:a("id")||t,slug:t,name:a("name")||t,version:a("version"),author:a("author"),description:a("description"),previewUrl:a("previewUrl"),cssUrl:a("cssUrl"),cssText:a("cssText"),tokens:i,fonts:n,icons:o,iconColors:r,recommendedOsSettings:Zn(e.recommendedOsSettings),installedAt:typeof e.installedAt=="number"?e.installedAt:0,source:e.source==="code"?"code":"upload",cssDeferred:e.cssDeferred===!0}}function Ql(){const e=window.openStationConfig?.serverDesktopThemes,t=[];if(Array.isArray(e))for(const o of e){const i=Qn(o);i&&t.push(i)}return{themes:t,activeId:null,activeIcons:null,activeIconColors:null}}const oe=J("desktop-mode/desktop-themes",Ql);function er(){return oe}function no(){return oe.getState().themes.slice()}function ec(s){if(typeof s!="string"||s==="")return null;const e=s.replace(/\//g,"-");return oe.getState().themes.find(t=>t.slug===e||t.id===s)??null}function tr(s){const e=Qn(s);if(!e)return null;const t=oe.state.themes.slice(),o=t.findIndex(i=>i.slug===e.slug);return o>=0?t[o]=e:t.push(e),t.sort((i,n)=>i.name.localeCompare(n.name)),oe.setState({themes:t}),e}let Ne=null;function tc(){if(Ne)return Ne;const s=window.openStationConfig?.desktopThemesUrl;return s?(Ne=wn(s,{method:"GET",credentials:"same-origin"},{source:"desktop-mode/desktop-themes"}).then(async e=>{if(!e.ok)throw await xe(e);return e.json()}).then(e=>{for(const t of e?.themes??[])tr(t)}).catch(()=>{Ne=null}),Ne):Promise.resolve()}function sc(s){const e=oe.state.themes.filter(t=>t.slug!==s);e.length!==oe.state.themes.length&&oe.setState({themes:e})}function oc(s){return oe.subscribe(s)}const ic="data-os-mode";function nc(s=typeof document<"u"?document.documentElement:null){return!!s&&s.getAttribute(ic)==="mobile"}function rc(s){s.style.setProperty("--os-file-tile-enter-delay",`${(Math.random()*.25).toFixed(3)}s`),s.style.setProperty("--os-file-tile-enter-duration",`${(.3+Math.random()*.25).toFixed(3)}s`)}function sr(s){if(!s)return 214;let e=5381;for(let t=0;t64||/[;{}<>"'\\]/.test(e))return null;let t=0;for(const o of e)if(o==="(")t+=1;else if(o===")"&&(t-=1,t<0))return null;return t===0?e:null}function dc(s){return typeof s!="string"||s===""||s.length>4096||!/^(https?:\/\/|data:image\/)/i.test(s)?!1:!/['"()\\<>\s]/.test(s)}function or(s,e,t){if(!dc(e))return!1;const o=`url("${e}") center / contain no-repeat`;return s.style.backgroundImage="none",s.style.backgroundColor=t,s.style.setProperty("-webkit-mask",o),s.style.setProperty("mask",o),!0}const Me={OS_SETTINGS:"OS_SETTINGS",RECYCLE_BIN:"RECYCLE_BIN",BUG_REPORT:"BUG_REPORT",EXIT_OPENSTATION:"EXIT_OPENSTATION",PWA_INSTALL:"PWA_INSTALL"},uc={"desktop-mode-os-settings":Me.OS_SETTINGS,"desktop-mode-recycle-bin":Me.RECYCLE_BIN,"desktop-mode-bug-report":Me.BUG_REPORT,"os-exit":Me.EXIT_OPENSTATION,"os-pwa-install":Me.PWA_INSTALL};function hc(s){if(typeof s!="string"||s==="")return"";const e=uc[s];if(e)return e;const t=s.toLowerCase().replace(/[^a-z0-9_-]/g,"");return t===""?"":`APP:${t}`}function ir(s){let e,t;try{const i=new URL(s,document.baseURI);e=i.origin,t=i.pathname}catch{return null}if(!t)return null;const o=document.querySelectorAll("script[src]");for(const i of Array.from(o))try{const n=new URL(i.src,document.baseURI);if(n.origin===e&&n.pathname===t)return i}catch{}return null}const nr=new Map;function pc(s){const e=nr.get(s);if(e)return e;let t=[];try{const o=new URL(s,document.baseURI);if(o.pathname.endsWith("/load-scripts.php")){const i=[];o.searchParams.forEach((n,r)=>{if(r!=="load"&&!r.startsWith("load["))return;const a=/(\d+)/.exec(r);i.push({order:a?Number(a[1]):i.length,value:n})}),i.sort((n,r)=>n.order-r.order),t=i.map(n=>n.value).join("").split(",").map(n=>n.trim()).filter(Boolean)}}catch{}return nr.set(s,t),t}function gc(){const s=new Set,e=document.querySelectorAll('script[src*="load-scripts.php"]');for(const t of Array.from(e))for(const o of pc(t.src))s.add(o);return s}const fc=["-js","-js-before","-js-after","-js-extra","-js-translations"];function bc(s){return s?fc.some(e=>{const t=document.getElementById(s+e);return!!t&&t.tagName==="SCRIPT"}):!1}function rr(s){return s.url&&ir(s.url)?!0:s.handle?gc().has(s.handle)||bc(s.handle):!1}const vs=new Map,ar=new Set;function ro(s,e){const t=vs.get(s);if(t)return t;const o=e?.deps;if(o&&o.length>0){const n=a=>rr(a)?Promise.resolve():a.url?ro(a.url,{...a,deps:void 0}):(mc(a),Promise.resolve()),r=o.reduce((a,l)=>a.then(()=>n(l)),Promise.resolve(void 0)).then(()=>lr(s,e));return vs.set(s,r),r}const i=lr(s,e);return vs.set(s,i),i}function mc(s){if(s.handle){if(ar.has(s.handle))return;ar.add(s.handle)}for(const e of s.l10n??[])me(e);for(const e of s.before??[])me(e);for(const e of s.after??[])me(e)}function lr(s,e){return new Promise((t,o)=>{const i=`script[data-os-vendor="${vc(s)}"]`,n=document.querySelector(i);if(n){if(n.dataset.loaded==="1"){t();return}n.addEventListener("load",()=>t(),{once:!0}),n.addEventListener("error",()=>o(new Error(`Failed to load ${s}`)),{once:!0});return}const r=ir(s);if(r){r.dataset.osVendor=s,r.dataset.loaded="1",t();return}if(rr({handle:e?.handle})){t();return}e?.translations&&me(e.translations);for(const l of e?.l10n??[])me(l);for(const l of e?.before??[])me(l);const a=document.createElement("script");a.src=s,a.async=!0,a.dataset.osVendor=s,a.addEventListener("load",()=>{a.dataset.loaded="1";for(const l of e?.after??[])me(l);t()},{once:!0}),a.addEventListener("error",()=>{vs.delete(s),a.remove(),o(new Error(`Failed to load ${s}`))},{once:!0}),document.head.appendChild(a)})}function me(s){if(!s)return;const e=document.createElement("script");e.textContent=s,e.dataset.osVendorInline="1",document.head.appendChild(e)}function vc(s){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(s):s.replace(/["\\]/g,"\\$&")}J("desktop-mode/native-url-remap",()=>({remaps:[],deps:null}));const _c={core:"rail",plugin:"rail",app:"desktop",control:"rail"};function wc(s,e){return s==="core"&&e==="classic"?"sidebar":"dock"}function yc(s,e){return s.locked?"rail":e[s.id]??s.defaultPlacement??_c[s.kind]}function xc(s){return s.map((e,t)=>({item:e,index:t})).sort((e,t)=>(e.item.order??0)-(t.item.order??0)||e.index-t.index).map(e=>e.item)}function kc(){return window.wp?.os??null}function ao(){return kc()?.getNavItems?.()??[]}const lo="none",cr=J("desktop-mode/unfocus-effect-registry",()=>({registry:new Map,listeners:new Set})),dr=cr.state.registry,co=cr.state.listeners,ur=/^[a-z0-9_/-]+$/;function uo(s){const e=[];!s||typeof s!="object"?e.push("def (not an object)"):(typeof s.id!="string"||s.id.trim()===""?e.push("id (missing)"):ur.test(s.id.trim().toLowerCase())?s.id.trim().toLowerCase()===lo&&e.push('id ("none" is reserved)'):e.push(`id (must match ${ur} — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof s.label!="string"||s.label.trim()==="")&&e.push("label (missing)"),typeof s.className!="string"&&typeof s.apply!="function"&&e.push("className|apply (at least one must be provided — a CSS class to toggle or an apply callback)")),Xs("UnfocusEffect",e,s);const t=s.id.trim().toLowerCase();dr.set(t,{...s,id:t}),Ac()}function ho(){const s=Array.from(dr.values()),e=fe(V.UNFOCUS_EFFECTS,s);return Array.isArray(e)?e:(typeof console<"u"&&console.warn("[openstation] `os.unfocus-effects` filter returned a non-array; falling back to registry list."),s)}function $c(s){return co.add(s),()=>{co.delete(s)}}function Ac(){const s=Array.from(co);for(const e of s)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] unfocus-effect registry listener threw:",t)}}uo({id:"darken",label:d("Darken"),description:d("Dim unfocused windows so the focused one stands out."),className:"os-window--fx-darken"}),uo({id:"frost",label:d("Frost"),description:d("Throw unfocused windows out of focus — a soft, frosted-glass blur, as if you were looking at them through an iced-over pane."),className:"os-window--fx-frost"}),uo({id:"grayscale",label:d("Grayscale"),description:d("Drain the colour from unfocused windows so the focused one is the only thing still in colour — your eye snaps right to it."),className:"os-window--fx-grayscale"});const hr="none",pr=J("desktop-mode/window-link-renderer-registry",()=>({registry:new Map,listeners:new Set})),Ec=pr.state.registry,gr=pr.state.listeners;function po(){const s=Array.from(Ec.values()),e=fe(V.WINDOW_LINK_RENDERERS,s);return Array.isArray(e)?e:(typeof console<"u"&&console.warn("[openstation] `os.window-links.renderers` filter returned a non-array; falling back to registry list."),s)}function Sc(s){return gr.add(s),()=>{gr.delete(s)}}const fr=J("desktop-mode/wallpaper-registry",()=>({seed:[],listeners:new Set})),_s=fr.state.seed,go=fr.state.listeners;function br(s){Xs("Wallpaper",Sn(s,mr),s);const e=_s.findIndex(t=>t.id===s.id);e>=0?_s[e]=s:_s.push(s),Ic()}function Cc(s){return go.add(s),()=>{go.delete(s)}}function Ic(){const s=Array.from(go);for(const e of s)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] wallpaper registry listener threw:",t)}}function Ae(){const s=_s.slice(),e=fe(V.WALLPAPERS,s);return Array.isArray(e)?e.filter(Rc):(typeof console<"u"&&console.warn("[openstation] `os.wallpapers` filter returned a non-array; falling back to seed list."),s)}function ze(s){return Ae().find(e=>e.id===s)}const mr=[{field:"id",message:"missing or not a non-empty string",valid:s=>typeof s.id=="string"&&s.id!==""},{field:"label",message:"missing or not a non-empty string",valid:s=>typeof s.label=="string"&&s.label!==""},{field:"preview",message:"missing or not a non-empty string",valid:s=>typeof s.preview=="string"&&s.preview!==""},{field:"type",message:'must be "css" or "canvas"',valid:s=>s.type==="css"||s.type==="canvas"},{field:"value/resolveValue/mount",message:"css types need `value` or `resolveValue`; canvas types need `mount`",valid:s=>s.type==="css"?typeof s.value=="string"||typeof s.resolveValue=="function":s.type==="canvas"?typeof s.mount=="function":!0}];function Rc(s){return Sn(s,mr).length===0}const Lc={desktopLayout:["unified","classic"],dockPlacement:["bottom","left","right"],dockBehavior:["static","dynamic"],sideDockBehavior:["static","dynamic"],dockSize:["compact","default","large"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"],windowLinkVisibility:["always","focus","off"],mobileLayout:["auto","desktop","mobile"],heartbeatRate:[15,30,45,60]},Tc=["mioApiEnabled","mioShowOnWallpaper","windowLinksEnabled","windowLinkRaiseOnFocus","windowLinkHighlight","showDesktopOnWallpaperClick","showPostStatusRibbons","developerModeEnabled","foldersSharingEnabled","stationHomeEnabled","nativePostsEnabled","nativePagesEnabled","nativeUsersEnabled","nativePluginsEnabled","nativeCommentsEnabled","confirmCloseAllWindows","libraryHdOnly"];function fo(){return{...Lc,accent:[...De().map(s=>s.id),"custom"],desktopTheme:["",...no().map(s=>s.slug)],wallpaper:Ae().map(s=>s.id),dockRailRenderer:Gs().map(s=>s.id),unfocusEffect:["none",...ho().map(s=>s.id)],windowReveal:["none",...io().map(s=>s.id)],windowLinkRenderer:["none",...po().map(s=>s.id)]}}function vr(){return ao().filter(s=>!s.locked&&!s.transient&&(s.menu||s.entry||s.tile?.placeable))}function _r(){return ao().filter(s=>!s.locked&&!s.transient&&!!(s.windowId||s.tile||s.menu?.url||s.entry?.url))}async function Dc(){return await tc(),{choices:fo(),themes:[{id:"",name:"OpenStation",description:"Built-in dark OpenStation palette.",surface:"#15151e"},...no().map(s=>({id:s.slug,name:s.name,description:s.description,surfaces:Object.fromEntries(Object.entries(s.tokens).filter(([e])=>/(?:surface|bg|backstop)$/.test(e)).slice(0,12)),recommendations:s.recommendedOsSettings}))],accents:De(),wallpapers:Ae().map(s=>({id:s.id,label:s.label,configurable:!!s.renderConfig})),dockRenderers:Gs().map(s=>({id:s.id,label:s.label})),unfocusEffects:ho().map(s=>({id:s.id,label:s.label})),reveals:io().map(s=>({id:s.id,label:s.label})),linkRenderers:po().map(s=>({id:s.id,label:s.label})),navigation:vr().map(s=>({id:s.id,title:s.title})),phonePins:_r().map(s=>({id:s.id,title:s.title}))}}function wr(s,e,t){const o=JSON.parse(JSON.stringify(P()));return new Promise((i,n)=>{let r=!1;const a=p=>{if(!r)if(r=!0,clearTimeout(h),document.removeEventListener("os-settings-save-lifecycle",u),e.removeEventListener("abort",l),p)n(p);else{const g=P(),b=Object.keys(g).flatMap(m=>{const x=m;return JSON.stringify(o[x])===JSON.stringify(g[x])?[]:[{setting:x,before:o[x],after:g[x]}]});i({saved:!0,changed:b.length>0,changes:b,settings:t})}},l=()=>a(new DOMException("Cancelled; a submitted save may still finish.","AbortError")),u=p=>{const g=p.detail;if(g.phase==="failed")a(new Error(g.error||"Preferences could not be saved."));else if(g.phase==="saved"){const b=P(),m=!t||Object.entries(t).every(([k,f])=>JSON.stringify(b[k])===JSON.stringify(f)),x=g.savedSettings,y=x&&Object.entries(t??b).every(([k,f])=>JSON.stringify(x[k])===JSON.stringify(f));if(m&&!y)return;a(m?void 0:new Error("The setting changed during this request. Review Preferences."))}},h=setTimeout(()=>a(new Error("Save confirmation timed out. Changes may still be saving; review Preferences.")),2e4);if(document.addEventListener("os-settings-save-lifecycle",u),e.addEventListener("abort",l,{once:!0}),e.aborted){l();return}try{s()}catch(p){a(p instanceof Error?p:new Error(String(p)))}})}const Pc={wind:{min:0,max:80},particleCount:{min:100,max:2e3},flakeSize:{min:6,max:40}},yr=J("desktop-mode/wallpaper-settings",()=>({values:{}}));function xr(s){return{...yr.state.values[s]??{}}}function kr(s,e){yr.state.values[s]={...e},be(V.WALLPAPER_SETTINGS_CHANGED,{id:s,settings:{...e}})}function c(s,...e){return{__wpdHtml:!0,strings:s,values:e}}function Nc(s){return!!s&&s.__wpdHtml===!0}const Mc="$$wpd$$",U=/\$\$wpd\$\$(\d+)\$\$/g,zc="$$wpd-node$$",Oc=/^\$\$wpd-node\$\$(\d+)\$\$$/,Wc=new Set(["style","script","textarea","title"]);function Hc(s){let e="",t=!1,o=null,i=!1,n=null,r="",a=!1;for(let l=0;l",h)&&(i=!1,h+=2);continue}if(n!==null){p==="<"&&u[h+1]==="/"&&u.slice(h+2,h+2+n.length).toLowerCase()===n&&(h+=1+n.length,n=null,t=!0,a=!1,r="");continue}if(o!==null){p===o&&(o=null);continue}if(t){p==='"'||p==="'"?(o=p,a=!1):p===">"?(t=!1,a=!1,Wc.has(r)&&(n=r),r=""):a&&(/[a-zA-Z0-9-]/.test(p)?r+=p.toLowerCase():a=!1);continue}if(u.startsWith("`)}return e}const $r=new WeakMap;function Ar(s){const e=$r.get(s);if(e)return e;const t=document.createElement("template");t.innerHTML=Hc(s);const o=[],i=(a,l)=>{if(a.nodeType===Node.ELEMENT_NODE){const p=a;for(const g of Array.from(p.attributes)){const b=g.name,m=g.value,x=b[0];if(U.test(m))if(U.lastIndex=0,x==="@"){const y=U.exec(m);U.lastIndex=0,o.push({path:l,kind:"event",name:b.slice(1),valueIndex:y?Number(y[1]):0}),p.removeAttribute(b)}else if(x==="."){const y=U.exec(m);U.lastIndex=0,o.push({path:l,kind:"prop",name:b.slice(1),valueIndex:y?Number(y[1]):0}),p.removeAttribute(b)}else if(x==="?"){const y=U.exec(m);U.lastIndex=0,o.push({path:l,kind:"bool",name:b.slice(1),valueIndex:y?Number(y[1]):0}),p.removeAttribute(b)}else{const y=[],k=[];let f=0,A;for(U.lastIndex=0;(A=U.exec(m))!==null;)y.push(m.slice(f,A.index)),k.push(Number(A[1])),f=A.index+A[0].length;y.push(m.slice(f)),o.push({path:l,kind:"attr",name:b,template:y,valueIndices:k}),p.setAttribute(b,"")}}}const u=Array.from(a.childNodes);let h=0;for(let p=0;py&&f.push(document.createTextNode(m.slice(y,k.index)));const $=document.createTextNode("");f.push($),A.push({path:[...l,b+f.length-1],kind:"node",valueIndex:Number(k[1])}),y=k.index+k[0].length}y{const l=[];for(const u of o){let h=a;for(const p of u.path)h=h.childNodes[p];u.kind==="node"?l.push({kind:"node",valueIndex:u.valueIndex,child:{anchor:h,state:null}}):u.kind==="attr"?l.push({kind:"attr",element:h,name:u.name,template:u.template,valueIndices:u.valueIndices}):u.kind==="event"?l.push({kind:"event",valueIndex:u.valueIndex,element:h,name:u.name}):u.kind==="prop"?l.push({kind:"prop",valueIndex:u.valueIndex,element:h,name:u.name}):u.kind==="bool"&&l.push({kind:"bool",valueIndex:u.valueIndex,element:h,name:u.name})}return l}};return $r.set(s,r),r}const Er=new WeakMap;function Uc(s,e){for(const t of s.nodes)if(t.parentNode!==e)return!1;return!0}function Ee(s,e){const t=Er.get(e);if(t&&t.strings===s.strings&&Uc(t,e)){ws(t.parts,s.values);return}const o=Ar(s.strings),i=o.template.content.cloneNode(!0),n=o.buildParts(i),r=Array.from(i.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(i),ws(n,s.values),Er.set(e,{strings:s.strings,parts:n,nodes:r})}function ws(s,e){for(const t of s)if(t.kind==="node")ys(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let o=t.template[0];for(let i=0;iObject.prototype.hasOwnProperty.call(t,r),runLocal:(r,a,l,u)=>{const h=t[r];if(!h)return a;const p={...a},g=h(p,l,u);return g===void 0?p:g},render:r=>{Ee(e.view(r),r.root),e.updated?.(r)},mounted:r=>e.mounted?.(r)},{placeholder:i}=e;i&&(o.placeholder=r=>i(r));const n=window;return(n.openStationApps??(n.openStationApps={}))[s]=o,o}const Cr=J("desktop-mode/settings-tab-registry",()=>({registry:new Map,listeners:new Set})),Bc=Cr.state.registry,Ir=Cr.state.listeners;function Gc(){return Array.from(Bc.values()).sort((s,e)=>(s.order??100)-(e.order??100))}function Xc(s){return Ir.add(s),()=>{Ir.delete(s)}}function Zc(s,e){switch(s){case"starlight":return d("Starlight");case"wp-blue":return d("WordPress Blue");case"indigo":return d("Indigo");case"teal":return d("Teal");case"emerald":return d("Emerald");case"amber":return d("Amber");case"rose":return d("Rose");default:return e}}function Yc(s,e){switch(s){case"compact":return d("Compact");case"default":return d("Default");case"large":return d("Large");default:return e}}function Jc(s,e){switch(s){case"sharp":return d("Sharp");case"default":return d("Default");case"round":return d("Round");default:return e}}function Qc(s,e){switch(s){case"static":return d("Static");case"dynamic":return d("Dynamic");case"hidden":return d("Hidden");default:return e}}function ed(s,e){switch(s){case"static":return d("Static");case"dynamic":return d("Dynamic");default:return e}}function td(s,e){switch(s){case"bottom":return d("Bottom");case"left":return d("Left");case"right":return d("Right");default:return e}}function sd(s,e){switch(s){case"classic":return d("Split");case"unified":return d("Unified");default:return e}}function od(s){switch(s){case"classic":return d("Core admin menus are placed in a sidebar; plugins, apps, and OpenStation controls in a dock along the bottom edge.");case"unified":return d("Every menu in a single dock.");default:return""}}const id=()=>({editor:{id:"",teardown:null},previews:null,imagePickerOpen:!1,imageSource:"",library:{query:"",page:0,totalPages:0,loaded:[],loading:!1,error:"",searchTimer:null,uploadError:"",uploading:!1,dragover:!1},themes:{error:"",busy:!1},features:{purging:!1,resetting:!1,extendedSaving:!1,extendedError:""},components:{entries:null,activeTag:"",query:"",paintedTag:""},about:null,search:{query:"",index:null},mountedTabs:new WeakMap,glyphs:new Map}),de=s=>s.extra,S=s=>s.ui(id),Rr=s=>s.detail??{},W=s=>String(Rr(s).value??""),q=s=>Rr(s).checked===!0,nd="conic-gradient( #f252fc, #9af2ff, #93f0c6, #f8f2b6, #ff5a5a, #f252fc )";function rd(s){const e=s.querySelector(".os-settings__accent-picker");if(e)try{e.showPicker()}catch{e.click()}}const ad=s=>{const e=s.accent===Te,t=i=>{const n=W(i);n!==Te&&!De().some(r=>r.id===n)||(E({accent:n}),n===Te&&rd(i.currentTarget))},o=i=>{const n=i.target.value;/^#[0-9a-fA-F]{6}$/.test(n)&&E({customAccent:n,accent:Te})};return c` ${De().map(i=>c``)} `},ld={unified:[{kind:"win",style:"left:12%;top:14%;width:44%;height:42%"},{kind:"win",style:"left:30%;top:30%;width:44%;height:42%"},{kind:"bar",rail:"dock",style:"left:24%;bottom:10%;width:52%;height:9%"}],classic:[{kind:"bar",rail:"sidebar",style:"left:0;top:0;bottom:0;width:5%"},{kind:"win",style:"left:14%;top:14%;width:44%;height:42%"},{kind:"win",style:"left:32%;top:30%;width:44%;height:42%"},{kind:"bar",rail:"dock",style:"left:33%;bottom:10%;width:38%;height:9%"}]},We=(s,e)=>t=>{const o=W(t);s.some(i=>i.id===o)&&e(o)},Lr=()=>js.map(s=>c`${ed(s.id,s.label)}`),cd=s=>d(s==="dynamic"?"The dock folds into a thin line at its edge of the screen and comes back when you move the pointer there. Windows can use the whole desktop.":"The dock is always visible, and windows open above it."),dd=s=>{const e=r=>a=>{a.target.closest(".os-settings__dock-option")||E({desktopLayout:r})},t=r=>{const a=["os-settings__layout-card"];return s.dockBehavior==="dynamic"&&a.push("is-dock-dynamic"),r==="classic"&&s.sideDockBehavior==="dynamic"&&a.push("is-sidebar-dynamic"),a.join(" ")},o=(r,a,l,u="")=>c`
${a} ${l} ${u?c`${u}`:""}
`,i=()=>c`
${o("os-settings-dock-placement-label",d("Placement"),c`E({dockPlacement:r}))} > ${gn.map(r=>c`${td(r.id,r.label)}`)} `)}
`,n=()=>c`
${o("os-settings-side-dock-behavior-label",d("Sidebar behavior"),c`E({sideDockBehavior:r}))} > ${Lr()} `)}
`;return c`
${hl.map(r=>{const a=s.desktopLayout===r.id;return c`
${r.id==="classic"?n():i()}
`})}
${o("os-settings-dock-size-label",d("Dock size"),c`E({dockSize:r}))} > ${un.map(r=>c`${Yc(r.id,r.label)}`)} `)} ${o("os-settings-dock-behavior-label",d("Dock behavior"),c`E({dockBehavior:r}))} > ${Lr()} `,cd(s.dockBehavior))}
`},ud=s=>{const e=Gs();return e.length<=1?c``:c` {const o=W(t);o!==""&&E({dockRailRenderer:o})}} > ${e.map(t=>c`${t.label}`)} `};function hd(s){switch(s){case"dynamic":return d("The admin bar slides out of the way and comes back when you move the pointer to the top edge of the screen.");case"hidden":return d("The admin bar is never shown. Use the Exit OpenStation tile on the dock to get back to the classic admin.");default:return d("The admin bar is always visible above the desktop.")}}const pd=s=>c` E({adminBarMode:e}))} > ${pn.map(e=>c`${Qc(e.id,e.label)}`)} `;function gd(s,e,t){return c` ${ad(s)} ${e} ${dd(s)} ${ud(s)} ${pd(s)} `}const pe=class pe 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(Tr)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,o){if(t===o)return;const i=fd(e);this._propValues[i]=o,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const o=(Array.isArray(e)?e:String(e).split(/\s+/)).map(i=>String(i).trim()).filter(i=>i!=="");this.className=o.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const t of e.props){if(Object.getOwnPropertyDescriptor(this,t))continue;const o=Tr(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(o),set:i=>{let n;i==null||i===!1?n=null:i===!0?n="":n=String(i),this._propValues[t]=n,n===null?this.removeAttribute(o):this.setAttribute(o,n),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&Ee(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(o=>o.sheet).filter(o=>o!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const o of e.styles)if(!o.sheet){const i=document.createElement("style");i.textContent=o.cssText,this.shadowRoot.appendChild(i)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!pe._lightStylesAdopted.has(e)){pe._lightStylesAdopted.add(e);for(const t of e.styles){const o=document.createElement("style");o.dataset.osUi=this.tagName.toLowerCase(),o.textContent=t.cssText,document.head.appendChild(o)}}}};pe.props=[],pe.styles=[],pe.shadow=!0,pe._lightStylesAdopted=new WeakSet;let _=pe;function w(s,e){customElements.get(s)||customElements.define(s,e)}function Tr(s){return s.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function fd(s){return s.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const bd=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function v(s,...e){let t=s[0];for(let o=1;or!=="").join("-")}function bo(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function He(s){if(s.id)return s.id;const e=md(s);return s.id=e,e}const C=v`: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 ) )}`,vd=v` .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%}}`,xs=v` .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%}}`,Dr=v` .os-holo-edge{position:relative}.os-holo-edge::after{content:'';position:absolute;inset:0;border-radius:inherit;padding:1px;background-image:var( --_holo-edge-quiet );opacity:0;pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude;transition:opacity var( --_holo-t ) ease}.os-holo-edge:hover::after,.os-holo-edge:focus-visible::after{background-image:var( --_holo-edge );opacity:1}.os-holo-edge.is-lit::after{background-image:var( --_holo-edge );opacity:1}@media ( prefers-reduced-motion:reduce ){.os-holo-edge::after{transition-duration:1ms}}`,ks=v` .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}}`,mo=v` .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}}`,Pr=v` .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%}}`,vo=v` .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}}`,_o=v` 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}}`,$s=v` 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}}`,Nr=v` @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}}`;v` ${C} ${vd} ${xs} ${Dr} ${ks} ${mo} ${Pr} ${vo} ${_o} ${$s} ${Nr} `;const _d=v` ${C}: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;--os-ui-fg:var( --os-ui-modal-text,#f0f0f1 );--os-ui-fg-muted:var( --os-ui-modal-text-muted,#a7aaad );--os-ui-border:var( --os-ui-modal-border,rgba( 255,255,255,0.25 ) );--os-window-bg:var( --os-ui-modal-field-bg,#2c3338 );--os-ui-button-bg-hover:var( --os-ui-modal-button-bg-hover,rgba( 255,255,255,0.08 ) );--os-ui-surface:var( --os-ui-modal-surface,#2c3338 );--os-ui-surface-elevated:var( --os-ui-modal-surface-elevated,#3c434a );--os-ui-border-strong:var( --os-ui-modal-border-strong,rgba( 255,255,255,0.35 ) );--os-ui-hover:var( --os-ui-modal-hover,rgba( 255,255,255,0.08 ) );--os-ui-notice-color:var( --os-ui-modal-text,#f0f0f1 );--os-ui-card-bg:var( --os-ui-modal-surface,#2c3338 );--os-ui-card-fg:var( --os-ui-modal-text,#f0f0f1 );--os-ui-card-border:var( --os-ui-modal-border,rgba( 255,255,255,0.25 ) );--os-ui-card-border-hover:var( --os-ui-modal-border-strong,rgba( 255,255,255,0.35 ) )}:host( [ open ] ){display:flex;animation:os-modal-scrim var( --_holo-t ) var( --_holo-ease )}:host( [ open ] ) .dialog{animation:os-modal-dialog var( --_holo-t ) var( --_holo-spring )}@keyframes os-modal-scrim{from{opacity:0}}@keyframes os-modal-dialog{from{opacity:0;transform:scale( 0.96 ) translateY( 8px )}}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ),:host( [ open ] ) .dialog{animation:none}}.dialog{max-width:92vw;max-height:90vh;background-color:var( --os-ui-modal-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-modal-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 );display:flex;flex-direction:column;overflow:hidden}:host( [ size='sm' ] ) .dialog{width:min( 360px,92vw )}:host(:not( [ size ] ) ) .dialog,:host( [ size='md' ] ) .dialog{width:min( 540px,92vw )}:host( [ size='lg' ] ) .dialog{width:min( 760px,94vw )}.header{display:flex;align-items:center;gap:10px;padding:16px 20px 12px;border-bottom:1px solid var( --os-ui-border,rgba( 255,255,255,0.06 ) )}.title{margin:0;flex:1;font-size:15px;font-weight:600}.header-actions{display:flex;gap:6px}.header-actions::slotted( * ){margin-inline-start:6px}.close{background:transparent;border:0;color:inherit;font-size:18px;line-height:1;padding:4px 8px;border-radius:4px;cursor:pointer;opacity:0.7}.close:hover{opacity:1;background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) )}.body{padding:16px 20px;overflow:auto;flex:1 1 auto;font-size:13px;line-height:1.5}.footer{padding:12px 20px 16px;border-top:1px solid var( --os-ui-border,rgba( 255,255,255,0.06 ) )}.footer slot{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap}:host( [ mandatory ] ) .close{display:none}`,Mr='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',Be=class Be extends _{constructor(){super(...arguments),this._prevFocus=null,this._onKey=e=>{if(e.key==="Escape"&&!this.hasAttribute("mandatory")){e.preventDefault(),this._cancel();return}if(e.key==="Tab"){const t=this._focusables();if(t.length===0)return;const o=t[0],i=t[t.length-1],n=this.ownerDocument,r=n?n.activeElement:null,a=e.composedPath()[0]||r;e.shiftKey&&a===o?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),o.focus())}},this._onBackdrop=e=>{if(this.hasAttribute("mandatory"))return;const t=e.composedPath();(t.length>0?t[0]:e.target)===this&&this._cancel()}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","dialog"),this.setAttribute("aria-modal","true"),this.addEventListener("keydown",this._onKey),this.addEventListener("click",this._onBackdrop)}disconnectedCallback(){this.removeEventListener("keydown",this._onKey),this.removeEventListener("click",this._onBackdrop)}attributeChangedCallback(e,t,o){if(super.attributeChangedCallback?.(e,t,o),e==="open"){if(o!==null){const i=this.ownerDocument;this._prevFocus=i?i.activeElement:null,queueMicrotask(()=>this._focusFirst())}else if(this._prevFocus){try{this._prevFocus.focus()}catch{}this._prevFocus=null}}}showModal(){this.setAttribute("open","")}hideModal(){this.removeAttribute("open")}_focusables(){const e=this.shadowRoot;if(!e)return[];const t=Array.from(this.querySelectorAll(Mr)),o=Array.from(e.querySelectorAll(Mr));return[...t,...o].filter(i=>i.offsetParent!==null||i.tagName==="BUTTON")}_focusFirst(){const e=this._focusables();e.length>0?e[0].focus():this.shadowRoot?.querySelector(".dialog")?.focus?.()}_cancel(){const e=new CustomEvent("os-modal-cancel",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e)&&this.hideModal()}render(){const e=this.getAttribute("title")??"",t=this.hasAttribute("mandatory");return c`
${e?c`

${e}

${t?c``:c``}
`:c``}
`}};Be.props=["open","title","size","mandatory"],Be.styles=[_d],Be.help=void 0;let wo=Be;w("os-modal",wo);const wd=v` ${C} ${xs} ${Dr} ${ks} ${mo} ${Nr}:host{display:inline-flex}:host( [ fill-cell ] ){display:flex;width:100%}button{appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:var( --os-ui-button-padding,6px 12px );border-radius:var( --os-ui-button-border-radius,6px );font:inherit;font-weight:500;cursor:pointer;transition:background-color var( --_holo-t ) ease,color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,transform 80ms ease;background:var( --os-ui-button-bg,transparent );background-image:var( --os-ui-button-bg-image,none );background-repeat:var( --os-ui-button-bg-image-repeat,repeat );background-size:var( --os-ui-button-bg-image-size,auto );background-position:var( --os-ui-button-bg-image-position,center );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid var( --os-ui-border,#c3c4c7 ) )}:host( [ fill-cell ] ) button{width:100%;min-height:var( --os-ui-button-min-height,44px )}button:disabled{opacity:0.5;cursor:not-allowed}button:active:not(:disabled ){transform:translateY( 1px )}button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button:disabled::before,button:disabled::after,button:disabled .os-holo-glint{opacity:0 !important}:host( [ variant='primary' ] ) button{background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );color:var( --os-ui-button-fg,var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='primary' ] ) button:hover:not(:disabled ){filter:brightness( 1.06 );background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );box-shadow:var( --_holo-glow )}:host( [ variant='holo' ] ) button{background-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;color:var( --os-ui-button-fg,var( --_holo-ink ) );border:var( --os-ui-button-border,1px solid transparent );box-shadow:var( --_holo-glow );font-weight:600;transition:background-position var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,filter var( --_holo-t ) ease,transform 80ms ease}:host( [ variant='holo' ] ) button:hover:not(:disabled ){background-color:transparent;background-position:74% 66%;box-shadow:var( --_holo-glow-strong )}:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:88% 82%;filter:brightness( 0.94 )}:host( [ variant='holo' ] ) button::before{display:none}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ] ) button:hover:not(:disabled ),:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:22% 28%}}:host( [ variant='secondary' ] ) button{background-color:var( --os-ui-button-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='secondary' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.1 ) ) )}:host( [ variant='danger' ] ) button{background-color:var( --os-ui-button-bg,transparent );color:var( --os-ui-button-fg,var( --os-ui-danger,#d63638 ) );border:var( --os-ui-button-border,1px solid currentColor )}:host( [ variant='danger' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}:host( [ variant='danger' ] ) button::after{display:none}:host( [ variant='link' ] ) button{background-color:transparent;background-image:none;color:var( --os-ui-button-fg,var( --wp-admin-theme-color,#2271b1 ) );border:0;padding:0;text-decoration:underline}:host( [ variant='link' ] ) button::before,:host( [ variant='link' ] ) button::after,:host( [ variant='link' ] ) .os-holo-glint,:host( [ variant='link' ] ) .os-holo-ring{display:none}:host( [ variant='link' ] ) button:active:not(:disabled ){transform:none}:host( [ busy ] ) button{pointer-events:none;opacity:0.75}:host( [ variant='holo' ][ busy ] ) button{animation:os-holo-drift 12s ease-in-out infinite}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ][ busy ] ) button{animation:none}}.os-button__spinner{box-sizing:border-box;display:inline-block;width:12px;height:12px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:os-button-spin 0.6s linear infinite;flex-shrink:0}@keyframes os-button-spin{to{transform:rotate( 360deg )}}`,Ge=class Ge extends _{static get observedAttributes(){return[...super.observedAttributes,"aria-label"]}render(){const e=this.disabled!==null,t=this.busy!==null,o=this.type||"button",i=this.getAttribute("aria-label")||"";return c` `}};Ge.props=["variant","disabled","type","busy","fill-cell"],Ge.styles=[wd],Ge.help=void 0;let yo=Ge;w("os-button",yo);function xo(s){return!!s&&typeof s=="object"&&typeof s.then=="function"}function ko(s){const{from:e,to:t,angle:o}=s.customGradient;return`linear-gradient(${o}deg, ${e}, ${t})`}function yd(s,e){br({id:gs,label:d("Custom gradient"),type:"css",preview:ko(s()),description:d("Mix your own two-colour gradient and set the angle — your desk, your palette."),resolveValue:()=>ko(s()),...e?{renderEditor:e}:{}})}const xd="rest_cookie_invalid_nonce",zr=()=>d("Could not reach the site. Check your connection and try again.","desktop-mode");function Or(s){return typeof navigator<"u"&&navigator.onLine===!1?!0:s instanceof TypeError}function kd(s){return xn(s)?s.code===xd||s.status===401?"session":s.status>=200&&s.status<300?"unreadable":s.status===404?"gone":s.status>=500?"server":s.status>=400?"refused":"unknown":Or(s)?"offline":"unknown"}function $d(s){return xn(s)?s.serverMessage:Or(s)?zr():s instanceof Error?s.message:""}function As(s,e){const{fallback:t,lead:o}=e,i=kd(s),n=i==="offline"||i==="unreadable"?"warning":"error";let r="",a=!0;switch(i){case"offline":r=zr();break;case"session":r=d("Your session has expired. Reload the page and try again.","desktop-mode");break;case"unreadable":r=d("The site sent an unreadable reply. Reload the page to check whether the change went through.","desktop-mode");break;case"gone":case"refused":case"server":{const u=s;u.serverMessage?r=u.serverMessage:i==="gone"?(r=d("It no longer exists. Reload the page to catch up.","desktop-mode"),a=!1):i==="server"?(r=F(d("The server answered with error %d.","desktop-mode"),u.status),a=!1):(r=F(d("The server refused the request (HTTP %d).","desktop-mode"),u.status),a=!1);break}case"unknown":default:r=$d(s);break}let l;return o?l=r?`${o}: ${r}`:t:r?a?l=r:l=`${t} ${r}`:l=t,{message:l,reason:r,kind:i,type:n}}function Ad(s){return s.replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"wallpaper"}function Ed(s){if(!s||typeof s.id!="number"||!s.source_url)return!1;const e=s.media_details;return!!e&&typeof e.width=="number"&&typeof e.height=="number"&&e.width>0&&e.height>0}function Sd(s){if(!s)return"";const e=document.createElement("div");return e.innerHTML=s,e.textContent?.trim()||""}async function Cd(s,e,t,o){const i=new URL(de(s).mediaUrl);i.searchParams.set("media_type","image"),i.searchParams.set("per_page",String(cl)),i.searchParams.set("page",String(e)),i.searchParams.set("orderby","date"),i.searchParams.set("order","desc"),i.searchParams.set("_fields","id,source_url,alt_text,title,media_details"),t&&i.searchParams.set("search",t),o&&(i.searchParams.set("openstation_min_width",String(Fs)),i.searchParams.set("openstation_min_height",String(Vs)));const n=await s.fetch(i.toString());if(!n.ok)throw await xe(n);const r=n.headers.get("X-WP-TotalPages"),a=r?parseInt(r,10):1;return{items:(await n.json()).filter(Ed),totalPages:a||1}}async function Id(s,e){const t=await s.fetch(de(s).mediaUrl,{method:"POST",headers:{"Content-Type":e.type,"Content-Disposition":`attachment; filename="${Ad(e.name)}"`},body:e});if(!t.ok)throw await xe(t);const o=await t.json();return{id:o.id,url:o.source_url}}function Wr(s){E({customImage:s,wallpaper:ne})}async function Hr(s,e){const t=S(s).library,o=i=>{t.uploadError=i,s.repaint(),window.setTimeout(()=>{t.uploadError="",s.repaint()},4e3)};if(!e.type.startsWith("image/")){o(d("That file isn’t an image."));return}t.uploading=!0,s.repaint();try{Wr(await Id(s,e))}catch(i){o(As(i,{fallback:d("Upload failed.")}).message)}finally{t.uploading=!1,s.repaint()}}function Rd(s,e,t){return s?c`${d("Uploading…")}`:e?c`${d("Remove")}`:c`
${d("Drop an image here, or click to upload")} ${d("JPEG, PNG, or WebP · goes straight to your Media Library")}
`}const Ld=(s,e)=>{const t=S(e).library,o=!!s.customImage,i=["os-settings__upload-tile"];o&&i.push("os-settings__upload-tile--filled"),t.dragover&&i.push("os-settings__upload-tile--dragover"),t.uploading&&i.push("os-settings__upload-tile--busy");const n=()=>e.root.querySelector("[data-os-upload-input]"),r=h=>{h.stopPropagation(),E({customImage:null,...s.wallpaper===ne?{wallpaper:dn()}:{}})},a=()=>{if(!t.uploading){if(s.customImage){E({wallpaper:ne});return}n()?.click()}},l=h=>{const p=h.currentTarget,g=p.files?.[0];g&&Hr(e,g),p.value=""},u=h=>{t.dragover!==h&&(t.dragover=h,e.repaint())};return c`
{h.preventDefault(),u(!0)}} @dragleave=${()=>u(!1)} @drop=${h=>{h.preventDefault(),u(!1);const p=h.dataTransfer?.files?.[0];p&&Hr(e,p)}} > ${Rd(t.uploading,o,r)} ${t.uploadError?c`${t.uploadError}`:""}
`};function Td(s,e){return s.libraryHdOnly?e.filter(t=>t.media_details.width>=Fs&&t.media_details.height>=Vs):e}async function $o(s){const e=S(s).library;if(!(e.loading||e.totalPages>0&&e.page>=e.totalPages)){e.loading=!0,e.error="",s.repaint();try{const t=await Cd(s,e.page+1,e.query,P().libraryHdOnly);e.page+=1,e.totalPages=t.totalPages,e.loaded=e.loaded.concat(t.items)}catch(t){e.error=As(t,{lead:d("Couldn’t load your media"),fallback:d("Couldn’t load your media.")}).message}finally{e.loading=!1,s.repaint()}}}function Ur(s){const e=S(s).library;e.page=0,e.totalPages=0,e.loaded=[],$o(s)}const Dd=(s,e)=>{const t=s.wallpaper===ne&&s.customImage?.id===e.id,o=e.media_details.sizes||{},i=o.medium?.source_url||o.thumbnail?.source_url||o.large?.source_url||e.source_url,n=e.alt_text||Sd(e.title?.rendered||"")||`Image #${e.id}`;return c``},Pd=(s,e)=>{const t=S(e).library,o=Td(s,t.loaded),i=t.loaded.length-o.length,n=[F(d("Showing %d"),o.length)];s.libraryHdOnly&&i>0&&n.push(F(d("%d hidden by HD filter"),i));const r=u=>{const h=u.target.value;t.searchTimer!==null&&window.clearTimeout(t.searchTimer),t.searchTimer=window.setTimeout(()=>{t.searchTimer=null,t.query=h.trim(),Ur(e)},dl)},a=u=>{E({libraryHdOnly:q(u)}),Ur(e)},l=()=>t.error?c`

${t.error}

`:t.loading&&t.page===0?Array.from({length:8},()=>c`
`):o.length===0&&!t.loading?c`

${s.libraryHdOnly?d("No HD images found. Try unchecking the filter, or upload a larger image."):d("No images in your Media Library yet.")}

`:o.map(u=>Dd(s,u));return c`
${l()}
`};function qr(s){const e=S(s);return e.imageSource?e.imageSource:s.data.canUpload?"upload":"library"}function Nd(s){const e=S(s);if(!e.imagePickerOpen||qr(s)!=="library")return;const t=e.library;t.page===0&&!t.loading&&!t.error&&$o(s)}const Md=(s,e)=>{const t=e.data.canUpload,o=qr(e),i=n=>{const r=W(n);(r==="upload"||r==="library")&&(S(e).imageSource=r,e.repaint())};return c`
${t?c` ${d("Upload new")} ${d("Media Library")} `:""}
${o==="upload"?Ld(s,e):Pd(s,e)}
`},zd="[data-os-editor-slot]";function Fr(s){return{id:s,pluginUrl:"",prefersReducedMotion:typeof window.matchMedia=="function"&&window.matchMedia("( prefers-reduced-motion: reduce )").matches,visible:!document.hidden,settings:xr(s)}}function Od(s){const e=s.root.querySelector(zd);if(!e)return;const t=S(s),o=P().wallpaper;if(t.editor.id===o&&e.firstElementChild)return;Vr(s),t.editor.id=o;const i=document.createElement("div");i.className="os-settings__editor-slot-inner",e.textContent="",e.appendChild(i);const n=ze(o);if(n?.renderEditor)try{const r=n.renderEditor(i,Fr(n.id));xo(r)?r.then(a=>{t.editor.teardown=a}):t.editor.teardown=r}catch(r){console.error(`[openstation] Wallpaper "${n.id}" renderEditor threw:`,r)}}function Vr(s){const e=S(s);if(e.editor.teardown)try{e.editor.teardown()}catch(t){console.error("[openstation] Wallpaper editor teardown threw:",t)}e.editor={id:"",teardown:null}}function Wd(s){s.classList.add("os-settings__gradient-editor-inner");const e=o=>{E({customGradient:{...P().customGradient,...o}}),t()},t=()=>{const{from:o,to:i,angle:n}=P().customGradient;Ee(c`
e({from:W(r)})} > e({to:W(r)})} >
e({angle:Number(W(r))})} > `,s)};return t(),()=>{}}function jr(s){if(typeof s.renderConfig!="function")return;const e=document.createElement("os-modal");e.setAttribute("size","sm"),e.setAttribute("title",F(d("%s settings"),s.label));const t=document.createElement("div");t.className="os-settings__wallpaper-config-form",e.appendChild(t);const o=document.createElement("os-button");o.setAttribute("slot","footer"),o.setAttribute("variant","primary"),o.textContent=d("Done"),e.appendChild(o);let i=null,n=!1;const r=()=>{if(!n){n=!0;try{i?.()}catch(l){console.error(`[openstation] Wallpaper "${s.id}" config teardown threw:`,l)}i=null,e.remove()}};o.addEventListener("click",r),e.addEventListener("os-modal-cancel",r);const a={...Fr(s.id),setSettings:l=>{const u=P(),h={...u.wallpaperSettings[s.id]??{},...l};E({wallpaperSettings:{...u.wallpaperSettings,[s.id]:h}}),kr(s.id,h)}};document.body.appendChild(e),e.setAttribute("open","");try{const l=s.renderConfig(t,a);xo(l)?l.then(u=>{if(n){try{u()}catch{}return}i=u}):i=l}catch(l){console.error(`[openstation] Wallpaper "${s.id}" renderConfig threw:`,l),r()}}const Hd=(s,e)=>{const t=S(e),o=ze(s.wallpaper),i=typeof o?.renderConfig=="function",n=typeof o?.renderEditor=="function",r=l=>{const u=ze(W(l));u&&u.id!==ne&&E({wallpaper:u.id})},a=Ae().filter(l=>l.id!==ne).sort((l,u)=>+(l.id===gs)-+(u.id===gs));return c`
${a.map(l=>c` ${l.label} `)}
${i?c`
jr(o)}> ${d("Wallpaper settings")}
`:""}
${Md(s,e)}
`},Ud=s=>c` {const t=W(e);hn.some(o=>o.id===t)&&E({windowRadius:t})}} > ${hn.map(e=>c`${Jc(e.id,e.label)}`)} `,Kr=[{value:jl,label:()=>d("Default (per reveal)")},{value:200,label:()=>d("Very fast — 200 ms")},{value:320,label:()=>d("Fast — 320 ms")},{value:460,label:()=>d("Normal — 460 ms")},{value:700,label:()=>d("Slow — 700 ms")},{value:1100,label:()=>d("Very slow — 1100 ms")}],qd=[{id:"focus",label:()=>d("When a related window is focused")},{id:"always",label:()=>d("Always")},{id:"off",label:()=>d("Off")}],Ao=(s,e,t,o,i)=>c`{const r=W(n);r!==""&&(r===t||o.some(a=>a.id===r))&&i(r)}} > ${d("None")} ${o.map(n=>c`${n.label}`)} `,Fd=s=>{const e=ho(),t=io(),o=po(),i=(n,r,a,l)=>{const u=n.find(h=>h.id===r);return r!==a&&u?.description?u.description:l};return c` ${Ao(d("Unfocused window effect"),s.unfocusEffect,lo,e,n=>E({unfocusEffect:n}))} ${Ao(d("Reveal style"),s.windowReveal,ms,t,n=>E({windowReveal:n}))} {const r=Number(W(n));Kr.some(a=>a.value===r)&&E({windowRevealDuration:r})}} > ${Kr.map(n=>c`${n.label()}`)} ${Ao(d("Link style"),s.windowLinkRenderer,hr,o,n=>E({windowLinkRenderer:n}))} {const r=W(n);(r==="focus"||r==="always"||r==="off")&&E({windowLinkVisibility:r})}} > ${qd.map(n=>c`${n.label()}`)} `},Vd=s=>c` E({confirmCloseAllWindows:q(e)})} > `,jd=(s,e)=>c` ${Ud(s)} ${Fd(s)} ${Vd(s)} `,Kd=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform||navigator.userAgent||"")?"⌘K":"Ctrl+K";let Es=!1;document.addEventListener("os-settings-save-lifecycle",s=>{if(!Es)return;const e=s.detail?.phase;e!=="saved"&&e!=="failed"||(Es=!1,e==="saved"&&mn())});const Z=(s,e,t,o,i=!1,n="")=>c`

${o}

${n}
`,Bd=s=>c` ${d("This feature requires an AI provider configured in")} {e.preventDefault(),s&&gl(s,d("Connectors"))}} >${d("Settings → Connectors")}. `;async function Gd(s){const e=S(s).features;e.resetting||(e.resetting=!0,s.repaint(),await s.dispatch("reset-intros")&&document.dispatchEvent(new CustomEvent("os-intros-reset")),e.resetting=!1,s.repaint())}function Xd(){document.dispatchEvent(new CustomEvent("os-shell-tour-start"))}function Br(s){const e=Bs(),t=s.data.aiAssistant;if(t&&e.aiAssistant){const o=e.aiAssistant.available!==t.available||e.aiAssistant.assistantProviderConfigured!==t.assistantProviderConfigured;Object.assign(e.aiAssistant,t),o&&document.dispatchEvent(new CustomEvent("os-ai-status-changed"))}}const Zd=(s,e)=>{const{aiAssistant:t,isAdmin:o}=e.data,i=S(e).features,n=r=>{const a=Number(W(r));if([15,30,45,60].includes(a)){E({heartbeatRate:a});try{window.wp?.heartbeat?.interval?.(a>=60?"slow":"standard")}catch{}}};return c` ${t?.available?Z(d("AI assistant"),s.ai.enabled,r=>E({ai:{...s.ai,enabled:q(r)}}),F(d("Adds an AI mode to the %s command palette: find content and ask about your site."),Kd),!t.assistantProviderConfigured,t.assistantProviderConfigured?"":Bd(t.connectorsUrl)):""} ${Z(d("MIO API"),s.mioApiEnabled,r=>E({mioApiEnabled:q(r)}),d("Enables MIO and its window integrations. This is the same switch as the MIO dock button. Ask MIO also requires the AI assistant and a configured connector."))} ${Z(d("Show MIO on wallpaper"),s.mioShowOnWallpaper,r=>E({mioShowOnWallpaper:q(r)}),d("Let MIO roam the desktop. Turn this off to keep it hidden until a window opens chat or invites it to show a tip."))}
E({windowLinksEnabled:q(r)})} >

${d("Draws connector lines between related windows. Line style and visibility live in Windows → Window links.")}

${Z(d("Bring related windows to front"),s.windowLinkRaiseOnFocus,r=>E({windowLinkRaiseOnFocus:q(r)}),d("Clicking a window also surfaces its parent and children."),!s.windowLinksEnabled)} ${Z(d("Highlight related windows"),s.windowLinkHighlight,r=>E({windowLinkHighlight:q(r)}),d("Related windows get an accent outline while one of them is focused."),!s.windowLinksEnabled)}
${Z(d("Show desktop when clicking the wallpaper"),s.showDesktopOnWallpaperClick,r=>E({showDesktopOnWallpaperClick:q(r)}),d("A click on the empty desktop minimizes every window; a second click restores them."))} ${Z(d("Show post/page status ribbon"),s.showPostStatusRibbons,r=>E({showPostStatusRibbons:q(r)}),d("Marks unpublished posts and pages with a corner ribbon on their tiles."))} ${Z(d("Enable developer mode"),s.developerModeEnabled,r=>{E({developerModeEnabled:q(r)}),Es=!0},d("Unlocks developer surfaces meant for plugin authors."))} ${Z(d("Folder sharing"),s.foldersSharingEnabled,r=>E({foldersSharingEnabled:q(r)}),d("Share desktop folders with other users or roles, with read or write access."),!1,o?c`

${d("Removes every share and its access list. Cannot be undone.")}

${d("Delete folder sharing data")}
`:"")}

${d("How often the Heartbeat API runs. Faster means quicker live updates and more server traffic. The 30s and 45s rates apply exactly from the next page load.")}

${d("Brings back the one-time announcements you have dismissed, such as the welcome dialog.")}

void Gd(e)}> ${i.resetting?d("Resetting…"):d("Reset what’s-new dialogs")}
${nc()?"":c`

${d("Replays the first-boot tour: where the menus are, changing the layout, opening a window, snapping it, finding anything.")}

${d("Take the tour")}
`}
`},Yd=s=>{const e=(t,o,i)=>Z(o,s[t]===!0,n=>{E({[t]:q(n)}),Es=!0},i);return c` ${e("stationHomeEnabled",d("Use Station Home as your Dashboard"),d("Opens Station Home instead of the classic WordPress Dashboard: recent work, site pulse, and quick actions in one native window. Leave off to keep the classic Dashboard, including any customizations plugins have made to it."))} ${e("nativePostsEnabled",d("Use the native Posts window"),d("Replaces the classic Posts list with a native table window: sticky header, paginated rows, bulk actions, and a row preview."))} ${e("nativePagesEnabled",d("Use the native Pages window"),d("The Posts table experience for Pages, with a Parent column, hierarchical sort, and edit-lock indicators."))} ${e("nativeUsersEnabled",d("Use the native Users window"),d("A native Users list with bulk role changes, online indicators, and one-click password resets."))} ${e("nativePluginsEnabled",d("Use the native Plugins window"),d("A native Plugins window with an Installed list, bulk actions, and a Browse gallery from the WordPress.org directory."))} ${e("nativeCommentsEnabled",d("Use the native Comments window"),d("A native two-pane Comments window: a list of conversations beside the full reply thread."))} `};let Eo=0;async function Jd(s,e){const t=S(s).features;t.extendedSaving=!0,t.extendedError="",s.data.extendedOptions&&Object.assign(s.data.extendedOptions,e),s.repaint(),Eo++;try{const o=await s.dispatch("extended",{options:e});if(o&&s.data.extendedOptions)try{be(V.EXTENDED_OPTIONS_CHANGED,{options:s.data.extendedOptions})}catch{}else o||(t.extendedError=d("The options could not be saved."))}finally{Eo--,t.extendedSaving=Eo>0,s.repaint()}}const Qd=(s,e)=>{const t=e.data.extendedOptions;if(!t)return c``;const o=S(e).features,i=(n,r,a)=>Z(r,t[n],l=>void Jd(e,{...t,[n]:q(l)}),a);return c` ${i("media_library_enhanced",d("Enable drag-and-drop in the Media Library"),d("Makes every item in the WordPress Media Library draggable. Drop a media item into text fields, rich-text editors, Gutenberg blocks, or any target that accepts images or files. No replacement of the library — just a drag-and-drop layer on top of the one you already know."))} ${i("agents",d("Enable AI agents"),d("Adds an Agents section to WP Explorer: durable AI workers that live on the site as login-blocked users, act through the WordPress Abilities API under their own role, and answer in a chat window. Requires a configured AI connector to run. Off by default — while off, nothing agent-related loads. Agent definitions are kept across a disable and reappear when re-enabled."))} ${i("network",d("Enable OpenStation Network"),d("Pairs this install with other OpenStation installs into one network: a Network app on the desktop, a key and a registry, and a site switcher that moves between installs and logs you in on arrival. Off by default — while off, none of the network module loads, on the server or in the browser, and a multisite keeps its own site switcher. Pairings are kept across a disable and reappear when re-enabled."))} ${i("games",d("Enable games"),d("Adds a Games app for every user: built-in games, scoreboards, and player-to-player challenges. Off by default — while off, nothing game-related runs anywhere, on the server or in the browser. Saved scores are kept across a disable and reappear when re-enabled."))} ${i("window_prewarm",d("Preload windows on hover"),d("Starts loading a window while you hover its dock icon, so it appears sooner when you click. Enabled by default for everyone; turn off to avoid the extra memory and background requests. Takes effect after reloading OpenStation."))} ${i("admin_asset_cache",d("Shared asset cache"),d("Shares cached admin stylesheets and scripts across windows to reduce network requests. Enabled by default for everyone; turn off to bypass the shared cache. Takes effect after reloading OpenStation."))} ${o.extendedError?c`

${o.extendedError}

`:""} ${o.extendedSaving?c`

${d("Saving…")}

`:""}
`},eu=(s,e)=>c` ${Zd(s,e)} ${Yd(s)} ${e.data.isAdmin?Qd(s,e):""} `,tu="",su={accent:"pulse",desktopLayout:"unified",dockPlacement:"bottom"};function ou(s){if(s===tu)return Object.keys(Yn(su)).length>0;const e=ec(s);return e?Object.keys(Yn(e.recommendedOsSettings)).length>0:!1}const Ss="",Gr="OpenStation";function iu(s){const e=s.trim().split(/\s+/).filter(Boolean);return e.length===0?"?":e.length>=2?(e[0][0]+e[1][0]).toUpperCase():e[0].slice(0,2).toUpperCase()}function Xr(s){const e=s?.serverWallpapers;Array.isArray(e)&&be(V.WALLPAPERS_SERVER_CHANGED,{wallpapers:e})}async function nu(s,e){const t=new FormData;t.append("file",e,e.name);const o=await s.fetch(de(s).desktopThemesUrl,{method:"POST",body:t});if(!o.ok)throw await xe(o);const i=await o.json();return Xr(i),i}async function ru(s,e){const t=await s.fetch(`${de(s).desktopThemesUrl}/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw await xe(t);try{Xr(await t.json())}catch{}}async function Zr(s,e){const t=S(s).themes;if(!t.busy){t.busy=!0,t.error="",s.repaint();try{tr(await nu(s,e))}catch(o){t.error=As(o,{fallback:d("That theme could not be installed.")}).message}finally{t.busy=!1,s.repaint()}}}async function au(s,e){if(!await s.host.confirm?.({title:d("Delete this theme?"),message:F(d("“%s” will be removed from this site for everyone. This cannot be undone."),e.name),confirmLabel:d("Delete"),danger:!0}))return;const o=S(s).themes;o.error="";try{await ru(s,e.slug),sc(e.slug),P().desktopTheme===e.slug&&E({desktopTheme:Ss})}catch(i){o.error=As(i,{fallback:d("That theme could not be deleted.")}).message}s.repaint()}const lu=(s,e,t,o)=>c`
${o&&e.source!=="code"?c``:""}
`,cu=s=>c`
`,du=s=>{const e=S(s).themes,t=o=>o.dataTransfer?.files?.[0]??o.currentTarget.files?.[0];return c`
{o.preventDefault(),o.currentTarget.classList.add("os-settings__theme-upload--dragover")}} @dragleave=${o=>{o.currentTarget.classList.remove("os-settings__theme-upload--dragover")}} @drop=${o=>{o.preventDefault(),o.currentTarget.classList.remove("os-settings__theme-upload--dragover");const i=t(o);i&&Zr(s,i)}} >
`},uu=(s,e)=>{if(!ou(s))return"";const t=s===Ss?Gr:e.find(o=>o.slug===s)?.name;return t===void 0?"":c`
bn(s)}> ${F(d("Apply %s’s recommended layout and effects"),t)}
`},hu=(s,e)=>{const t=no(),o=e.data.canManageDesktopThemes,i=S(e).themes.error;return c` ${i!==""?c`${i}`:""}
${cu(s.desktopTheme===Ss)} ${t.map(n=>lu(e,n,s.desktopTheme===n.slug,o))} ${o?du(e):""}
${uu(s.desktopTheme,t)}
`},Yr="data:image/svg+xml;base64,",Cs=new Map;function pu(s){const e=Cs.get(s);if(e!==void 0)return e;let t=!1;try{t=atob(s.slice(Yr.length)).includes("currentColor")}catch{}return Cs.size>=256&&Cs.clear(),Cs.set(s,t),t}function Jr(s,e){const t=e.className??"",o=e.title??"";let i=null;if(e.slot){const l=ac(e.slot);l!==null&&(s=l),i=lc(e.slot)}if(typeof s=="string"&&s.startsWith("dashicons-")){const l=document.createElement("span");return l.className=`dashicons ${s} ${t}`.trim(),l.setAttribute("aria-hidden","true"),i!==null&&(l.style.color=i),l}if(i!==null&&typeof s=="string"){const l=document.createElement("span");if(l.className=t,l.setAttribute("aria-hidden","true"),l.style.display="inline-block",or(l,s,i))return l}if(typeof s=="string"&&s.startsWith("data:image/svg+xml;base64,")){const l=s.slice(Yr.length);if(/^[A-Za-z0-9+/=]+$/.test(l)){const u=document.createElement("span");return u.className=t,u.setAttribute("aria-hidden","true"),u.style.display="inline-block",pu(s)&&or(u,s,"currentColor")||(u.style.backgroundImage=`url("${s}")`,u.style.backgroundRepeat="no-repeat",u.style.backgroundPosition="center",u.style.backgroundSize="contain"),u}}if(typeof s=="string"&&/^data:image\/(png|jpeg|jpg|gif|webp|x-icon|vnd\.microsoft\.icon);base64,/i.test(s)){const l=s.indexOf(","),u=l>=0?s.slice(l+1):"";if(/^[A-Za-z0-9+/=]+$/.test(u))return Qr(s,t)}if(typeof s=="string"&&(s.startsWith("http://")||s.startsWith("https://")))return Qr(s,t);const n=document.createElement("span");n.className=`${t} os-icon-letter`.trim(),n.setAttribute("aria-hidden","true");const r=gu(o);n.textContent=r;const a=sr(o);return n.style.backgroundColor=`hsl( ${a}, 60%, 45% )`,n.style.color="#fff",n.style.display="inline-flex",n.style.alignItems="center",n.style.justifyContent="center",n.style.fontWeight="600",n.style.borderRadius="4px",n}function Qr(s,e){const t=document.createElement("img");return t.className=e,t.src=s,t.alt="",t.setAttribute("aria-hidden","true"),t.draggable=!1,t}function gu(s){const e=(s??"").trim();if(e==="")return"?";const t=e.split(/\s+/);if(t.length>=2)return(t[0][0]+t[1][0]).toUpperCase();const o=t[0];return o.length>=2?o.slice(0,2).toUpperCase():o.toUpperCase()}const fu=[{kinds:["core"],heading:()=>d("WordPress Core"),description:()=>d("The admin menus WordPress itself registers.")},{kinds:["plugin","app"],heading:()=>d("Plugins & Apps"),description:()=>d("Menus from installed plugins and apps.")},{kinds:["control"],heading:()=>d("OpenStation"),description:()=>d("The OpenStation’s own controls.")}];function bu(){const s=window.wp?.os;return typeof s?.getNavItems=="function"?s.getNavItems():[]}function mu(s){return s.locked||s.transient?!1:s.menu||s.entry?!0:s.tile?.placeable===!0}const vu=s=>d(s==="classic"?"Choose where each menu shows up: on the dock/sidebar, on the desktop wallpaper, both, or hidden entirely. Changes apply instantly.":"Choose where each menu shows up: on the dock, on the desktop wallpaper, both, or hidden entirely. Changes apply instantly."),_u=(s,e)=>[{id:"rail",label:wc(s,e)==="sidebar"?d("In the sidebar"):d("On the dock")},{id:"desktop",label:d("On the desktop")},{id:"both",label:d("On both")},{id:"hidden",label:d("Hidden")}],wu=(s,e)=>c`
${Jr(s.icon,{title:s.title,className:"os-nav-settings__icon",slot:hc(s.id)})}
${s.title}
{const o=W(t);(o==="both"||o==="rail"||o==="desktop"||o==="hidden")&&E({navPlacement:{...e.navPlacement,[s.id]:o}})}} > ${_u(s.kind,e.desktopLayout).map(t=>c`${t.label}`)}
`,yu=s=>{const e=bu().filter(mu),t=fu.map(o=>({...o,rows:xc(e.filter(i=>o.kinds.includes(i.kind)))})).filter(o=>o.rows.length>0);return c`

${vu(s.desktopLayout)}

${t.length===0?c``:t.map(o=>c` ${o.rows.map(i=>wu(i,s))} `)} `},ea={close:{a:'fill="currentColor"',b:''},check:{a:'fill="currentColor"',b:''},"chevron-right":{a:'fill="currentColor"',b:''},"arrow-up-right":{a:'fill="currentColor"',b:''},plus:{a:'fill="currentColor"',b:''},search:{a:'fill="currentColor"',b:''},pin:{a:'fill="currentColor"',b:''},trash:{a:'fill="currentColor"',b:''},download:{a:'fill="currentColor"',b:''},settings:{a:'fill="currentColor"',b:''},info:{a:'fill="currentColor"',b:''},bell:{a:'fill="currentColor"',b:''},more:{a:'fill="currentColor"',b:''},maximize:{a:'fill="currentColor"',b:''},edit:{a:'fill="currentColor"',b:''},color:{a:'fill="currentColor"',b:''},wallpaper:{a:'fill="currentColor"',b:''},warning:{a:'fill="currentColor"',b:''},minimize:{a:'fill="currentColor"',b:''},window:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:''},windows:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:''},dock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:''},spaces:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:''},copilot:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:''},snap:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:''},command:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:''},apps:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:''},widgets:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:''},user:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:''},lock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:''}};function ta(s){return s.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function sa(s){return Object.prototype.hasOwnProperty.call(ea,s)?ea[s]:null}function xu(s){return sa(s)!==null}function ku(s,e={}){const t=sa(s);if(!t)return"";const{size:o=24,className:i,title:n,rotate:r}=e,a=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];o!=null&&a.push(`width="${o}"`,`height="${o}"`),a.push(t.a),i&&a.push(`class="${ta(i)}"`),n?a.push('role="img"',`aria-label="${ta(n)}"`):a.push('aria-hidden="true"','focusable="false"');const l=r?`${t.b}`:t.b;return`${l}`}function N(s,e={}){const t=ku(s,e),o=document.createElement("div");o.innerHTML=t;const i=o.firstElementChild;return i instanceof SVGSVGElement?i:document.createElementNS("http://www.w3.org/2000/svg","svg")}const Is=3,oa=[{id:"auto",label:()=>d("Automatic")},{id:"desktop",label:()=>d("Always desktop")},{id:"mobile",label:()=>d("Always mobile")}];function $u(s){return s.filter(e=>!e.locked&&!e.transient&&!!(e.windowId||e.tile||e.menu?.url||e.entry?.url))}const Au=(s,e)=>{const t=$u(ao()),o=new Set(t.map(u=>u.id)),i=(Bs().mode?.tabBar??[]).filter(u=>o.has(u)),n=(s.mobileTabs.length>0?s.mobileTabs:i).slice(0,Is),r=n.length>=Is,a=u=>{const h=W(u);oa.some(p=>p.id===h)&&E({mobileLayout:h})},l=u=>h=>{const p=q(h),g=n.filter(b=>b!==u);p&&g.length ${oa.map(u=>c`${u.label()}`)} ${t.length===0?c`

${d("Nothing to pin yet.")}

`:t.map(u=>{const h=n.includes(u.id);return c`
`})}
`},Eu=v`:host{display:block;margin-block-end:36px}:host( [ hidden ] ){display:none}.os-section__heading{margin:0 0 5px;font-size:20px;font-weight:500;letter-spacing:-0.01em;color:var( --os-ui-fg,#1d2327 )}.os-section__description{margin:0 0 14px;max-width:78ch;font-size:14px;color:var( --os-ui-fg-muted,#646970 );line-height:1.55}.os-section__description:empty{display:none}:host( [ stack ] ) .os-section__body{display:flex;flex-direction:column;gap:var( --os-ui-section-gap,12px )}`,Xe=class Xe extends _{render(){const e=this.heading||"",t=this.description||"";return c` ${e?c`

${e}

`:""} ${t?c`

${t}

`:""}
`}};Xe.props=["heading","description","stack"],Xe.styles=[Eu],Xe.help=void 0;let So=Xe;w("os-section",So);const Su=v` ${C}:host{display:block;width:100%;aspect-ratio:4 / 3}:host( [ size='small' ] ){display:inline-block;width:32px;height:32px;aspect-ratio:1 / 1;flex:0 0 auto}:host( [ variant='accent' ] ){display:inline-block;width:28px;height:28px;aspect-ratio:1 / 1;flex:0 0 auto}:host( [ size='small' ][ variant='accent' ] ) button{border-radius:8px}:host( [ size='small' ][ variant='accent' ] ) button[ aria-pressed='true' ]{box-shadow:0 0 0 2px var( --os-ui-surface-sunken,#f0f0f1 ),0 0 0 4px var( --os-ui-accent,#2271b1 )}:host( [ size='small' ][ variant='accent' ] ) button[ aria-pressed='true' ]:focus-visible{box-shadow:var( --_holo-focus )}:host( [ variant='wallpaper' ] ){aspect-ratio:16 / 10}:host( [ variant='wallpaper' ] ) button{display:flex;align-items:flex-end;justify-content:flex-start;padding:8px;overflow:hidden}button{appearance:none;position:relative;width:100%;height:100%;padding:0;border-radius:10px;border:2px solid transparent;cursor:pointer;background-color:var( --os-ui-surface-sunken,#eee );background-size:cover;background-position:center;transition:transform 0.15s ease,border-color 0.15s ease,box-shadow 0.15s ease}:host( [ size='small' ] ) button{border-radius:50%}button:hover{transform:scale( 1.04 )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button[ aria-pressed='true' ]{border-color:transparent;box-shadow:0 0 0 var( --os-ui-swatch-ring-width,2px ) var( --os-ui-accent,#2271b1 ),var( --os-ui-swatch-lift,0 0 0 0 transparent )}:host(:not( [ variant='accent' ] ) ) button[ aria-pressed='true' ]::after{content:'';position:absolute;top:6px;inset-inline-end:6px;width:18px;height:18px;border-radius:50%;background:var( --os-ui-swatch-badge-bg,transparent );pointer-events:none;-webkit-mask:url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E" ) center / 12px no-repeat,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E" ) center / 12px no-repeat,linear-gradient( #000 0 0 );mask-composite:exclude}button[ aria-pressed='true' ]:focus-visible{box-shadow:var( --_holo-focus )}:host( [ variant='wallpaper' ] ) button:hover{transform:translateY( -2px )}`,Ze=class Ze extends _{render(){const e=this.selected!==null,t=this.label||"",o=this.preview||"";return c` `}_onPick(){this.emit("os-pick",{value:this.value})}};Ze.props=["value","label","selected","preview","size","variant"],Ze.styles=[Su],Ze.help=void 0;let Co=Ze;w("os-swatch",Co);const Cu=v`:host{display:grid;grid-template-columns:repeat( var( --os-ui-swatch-grid-cols,4 ),1fr );gap:12px}:host( [ mode='row' ] ){display:flex;flex-wrap:wrap;align-items:center;gap:10px}`,Ye=class Ye extends _{render(){const e=this.label||"",t=this.columns||"";return t&&this.style.setProperty("--os-ui-swatch-grid-cols",t),this.setAttribute("role","radiogroup"),e&&this.setAttribute("aria-label",e),c``}};Ye.props=["label","columns","mode"],Ye.styles=[Cu],Ye.help=void 0;let Io=Ye;w("os-swatch-grid",Io);const Iu=v` ${C}:host{display:inline-flex;position:relative;padding:3px;background:var( --os-ui-segmented-bg,var( --os-ui-hover,rgba( 0,0,0,0.05 ) ) );border-radius:8px;gap:2px;box-shadow:var( --os-ui-segmented-edge,none )}.os-segmented__thumb{position:absolute;top:3px;bottom:3px;left:0;width:var( --_thumb-w,0px );border-radius:6px;background-color:var( --os-ui-segmented-selected-bg,color-mix( in srgb,var( --os-ui-accent,#2271b1 ) var( --os-ui-segmented-selected-accent,100% ),var( --os-ui-segmented-selected-base,var( --os-ui-surface,#fff ) ) ) );background-image:var( --os-ui-segmented-selected-image,none );box-shadow:var( --os-ui-segmented-selected-shadow,none );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;transform:translateX( var( --_thumb-x,0px ) );pointer-events:none;opacity:0}:host( [ data-thumb ] ) .os-segmented__thumb{opacity:1}:host( [ data-thumb-ready ] ) .os-segmented__thumb{transition:transform var( --_holo-t-slow ) var( --_holo-spring ),width var( --_holo-t-slow ) var( --_holo-ease ),opacity var( --_holo-t-fast ) linear}@media ( prefers-reduced-motion:reduce ){:host( [ data-thumb-ready ] ) .os-segmented__thumb{transition-duration:1ms}}`,Ru=v` ${C} ${xs}:host{flex:1 1 auto;min-width:0;--_holo-sheen:var( --os-ui-segmented-hover-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% ) ) )}button{appearance:none;display:block;width:100%;padding:6px 13px;background:transparent;border:0;font:inherit;font-size:13px;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:6px;transition:background-color var( --_holo-t ) ease,color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,background-position var( --_holo-t ) ease;white-space:nowrap}button:hover{color:var( --os-ui-fg,#1d2327 )}:host(:not( [ aria-checked='true' ] ) ) button:hover{background-color:var( --os-ui-segmented-hover-bg,transparent )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}:host( [ aria-checked='true' ] ) button{color:var( --os-ui-segmented-selected-fg,color-mix( in srgb,var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) ) var( --os-ui-segmented-selected-accent,100% ),var( --os-ui-fg,#1d2327 ) ) );transition-duration:var( --_holo-t-fast )}:host( [ aria-checked='true' ] ) button::before{display:none}`,Je=class Je extends _{render(){return this.setAttribute("role","radio"),c` `}_onPick(){this.emit("os-segment-pick",{value:this.value})}};Je.props=["value"],Je.styles=[Ru],Je.help=void 0;let Ro=Je;w("os-segment",Ro);const Qe=class Qe extends _{constructor(){super(...arguments),this._resizeObserver=null}connectedCallback(){super.connectedCallback(),this.addEventListener("os-segment-pick",e=>{const t=e.detail;e.stopPropagation(),this.value=t.value,this.emit("os-pick",{value:t.value})}),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._placeThumb()),this._resizeObserver.observe(this))}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null}_placeThumb(){if(!this.shadowRoot?.querySelector(".os-segmented__thumb"))return;const t=this.value,o=Array.from(this.querySelectorAll(":scope > os-segment")).find(u=>u.getAttribute("value")===t);if(!o||this.offsetWidth===0){this.removeAttribute("data-thumb");return}const i=this.getBoundingClientRect(),n=i.width/this.offsetWidth,r=Math.abs(n-1)<.02?1:n;if(!(r>0))return;const a=o.getBoundingClientRect(),l=u=>`${Math.round(u*100)/100}px`;this.style.setProperty("--_thumb-x",l((a.left-i.left)/r)),this.style.setProperty("--_thumb-w",l(a.width/r)),this.setAttribute("data-thumb",""),this.hasAttribute("data-thumb-ready")||requestAnimationFrame(()=>this.setAttribute("data-thumb-ready",""))}set items(e){const t=this.querySelectorAll(":scope > os-segment");for(const n of Array.from(t))n.remove();for(const n of e){const r=document.createElement("os-segment");r.setAttribute("value",n.value),r.textContent=n.label,this.appendChild(r)}const o=this.value;!(o!==null&&e.some(n=>n.value===o))&&e.length>0?this.value=e[0].value:this.requestUpdate()}render(){const e=this.label||"";e&&this.setAttribute("aria-label",e),this.setAttribute("role","radiogroup");const t=this.value;return queueMicrotask(()=>{const o=this.querySelectorAll("os-segment");for(const i of Array.from(o)){const n=i.getAttribute("value");i.setAttribute("aria-checked",n===t?"true":"false")}this._placeThumb()}),c``}};Qe.props=["value","label"],Qe.styles=[Iu],Qe.help={title:"Segmented",summary:"iOS-style segmented radio group. Pill-shaped bar of equal-width children where exactly one is active.",status:"stable",props:[{name:"value",type:"string",description:"Currently selected segment value. Mirrored onto child aria-checked."},{name:"label",type:"string",description:"aria-label for the radiogroup."}],slots:[{name:"(default)",description:' children.'}],events:[{name:"os-pick",description:"Fires when the selected segment changes.",detail:"{ value: string }"}],cssProps:[{name:"--os-window-bg",description:"Pill background."},{name:"--os-ui-fg",description:"Active label colour."},{name:"--os-ui-fg-muted",description:"Inactive label colour."}],example:c` Small Medium Large `};let Lo=Qe;w("os-segmented",Lo);const Lu=v` ${C}:host{display:flex;flex-direction:column;gap:8px;font-size:13px;color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-select__label{font-size:13px;line-height:1.5;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger{appearance:none;display:flex;align-items:center;gap:8px;width:100%;min-width:0;padding:8px 12px;background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border:1px solid transparent;border-radius:8px;font:inherit;font-size:13px;line-height:1.5;color:var( --os-ui-fg,#1d2327 );text-align:start;cursor:pointer;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}.os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.08 ) );border-color:var( --os-ui-border-strong,#8c8f94 )}.os-select__trigger:focus,.os-select__trigger:focus-visible{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.os-select__trigger:disabled{opacity:0.5;cursor:not-allowed}:host( [ plain ] ){display:inline-flex;flex-direction:row;align-items:center}:host( [ plain ] ) .os-select__label{display:none}:host( [ plain ] ) .os-select__trigger{width:auto;padding:4px 6px;background:transparent;border-color:transparent;border-radius:6px}:host( [ plain ] ) .os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border-color:transparent}:host( [ plain ] ) .os-select__trigger:focus,:host( [ plain ] ) .os-select__trigger:focus-visible{border-color:var( --os-ui-accent,#2271b1 )}:host( [ plain ] ) .os-select__value{flex:0 1 auto}.os-select__value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-select__value--placeholder{color:var( --os-ui-fg-muted,#646970 )}.os-select__chevron{flex:0 0 auto;pointer-events:none;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger:hover .os-select__chevron{color:var( --os-ui-fg,#1d2327 )}.os-select__trigger:focus .os-select__chevron,.os-select__trigger:focus-visible .os-select__chevron{color:var( --os-ui-accent,#2271b1 )}.os-select__popup{position:fixed;inset:auto;margin:0;max-height:min( 320px,60vh );overflow-y:auto;padding:4px;background:var( --os-ui-surface,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:8px;box-shadow:0 12px 32px rgba( 0,0,0,0.45 );color:var( --os-ui-fg,#1d2327 )}.os-select__popup:not( [ data-open ] ){display:none}.os-select__popup:popover-open{display:block}.os-select__popup[ data-open ]{position:absolute;top:calc( 100% + 4px );left:0;min-width:100%;z-index:1000}:host{position:relative}.os-select__option{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:6px;font-size:13px;line-height:1.5;cursor:pointer;white-space:nowrap}.os-select__check{flex:0 0 auto;visibility:hidden}.os-select__option[ aria-selected='true' ] .os-select__check{visibility:visible}.os-select__option[ data-active ],.os-select__option:hover{background:var( --os-ui-accent,#2271b1 );color:var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) )}.os-select__option[ aria-disabled='true' ]{opacity:0.5;cursor:not-allowed}.os-select__option[ aria-disabled='true' ]:hover{background:transparent;color:inherit}@media ( prefers-reduced-motion:reduce ){.os-select__trigger{transition-duration:1ms}}`,Tu=v`:host{display:none}`,et=class et extends _{render(){return c``}};et.props=["value","disabled"],et.styles=[Tu],et.help=void 0;let To=et;w("os-option",To);const tt=class tt extends _{constructor(){super(...arguments),this._optionObserver=null,this._open=!1,this._activeIndex=-1,this._typed="",this._dismissedAt=0,this._typedTimer=null,this._onWindowScroll=e=>{const t=e.target,o=this._popup();o&&t instanceof Node&&(t===o||o.contains(t))||this._hide()},this._onWindowResize=()=>this._hide()}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const n of Array.from(t))n.remove();for(const n of e){const r=document.createElement("os-option");r.setAttribute("value",n.value),r.textContent=n.label,this.appendChild(r)}const o=this.value;!(o!==null&&e.some(n=>n.value===o))&&e.length>0&&(this.value=e[0].value),this.requestUpdate()}connectedCallback(){super.connectedCallback(),He(this),this._optionObserver=new MutationObserver(()=>this.requestUpdate()),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._teardownDismiss(),this._open=!1,this._typedTimer&&(clearTimeout(this._typedTimer),this._typedTimer=null)}render(){const e=this.label||"",t=this.value,o=this.placeholder||"",i=this.disabled!==null;e&&this.setAttribute("aria-label",e);const n=this.getAttribute("aria-label")||"",r=e||n||o,a=this._readOptions(),l=a.find(m=>m.value===t),u=l?l.label:o,h=this.id||"os-unnamed",p=`${h}__listbox`,g=`${h}__trigger`,b=this._open&&this._activeIndex>=0?`${h}__opt-${this._activeIndex}`:"";return c` ${e?c``:c``}
this._onPopoverToggle(m)} > ${a.map((m,x)=>c`
this._onOptionClick(m)} @pointermove=${()=>this._setActive(x)} > ${N("check",{size:16,className:"os-select__check"})} ${m.label}
`)}
`}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const o of Array.from(t)){const i=o.getAttribute("value");i!==null&&e.push({value:i,label:(o.textContent||i).trim(),disabled:o.hasAttribute("disabled")})}return e}_popup(){return this.shadowRoot?.querySelector(".os-select__popup")??null}_trigger(){return this.shadowRoot?.querySelector(".os-select__trigger")??null}_toggle(){if(this._open){this._hide();return}performance.now()-this._dismissedAt<250||this._show()}_show(){const e=this._popup(),t=this._trigger();if(!e||!t||this._open)return;this._open=!0;const o=this._readOptions(),i=this.value,n=o.findIndex(a=>a.value===i&&!a.disabled);this._activeIndex=n>=0?n:o.findIndex(a=>!a.disabled);const r=t.getBoundingClientRect();e.style.minWidth=`${r.width}px`,typeof e.showPopover=="function"?(e.style.left=`${r.left}px`,e.style.top=`${r.bottom+4}px`,e.showPopover(),r.bottom+4+e.offsetHeight>window.innerHeight-8&&(e.style.top=`${Math.max(8,r.top-4-e.offsetHeight)}px`)):e.setAttribute("data-open",""),window.addEventListener("scroll",this._onWindowScroll,{capture:!0,passive:!0}),window.addEventListener("resize",this._onWindowResize),this.requestUpdate(),this._scrollActiveIntoView()}_hide(){if(!this._open)return;this._open=!1;const e=this._popup();if(e){if(typeof e.hidePopover=="function")try{e.hidePopover()}catch{}e.removeAttribute("data-open")}this._teardownDismiss(),this.requestUpdate()}_teardownDismiss(){window.removeEventListener("scroll",this._onWindowScroll,{capture:!0}),window.removeEventListener("resize",this._onWindowResize)}_onPopoverToggle(e){e.newState==="closed"&&this._open&&(this._dismissedAt=performance.now(),this._open=!1,this._teardownDismiss(),this.requestUpdate())}_onOptionClick(e){e.disabled||this._commit(e.value)}_commit(e){this._hide(),this.value=e,this.emit("os-pick",{value:e})}_setActive(e){if(e===this._activeIndex)return;const t=this._readOptions();!t[e]||t[e].disabled||(this._activeIndex=e,this.requestUpdate())}_moveActive(e){const t=this._readOptions();let o=this._activeIndex;for(let i=0;i{this.shadowRoot?.querySelector(".os-select__option[data-active]")?.scrollIntoView?.({block:"nearest"})})}_typeAhead(e){this._typedTimer&&clearTimeout(this._typedTimer),this._typed+=e.toLowerCase(),this._typedTimer=setTimeout(()=>{this._typed=""},500);const o=this._readOptions().findIndex(i=>!i.disabled&&i.label.toLowerCase().startsWith(this._typed));o>=0&&(this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView())}_onTriggerKeydown(e){const t=this._readOptions();if(t.length!==0){if(!this._open){if(["ArrowDown","ArrowUp","Enter"," ","Home","End"].includes(e.key)){if(e.preventDefault(),this._show(),e.key==="Home"&&(this._activeIndex=t.findIndex(o=>!o.disabled)),e.key==="End"){for(let o=t.length-1;o>=0;o--)if(!t[o].disabled){this._activeIndex=o;break}}this.requestUpdate()}else e.key.length===1&&e.key.trim()!==""&&(this._show(),this._typeAhead(e.key));return}switch(e.key){case"ArrowDown":e.preventDefault(),this._moveActive(1);break;case"ArrowUp":e.preventDefault(),this._moveActive(-1);break;case"Home":e.preventDefault(),this._activeIndex=t.findIndex(o=>!o.disabled),this.requestUpdate(),this._scrollActiveIntoView();break;case"End":e.preventDefault();for(let o=t.length-1;o>=0;o--)if(!t[o].disabled){this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView();break}break;case"Enter":case" ":{e.preventDefault();const o=t[this._activeIndex];o&&!o.disabled&&this._commit(o.value);break}case"Tab":{const o=t[this._activeIndex];o&&!o.disabled?this._commit(o.value):this._hide();break}case"Escape":e.preventDefault(),this._hide();break;default:e.key.length===1&&e.key.trim()!==""&&this._typeAhead(e.key)}}}};tt.props=["value","label","placeholder","disabled","name"],tt.styles=[Lu],tt.help={title:"Select",summary:"Dropdown picker: a combobox trigger plus a custom top-layer listbox, so the popup wears the station instead of the operating system. Mirrors the contract (set value, listen for os-pick).",status:"stable",props:[{name:"value",type:"string",description:"Currently selected option value."},{name:"label",type:"string",description:"Visible label rendered above the trigger and used as the accessible name."},{name:"placeholder",type:"string",description:"Trigger text shown when no value is set."},{name:"disabled",type:"boolean attribute",description:"Disables the trigger and dims the chrome."},{name:"plain",type:"boolean attribute",description:"Drops the field chrome and shrinks to the value, for a picker that is a list row’s trailing control rather than a field of its own. The container already draws the box; use with no `label`."},{name:"name",type:"string",description:"Accepted for compatibility. Shadow-DOM controls never participated in light-DOM form submission, so nothing is lost by the native select being gone; read `value` off the host instead."}],slots:[{name:"(default)",description:' children.'}],events:[{name:"os-pick",description:"Fires when the user picks a new option.",detail:"{ value: string }"}],cssProps:[{name:"--os-ui-fg",description:"Label + value colour."},{name:"--os-ui-fg-muted",description:"Placeholder + chevron colour."},{name:"--os-ui-accent",description:"Active option row + selected check."}],example:c` Euro US Dollar Japanese Yen `};let Do=tt;w("os-select",Do);const Du=v` :host { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var( --os-ui-fg, #1d2327 ); min-width: 0; } :host( [ hidden ] ) { display: none; } .os-multiselect__label { font-size: 12px; color: var( --os-ui-fg-muted, #646970 ); } .os-multiselect__trigger { appearance: none; display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; padding: 7px 12px 7px 12px; background: var( --os-ui-hover, rgba( 0, 0, 0, 0.05 ) ); border: 1px solid transparent; border-radius: 7px; font: inherit; font-size: 13px; color: var( --os-ui-fg, #1d2327 ); cursor: pointer; text-align: start; transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease; } .os-multiselect__trigger:hover { background: var( --os-ui-hover, rgba( 0, 0, 0, 0.08 ) ); } .os-multiselect__trigger:focus-visible { outline: none; border-color: var( --os-ui-accent, #2271b1 ); box-shadow: var( --os-ui-focus-ring-field, 0 0 0 1px #2271b1, 0 0 0 4px rgba( 34, 113, 177, 0.18 ) ); } .os-multiselect__trigger:disabled { opacity: 0.5; cursor: not-allowed; } .os-multiselect__trigger[ data-active='true' ] { color: var( --wp-admin-theme-color, #2271b1 ); font-weight: 600; } .os-multiselect__summary { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .os-multiselect__chevron { color: var( --os-ui-fg-muted, #646970 ); flex-shrink: 0; transition: color 0.12s ease, transform 0.18s ease; } .os-multiselect__trigger:hover .os-multiselect__chevron, .os-multiselect__trigger:focus-visible .os-multiselect__chevron { color: var( --os-ui-fg, #1d2327 ); } :host( [ open ] ) .os-multiselect__chevron { transform: rotate( 180deg ); } `;function Pu(){const s="os-multiselect-popover-styles";if(document.getElementById(s))return;const e=document.createElement("style");e.id=s,e.textContent=` .os-multiselect__popover { position: fixed; z-index: 100000; max-height: 320px; overflow-y: auto; min-width: 200px; padding: 4px 0; background: var( --os-window-bg, #fff ); color: var( --os-ui-fg, #1d2327 ); border: 1px solid var( --os-window-border, #c3c4c7 ); border-radius: 8px; box-shadow: 0 8px 28px rgba( 0, 0, 0, 0.18 ); font: inherit; font-size: 13px; } .os-multiselect__clear { display: block; width: 100%; padding: 6px 12px; font: inherit; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; text-align: start; border: 0; border-bottom: 1px solid var( --os-window-border, #dcdcde ); background: transparent; color: var( --wp-admin-theme-color, #2271b1 ); cursor: pointer; } .os-multiselect__clear:hover { background: color-mix( in srgb, var( --wp-admin-theme-color, #2271b1 ) 10%, transparent ); } .os-multiselect__option { display: flex; align-items: center; gap: 8px; padding: 6px 12px; cursor: pointer; user-select: none; } .os-multiselect__option:hover { background: var( --os-ui-hover, rgba( 0, 0, 0, 0.05 ) ); } .os-multiselect__option[ data-disabled='true' ] { opacity: 0.5; cursor: not-allowed; } .os-multiselect__option > span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .os-multiselect__option > input[ type='checkbox' ] { margin: 0; flex-shrink: 0; accent-color: var( --wp-admin-theme-color, #2271b1 ); } .os-multiselect__empty { padding: 8px 12px; color: var( --os-ui-fg-muted, #646970 ); font-style: italic; } .os-multiselect__loading { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var( --os-ui-fg-muted, #646970 ); font-size: 12px; } .os-multiselect__spinner { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: os-multiselect-spin 0.8s linear infinite; } @keyframes os-multiselect-spin { to { transform: rotate( 360deg ); } } `,document.head.appendChild(e)}typeof document<"u"&&Pu();const st=class st extends _{constructor(){super(...arguments),this._optionObserver=null,this._popover=null,this._teardownOpen=null,this._hasMore=!1,this._loadingMore=!1}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const n of Array.from(t))n.remove();for(const n of e){const r=document.createElement("os-option");r.setAttribute("value",n.value),r.textContent=n.label,this.appendChild(r)}this._loadingMore=!1;const o=new Set(e.map(n=>n.value)),i=this._readValues().filter(n=>o.has(n));this._writeValueAttribute(i),this.requestUpdate(),this._refreshPopover()}get values(){return this._readValues()}set values(e){const t=Array.isArray(e)?e.map(o=>String(o)).filter(o=>o!==""):[];this._writeValueAttribute(t),this.requestUpdate(),this._refreshPopover()}get hasMore(){return this._hasMore}set hasMore(e){this._hasMore=!!e,this._refreshPopover()}get loadingMore(){return this._loadingMore}set loadingMore(e){this._loadingMore=!!e,this._refreshPopover()}appendItems(e){if(this._loadingMore=!1,!e||e.length===0){this._refreshPopover();return}const t=new Set(Array.from(this.querySelectorAll(":scope > os-option")).map(o=>o.getAttribute("value")));for(const o of e){if(t.has(o.value))continue;const i=document.createElement("os-option");i.setAttribute("value",o.value),i.textContent=o.label,this.appendChild(i)}this.requestUpdate(),this._refreshPopover()}connectedCallback(){super.connectedCallback(),He(this),this._optionObserver=new MutationObserver(()=>{this.requestUpdate(),this._refreshPopover()}),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._closePopover()}render(){const e=this.label||"",t=this.placeholder||"All",o=this.disabled!==null;e?this.setAttribute("aria-label",e):this.removeAttribute("aria-label");const i=e||t,n=this._summarize(t),r=this._readValues().length>0,l=`${this.id||"os-unnamed"}__trigger`;return c` ${e?c``:c``} `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const o of Array.from(t)){const i=o.getAttribute("value");i!==null&&e.push({value:i,label:(o.textContent||i).trim(),disabled:o.hasAttribute("disabled")})}return e}_readValues(){return(this.value??"").split(",").map(t=>t.trim()).filter(t=>t!=="")}_writeValueAttribute(e){const t=e.join(",");this.value=t}_summarize(e){const t=this._readValues();if(t.length===0)return e;const o=this._readOptions(),i=new Map(o.map(n=>[n.value,n.label]));return t.length===1?i.get(t[0])??t[0]:`${t.length} selected`}_isOpen(){return this.open!==null}_onTriggerClick(e){e.stopPropagation(),e.preventDefault(),this.disabled===null&&(this._popover?this._closePopover():this._openPopover())}_openPopover(){if(this._popover)return;const e=document.createElement("div");e.className="os-multiselect__popover",e.setAttribute("role","listbox"),e.setAttribute("aria-multiselectable","true"),e.style.setProperty("--wp-admin-theme-color",getComputedStyle(this).getPropertyValue("--wp-admin-theme-color")||"#2271b1"),document.body.appendChild(e),this._popover=e,this._refreshPopover(),this._placePopover();const t=r=>{const a=r.target;if(!a)return;const l=this.shadowRoot?.querySelector(".os-multiselect__trigger");e.contains(a)||l&&l.contains(a)||this._closePopover()},o=r=>{r.key==="Escape"&&(r.stopPropagation(),this._closePopover(),this.shadowRoot?.querySelector(".os-multiselect__trigger")?.focus())},i=()=>this._placePopover(),n=()=>{if(!this._hasMore||this._loadingMore)return;const r=e.scrollHeight,a=e.clientHeight,l=e.scrollTop;r-(l+a)<64&&this.emit("os-multiselect-load-more",{})};setTimeout(()=>{document.addEventListener("pointerdown",t,!0)},0),document.addEventListener("keydown",o,!0),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),e.addEventListener("scroll",n),this._teardownOpen=()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",o,!0),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0),e.removeEventListener("scroll",n)},this.setAttribute("open",""),this.requestUpdate(),this.emit("os-multiselect-open",{})}_closePopover(){this._teardownOpen&&(this._teardownOpen(),this._teardownOpen=null),this._popover&&(this._popover.remove(),this._popover=null,this.removeAttribute("open"),this.requestUpdate(),this.emit("os-multiselect-close",{}))}_refreshPopover(){const e=this._popover;if(!e)return;const t=this._readOptions(),o=new Set(this._readValues());if(e.replaceChildren(),t.length===0){const i=document.createElement("div");i.className="os-multiselect__empty",i.textContent="No options",e.appendChild(i);return}if(o.size>0){const i=document.createElement("button");i.type="button",i.className="os-multiselect__clear",i.textContent="Clear",i.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),this._writeValueAttribute([]),this.requestUpdate(),this._refreshPopover(),this._emitPick()}),e.appendChild(i)}for(const i of t){const n=document.createElement("label");n.className="os-multiselect__option",n.setAttribute("role","option"),n.setAttribute("aria-selected",o.has(i.value)?"true":"false"),i.disabled&&(n.setAttribute("aria-disabled","true"),n.dataset.disabled="true");const r=document.createElement("input");r.type="checkbox",r.checked=o.has(i.value),r.disabled=i.disabled,r.addEventListener("change",()=>{const l=new Set(this._readValues());r.checked?l.add(i.value):l.delete(i.value);const u=t.map(h=>h.value).filter(h=>l.has(h));this._writeValueAttribute(u),n.setAttribute("aria-selected",r.checked?"true":"false"),this.requestUpdate(),this._refreshPopover(),this._emitPick()});const a=document.createElement("span");a.textContent=i.label,n.appendChild(r),n.appendChild(a),e.appendChild(n)}if(this._loadingMore){const i=document.createElement("div");i.className="os-multiselect__loading";const n=document.createElement("span");n.className="os-multiselect__spinner",n.setAttribute("aria-hidden","true");const r=document.createElement("span");r.textContent="Loading…",i.appendChild(n),i.appendChild(r),e.appendChild(i)}}_placePopover(){const e=this._popover,t=this.shadowRoot?.querySelector(".os-multiselect__trigger");if(!e||!t)return;const o=t.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,r=Math.max(o.width,200);e.style.minWidth=`${r}px`;let a=o.left;a+r>i-8&&(a=Math.max(8,i-r-8)),e.style.left=`${a}px`,e.style.top=`${o.bottom+4}px`;const l=e.offsetHeight||200;o.bottom+4+l>n-8&&(e.style.top=`${Math.max(8,o.top-l-4)}px`)}_emitPick(){const e=this._readValues();this.emit("os-pick",{value:e.join(","),values:e})}};st.props=["value","label","placeholder","disabled","name","open"],st.styles=[Du],st.help=void 0;let Po=st;w("os-multiselect",Po);const Nu=v` ${C}:host{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}label{display:inline-flex;align-items:center;gap:8px}input[ type='color' ]{width:28px;height:28px;padding:0;border:1px solid var( --os-ui-border,#c3c4c7 );border-radius:6px;background:transparent;cursor:pointer;transition:border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='color' ]:hover{border-color:var( --os-ui-border-strong,#8c8f94 )}input[ type='color' ]:focus-visible{outline:none;box-shadow:var( --_holo-focus )}:host( [ variant='block' ] ){display:flex;width:100%}:host( [ variant='block' ] ) label{display:flex;flex:1;align-items:center}:host( [ variant='block' ] ) input[ type='color' ]{flex:1;width:auto;height:32px}input[ type='color' ]::-webkit-color-swatch-wrapper{padding:2px}input[ type='color' ]::-webkit-color-swatch{border:none;border-radius:2px}`,ot=class ot extends _{open(){const e=()=>{const t=this.shadowRoot?.querySelector("input");if(!t)return!1;try{t.showPicker()}catch{t.click()}return!0};e()||queueMicrotask(()=>void e())}render(){const e=this.label||"",t=this.value||"#000000";return c` `}_onInput(e){const t=e.target;this.value=t.value,this.emit("os-color-change",{value:t.value})}};ot.props=["name","label","value","variant"],ot.styles=[Nu],ot.help=void 0;let No=ot;w("os-color-field",No);const Mu=v` ${C}:host{display:flex;align-items:center;gap:10px;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}input[ type='range' ]{appearance:none;-webkit-appearance:none;flex:1;min-width:0;height:18px;margin:0;padding:0;background:transparent;cursor:pointer}input[ type='range' ]:disabled{cursor:not-allowed;opacity:0.5}input[ type='range' ]::-webkit-slider-runnable-track{height:6px;border-radius:999px;background-image:linear-gradient( var( --_range-angle,90deg ),transparent var( --_fill,0% ),var( --_holo-track ) var( --_fill,0% ) ),linear-gradient( var( --os-ui-accent,#2271b1 ),var( --os-ui-accent,#2271b1 ) );background-size:auto,auto;background-position:center,center;background-repeat:no-repeat;box-shadow:inset 0 0 0 1px var( --_holo-track-edge )}input[ type='range' ]::-moz-range-track{height:6px;border-radius:999px;background-image:linear-gradient( var( --_range-angle,90deg ),transparent var( --_fill,0% ),var( --_holo-track ) var( --_fill,0% ) ),linear-gradient( var( --os-ui-accent,#2271b1 ),var( --os-ui-accent,#2271b1 ) );background-size:auto,auto;background-position:center,center;background-repeat:no-repeat;box-shadow:inset 0 0 0 1px var( --_holo-track-edge )}input[ type='range' ]::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:16px;height:16px;margin-top:-5px;border:0;border-radius:50%;background:var( --os-ui-switch-knob,#fffbff );box-shadow:0 1px 3px rgba( 12,11,15,0.5 ),0 0 0 1px rgba( 12,11,15,0.14 );cursor:inherit;transition:transform var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='range' ]::-moz-range-thumb{width:16px;height:16px;border:0;border-radius:50%;background:var( --os-ui-switch-knob,#fffbff );box-shadow:0 1px 3px rgba( 12,11,15,0.5 ),0 0 0 1px rgba( 12,11,15,0.14 );cursor:inherit;transition:transform var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='range' ]:active::-webkit-slider-thumb{transform:scale( 1.15 );box-shadow:var( --_holo-glow-strong )}input[ type='range' ]:active::-moz-range-thumb{transform:scale( 1.15 );box-shadow:var( --_holo-glow-strong )}input[ type='range' ]:focus-visible{outline:none}input[ type='range' ]:focus-visible::-webkit-slider-thumb{box-shadow:var( --_holo-focus )}input[ type='range' ]:focus-visible::-moz-range-thumb{box-shadow:var( --_holo-focus )}.os-range-field__value{width:var( --os-ui-range-readout-width,3ch );flex:none;text-align:end;font-variant-numeric:tabular-nums;color:var( --os-ui-fg,#1d2327 )}@media ( prefers-reduced-motion:reduce ){input[ type='range' ]::-webkit-slider-thumb{transition-duration:1ms}input[ type='range' ]::-moz-range-thumb{transition-duration:1ms}}`;function zu(s,e,t){const o=Number.parseFloat(s),i=Number.parseFloat(e),n=Number.parseFloat(t);if(!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(n)||n===i)return"0%";const r=(o-i)/(n-i);return`${Math.min(100,Math.max(0,r*100)).toFixed(2)}%`}function Ou(s){const e=s.indexOf(".");return e<0?0:Math.min(3,s.length-e-1)}function Wu(s,e,t,o){const i=r=>{const a=Number.parseFloat(r);return Number.isFinite(a)?String(Math.trunc(Math.abs(a))).length+(a<0?1:0):3};return Math.max(i(s),i(e))+(t>0?t+1:0)+o.length}const it=class it extends _{render(){const e=this.label||"",t=this.value||"0",o=this.min||"0",i=this.max||"100",n=this.step||"1",r=this.suffix||"",a=this.decimals,l=a?Math.min(6,Math.max(0,Number.parseInt(a,10)||0)):Ou(n),u=Number.parseFloat(t),h=Number.isFinite(u)?u.toFixed(l):t,p=Wu(o,i,l,r);return c` this._onInput(g)} /> ${h}${r} `}connectedCallback(){super.connectedCallback(),getComputedStyle(this).direction==="rtl"&&this.style.setProperty("--_range-angle","270deg")}_onInput(e){const t=e.target,o=parseFloat(t.value);Number.isFinite(o)&&(this.value=String(o),this.emit("os-range-change",{value:o}))}};it.props=["name","label","value","min","max","step","suffix","decimals"],it.styles=[Mu],it.help=void 0;let Mo=it;w("os-range-field",Mo);const ia=v` ${C} ${_o}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-text-field__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-text-field__label--hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;white-space:nowrap;clip-path:inset( 50% )}.os-text-field__row{position:relative;display:flex;align-items:center;width:100%}input{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:7px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:var( --_field-radius );font:inherit;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 )}input:is( [ type='date' ],[ type='datetime-local' ],[ type='month' ],[ type='week' ] )::-webkit-calendar-picker-indicator{--_calendar-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath d='M4.75 7.25L4.75 18C4.75 18.6904 5.30964 19.25 6 19.25H18C18.6904 19.25 19.25 18.6904 19.25 18V7.25V6C19.25 5.30964 18.6904 4.75 18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V7.25ZM19.25 7.25H4.75M7.25 10.75H9.25M11 10.75H13M14.75 10.75H16.75M7.25 14.5H9.25M11 14.5H13M14.75 14.5H16.75' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V7.25H19.25V6C19.25 5.30964 18.6904 4.75 18 4.75Z' fill='currentColor' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");background:var( --os-ui-fg-muted,#646970 );-webkit-mask:var( --_calendar-icon ) center / contain no-repeat;mask:var( --_calendar-icon ) center / contain no-repeat;width:16px;height:16px;cursor:pointer}@media ( forced-colors:active ){input:is( [ type='date' ],[ type='datetime-local' ],[ type='month' ],[ type='week' ] )::-webkit-calendar-picker-indicator{background:ButtonText;forced-color-adjust:none}}.os-text-field__suffix{position:absolute;inset-inline-end:10px;top:50%;transform:translateY( -50% );pointer-events:none;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-text-field__row--has-reveal input{padding-inline-end:36px}:host( [ clearable ] ) input::-webkit-search-cancel-button{-webkit-appearance:none;display:none}.os-text-field__row--has-clear input{padding-inline-end:36px}.os-text-field__row--has-reveal.os-text-field__row--has-clear input{padding-inline-end:68px}.os-text-field__clear{position:absolute;inset-inline-end:0;top:0;bottom:0;width:34px;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:0 6px 6px 0}.os-text-field__row--has-reveal .os-text-field__clear{inset-inline-end:34px;border-radius:0}.os-text-field__clear:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__clear:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.os-text-field__clear:disabled{opacity:0.45;cursor:default}.os-text-field__reveal{position:absolute;inset-inline-end:0;top:0;bottom:0;width:34px;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:0 6px 6px 0;transition:color 0.12s ease}.os-text-field__reveal:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__reveal:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 );border-radius:0 6px 6px 0}.os-text-field__reveal:disabled{opacity:0.45;cursor:not-allowed}.os-text-field__input--masked{-webkit-text-security:disc;text-security:disc}@supports not ( ( -webkit-text-security:disc ) or ( text-security:disc ) ){.os-text-field__input--masked{font-family:text-security-disc,"password",monospace;letter-spacing:0.2em}}input:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}input[ aria-invalid='true' ],input[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}input[ aria-invalid='true' ]:focus,input[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}input[ type='number' ]::-webkit-inner-spin-button,input[ type='number' ]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[ type='number' ]{-moz-appearance:textfield}`,nt=class nt extends _{constructor(){super(...arguments),this._revealed=!1}connectedCallback(){super.connectedCallback(),He(this)}render(){const e=this.label||"",t=this.hideLabel!==null,o=this.value??"",i=this.placeholder||"",n=this.disabled!==null,r=this.readonly!==null,a=this.autocomplete,l=this.type||"text",u=l==="password";let h=a||"off";u&&(!a||h==="off")&&(h="new-password");const p=this.maxlength,g=this.minlength,b=this.pattern||"",m=this.name||"",x=this.suffix||"",y=this.invalid!==null,k=this.reveal!==null,f=this.clearable!==null,A=l==="password",$=A&&!(k&&this._revealed);let R;A||k&&this._revealed?R="text":R=l;const I=["os-text-field__row",k?"os-text-field__row--has-reveal":"",f?"os-text-field__row--has-clear":""].filter(Boolean).join(" "),O=$?"os-text-field__input os-text-field__input--masked":"os-text-field__input",X=`${this.id||"os-unnamed"}__input`;return c` ${e?c``:c``} this._onInput(ye)} @change=${ye=>this._onChange(ye)} @keydown=${ye=>this._onKeyDown(ye)} /> ${x?c`${x}`:c``} ${f&&o!==""?this._renderClearButton(n):c``} ${k?this._renderRevealButton(n):c``} `}_renderClearButton(e){return c` `}_onClear(){this.value="",this.emit("os-input-change",{value:""}),this.emit("os-input-commit",{value:""}),this.shadowRoot?.querySelector("input")?.focus()}_renderRevealButton(e){const t=this._revealed?"Hide":"Show";return c` `}_onToggleReveal(){this._revealed=!this._revealed,this.requestUpdate()}_onInput(e){const t=e.target;this.value=t.value,this.emit("os-input-change",{value:t.value})}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey){const t=e.target;this.emit("os-submit",{value:t.value})}}};nt.props=["label","hideLabel","value","placeholder","disabled","readonly","autocomplete","type","maxlength","minlength","pattern","name","suffix","invalid","reveal","clearable"],nt.styles=[ia],nt.help=void 0;let zo=nt;w("os-text-field",zo);function Hu(){return c` `}function Uu(){return c` `}function qu(){return c` `}const rt=class rt extends _{connectedCallback(){super.connectedCallback(),He(this)}render(){const e=this.label||"",t=this.value??"",o=this.placeholder||"",i=this.disabled!==null,n=this.readonly!==null,r=this.name||"",a=this.suffix||"",l=this.min,u=this.max,h=this.step||"any",p=this.invalid!==null,b=`${this.id||"os-unnamed"}__input`;return c` ${e?c``:c``} this._onInput(m)} @change=${m=>this._onCommit(m)} @keydown=${m=>this._onKeyDown(m)} /> ${a?c`${a}`:c``} `}_readRange(){const e=this.min,t=this.max,o=e!==null?parseFloat(e):-1/0,i=t!==null?parseFloat(t):1/0;return{min:Number.isFinite(o)?o:-1/0,max:Number.isFinite(i)?i:1/0}}_clamp(e){const{min:t,max:o}=this._readRange();return eo?o:e}_onInput(e){const t=e.target,o=parseFloat(t.value);Number.isFinite(o)&&(this.value=String(o),this.emit("os-input-change",{value:o}))}_onCommit(e){const t=e.target,o=parseFloat(t.value);if(!Number.isFinite(o))return;const i=this._clamp(o);i!==o&&(t.value=String(i),this.value=String(i)),this.emit("os-input-commit",{value:i})}_onKeyDown(e){if(e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey){const t=e.target,o=parseFloat(t.value);if(!Number.isFinite(o))return;const i=this._clamp(o);i!==o&&(t.value=String(i),this.value=String(i)),this.emit("os-submit",{value:i})}}};rt.props=["label","value","placeholder","disabled","readonly","name","suffix","min","max","step","invalid"],rt.styles=[ia],rt.help=void 0;let Oo=rt;w("os-number-field",Oo);const Fu=v` ${C} ${$s}:host{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var( --os-ui-fg,#1d2327 );cursor:pointer}:host( [ disabled ] ){cursor:not-allowed;opacity:0.55}:host( [ block ] ){display:flex;cursor:default}:host( [ block ] ) label{cursor:pointer}:host( [ block ][ disabled ] ) label{cursor:not-allowed}label{display:inline-flex;align-items:center;gap:6px;cursor:inherit}.os-checkbox__label{line-height:1.3}.os-checkbox__label:empty{display:none}`,at=class at extends _{render(){const e=this.checked!==null,t=this.disabled!==null,o=this.label||"",i=this.value;return c` `}_onChange(e){const o=e.target.checked;o?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:o,value:this.value})}};at.props=["checked","value","label","disabled"],at.styles=[Fu],at.help=void 0;let Wo=at;w("os-checkbox",Wo);const Vu=v` ${C} ${$s}:host{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var( --os-ui-fg,#1d2327 );cursor:pointer;-webkit-user-select:none;user-select:none}label{display:inline-flex;align-items:center;gap:8px;cursor:pointer}:host( [ disabled ] ){opacity:0.5;cursor:not-allowed}:host( [ disabled ] ) label,:host( [ disabled ] ) input[ type='checkbox' ]{cursor:not-allowed}`,lt=class lt extends _{render(){const e=this.label||"",t=this.checked!==null,o=this.disabled!==null;return c` `}_onChange(e){if(this.disabled!==null)return;const t=e.target.checked;t?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:t})}};lt.props=["label","checked","disabled"],lt.styles=[Vu],lt.help=void 0;let Ho=lt;w("os-checkbox-label",Ho);const ju=v` ${C}:host{--_h:22px;--_pad:2px;--_knob:calc( var( --_h ) - 2 * var( --_pad ) );--_travel:calc( var( --_w ) - var( --_knob ) - 2 * var( --_pad ) );--_w:calc( var( --_h ) * 1.85 );--_drag:0px;--_dir:1;display:inline-flex;align-items:center;gap:10px;font-size:13px;line-height:1.3;color:var( --os-ui-fg,#1d2327 );cursor:pointer;-webkit-user-select:none;user-select:none}:host( [ size='sm' ] ){--_h:16px;--_pad:2px;font-size:12px;gap:8px}:host( [ size='lg' ] ){--_h:30px;--_pad:3px;font-size:14px;gap:12px}:host( [ block ] ){display:flex;width:100%;justify-content:space-between}:host( [ label-position='start' ] ) .os-switch__row{flex-direction:row-reverse}:host( [ disabled ] ){cursor:not-allowed;opacity:0.5}.os-switch__row{display:inline-flex;align-items:center;gap:inherit;flex:1 1 auto;justify-content:inherit}button{appearance:none;flex:0 0 auto;position:relative;box-sizing:border-box;width:var( --_w );height:var( --_h );padding:0;margin:0;border:0;border-radius:999px;background-color:var( --_holo-track );background-image:none;box-shadow:inset 0 0 0 1px var( --_holo-track-edge );cursor:inherit;outline:none;transition:background-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}button:disabled{cursor:not-allowed}:host( [ checked ] ) button{background-image:none;background-color:var( --os-ui-accent,#2271b1 );box-shadow:none}button:focus-visible{box-shadow:var( --_holo-focus ),inset 0 0 0 1px var( --_holo-track-edge )}:host( [ checked ] ) button:focus-visible{box-shadow:var( --_holo-focus )}:host( [ tone='accent' ][ checked ] ) button,:host( [ tone='danger' ][ checked ] ) button,:host( [ tone='success' ][ checked ] ) button{background-image:none}:host( [ tone='accent' ][ checked ] ) button{background-color:var( --os-ui-accent,#2271b1 )}:host( [ tone='danger' ][ checked ] ) button{background-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px rgba( 255,90,90,0.3 ),0 2px 10px rgba( 255,90,90,0.25 )}:host( [ tone='success' ][ checked ] ) button{background-color:var( --os-ui-success-fg,#00a32a );box-shadow:0 0 0 1px rgba( 147,240,198,0.3 ),0 2px 10px rgba( 147,240,198,0.25 )}.os-switch__knob{position:absolute;top:var( --_pad );inset-inline-start:var( --_pad );width:var( --_knob );height:var( --_knob );border-radius:999px;background:var( --os-ui-switch-knob,#fffbff );box-shadow:0 1px 2px rgba( 12,11,15,0.45 ),0 0 0 1px var( --os-ui-switch-knob-edge,rgba( 12,11,15,0.55 ) );pointer-events:none;transition:transform var( --_holo-t ) var( --_holo-spring ),width var( --_holo-t ) ease}.os-switch__knob{transform:translateX( calc( var( --_dir ) * var( --_drag ) ) )}:host( [ checked ] ) .os-switch__knob{transform:translateX( calc( var( --_dir ) * ( var( --_travel ) + var( --_drag ) ) ) )}:host(:not( [ disabled ] ) ) button:active .os-switch__knob{width:calc( var( --_knob ) * 1.28 )}:host( [ checked ]:not( [ disabled ] ) ) button:active .os-switch__knob{width:calc( var( --_knob ) * 1.28 );transform:translateX( calc( var( --_dir ) * ( var( --_travel ) - var( --_knob ) * 0.28 + var( --_drag ) ) ) )}:host( [ data-dragging ] ) .os-switch__knob{transition:width var( --_holo-t ) ease}.os-switch__label{line-height:1.3}.os-switch__label:empty{display:none}.os-switch__text{display:flex;flex-direction:column;gap:2px;min-width:0}.os-switch__description{font-size:0.92em;color:var( --os-ui-fg-muted,#646970 )}@media ( prefers-reduced-motion:reduce ){.os-switch__knob{transition-duration:1ms}}`,Ku=4,ct=class ct extends _{constructor(){super(...arguments),this._pointerId=null,this._startX=0,this._travel=0,this._moved=!1,this._dir=1,this._swallowClick=!1}render(){const e=this._attr("checked")!==null,t=this._attr("disabled")!==null,o=this._attr("label")||"",i=this._attr("description")||"";return c`
${o} ${i}
`}_onPointerDown(e){if(this._attr("disabled")!==null)return;const t=e.currentTarget;this._pointerId=e.pointerId,this._startX=e.clientX,this._moved=!1,this._dir=getComputedStyle(this).direction==="rtl"?-1:1,this.style.setProperty("--_dir",String(this._dir)),this._travel=Math.max(0,t.clientWidth-t.clientHeight),t.setPointerCapture(e.pointerId)}_onPointerMove(e){if(this._pointerId!==e.pointerId||this._travel===0)return;const t=(e.clientX-this._startX)*this._dir;if(!this._moved&&Math.abs(t)>=Ku&&(this._moved=!0,this.setAttribute("data-dragging","")),!this._moved)return;const o=this._attr("checked")!==null,i=o?-this._travel:0,n=o?0:this._travel;this.style.setProperty("--_drag",`${Math.min(n,Math.max(i,t))}px`)}_onPointerUp(e){if(this._pointerId!==e.pointerId)return;const t=this._moved,o=(e.clientX-this._startX)*this._dir;if(this._swallowClick=t,this._endGesture(),!t)return;const i=this._attr("checked")!==null,r=(i?this._travel:0)+o>this._travel/2;r!==i&&this._commit(r)}_endGesture(){this._pointerId=null,this._moved=!1,this.removeAttribute("data-dragging"),this.style.removeProperty("--_drag")}_onClick(){if(this._swallowClick){this._swallowClick=!1;return}this._attr("disabled")===null&&this._commit(this._attr("checked")===null)}_onKeyDown(e){this._attr("disabled")===null&&(e.key==="ArrowRight"||e.key==="End"?(e.preventDefault(),this._attr("checked")===null&&this._commit(!0)):(e.key==="ArrowLeft"||e.key==="Home")&&(e.preventDefault(),this._attr("checked")!==null&&this._commit(!1)))}_commit(e){e?this.setAttribute("checked",""):this.removeAttribute("checked");const t={checked:e,value:this._attr("value")};this.emit("os-switch-change",t),this.emit("os-checkbox-change",t)}_attr(e){return this[e]??null}};ct.props=["name","checked","value","label","description","disabled","size","tone","block","labelPosition"],ct.styles=[ju],ct.help=void 0;let Uo=ct;w("os-switch",Uo);const Bu=v`:host{position:fixed;top:calc( var( --os-admin-bar-height,var( --wp-admin--admin-bar--height,32px ) ) + 16px );inset-inline-end:16px;display:flex;flex-direction:column;gap:8px;z-index:calc( var( --os-z-fullscreen,99999 ) + 10 );pointer-events:none}`,Gu=v` ${C}:host{position:relative;overflow:hidden;display:flex;align-items:center;gap:12px;min-width:280px;max-width:420px;padding:10px 14px;background-color:var( --os-ui-toast-bg,var( --os-ui-modal-bg,#1d2327 ) );background-image:var( --os-ui-toast-bg-image,none );background-repeat:var( --os-ui-toast-bg-image-repeat,repeat );background-size:var( --os-ui-toast-bg-image-size,auto );background-position:var( --os-ui-toast-bg-image-position,center );color:var( --os-ui-fg-on-accent,#fff );border-radius:10px;border:1px solid var( --os-ui-border,rgba( 255,255,255,0.12 ) );box-shadow:0 10px 30px rgba( 0,0,0,0.4 ),0 2px 6px rgba( 0,0,0,0.18 ),inset 0 0 0 1px rgba( 255,255,255,0.04 );font-size:13px;line-height:1.4;opacity:0;transform:translateY( -10px ) scale( 0.97 );transition:opacity var( --_holo-t-fast ) linear,transform var( --_holo-t ) var( --_holo-spring );pointer-events:auto}:host( [ state='in' ] ){opacity:1;transform:translateY( 0 ) scale( 1 )}:host( [ state='out' ] ){opacity:0;transform:translateX( 16px ) scale( 0.97 );transition:opacity var( --_holo-t-fast ) linear,transform var( --_holo-t ) var( --_holo-ease )}.os-toast__label{flex:1}.os-toast__icon{display:inline-flex;flex-shrink:0;color:var( --os-ui-toast-accent,currentColor )}.os-toast__icon[ hidden ]{display:none}:host( [ tone ] )::before{content:'';position:absolute;inset-block:0;inset-inline-start:0;width:3px;background:var( --os-ui-toast-accent,transparent )}:host( [ tone='positive' ] ){--os-ui-toast-accent:var( --os-ui-notice-success,var( --os-ui-success-fg,#1a7f37 ) )}:host( [ tone='warning' ] ){--os-ui-toast-accent:var( --os-ui-notice-warning,var( --os-ui-warning-fg,#9a6700 ) )}:host( [ tone='critical' ] ){--os-ui-toast-accent:var( --os-ui-notice-error,var( --os-ui-danger,#cf222e ) )}:host( [ tone='neutral' ] ){--os-ui-toast-accent:var( --os-ui-notice-neutral,var( --os-ui-fg-muted,#57606a ) )}button[ hidden ]{display:none}button{flex-shrink:0;padding:4px 10px;border:none;border-radius:4px;background:var( --os-ui-hover,rgba( 255,255,255,0.12 ) );color:var( --os-ui-fg-on-accent,#fff );font:inherit;font-size:12px;font-weight:500;cursor:pointer;transition:background-color 0.12s ease}button:hover{background:var( --os-ui-scrim,rgba( 255,255,255,0.22 ) )}button:focus-visible{outline:2px solid var( --os-ui-border,rgba( 255,255,255,0.6 ) );outline-offset:2px}.os-toast__close{display:inline-flex;align-items:center;justify-content:center;padding:4px;border-radius:6px;background:transparent;color:var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) )}.os-toast__close:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.14 ) );color:var( --os-ui-fg-on-accent,#fff )}@media ( prefers-reduced-motion:reduce ){:host{transition-duration:0.01ms}}`,Os=class Os extends _{connectedCallback(){super.connectedCallback(),this.setAttribute("aria-live","polite")}render(){return c``}};Os.styles=[Bu],Os.help=void 0;let qo=Os;w("os-toast-container",qo);const Xu={positive:"check",warning:"warning",critical:"warning",neutral:"info"},dt=class dt extends _{constructor(){super(...arguments),this._hovered=!1,this._focused=!1,this._onEnter=()=>{this._hovered=!0,this._syncHold()},this._onLeave=()=>{this._hovered=!1,this._syncHold()},this._onFocusIn=()=>{this._focused=!0,this._syncHold()},this._onFocusOut=e=>{const t=e.relatedTarget;t instanceof Node&&this._containsDeep(t)||(this._focused=!1,this._syncHold())}}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","status"),this.addEventListener("mouseenter",this._onEnter),this.addEventListener("mouseleave",this._onLeave),this.addEventListener("focusin",this._onFocusIn),this.addEventListener("focusout",this._onFocusOut)}disconnectedCallback(){this.removeEventListener("mouseenter",this._onEnter),this.removeEventListener("mouseleave",this._onLeave),this.removeEventListener("focusin",this._onFocusIn),this.removeEventListener("focusout",this._onFocusOut)}_containsDeep(e){let t=e;for(;t;){if(t===this)return!0;const o=t.parentNode;t=o instanceof ShadowRoot?o.host:o}return!1}_syncHold(){const e=this._hovered||this._focused;e!==this.hasAttribute("held")&&(e?this.setAttribute("held",""):this.removeAttribute("held"),this.emit("os-toast-hold",{held:e}))}render(){const e=this.action||"",t=this.hasAttribute("dismissible"),o=this.tone||"";return c` `}_onAction(e){e.preventDefault(),e.stopPropagation(),this.emit("os-toast-action",{})}_onDismiss(e){e.preventDefault(),e.stopPropagation(),this.emit("os-toast-dismiss",{})}};dt.props=["action","state","dismissible","tone"],dt.styles=[Gu],dt.help={title:"Toast",summary:'Single transient notification. Message is slotted; fade-in / fade-out is CSS-driven by flipping the state attribute between "in" and "out". Usually created via the showToast() helper rather than authored by hand.',status:"stable",props:[{name:"action",type:"string",description:"Optional action button label. When set, a button renders on the right and emits os-toast-action on click."},{name:"state",type:"'in' | 'out'",description:'Drives the CSS fade transition. Set to "in" when rendered, flip to "out" before removal.'},{name:"dismissible",type:"boolean",description:"When set, a close (×) button renders on the right and emits os-toast-dismiss on click. Use for persistent toasts the user must be able to close."},{name:"tone",type:"'positive' | 'warning' | 'critical' | 'neutral'",description:"What kind of news this is. Paints a coloured edge and a leading icon from the palette’s notice tokens; absent, the toast is the plain dark chip. showToast() sets it from the type option through the server’s toast-type registry."},{name:"held",type:"boolean (reflected, read-only)",description:"Set by the component while the pointer is over the toast or focus is inside it. showToast() pauses the auto-dismiss timer for as long as it is present. Do not set it by hand — pass `persistent` for a toast that should never expire."}],slots:[{name:"(default)",description:"Message text."}],events:[{name:"os-toast-action",description:"Fires when the action button is clicked.",detail:"{}"},{name:"os-toast-dismiss",description:"Fires when the close (×) button is clicked.",detail:"{}"},{name:"os-toast-hold",description:"Fires when the toast starts or stops being attended to — pointer over it, or focus inside it. showToast() pauses the auto-dismiss timer while held is true.",detail:"{ held: boolean }"}],example:c` Post moved to trash. Could not move the post to trash. `};let Fo=dt;w("os-toast",Fo);const Zu=v`:host{display:flex;gap:4px;margin-bottom:10px;border-bottom:1px solid var( --os-ui-border,#dcdcde )}:host( [ orientation='vertical' ] ){flex-direction:column;align-items:stretch;gap:0;margin-bottom:0;border-bottom:0}`,Yu=v`:host{display:block}:host( [ hidden ] ){display:none}:host(:focus-visible ){outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:4px;border-radius:4px}`,Ju=v` ${C}:host{display:inline-block}:host( [ data-orientation='vertical' ] ){display:block;--_tab-edge:var( --os-ui-tab-edge,linear-gradient( var( --os-ui-accent,#f252fc ),var( --os-ui-accent,#f252fc ) ) );--_tab-wash:var( --os-ui-tab-wash,linear-gradient( 90deg,rgba( 242,82,252,0.16 ) 0%,rgba( 255,251,255,0.04 ) 42%,transparent 100% ) );--_tab-bloom:var( --os-ui-tab-bloom,linear-gradient( 90deg,rgba( 242,82,252,0.26 ),transparent ) );--_tab-edge-w:var( --os-ui-tab-edge-width,2px );--_tab-bloom-o:var( --os-ui-tab-bloom-opacity,1 );--_tab-fill:var( --os-ui-tab-fill,transparent );--_tab-radius:var( --os-ui-tab-radius,0px );--_tab-inset:var( --os-ui-tab-inset,0px )}:host( [ data-orientation='vertical' ] ) button{display:flex;align-items:center;gap:11px;isolation:isolate;overflow:hidden;width:calc( 100% - 2 * var( --_tab-inset ) );min-height:40px;padding:0 14px 0 calc( 20px - var( --_tab-inset ) );margin-bottom:0;margin-inline:var( --_tab-inset );border-radius:var( --_tab-radius );text-align:start;font-size:14px;font-weight:400;line-height:1.5;white-space:nowrap}:host( [ data-orientation='vertical' ] ) slot::slotted( svg ){flex:0 0 17px;width:17px;height:17px;opacity:0.8;transition:opacity var( --_holo-t ) var( --_holo-ease )}:host( [ data-orientation='vertical' ] ) button:hover slot::slotted( svg ),:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) slot::slotted( svg ){opacity:1}:host( [ data-orientation='vertical' ] ) button::after{inset-inline:0 auto;inset-block:0;z-index:-1;width:var( --_tab-edge-w );height:auto;border-radius:0;background-image:var( --_tab-edge );transition:opacity var( --_holo-t ) var( --_holo-ease )}:host( [ data-orientation='vertical' ] ) button::before{content:'';position:absolute;inset-inline:0 auto;inset-block:0;z-index:-1;width:44px;background-image:var( --_tab-bloom );filter:blur( 8px );opacity:0;pointer-events:none;transition:opacity var( --_holo-t ) var( --_holo-ease )}:host( [ data-orientation='vertical' ] ) button:hover::after{inset-inline:0 auto;opacity:0}:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) button{background-color:var( --_tab-fill );background-image:var( --_tab-wash );font-weight:400}:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) button::after,:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) button:hover::after{inset-inline:0 auto;opacity:1}:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) button::before{opacity:var( --_tab-bloom-o )}@media ( prefers-reduced-motion:reduce ){:host( [ data-orientation='vertical' ] ) button::before,:host( [ data-orientation='vertical' ] ) slot::slotted( svg ){transition-duration:1ms}}button{appearance:none;position:relative;padding:6px 10px 8px;border:none;background:transparent;color:var( --os-ui-fg-muted,#50575e );font:inherit;font-size:12px;font-weight:500;cursor:pointer;margin-bottom:-1px;transition:color var( --_holo-t ) ease}button::after{content:'';position:absolute;inset-inline:50%;bottom:0;height:2px;border-radius:2px 2px 0 0;background-image:linear-gradient( var( --os-ui-accent,#2271b1 ),var( --os-ui-accent,#2271b1 ) );background-size:100% 100%;opacity:0;transition:inset-inline var( --_holo-t ) ease,opacity var( --_holo-t ) ease}button:hover{color:var( --os-ui-fg,#1d2327 )}button:hover::after{inset-inline:30%;opacity:0.45}button:focus-visible{outline:none;box-shadow:var( --_holo-focus );border-radius:4px}:host( [ aria-selected='true' ] ) button{color:var( --os-ui-fg,#1d2327 );font-weight:600}:host( [ aria-selected='true' ] ) button::after,:host( [ aria-selected='true' ] ) button:hover::after{inset-inline:0;opacity:1}@media ( prefers-reduced-motion:reduce ){button::after{transition-duration:1ms}}`,ut=class ut extends _{render(){return this.setAttribute("role","tab"),c` `}_onPick(){this.emit("os-tab-pick",{value:this.value})}};ut.props=["value"],ut.styles=[Ju],ut.help=void 0;let Vo=ut;w("os-tab",Vo);const ht=class ht extends _{constructor(){super(...arguments),this._tabObserver=null,this._onKeyDown=e=>{const t=this.orientation==="vertical",o=t?"ArrowDown":"ArrowRight",i=t?"ArrowUp":"ArrowLeft";if(e.key!==o&&e.key!==i&&e.key!=="Home"&&e.key!=="End")return;const n=Array.from(this.querySelectorAll("os-tab")).filter(h=>!h.hasAttribute("data-search-hidden"));if(n.length===0)return;const r=this.value,a=n.findIndex(h=>h.getAttribute("value")===r);let l=0;if(e.key==="End")l=n.length-1;else if(e.key!=="Home"){const h=e.key===o?1:-1;l=(a+h+n.length)%n.length}const u=n[l]?.getAttribute("value");!u||u===r||(e.preventDefault(),this.value=u,this.emit("os-tab-change",{value:u}),queueMicrotask(()=>{n[l]?.focus()}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("os-tab-pick",e=>{const t=e.detail;e.stopPropagation(),this.value=t.value,this.emit("os-tab-change",{value:t.value})}),this.addEventListener("keydown",this._onKeyDown),this._tabObserver=new MutationObserver(()=>this.requestUpdate()),this._tabObserver.observe(this,{childList:!0})}disconnectedCallback(){this._tabObserver?.disconnect(),this._tabObserver=null,this.removeEventListener("keydown",this._onKeyDown)}set items(e){Qu(this,"os-tab",e);const t=this.value;!(t!==null&&e.some(i=>i.value===t))&&e.length>0?this.value=e[0].value:this.requestUpdate()}render(){this.setAttribute("role","tablist");const e=this.label||"";e&&this.setAttribute("aria-label",e);const t=this.orientation==="vertical";this.setAttribute("aria-orientation",t?"vertical":"horizontal");for(const i of Array.from(this.querySelectorAll("os-tab")))t?i.setAttribute("data-orientation","vertical"):i.removeAttribute("data-orientation");const o=this.value;return queueMicrotask(()=>{const i=this.querySelectorAll("os-tab");for(const n of Array.from(i)){const r=n.getAttribute("value");n.setAttribute("aria-selected",r===o?"true":"false"),n.setAttribute("tabindex",r===o?"0":"-1")}na(this,o)}),c``}};ht.props=["value","label","orientation"],ht.styles=[Zu],ht.help={title:"Tabs",summary:'Underline-accent tab strip. Pair with sibling elements and the strip auto-toggles their hidden attribute on selection. Set orientation="vertical" for a sidebar instead of a strip.',status:"stable",props:[{name:"value",type:"string",description:"Currently active tab value. Mirrored to child aria-selected."},{name:"label",type:"string",description:"aria-label for the tablist — describe the tab group for assistive tech."},{name:"orientation",type:"'horizontal' | 'vertical'",description:"Lay the tabs across the top (default) or down the side. Vertical also sets aria-orientation and moves each tab's accent from an underline to a leading edge."}],slots:[{name:"(default)",description:' children forming the strip.'}],events:[{name:"os-tab-change",description:"Fires when the active tab changes.",detail:"{ value: string }"}],example:c` One Two Three First panel. Second panel. Third panel. `};let jo=ht;w("os-tabs",jo);const pt=class pt extends _{connectedCallback(){super.connectedCallback(),this.setAttribute("role","tabpanel"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const e=eh(this);e&&na(e,e.getAttribute("value"))}render(){return c``}};pt.props=["for"],pt.styles=[Yu],pt.help={title:"Tab panel",summary:'Auto-managed panel paired with a sibling . Declares which tab it belongs to via `for=""`; the parent strip toggles `hidden` whenever the active tab changes. role="tabpanel" and tabindex="0" are set automatically.',status:"stable",props:[{name:"for",type:"string",description:"Matches the `value` of the owning . Panel is shown when its parent tabs strip is on that value."}],slots:[{name:"(default)",description:"Panel body content."}],example:c` One Two Hidden — the strip is on "two". Visible, because this panel's for matches the strip's value. `};let Ko=pt;w("os-tabpanel",Ko);function Qu(s,e,t){const o=s.querySelectorAll(`:scope > ${e}`);for(const i of Array.from(o))i.remove();for(const i of t){const n=document.createElement(e);n.setAttribute("value",i.value),n.textContent=i.label,s.appendChild(n)}}function eh(s){const e=s.parentElement;if(!e)return null;const t=e.querySelector(":scope > os-tabs");return t||s.closest("os-tabs")}function na(s,e){const t=new Set,o=s.parentElement;if(o)for(const i of Array.from(o.querySelectorAll(":scope > os-tabpanel")))t.add(i);for(const i of Array.from(s.querySelectorAll(":scope > os-tabpanel")))t.add(i);for(const i of t){const n=i.getAttribute("for"),r=n!==null&&n===e;r?i.removeAttribute("hidden"):i.setAttribute("hidden",""),i.setAttribute("aria-hidden",r?"false":"true")}}const th=v`: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}`,sh={minimize:'',maximize:'',fullscreen:'',"fullscreen-exit":'',detach:'',reload:'',close:'',menu:''};function oh(s){const e=(s??"").trim();return e===""||e.length>4096||!/^(https?:\/\/|data:image\/)/i.test(e)||/['"()\\<>\s]/.test(e)?"":e}const gt=class gt extends _{constructor(){super(...arguments),this._activateWired=!1}static get observedAttributes(){return[...super.observedAttributes,"aria-label","aria-pressed"]}render(){const e=oh(this["icon-src"]||this.getAttribute("icon-src")||""),t=e?"":this.icon||"",o=sh[t]||"",i=this.getAttribute("aria-label")||"";return e?c` `:c` ${o} `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg()),queueMicrotask(()=>this._wireActivateEvent())}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("svg"),o=e.querySelector("[data-svg-buffer]");if(t&&o){const i=o.textContent||"";t.innerHTML!==i&&(t.innerHTML=i)}}_wireActivateEvent(){if(this._activateWired)return;const e=this.shadowRoot;if(!e)return;const t=e.querySelector("button");t&&(this._activateWired=!0,t.addEventListener("click",()=>{this.hasAttribute("disabled")||this.dispatchEvent(new CustomEvent("os-button-activate",{bubbles:!0,composed:!0,cancelable:!0}))}))}};gt.props=["icon","icon-src","active","danger","disabled"],gt.styles=[th],gt.help=void 0;let Bo=gt;w("os-window-button",Bo);const ih=v` ${C} ${vo}:host{display:none;position:fixed;min-width:180px;background-color:var( --os-ui-context-menu-bg,#1d2327 );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-context-menu-fg,var( --os-fg,#fff ) );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.08 ) );border-radius:8px;box-shadow:0 8px 24px rgba( 0,0,0,0.45 );padding:4px;font-size:13px;line-height:1.3;z-index:9999}:host( [ open ] ){display:block;animation:os-holo-enter var( --_holo-t-fast ) var( --_holo-ease );transform-origin:top left;box-sizing:border-box;max-block-size:calc( 100vh - 16px );max-block-size:calc( 100dvh - 16px );overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}:host( [ open ]:dir( rtl ) ){transform-origin:top right}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ){animation:none}}`,nh=v`:host{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:0;background:transparent;color:inherit;text-align:start;cursor:pointer;border-radius:4px;box-sizing:border-box;user-select:none}:host(:hover ),:host( [ active ] ){background:var( --os-ui-hover,rgba( 255,255,255,0.1 ) );outline:none}:host( [ disabled ] ){opacity:0.45;cursor:not-allowed}:host( [ danger ] ){color:var( --os-ui-danger-hover,#ff8a8a )}:host( [ danger ]:hover ){background:var( --os-ui-badge-danger-bg,rgba( 255,90,90,0.18 ) )}:host( [ heading ] ){padding:8px 10px 4px;font-size:10px;font-weight:700;letter-spacing:0.06em;text-transform:uppercase;color:var( --os-ui-context-menu-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.5 ) ) );pointer-events:none}.icon{display:inline-flex;align-items:center;justify-content:center;font-size:18px;width:20px;height:20px}.label{flex:1}.chevron{margin-inline-start:auto;padding-inline-start:8px;font-size:16px;line-height:1;opacity:0.7}.check{display:inline-flex;align-items:center;justify-content:center;width:14px;font-size:13px;line-height:1;opacity:0.95}`,ft=class ft extends _{render(){return c` `}connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}};ft.props=["open"],ft.styles=[ih],ft.help=void 0;let Go=ft;w("os-context-menu",Go);const bt=class bt extends _{constructor(){super(...arguments),this._onActivate=e=>{if(this.hasAttribute("disabled")||this.hasAttribute("heading"))return;const t=e.target;t&&t!==this&&t.closest("os-context-menu-option")!==this||this.emit("os-context-menu-pick",{id:this.dataset.menuItemId??this.id??"",value:this.getAttribute("value")??""})},this._onKey=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._onActivate(e))}}connectedCallback(){super.connectedCallback();const e=this.hasAttribute("heading");this.setAttribute("role",e?"presentation":"menuitem"),e||this.setAttribute("tabindex","0"),this.addEventListener("click",this._onActivate),this.addEventListener("keydown",this._onKey)}disconnectedCallback(){this.removeEventListener("click",this._onActivate),this.removeEventListener("keydown",this._onKey)}render(){const e=this.getAttribute("icon"),t=this.hasAttribute("has-children"),o=this.hasAttribute("checked");return c` ${o?c``:c``} ${e?c``:c``} ${t?c``:c``} `}};bt.props=["value","icon","disabled","danger","heading","has-children","checked"],bt.styles=[nh],bt.help={title:"Context menu option",summary:"Single row inside . Use `icon` for a leading dashicon, `danger` for destructive items, `heading` for a non-interactive section header, `has-children` to render a trailing chevron.",status:"stable",props:[{name:"value",type:"string",description:"Forwarded as `detail.value` on activation."},{name:"icon",type:"string",description:"Dashicon class (e.g. `dashicons-trash`)."},{name:"disabled",type:"boolean attribute",description:"Renders the option dimmed; clicks are ignored."},{name:"danger",type:"boolean attribute",description:"Destructive styling — red text, red hover."},{name:"heading",type:"boolean attribute",description:"Non-interactive section header. Ignores clicks."},{name:"has-children",type:"boolean attribute",description:"Renders a trailing chevron to suggest a submenu."},{name:"checked",type:"boolean attribute",description:"Renders a leading check mark — for radio-style picks inside a submenu (e.g. the active Sort By order)."}],slots:[{name:"(default)",description:"Visible label."}],events:[{name:"os-context-menu-pick",description:"Bubbled on click / Enter for non-heading non-disabled options. Detail: `{ id, value }`."}],example:c` Every variant Plain With an icon Checked With a submenu Disabled Danger `};let Xo=bt;w("os-context-menu-option",Xo);function rh(s,e){s.style.visibility="hidden";const t=()=>{s.isConnected&&(e(s.getBoundingClientRect()),s.style.visibility="")};typeof requestAnimationFrame=="function"?requestAnimationFrame(t):t()}const ah=v`:host{display:inline-block}:host([hidden]){display:none}.panel{position:fixed;inset:auto;margin:0;padding:0;border:0;background:transparent;overflow:visible;max-inline-size:calc(100vw - 16px)}.panel[hidden]{display:none}os-context-menu{position:relative;inset:auto;max-inline-size:calc(100vw - 16px)}os-button::part(button){min-block-size:30px}.chevron{display:inline-block;inline-size:5px;block-size:5px;border-inline-end:1.5px solid currentColor;border-block-end:1.5px solid currentColor;transform:translateY(-2px) rotate(45deg);margin-inline-start:5px;vertical-align:middle}:host(:dir(rtl)) .chevron{transform:translateY(-2px) rotate(-45deg)}`,mt=class mt extends _{constructor(){super(...arguments),this.opened=!1,this.listeners=null,this.onKey=e=>{if(e.key==="Escape"||e.key==="Tab"){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation()),this.close();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;e.preventDefault(),e.stopPropagation();const t=this.options();let i=t.indexOf(this.ownerDocument.activeElement)+(e.key==="ArrowUp"?-1:1);e.key==="Home"&&(i=0),e.key==="End"&&(i=t.length-1),t[(i+t.length)%t.length]?.focus()}}get panel(){return this.shadowRoot?.querySelector(".panel")??null}get trigger(){return this.shadowRoot?.querySelector("os-button")?.shadowRoot?.querySelector("button")??null}options(){return Array.from(this.querySelectorAll("os-context-menu-option:not([heading]):not([disabled])"))}render(){return c`this.opened?this.close():this.show()} @keydown=${e=>{(e.key==="ArrowDown"||e.key==="ArrowUp")&&(e.preventDefault(),this.show(e.key==="ArrowUp"))}}>${this.getAttribute("text")||"Actions"} `}requestUpdate(){this.opened&&this.close(!1),super.requestUpdate(),queueMicrotask(()=>queueMicrotask(()=>this.syncTrigger()))}syncTrigger(){this.trigger?.setAttribute("aria-label",this.getAttribute("label")||"Actions"),this.trigger?.setAttribute("aria-haspopup","menu"),this.trigger?.setAttribute("aria-expanded",String(this.opened))}show(e=!1){if(this.opened||!this.panel)return;this.opened=!0,this.panel.hidden=!1,this.panel.showPopover?.(),this.syncTrigger();const t=this.panel;rh(t,i=>{if(!this.opened)return;const n=this.getBoundingClientRect(),r=getComputedStyle(this).direction==="rtl";t.style.left=`${Math.max(8,Math.min(r?n.left:n.right-i.width,window.innerWidth-i.width-8))}px`,t.style.top=`${Math.max(8,Math.min(n.bottom+5+i.height<=window.innerHeight-8?n.bottom+5:n.top-i.height-5,window.innerHeight-i.height-8))}px`;const a=this.options();a[e?a.length-1:0]?.focus({preventScroll:!0})}),this.listeners=new AbortController;const{signal:o}=this.listeners;document.addEventListener("pointerdown",i=>{i.composedPath().includes(this)||this.close(!1)},{capture:!0,signal:o}),document.addEventListener("focusin",i=>{i.composedPath().includes(this)||this.close(!1)},{signal:o}),document.addEventListener("scroll",i=>{i.composedPath().includes(t)||this.close(!1)},{capture:!0,signal:o}),window.addEventListener("resize",()=>this.close(!1),{signal:o}),this.addEventListener("keydown",this.onKey,{signal:o}),this.addEventListener("os-context-menu-pick",()=>this.close(),{capture:!0,signal:o})}close(e=!0){this.opened&&(this.opened=!1,this.listeners?.abort(),this.listeners=null,this.panel?.isConnected&&this.panel.hidePopover?.(),this.panel&&(this.panel.hidden=!0),this.syncTrigger(),e&&this.isConnected&&this.trigger?.focus({preventScroll:!0}))}disconnectedCallback(){this.close(!1)}};mt.props=["label","text"],mt.styles=[ah],mt.help=void 0;let Zo=mt;w("os-action-menu",Zo);const lh=v` ${C} ${vo}: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}`,ch=v`: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 )}`,Ws=class Ws extends _{connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}render(){return c``}};Ws.styles=[lh],Ws.help=void 0;let Yo=Ws;w("os-menu",Yo);const vt=class vt extends _{connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","menuitem")}render(){const e=this.icon||"",t=this.getAttribute("role")==="menuitemcheckbox",o=this.checked!==null;return t&&this.setAttribute("aria-checked",o?"true":"false"),c` `}_onPick(e){e.preventDefault(),this.emit("os-menu-item-click",{value:this.value})}};vt.props=["icon","value","checked"],vt.styles=[ch],vt.help={title:"Menu item",summary:'Single row inside a . 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 parent can delegate.",detail:"{ value: string | null }"}],example:c` Plain item With an icon Checked (menuitemcheckbox) `};let Jo=vt;w("os-menu-item",Jo);const dh=v` ${C}: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 )}`,ra='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function uh(s){let e=s?.activeElement??null;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e&&e!==s?.body?e:null}function aa(s){const e=s.composedPath(),t=e.length>0?e[0]:s.target;return t instanceof HTMLElement?t:null}function la(s){return s!==null&&s.matches(ra)}const _t=class _t extends _{constructor(){super(...arguments),this._prevFocus=null,this._focusTries=0,this._onKey=e=>{if(e.key==="Escape"){e.preventDefault(),this._cancel();return}if(e.key==="Tab"){this._trapTab(e);return}if(e.key==="Enter"&&!e.isComposing){if(la(aa(e))||this.hasAttribute("danger"))return;e.preventDefault(),this._confirm()}},this._focusInitial=()=>{if(!this.hasAttribute("open"))return;const e=this.isConnected?this._initialFocusTarget():null;if(e){e.focus();return}if(this._focusTries++<5){queueMicrotask(this._focusInitial);return}this.isConnected&&this.focus()},this._onBackdrop=e=>{const t=e.composedPath();(t.length>0?t[0]:e.target)===this&&this._cancel()},this._confirm=()=>{this.emit("os-confirm",{confirmed:!0,remember:this._remembered()}),this.removeAttribute("open")},this._cancel=()=>{this.emit("os-cancel",{confirmed:!1}),this.removeAttribute("open")}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","dialog"),this.setAttribute("aria-modal","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),this.addEventListener("keydown",this._onKey),this.addEventListener("click",this._onBackdrop)}disconnectedCallback(){this.removeEventListener("keydown",this._onKey),this.removeEventListener("click",this._onBackdrop),this._restoreFocus()}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),e==="open"&&(o!==null?(this._prevFocus=uh(this.ownerDocument),this._focusTries=0,queueMicrotask(this._focusInitial)):this._restoreFocus())}_focusables(){const e=this.shadowRoot;return e?Array.from(e.querySelectorAll(ra)):[]}_trapTab(e){const t=this._focusables();if(t.length===0)return;const o=t[0],i=t[t.length-1],n=aa(e),r=!la(n);e.shiftKey&&(r||n===o)?(e.preventDefault(),i.focus()):!e.shiftKey&&(r||n===i)&&(e.preventDefault(),o.focus())}_initialFocusTarget(){const e=this.shadowRoot;if(!e)return null;const t=e.querySelector(".btn--secondary"),o=e.querySelector(".dialog");return this.hasAttribute("danger")?t??e.querySelector(".close")??o:e.querySelector(".btn--primary, .btn--danger")??t??o}_restoreFocus(){const e=this._prevFocus;this._prevFocus=null,!(!e||!e.isConnected)&&e.focus()}_remembered(){return this.shadowRoot?.querySelector(".remember__box")?.checked===!0}render(){const e=this.title??"",t=this.message??"",o=this["confirm-label"]||"Confirm",i=this["cancel-label"]||"Cancel",n=this.hasAttribute("danger"),r=this.hasAttribute("hide-cancel"),a=this.hasAttribute("dismissable"),l=this["remember-label"]??"";return c`
${a?c``:c``} ${e?c`

${e}

`:c``} ${t?c`

${t}

`:c``} ${l?c``:c``}
${r?c``:c``}
`}};_t.props=["open","title","message","confirm-label","cancel-label","danger","hide-cancel","dismissable","remember-label"],_t.styles=[dh],_t.help=void 0;let Qo=_t;w("os-confirm-dialog",Qo);const hh=v`:host{display:block;position:relative;font-size:13px}.input{width:100%;padding:8px 10px;background:var( --os-ui-input-bg,var( --os-ui-hover,rgba( 255,255,255,0.06 ) ) );color:inherit;border:1px solid var( --os-ui-border,rgba( 255,255,255,0.12 ) );border-radius:6px;font:inherit;box-sizing:border-box}.input:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --os-ui-focus-ring-field,0 0 0 1px #2271b1,0 0 0 4px rgba( 34,113,177,0.18 ) )}.dropdown{background:var( --os-bg,#1d2327 );color:var( --os-fg,#fff );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.18 ) );border-radius:6px;overflow:auto;z-index:11000;box-shadow:0 12px 32px rgba( 0,0,0,0.5 )}.empty.error{color:var( --os-ui-danger-hover,#ff8080 )}.item{display:flex;align-items:center;gap:10px;padding:8px 10px;cursor:pointer;border:0;background:transparent;color:inherit;width:100%;text-align:start;font:inherit}.item:hover,.item:focus{background:var( --os-ui-hover,rgba( 255,255,255,0.06 ) );outline:none}.avatar{width:24px;height:24px;border-radius:50%;flex:0 0 auto;background:var( --os-ui-hover,rgba( 255,255,255,0.1 ) )}.name{font-weight:500}.slug{opacity:0.6;font-size:12px}.empty{padding:12px;color:var( --os-ui-fg-muted,rgba( 255,255,255,0.5 ) );font-size:12px}`,wt=class wt extends _{constructor(){super(...arguments),this._timer=null,this._abort=null,this._results=[],this._query="",this._open=!1,this._phase="idle",this._error="",this._dropdownStyle="",this._onScrollOrResize=()=>{},this._onInput=e=>{const t=e.target.value;this._query=t,this._scheduleSearch(t)},this._onFocus=()=>{if(this._results.length===0&&this._phase==="idle"){this._scheduleSearch(this._query);return}this._open=!0,this._positionDropdown(),this.requestUpdate()},this._onBlur=()=>{setTimeout(()=>{this._open=!1,this.requestUpdate()},150)},this._pick=e=>{this.emit("os-user-pick",{user:e}),this._results=[],this._open=!1,this._phase="idle",this._query="";const t=this.shadowRoot?.querySelector(".input");t&&(t.value=""),this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this._onScrollOrResize=()=>{this._open&&(this._positionDropdown(),this.requestUpdate())},window.addEventListener("resize",this._onScrollOrResize),window.addEventListener("scroll",this._onScrollOrResize,!0)}disconnectedCallback(){this._timer&&clearTimeout(this._timer),this._abort&&this._abort.abort(),window.removeEventListener("resize",this._onScrollOrResize),window.removeEventListener("scroll",this._onScrollOrResize,!0)}_endpoint(){const e=this.getAttribute("endpoint");return e||window.openStationConfig?.filesUsersSearchUrl||""}_scheduleSearch(e){this._timer&&clearTimeout(this._timer),this._phase="loading",this._open=!0,this._positionDropdown(),this.requestUpdate(),this._timer=setTimeout(()=>this._runSearch(e),200)}async _runSearch(e){const t=this._endpoint();if(!t){this._phase="error",this._error="Search endpoint is not configured.",this._results=[],this._open=!0,this.requestUpdate();return}this._abort&&this._abort.abort();const o=new AbortController;this._abort=o;const i=this.getAttribute("exclude")||"",n=t+"?q="+encodeURIComponent(e)+"&exclude="+encodeURIComponent(i);try{const r={signal:o.signal,credentials:"same-origin"},a=await wn(n,r,{source:"desktop-mode/files-user-search",silent:!0});if(!a.ok)throw await xe(a);const l=await a.json();this._results=l&&Array.isArray(l.users)?l.users:[],this._phase="ready",this._error="",this._open=!0}catch(r){if(r.name==="AbortError")return;this._results=[],this._phase="error",this._error=r.message||"Search failed.",this._open=!0}this._positionDropdown(),this.requestUpdate()}_positionDropdown(){const e=this.shadowRoot?.querySelector(".input");if(!e)return;const t=e.getBoundingClientRect(),o=t.bottom+4,i=t.left,n=t.width,a=window.innerHeight-t.bottom,l=t.top,u=Math.max(120,Math.min(280,Math.max(a,l)-16));a<200&&l>a?this._dropdownStyle=["position:fixed",`left:${i}px`,`top:${t.top-4-u}px`,`width:${n}px`,`max-height:${u}px`].join(";"):this._dropdownStyle=["position:fixed",`left:${i}px`,`top:${o}px`,`width:${n}px`,`max-height:${u}px`].join(";")}_dropdownContent(){if(this._phase==="loading")return c`
Searching…
`;if(this._phase==="error")return c`
${this._error}
`;if(this._results.length===0){const e=this._query?"No matches.":"No users available.";return c`
${e}
`}return this._results.map(e=>c` `)}render(){const e=this.getAttribute("placeholder")||"Search users…";return c` ${this._open?c` `:c``} `}};wt.props=["placeholder","exclude","endpoint"],wt.styles=[hh],wt.help=void 0;let ei=wt;w("os-user-search",ei);const ph=v`:host{display:flex;flex-wrap:wrap;gap:6px;font-size:13px}.chip{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;background:var( --os-ui-hover,rgba( 255,255,255,0.06 ) );color:inherit;border:1px solid var( --os-ui-border,rgba( 255,255,255,0.12 ) );cursor:pointer;font:inherit}.chip:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.12 ) )}.chip[ aria-pressed='true' ]{background:var( --wp-admin-theme-color,#2271b1 );border-color:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) )}.empty{color:var( --os-ui-fg-muted,rgba( 255,255,255,0.5 ) );font-size:12px}`,yt=class yt extends _{constructor(){super(...arguments),this._onToggle=e=>{const t=!this._selectedSet().has(e);this.emit("os-role-toggle",{slug:e,selected:t})}}_selectedSet(){const e=this.getAttribute("selected")||"";return new Set(e.split(",").map(t=>t.trim()).filter(t=>t!==""))}_roles(){const e=this.getAttribute("roles");if(e)try{const t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return window.openStationConfig?.shareEligibleRoles||[]}render(){const e=this._roles();if(e.length===0)return c`No eligible roles.`;const t=this._selectedSet();return c` ${e.map(o=>{const i=t.has(o.slug);return c` `})} `}};yt.props=["selected","roles"],yt.styles=[ph],yt.help=void 0;let ti=yt;w("os-role-picker",ti);const gh=v`:host{display:block;position:absolute;z-index:10;background:var( --os-ui-flyout-bg,var( --os-ui-surface-elevated,#ffffff ) );background-image:var( --os-ui-panel-bg-image,none );background-repeat:var( --os-ui-panel-bg-image-repeat,repeat );background-size:var( --os-ui-panel-bg-image-size,auto );background-position:var( --os-ui-panel-bg-image-position,center );color:var( --os-ui-flyout-fg,var( --os-fg,#1d2327 ) );border-radius:14px;box-shadow:var( --os-ui-flyout-shadow,0 16px 48px rgba( 0,25,53,0.4 ) );transform:translateX( 110% );opacity:0;pointer-events:none;transition:transform 220ms cubic-bezier( 0.22,1,0.36,1 ),opacity 180ms ease}:host( [ open ] ){transform:translateX( 0 );opacity:1;pointer-events:auto}:host( [ placement='end' ] ),:host(:not( [ placement ] ) ){inset-block:64px 14px;inset-inline-end:14px;width:min( 320px,calc( 100% - 28px ) )}:host( [ placement='start' ] ){inset-block:64px 14px;inset-inline-start:14px;width:min( 320px,calc( 100% - 28px ) );transform:translateX( -110% )}:host( [ placement='start' ][ open ] ){transform:translateX( 0 )}:host( [ placement='top' ] ){inset-block-start:14px;inset-inline:14px;max-block-size:calc( 100% - 28px );transform:translateY( -110% )}:host( [ placement='top' ][ open ] ){transform:translateY( 0 )}:host-context( [ dir='rtl' ] ):host( [ placement='end' ] ),:host-context( [ dir='rtl' ] ):host(:not( [ placement ] ) ){transform:translateX( -110% )}:host-context( [ dir='rtl' ] ):host( [ placement='end' ][ open ] ),:host-context( [ dir='rtl' ] ):host(:not( [ placement ] ) [ open ] ){transform:translateX( 0 )}:host-context( [ dir='rtl' ] ):host( [ placement='start' ] ){transform:translateX( 110% )}:host-context( [ dir='rtl' ] ):host( [ placement='start' ][ open ] ){transform:translateX( 0 )}:host::before{content:'';position:fixed;inset:0;background:var( --os-ui-flyout-backdrop,transparent );z-index:-1;pointer-events:none;transition:opacity 180ms ease;opacity:0}:host( [ open ] )::before{opacity:1}@media ( prefers-reduced-motion:reduce ){:host{transition:none}:host::before{transition:none}}`,ca=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(","),fh="[data-flyout-close]",xt=class xt extends _{constructor(){super(...arguments),this._trigger=null,this._onDocKey=null,this._onScopePointerDown=null,this._onHostClick=null,this._onHostKeyDown=null,this._pendingReason=null}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")||this.setAttribute("inert","")}disconnectedCallback(){this._detachOpenListeners()}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),e==="open"&&(o!==null&&t===null?this._handleOpen():o===null&&t!==null&&this._handleClose())}_handleOpen(){this.removeAttribute("inert");const e=this.ownerDocument,t=e?.activeElement??null;this._trigger=t instanceof HTMLElement&&t!==this&&t!==e?.body&&t!==e?.documentElement?t:null,queueMicrotask(()=>{if(!this.hasAttribute("open"))return;(this._firstFocusable()??this).focus?.({preventScroll:!0})}),this._attachOpenListeners()}_handleClose(){const e=this._pendingReason??"api";this._pendingReason=null,this.setAttribute("inert",""),this._detachOpenListeners(),this.emit("os-flyout-dismiss",{reason:e});const t=this._trigger;this._trigger=null,t&&t.isConnected&&t.focus?.({preventScroll:!0})}_dismiss(e){this.hasAttribute("open")&&(this._pendingReason=e,this.removeAttribute("open"))}_attachOpenListeners(){const e=this._resolveScopeRoot();this._onScopePointerDown=t=>{if(!this.hasAttribute("open"))return;const o=t.composedPath();o.includes(this)||this._trigger&&o.includes(this._trigger)||this._dismiss("pointer")},e.addEventListener("pointerdown",this._onScopePointerDown),this._onDocKey=t=>{t.key==="Escape"&&this.hasAttribute("open")&&(t.preventDefault(),this._dismiss("escape"))},document.addEventListener("keydown",this._onDocKey),this._onHostKeyDown=t=>{if(t.key!=="Tab")return;const o=this._allFocusable();if(o.length===0){t.preventDefault();return}const i=o[0],n=o[o.length-1],r=this.ownerDocument?.activeElement??null;t.shiftKey&&(r===i||r===this)?(t.preventDefault(),n.focus({preventScroll:!0})):!t.shiftKey&&r===n&&(t.preventDefault(),i.focus({preventScroll:!0}))},this.addEventListener("keydown",this._onHostKeyDown),this._onHostClick=t=>{const i=t.target?.closest?.(fh);i&&this.contains(i)&&this._dismiss("close-button")},this.addEventListener("click",this._onHostClick)}_detachOpenListeners(){this._onDocKey&&(document.removeEventListener("keydown",this._onDocKey),this._onDocKey=null),this._onScopePointerDown&&(this._resolveScopeRoot().removeEventListener("pointerdown",this._onScopePointerDown),this._onScopePointerDown=null),this._onHostKeyDown&&(this.removeEventListener("keydown",this._onHostKeyDown),this._onHostKeyDown=null),this._onHostClick&&(this.removeEventListener("click",this._onHostClick),this._onHostClick=null)}_resolveScopeRoot(){const e=this.getAttribute("scope")??"window";return e==="document"?document.body:e==="parent"?this.parentElement??document.body:this.closest(".os-window__body")??this.parentElement??document.body}_firstFocusable(){return this.querySelector(ca)??null}_allFocusable(){return Array.from(this.querySelectorAll(ca)).filter(e=>!e.disabled)}render(){return c``}};xt.props=["open","placement","scope","aria-label","aria-labelledby"],xt.styles=[gh],xt.help=void 0;let si=xt;w("os-flyout",si);const bh=v`:host{display:contents;--_accent:var( --os-ui-accent,#f252fc );--_glow:var( --os-ui-accent-dim,#d846e0 );--_bg:var( --os-ui-surface-elevated,#ffffff );--_fg:var( --os-ui-fg,#1d2327 );--_muted:var( --os-ui-fg-muted,#646970 );--_border:var( --os-ui-border-strong,rgba( 0,0,0,0.12 ) );--_shadow:var( --os-ui-flyout-shadow,0 16px 48px rgba( 0,25,53,0.4 ) );--_ease:cubic-bezier( 0.22,1,0.36,1 );--_step:360ms}.layer{position:fixed;inset:0;margin:0;padding:0;border:0;width:auto;height:auto;max-width:none;max-height:none;overflow:visible;background:transparent;color:inherit;pointer-events:none}.layer[hidden]{display:none}.outline{position:fixed;box-sizing:border-box;border:2px solid var( --_accent );border-radius:12px;box-shadow:0 0 0 4px color-mix( in srgb,var( --_glow ) 28%,transparent );pointer-events:none;animation:os-coachmark-pulse 1.6s ease-in-out infinite}.outline[hidden]{display:none}@keyframes os-coachmark-pulse{0%,100%{box-shadow:0 0 0 4px color-mix( in srgb,var( --_glow ) 28%,transparent )}50%{box-shadow:0 0 0 8px color-mix( in srgb,var( --_glow ) 12%,transparent )}}.card{position:fixed;box-sizing:border-box;width:min( 320px,calc( 100vw - 24px ) );padding:16px 18px 14px;border-radius:14px;background:var( --_bg );background-image:var( --os-ui-panel-bg-image,none );background-repeat:var( --os-ui-panel-bg-image-repeat,repeat );background-size:var( --os-ui-panel-bg-image-size,auto );background-position:var( --os-ui-panel-bg-image-position,center );color:var( --_fg );border:1px solid var( --_border );box-shadow:var( --_shadow );pointer-events:auto;outline:none;font-size:13px;line-height:1.5;animation:os-coachmark-in 240ms var( --_ease ) both}.card:focus-visible{box-shadow:var( --_shadow ),0 0 0 2px var( --_accent )}@keyframes os-coachmark-in{from{opacity:0;transform:translateY( 6px )}to{opacity:1;transform:none}}.layer.stepping .card,.layer.stepping .outline{transition:left var( --_step ) var( --_ease ),top var( --_step ) var( --_ease ),width var( --_step ) var( --_ease ),height var( --_step ) var( --_ease )}.card.swap{animation:os-coachmark-swap 300ms var( --_ease )}@keyframes os-coachmark-swap{from{opacity:0.35;transform:scale( 0.97 )}to{opacity:1;transform:none}}.layer.leaving .card,.layer.leaving .outline{animation:os-coachmark-out 180ms ease forwards;pointer-events:none}@keyframes os-coachmark-out{from{opacity:1;transform:none}to{opacity:0;transform:translateY( 6px )}}@keyframes os-coachmark-fade{from{opacity:0}to{opacity:1}}.tail{position:absolute;width:14px;height:14px;box-sizing:border-box;background:var( --_bg );border:1px solid var( --_border );transform:rotate( 45deg );pointer-events:none}.tail[hidden]{display:none}.tail[data-edge='bottom']{bottom:-8px;left:calc( var( --_tail-at,50% ) - 7px );border-top-color:transparent;border-left-color:transparent}.tail[data-edge='top']{top:-8px;left:calc( var( --_tail-at,50% ) - 7px );border-bottom-color:transparent;border-right-color:transparent}.tail[data-edge='left']{left:-8px;top:calc( var( --_tail-at,50% ) - 7px );border-top-color:transparent;border-right-color:transparent}.tail[data-edge='right']{right:-8px;top:calc( var( --_tail-at,50% ) - 7px );border-bottom-color:transparent;border-left-color:transparent}.meta{font-size:11px;font-weight:600;letter-spacing:0.04em;text-transform:uppercase;color:var( --_accent );margin:0 0 4px}.meta:empty{display:none}h2{margin:0 0 6px;font-size:15px;font-weight:600;line-height:1.3;color:inherit}.body{color:var( --_muted )}.body::slotted( p ){margin:0 0 8px}.actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.actions os-button[hidden]{display:none}@media ( prefers-reduced-motion:reduce ){.outline{animation:none}.card,.card.swap{animation:os-coachmark-fade 160ms ease}.layer.stepping .card,.layer.stepping .outline{transition:none}.layer.leaving .card,.layer.leaving .outline{animation:os-coachmark-fade 140ms ease reverse forwards}}`,mh=12,j=12,ue=4,vh=16,da=28,_h=180,wh=360,ua="gone",oi=["bottom","top","end","start"];function ha(s){switch(s){case"top":return"bottom";case"bottom":return"top";case"start":return"end";default:return"start"}}function pa(s){if(!s.isConnected)return!1;const e=s.checkVisibility;return typeof e!="function"||e.call(s)}const kt=class kt extends _{constructor(){super(...arguments),this._anchor=null,this._returnFocus=null,this._shown=!1,this._raf=0,this._lastKey="",this._listeners=null,this._leaving=!1,this._exitTimer=0,this._stepTimer=0,this._speakerKey="",this._onKeyDown=e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.emit("os-coachmark-dismiss",{step:this.stepNumber});return}if(e.key!=="Tab")return;const t=Array.from(this.card?.querySelectorAll("os-button")??[]).filter(n=>!n.hidden);if(t.length===0){e.preventDefault();return}const o=this._focusables(),i=t.indexOf(this._activeHost());e.shiftKey&&i<=0?(e.preventDefault(),o[o.length-1]?.focus({preventScroll:!0})):!e.shiftKey&&(i===-1||i===t.length-1)&&(e.preventDefault(),o[0]?.focus({preventScroll:!0}))}}get anchor(){return this._anchor}set anchor(e){this._anchor=e??null,this._lastKey="",this._shown&&(this._beginStep(),this._position())}get stepNumber(){return Number(this.getAttribute("step")??0)||0}get layer(){return this.shadowRoot?.querySelector(".layer")??null}get card(){return this.shadowRoot?.querySelector(".card")??null}get outline(){return this.shadowRoot?.querySelector(".outline")??null}disconnectedCallback(){this._teardown(),this._finishExit(),window.clearTimeout(this._stepTimer)}render(){const e=this.hasAttribute("open"),t=this.getAttribute("step"),o=this.getAttribute("total"),i=t&&o?this.getAttribute("counter-label")||`${t} of ${o}`:"",n=this.getAttribute("primary-label")??"Next",r=this.getAttribute("secondary-label")??"Skip";return c`
`}requestUpdate(){super.requestUpdate(),queueMicrotask(()=>queueMicrotask(()=>this._afterRender()))}_afterRender(){if(!this.isConnected)return;const e=this.hasAttribute("open");e&&!this._shown?this._show():!e&&this._shown?this._hide():e&&(this._lastKey="",this._position())}_show(){const e=this.layer;if(!e)return;this._finishExit(!1),this.card?.classList.remove("swap"),this._shown=!0;const t=this.ownerDocument.activeElement;this._returnFocus=t instanceof HTMLElement&&t!==this.ownerDocument.body?t:null;try{e.showPopover?.()}catch{}this._listeners=new AbortController;const{signal:o}=this._listeners,i=()=>{this._lastKey="",this._position()};window.addEventListener("resize",i,{signal:o}),document.addEventListener("os-work-area-changed",i,{signal:o}),this._position(),this._track(),this._focusPrimary()}_hide(){this._teardown();const e=this._returnFocus;this._returnFocus=null,e&&e.isConnected&&e.focus?.({preventScroll:!0});const t=this.layer;t&&(this._leaving=!0,t.classList.add("leaving"),this.requestUpdate(),this._exitTimer=window.setTimeout(()=>this._finishExit(),_h))}_finishExit(e=!0){if(!this._leaving)return;window.clearTimeout(this._exitTimer),this._exitTimer=0,this._leaving=!1;const t=this.layer;if(t?.classList.remove("leaving"),e&&t)try{t.hidePopover?.()}catch{}this.requestUpdate()}_beginStep(){const e=this.layer,t=this.card;!e||!t||(e.classList.add("stepping"),t.classList.remove("swap"),t.offsetWidth,t.classList.add("swap"),window.clearTimeout(this._stepTimer),this._stepTimer=window.setTimeout(()=>{e.classList.remove("stepping")},wh))}_teardown(){this._shown=!1,this._raf&&(cancelAnimationFrame(this._raf),this._raf=0),this._listeners?.abort(),this._listeners=null}_track(){if(typeof requestAnimationFrame!="function")return;const e=()=>{if(!this._shown){this._raf=0;return}if(this._anchor){let t=ua;if(pa(this._anchor)){const o=this._anchor.getBoundingClientRect();t=`${o.left},${o.top},${o.width},${o.height}`}t!==this._lastKey&&this._position()}this._raf=requestAnimationFrame(e)};this._raf=requestAnimationFrame(e)}_position(){const e=this.card,t=this.outline;if(!e||!t)return;const o=window.innerWidth,i=window.innerHeight,n=e.getBoundingClientRect(),r=this._anchor&&pa(this._anchor)?this._anchor:null,a=Math.max(0,Number(this.getAttribute("speaker-size"))||0),l=mh;if(!r){t.hidden=!0;const I=Math.max(j,(o-n.width)/2),O=Math.max(j,(i-n.height)/2);e.style.left=`${I}px`,e.style.top=`${O}px`,this._lastKey=this._anchor?ua:"",this._placeSpeaker("top",I,O,n,a);return}const u=r.getBoundingClientRect();this._lastKey=`${u.left},${u.top},${u.width},${u.height}`,t.hidden=!1,t.style.left=`${u.left-ue}px`,t.style.top=`${u.top-ue}px`,t.style.width=`${u.width+ue*2}px`,t.style.height=`${u.height+ue*2}px`;const h=getComputedStyle(this.ownerDocument.documentElement).direction==="rtl",p={top:u.top,bottom:i-u.bottom,start:h?o-u.right:u.left,end:h?u.left:o-u.right},g=I=>(I==="top"||I==="bottom"?n.height:n.width)+l+j,b=I=>p[I]>=g(I),m=this.getAttribute("placement")??"auto",x=oi.find(I=>I===m);let y;x?y=b(x)||!b(ha(x))?x:ha(x):(y=oi.reduce((I,O)=>p[O]>p[I]?O:I,oi[0]),b("bottom")?y="bottom":b("top")&&(y="top"));let k,f;const A=u.left+u.width/2-n.width/2,$=u.top+u.height/2-n.height/2,R=I=>I==="start"!==h?"left":"right";switch(y){case"top":k=A,f=u.top-ue-l-n.height;break;case"bottom":k=A,f=u.bottom+ue+l;break;default:f=$,k=R(y)==="left"?u.left-ue-l-n.width:u.right+ue+l}k=Math.min(Math.max(j,k),Math.max(j,o-n.width-j)),f=Math.min(Math.max(j,f),Math.max(j,i-n.height-j)),e.style.left=`${k}px`,e.style.top=`${f}px`,this._placeSpeaker(y,k,f,n,a)}_placeSpeaker(e,t,o,i,n){const r=this.card?.querySelector(".tail");if(!r)return;if(n<=0){r.hidden=!0,this._speakerKey="";return}const a=window.innerWidth,l=window.innerHeight,u=vh+n/2,h=(k,f,A)=>Math.min(Math.max(k,f),Math.max(f,A));let p,g;e==="top"||e==="bottom"?(p=a-(t+i.width)>=t?"right":"left",g={x:p==="right"?t+i.width+u:t-u,y:h(o+i.height/2,j+n/2,l-j-n/2)}):(p=l-(o+i.height)>=o?"bottom":"top",g={x:h(t+i.width/2,j+n/2,a-j-n/2),y:p==="bottom"?o+i.height+u:o-u}),r.hidden=!1,r.dataset.edge=p;const b=p==="top"||p==="bottom",m=b?i.width:i.height,x=h(b?g.x-t:g.y-o,da,m-da);r.style.setProperty("--_tail-at",`${x}px`);const y=`${Math.round(g.x)},${Math.round(g.y)}`;y!==this._speakerKey&&(this._speakerKey=y,this.emit("os-coachmark-speaker",g))}_focusables(){const e=this.card;return e?Array.from(e.querySelectorAll("os-button")).filter(t=>!t.hidden).map(t=>t.shadowRoot?.querySelector("button")??t):[]}_focusPrimary(){const e=this._focusables();(e[e.length-1]??this.card)?.focus?.({preventScroll:!0})}_activeHost(){return this.shadowRoot?.activeElement??null}};kt.props=["open","placement","step","total","counter-label","heading","primary-label","secondary-label","speaker-size"],kt.styles=[bh],kt.help=void 0;let ii=kt;w("os-coachmark",ii);const yh=v`:host{--_bg:var( --os-tooltip-bg,var( --os-ui-scrim,rgba( 0,0,0,0.85 ) ) );--_fg:var( --os-tooltip-fg,var( --os-ui-fg-on-accent,#fff ) );position:fixed;top:0;left:0;z-index:calc( var( --os-z-fullscreen,99999 ) + 1 );display:block;max-width:280px;pointer-events:none;opacity:0;visibility:hidden;transform:translateY( -2px );transition:opacity 0.15s ease,transform 0.15s ease,visibility 0s linear 0.15s}:host( [ open ] ){opacity:1;visibility:visible;transform:none;transition:opacity 0.15s ease,transform 0.15s ease,visibility 0s}.surface{display:flex;flex-direction:column;gap:2px;padding:6px 12px;border-radius:6px;background:var( --_bg );color:var( --_fg );font-size:12px;font-weight:400;line-height:1.4;overflow-wrap:anywhere}.heading{font-weight:600}.heading + .text{opacity:0.8}@media ( prefers-reduced-motion:reduce ){:host,:host( [ open ] ){transform:none;transition:none}}`,$t=class $t extends _{connectedCallback(){super.connectedCallback?.(),this.setAttribute("role","tooltip")}render(){const e=this.heading,t=this.text;return c`
${e?c`${e}`:""} ${t?c`${t}`:""}
`}};$t.props=["heading","text","open"],$t.styles=[yh],$t.help=void 0;let ni=$t;w("os-tooltip",ni);const xh=v` ${C}: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}}`,kh={detach:'',close:''},At=class At extends _{render(){const e=this.variant||"",t=kh[e]||"";return c` ${t} `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg())}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("svg"),o=e.querySelector("[data-svg-buffer]");if(t&&o){const i=o.textContent||"";t.innerHTML!==i&&(t.innerHTML=i)}}};At.props=["variant"],At.styles=[xh],At.help=void 0;let ri=At;w("os-tab-chip",ri);const $h=v`:host{display:flex;flex-direction:column;gap:var( --os-ui-stack-gap,12px );align-items:var( --os-ui-stack-align,stretch );padding:var( --os-ui-stack-padding,0 )}:host( [ hidden ] ){display:none}`,Et=class Et extends _{render(){const e=this.gap,t=this.align,o=this.padding,i=e&&/^\d+$/.test(e)?`${e}px`:"";return i&&this.style.setProperty("--os-ui-stack-gap",i),t&&this.style.setProperty("--os-ui-stack-align",t),o!==null&&/^\d+$/.test(o)&&this.style.setProperty("--os-ui-stack-padding",`${o}px`),c``}};Et.props=["gap","align","padding"],Et.styles=[$h],Et.help=void 0;let ai=Et;w("os-stack",ai);const Ah=v`:host{display:flex;flex-direction:row;flex-wrap:wrap;gap:var( --os-ui-cluster-gap,8px );justify-content:var( --os-ui-cluster-justify,flex-start );align-items:var( --os-ui-cluster-align,center )}:host( [ hidden ] ){display:none}`,St=class St extends _{render(){const e=this.gap,t=this.justify,o=this.align,i=e&&/^\d+$/.test(e)?`${e}px`:"";return i&&this.style.setProperty("--os-ui-cluster-gap",i),t&&this.style.setProperty("--os-ui-cluster-justify",t),o&&this.style.setProperty("--os-ui-cluster-align",o),c``}};St.props=["gap","justify","align"],St.styles=[Ah],St.help=void 0;let li=St;w("os-cluster",li);const Eh=v`:host{display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );color:inherit;line-height:1}:host( [ hidden ] ){display:none}.os-icon__glyph{font-size:var( --os-ui-icon-size,16px );width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );line-height:1;color:inherit;display:inline-flex;align-items:center;justify-content:center}.os-icon__glyph--char{font-family:dashicons;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;speak:none}.os-icon__glyph.dashicons{font-family:dashicons}`;let Rs=null;function Sh(s){let e=s.trim();if(e==="")return null;(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));const t=e.match(/^\\([0-9a-f]{1,6})\s?$/i);return t?String.fromCodePoint(parseInt(t[1],16)):e||null}function ga(){const s=new Map;if(typeof document>"u")return s;const e=Array.from(document.styleSheets??[]);for(const t of e){let o=null;try{o=t.cssRules}catch{continue}if(o)for(const i of Array.from(o)){const n=i;if(!n||!n.selectorText)continue;const r=n.selectorText.match(/\.dashicons-([a-z0-9-]+)::?before/i);if(!r)continue;const a=n.style?.content;if(!a)continue;const l=Sh(a);l&&s.set(r[1],l)}}return s}function Ch(s){Rs||(Rs=ga());const e=s.startsWith("dashicons-")?s.slice(10):s;return Rs.get(e)??null}function Ih(){Rs=ga()}let fa=!1;function Rh(){if(fa||typeof window>"u")return;fa=!0;const s=()=>{Ih()};document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",s,{once:!0}),window.addEventListener("load",s,{once:!0})}Rh();const Ct=class Ct extends _{render(){const e=this.name||"",t=e.startsWith("dashicons-")?e.slice(10):e,o=this.size;o&&/^\d+$/.test(o)&&this.style.setProperty("--os-ui-icon-size",`${o}px`);const i=Ch(t);return i?c``:c``}};Ct.props=["name","size"],Ct.styles=[Eh],Ct.help=void 0;let ci=Ct;w("os-icon",ci);const Lh=v`:host{display:flex;flex-direction:column;gap:var( --os-ui-body-gap,12px );padding:var( --os-ui-body-padding,16px );box-sizing:border-box;width:100%;height:100%;min-width:0;min-height:0}:host( [ scroll ] ){overflow:auto}:host( [ hidden ] ){display:none}::slotted( * ){min-width:0}`,It=class It extends _{render(){const e=this.gap,t=this.padding;return e&&/^\d+$/.test(e)&&this.style.setProperty("--os-ui-body-gap",`${e}px`),t&&/^\d+$/.test(t)&&this.style.setProperty("--os-ui-body-padding",`${t}px`),c``}};It.props=["gap","padding","scroll"],It.styles=[Lh],It.help=void 0;let di=It;w("os-body",di);const Th=v`:host{display:flex;flex-direction:column;gap:var( --os-ui-panel-gap,12px );padding:var( --os-ui-panel-padding,16px );background-image:var( --os-ui-panel-bg-image,none );background-repeat:var( --os-ui-panel-bg-image-repeat,repeat );background-size:var( --os-ui-panel-bg-image-size,auto );background-position:var( --os-ui-panel-bg-image-position,center );box-sizing:border-box}:host( [ hidden ] ){display:none}`,Rt=class Rt extends _{render(){const e=this.gap,t=this.padding;return e&&/^\d+$/.test(e)&&this.style.setProperty("--os-ui-panel-gap",`${e}px`),t&&/^\d+$/.test(t)&&this.style.setProperty("--os-ui-panel-padding",`${t}px`),c``}};Rt.props=["gap","padding"],Rt.styles=[Th],Rt.help=void 0;let ui=Rt;w("os-panel",ui);const Dh=v`:host{display:grid;grid-template-columns:repeat( 12,minmax( 0,1fr ) );gap:var( --os-ui-row-gap,12px );row-gap:var( --os-ui-row-row-gap,var( --os-ui-row-gap,12px ) );column-gap:var( --os-ui-row-column-gap,var( --os-ui-row-gap,12px ) );width:100%;min-width:0}:host( [ hidden ] ){display:none}::slotted( [ col='1' ] ){grid-column:span 1}::slotted( [ col='2' ] ){grid-column:span 2}::slotted( [ col='3' ] ){grid-column:span 3}::slotted( [ col='4' ] ){grid-column:span 4}::slotted( [ col='5' ] ){grid-column:span 5}::slotted( [ col='6' ] ){grid-column:span 6}::slotted( [ col='7' ] ){grid-column:span 7}::slotted( [ col='8' ] ){grid-column:span 8}::slotted( [ col='9' ] ){grid-column:span 9}::slotted( [ col='10' ] ){grid-column:span 10}::slotted( [ col='11' ] ){grid-column:span 11}::slotted( [ col='12' ] ){grid-column:span 12}::slotted(:not( [ col ] ) ){grid-column:1 / -1}::slotted( * ){min-width:0}`,Lt=class Lt extends _{render(){const e=this.gap,t=this["column-gap"],o=this["row-gap"];return e&&/^\d+$/.test(e)&&this.style.setProperty("--os-ui-row-gap",`${e}px`),t&&/^\d+$/.test(t)&&this.style.setProperty("--os-ui-row-column-gap",`${t}px`),o&&/^\d+$/.test(o)&&this.style.setProperty("--os-ui-row-row-gap",`${o}px`),c``}};Lt.props=["gap","column-gap","row-gap"],Lt.styles=[Dh],Lt.help=void 0;let hi=Lt;w("os-row",hi);const Ph=v`:host{display:grid;grid-template-rows:auto auto minmax( 0,1fr ) auto;flex:1 1 auto;min-inline-size:0;min-block-size:0;block-size:100%;overflow:hidden}:host( [ hidden ] ){display:none}.content{min-inline-size:0;min-block-size:0;overflow:auto}:host( [ contained ] ) .content{display:flex;flex-direction:column;overflow:hidden}::slotted( * ){min-inline-size:0}:host( [ contained ] ) slot:not( [ name ] )::slotted( * ){flex:1 1 auto;min-block-size:0}`,Tt=class Tt extends _{render(){return c`
`}};Tt.props=["contained"],Tt.styles=[Ph],Tt.help=void 0;let pi=Tt;w("os-app-frame",pi);const Nh=v`:host{display:flex;flex:1 1 auto;min-inline-size:0;min-block-size:0;overflow:hidden}:host( [ hidden ] ){display:none}.layout{display:grid;flex:1;min-inline-size:0;min-block-size:0;grid-template-columns:minmax( 0,var( --_split-start,35% ) ) auto minmax( 0,1fr );grid-template-rows:minmax( 0,1fr )}.pane{display:flex;flex-direction:column;min-inline-size:0;min-block-size:0;overflow:auto}::slotted( * ){flex:1 1 auto;min-inline-size:0;min-block-size:0}.divider{inline-size:0;outline:none}.divider.enabled{position:relative;inline-size:8px;cursor:col-resize;touch-action:none;user-select:none}.divider.enabled::before,.divider.enabled::after{content:'';position:absolute;inset-inline:0;margin-inline:auto;inset-block-start:50%;transform:translateY( -50% );pointer-events:none;transition:background-color 120ms ease}.divider.enabled::before{inline-size:1px;block-size:100%;background:var( --os-ui-border,#dcdcde );opacity:0.65}.divider.enabled::after{inline-size:3px;block-size:28px;border-radius:999px;background:var( --os-ui-fg-faint,#787c82 )}.divider.enabled:hover::after,.divider.dragging::after,.divider:focus-visible::after{background:var( --os-ui-accent,#2271b1 )}.divider:focus-visible{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:-2px;border-radius:4px}:host( [ direction='vertical' ] ) .layout{grid-template-columns:minmax( 0,1fr );grid-template-rows:minmax( 0,var( --_split-start,35% ) ) auto minmax( 0,1fr )}:host( [ direction='vertical' ] ) .divider.enabled{inline-size:auto;block-size:8px;cursor:row-resize}:host( [ direction='vertical' ] ) .divider.enabled::before{inline-size:100%;block-size:1px}:host( [ direction='vertical' ] ) .divider.enabled::after{inline-size:28px;block-size:3px}:host .layout.compact{grid-template-columns:minmax( 0,1fr );grid-template-rows:minmax( 0,1fr ) minmax( 0,1fr )}.layout.compact .divider{display:none}:host .layout.compact.start,:host .layout.compact.end{grid-template-rows:minmax( 0,1fr )}.layout.compact.start .end,.layout.compact.end .start{display:none}.shield{position:fixed;inset:0;z-index:2147483647;cursor:col-resize}:host( [ direction='vertical' ] ) .shield{cursor:row-resize}.shield[hidden]{display:none}@media ( prefers-reduced-motion:reduce ){.divider.enabled::before,.divider.enabled::after{transition:none}}`,Dt=class Dt extends _{constructor(){super(...arguments),this.observer=null,this.width=0,this.height=0,this.drag=null,this.onDown=e=>{if(!this.enabled()||e.button!==0||this.drag||this.extent()<=0)return;e.preventDefault();const t=e.currentTarget;t.focus(),this.drag={id:e.pointerId,origin:this.coordinate(e),last:this.coordinate(e),position:this.positionValue(),initial:this.positionValue(),target:t},t.setPointerCapture(e.pointerId),this.requestUpdate()},this.onMove=e=>{this.drag?.id===e.pointerId&&(this.drag.last=this.coordinate(e),this.setPosition(this.drag.position+(this.coordinate(e)-this.drag.origin)*this.sign()/Math.max(1,this.extent())*100))},this.cancelDrag=()=>this.finishDrag(!1),this.onCancel=e=>{this.drag?.id===e.pointerId&&this.cancelDrag()},this.onLostCapture=e=>{this.drag?.id===e.pointerId&&this.finishDrag(!0)},this.onUp=e=>{this.drag?.id===e.pointerId&&(this.onMove(e),this.finishDrag(!0))},this.onKey=e=>{if(!this.enabled())return;if(e.key==="Escape"&&this.drag){e.preventDefault(),this.cancelDrag();return}const[t,o]=this.bounds(),i=this.positionValue(),n=e.shiftKey?10:2,r=this.isVertical()?"ArrowDown":"ArrowRight",a=this.isVertical()?"ArrowUp":"ArrowLeft";let l=i;if(e.key==="Home")l=t;else if(e.key==="End")l=o;else if(e.key===r||e.key===a)l+=n*this.sign()*(e.key===r?1:-1);else return;e.preventDefault(),this.setPosition(l),i!==this.positionValue()&&this.emit("os-split-change",{position:this.positionValue()})}}connectedCallback(){super.connectedCallback(),typeof ResizeObserver<"u"&&(this.observer=new ResizeObserver(e=>{const{width:t,height:o}=e[0].contentRect;if(t===this.width&&o===this.height)return;const i=this.positionValue();this.width=t,this.height=o,this.isCompact()?this.cancelDrag():this.drag&&(this.setPosition(i),this.drag.origin=this.drag.last,this.drag.position=this.positionValue()),this.requestUpdate()}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.observer=null,this.cancelDrag()}attributeChangedCallback(e,t,o){t!==o&&e==="direction"&&this.cancelDrag(),super.attributeChangedCallback(e,t,o)}number(e,t){const o=this.getAttribute(e),i=o===null||o.trim()===""?NaN:Number(o);return Number.isFinite(i)&&i>=0?i:t}isVertical(){return this.getAttribute("direction")==="vertical"}isCompact(){const e=this.number("collapse-at",600);return this.hasAttribute("compact")||!this.isVertical()&&e>0&&this.width>0&&this.width<=e}extent(){return Math.max(0,(this.isVertical()?this.height:this.width)-(this.hasAttribute("resizable")?8:0))}bounds(){const e=this.extent();if(e<=0)return[0,100];const t=this.number("min-start",160),o=this.number("min-end",160),i=t+o,n=i>e?e/i:1;return[t*n/e*100,100-o*n/e*100]}positionValue(){const[e,t]=this.bounds();return Math.min(t,Math.max(e,this.number("position",35)))}enabled(){return this.hasAttribute("resizable")&&!this.isCompact()}setPosition(e){const[t,o]=this.bounds();this.setAttribute("position",String(Math.min(o,Math.max(t,e))))}coordinate(e){return this.isVertical()?e.clientY:e.clientX}sign(){return!this.isVertical()&&getComputedStyle(this).direction==="rtl"?-1:1}finishDrag(e){const t=this.drag;t&&(this.drag=null,e||this.setPosition(t.initial),t.target.hasPointerCapture(t.id)&&t.target.releasePointerCapture(t.id),this.requestUpdate(),e&&this.positionValue()!==t.initial&&this.emit("os-split-change",{position:this.positionValue()}))}recoverFocus(e){const t=e==="end"?"start":"end",i=this.getRootNode().activeElement,n=e!=="stack"&&Array.from(this.children).some(a=>a.slot===t&&a.contains(i)),r=this.shadowRoot?.activeElement?.classList.contains("divider");!n&&!r||queueMicrotask(()=>{this.isConnected&&this.shadowRoot?.querySelector(e==="end"?".pane.end":".pane.start")?.focus()})}render(){!this.enabled()&&this.drag&&this.cancelDrag();const e=this.enabled(),t=this.positionValue(),[o,i]=this.bounds(),n=this.getAttribute("narrow"),r=n==="start"||n==="end"?n:"stack";return this.style.setProperty("--_split-start",`calc((100% - ${this.hasAttribute("resizable")?8:0}px) * ${t/100})`),this.isCompact()&&this.recoverFocus(r),c`
`}};Dt.props=["position","min-start","min-end","resizable","direction","collapse-at","narrow","compact","label"],Dt.styles=[Nh],Dt.help=void 0;let gi=Dt;w("os-split",gi);const Mh=v`:host{display:grid;min-inline-size:0;min-block-size:0;grid-template-columns:var( --os-ui-grid-columns,1fr );grid-template-rows:var( --os-ui-grid-rows,auto );gap:var( --os-ui-grid-gap,8px );column-gap:var( --os-ui-grid-column-gap,var( --os-ui-grid-gap,8px ) );row-gap:var( --os-ui-grid-row-gap,var( --os-ui-grid-gap,8px ) )}:host( [ hidden ] ){display:none}::slotted( * ){min-inline-size:0}::slotted( [ col-span='1' ] ){grid-column:span min( 1,var( --_os-grid-tracks,1 ) )}::slotted( [ row-span='1' ] ){grid-row:span 1}::slotted( [ col-span='2' ] ){grid-column:span min( 2,var( --_os-grid-tracks,1 ) )}::slotted( [ row-span='2' ] ){grid-row:span 2}::slotted( [ col-span='3' ] ){grid-column:span min( 3,var( --_os-grid-tracks,1 ) )}::slotted( [ row-span='3' ] ){grid-row:span 3}::slotted( [ col-span='4' ] ){grid-column:span min( 4,var( --_os-grid-tracks,1 ) )}::slotted( [ row-span='4' ] ){grid-row:span 4}::slotted( [ col-span='5' ] ){grid-column:span min( 5,var( --_os-grid-tracks,1 ) )}::slotted( [ row-span='5' ] ){grid-row:span 5}::slotted( [ col-span='6' ] ){grid-column:span min( 6,var( --_os-grid-tracks,1 ) )}::slotted( [ row-span='6' ] ){grid-row:span 6}::slotted( [ col-span='7' ] ){grid-column:span min( 7,var( --_os-grid-tracks,1 ) )}::slotted( [ row-span='7' ] ){grid-row:span 7}::slotted( [ col-span='8' ] ){grid-column:span min( 8,var( --_os-grid-tracks,1 ) )}::slotted( [ row-span='8' ] ){grid-row:span 8}::slotted( [ col-span='9' ] ){grid-column:span min( 9,var( --_os-grid-tracks,1 ) )}::slotted( [ row-span='9' ] ){grid-row:span 9}::slotted( [ col-span='10' ] ){grid-column:span min( 10,var( --_os-grid-tracks,1 ) )}::slotted( [ row-span='10' ] ){grid-row:span 10}::slotted( [ col-span='11' ] ){grid-column:span min( 11,var( --_os-grid-tracks,1 ) )}::slotted( [ row-span='11' ] ){grid-row:span 11}::slotted( [ col-span='12' ] ){grid-column:span min( 12,var( --_os-grid-tracks,1 ) )}::slotted( [ row-span='12' ] ){grid-row:span 12}:host( [ data-single-column ] ){grid-template-rows:none}:host( [ data-single-column ] )::slotted( [ row-span ] ){grid-row:auto}`,Pt=class Pt extends _{constructor(){super(...arguments),this.observer=null,this.availableWidth=0,this.overrides=new Map}overrideToken(e,t){if(t!==null)this.overrides.has(e)||this.overrides.set(e,{value:this.style.getPropertyValue(e),priority:this.style.getPropertyPriority(e)}),this.style.setProperty(e,t);else{const o=this.overrides.get(e);o&&(o.value?this.style.setProperty(e,o.value,o.priority):this.style.removeProperty(e),this.overrides.delete(e))}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(e=>{this.availableWidth=e[0].contentRect.width,this.updateTracks()}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.observer=null}updateTracks(){const e=Number(this.getAttribute("min-item-width")),t=Number.isFinite(e)&&e>0,o=parseFloat(getComputedStyle(this).columnGap)||0,i=Number(this.getAttribute("columns")),n=Number.isSafeInteger(i)&&i>0?i:1,r=t?Math.max(1,Math.floor((this.availableWidth+o)/(e+o))):n;this.style.setProperty("--_os-grid-tracks",String(r)),this.toggleAttribute("data-single-column",t&&r===1),t||Number.isSafeInteger(i)&&i>0?this.overrideToken("--os-ui-grid-columns",`repeat(${r}, minmax(0, 1fr))`):this.overrideToken("--os-ui-grid-columns",null)}render(){const e=this.getAttribute("rows");e&&/^[1-9]\d*$/.test(e)?this.overrideToken("--os-ui-grid-rows",`repeat(${e}, minmax(0, 1fr))`):this.overrideToken("--os-ui-grid-rows",null);for(const t of["gap","column-gap","row-gap"]){const o=this.getAttribute(t);o!==null&&/^\d+$/.test(o)?this.overrideToken(`--os-ui-grid-${t}`,`${o}px`):this.overrideToken(`--os-ui-grid-${t}`,null)}return this.updateTracks(),c``}};Pt.props=["columns","rows","gap","column-gap","row-gap","min-item-width"],Pt.styles=[Mh],Pt.help=void 0;let fi=Pt;w("os-grid",fi);const zh=v`:host{display:flex;align-items:center;justify-content:var( --os-ui-display-align,flex-end );width:100%;min-height:calc( var( --os-ui-display-size,28px ) * 1.4 );padding:8px 14px;box-sizing:border-box;font-size:var( --os-ui-display-size,28px );font-variant-numeric:tabular-nums;font-weight:500;letter-spacing:0.01em;color:var( --os-ui-display-fg,var( --os-ui-fg,#1d2327 ) );background:var( --os-ui-display-bg,transparent );border-radius:var( --os-ui-display-border-radius,0 );line-height:1.1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host( [ hidden ] ){display:none}.os-display__output{display:block;font:inherit;color:inherit;text-align:var( --os-ui-display-align,end );overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}`,ba={sm:"16px",md:"20px",lg:"28px",xl:"40px"},Nt=class Nt extends _{connectedCallback(){super.connectedCallback?.(),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"),this.hasAttribute("role")||this.setAttribute("role","status")}render(){const e=this.value,t=this.size||"lg",o=this.align||"end";return this.style.setProperty("--os-ui-display-size",ba[t]||ba.lg),this.style.setProperty("--os-ui-display-align",o),c` ${e??c``} `}};Nt.props=["value","size","align"],Nt.styles=[zh],Nt.help=void 0;let bi=Nt;w("os-display",bi);const Oh=v`:host{display:block}:host( [ hidden ] ){display:none}.os-disclosure__summary{display:flex;align-items:center;gap:8px;width:100%;padding:0;background:none;border:0;font:inherit;color:var( --os-ui-fg,#1d2327 );text-align:start;cursor:pointer}.os-disclosure__summary:focus-visible{outline:2px solid var( --os-ui-accent,#f252fc );outline-offset:2px;border-radius:4px}.os-disclosure__heading{flex:1 1 auto;min-width:0;margin:0;font-size:20px;font-weight:500;letter-spacing:-0.01em}.os-disclosure__hint{flex:0 0 auto;font-size:13px;font-weight:400;color:var( --os-ui-fg-muted,#646970 )}.os-disclosure__marker{flex:0 0 auto;width:8px;height:8px;margin-inline-end:2px;border-inline-end:2px solid currentColor;border-block-end:2px solid currentColor;transform:rotate( -45deg );transition:transform 160ms ease;opacity:0.7}:host( [ open ] ) .os-disclosure__marker{transform:rotate( 45deg )}@media ( prefers-reduced-motion:reduce ){.os-disclosure__marker{transition:none}}.os-disclosure__body{margin-block-start:14px}.os-disclosure__body[ hidden ]{display:none}`;let Wh=0;const Mt=class Mt extends _{constructor(){super(...arguments),this.bodyId=`os-disclosure-body-${++Wh}`,this.onToggle=()=>{const e=!this.isOpen();e?this.setAttribute("open",""):this.removeAttribute("open"),this.emit("os-disclosure-toggle",{open:e})}}isOpen(){return this.hasAttribute("open")}render(){const e=this.heading||"",t=this.hint||"",o=this.isOpen();return c`
`}};Mt.props=["heading","hint","open"],Mt.styles=[Oh],Mt.help=void 0;let mi=Mt;w("os-disclosure",mi);const Hh=v`:host{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:32px 24px;text-align:center;color:var( --os-ui-empty-state-fg,var( --os-ui-fg-muted,#646970 ) )}:host( [ hidden ] ){display:none}.os-empty-state__icon{margin-bottom:4px;color:var( --os-ui-empty-state-icon-color,currentColor );opacity:0.75}.os-empty-state__heading{margin:0;font-size:14px;font-weight:600;color:var( --os-ui-fg,#1d2327 )}.os-empty-state__description{margin:0;font-size:12px;line-height:1.4;max-width:48ch}.os-empty-state__description:empty{display:none}.os-empty-state__cta{margin-top:8px}.os-empty-state__cta:empty{display:none}`,zt=class zt extends _{render(){const e=this.icon||"",t=this.heading||"",o=this.description||"";return c` ${e?c``:null}

${t}

${o}

`}};zt.props=["icon","heading","description"],zt.styles=[Hh],zt.help=void 0;let vi=zt;w("os-empty-state",vi);const Uh=v` ${C} ${xs} ${ks} ${mo}:host{display:inline-flex;user-select:none}:host( [ fill-cell ] ),:host{display:flex;width:100%}:host( [ hidden ] ){display:none}button{width:100%;min-height:var( --os-ui-key-min-height,48px );appearance:none;display:inline-flex;align-items:center;justify-content:center;padding:var( --os-ui-key-padding,8px 12px );font:inherit;font-size:var( --os-ui-key-font-size,16px );font-weight:500;cursor:pointer;border-radius:var( --os-ui-key-border-radius,8px );background:var( --os-ui-key-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-key-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-key-border,1px solid transparent );transition:transform 0.08s ease,background-color 0.12s ease,box-shadow 0.12s ease}button:hover:not(:disabled ){background:var( --os-ui-key-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.1 ) ) )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button:disabled::before{opacity:0 !important}:host( [ variant='primary' ] ) button{background:var( --os-ui-key-bg,var( --wp-admin-theme-color,#2271b1 ) );color:var( --os-ui-key-fg,var( --os-ui-fg-on-accent,#fff ) )}:host( [ variant='primary' ] ) button:hover:not(:disabled ){filter:brightness( 1.06 )}:host( [ variant='secondary' ] ) button{background:var( --os-ui-key-bg,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) )}:host( [ variant='ghost' ] ) button{background:transparent;border:var( --os-ui-key-border,1px solid var( --os-ui-border,#c3c4c7 ) )}:host( [ variant='danger' ] ) button{background:transparent;color:var( --os-ui-danger,#d63638 );border:1px solid currentColor}:host( .os-key--pressed ) button,button:active:not(:disabled ){transform:scale( 0.96 );box-shadow:inset 0 1px 2px rgba( 0,0,0,0.22 );background:var( --os-ui-key-bg-pressed,var( --os-ui-hover,rgba( 0,0,0,0.14 ) ) )}button:disabled{opacity:0.5;cursor:not-allowed}`,Ls="os-key--pressed",Ot=class Ot extends _{constructor(){super(...arguments),this._onKeyDown=null,this._onKeyUp=null,this._keyHeldByKeyboard=!1}connectedCallback(){super.connectedCallback?.(),this._onKeyDown=e=>this.handleKeyboardDown(e),this._onKeyUp=e=>this.handleKeyboardUp(e),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("keyup",this._onKeyUp)}disconnectedCallback(){this._onKeyDown&&document.removeEventListener("keydown",this._onKeyDown),this._onKeyUp&&document.removeEventListener("keyup",this._onKeyUp)}render(){const e=this.label,t=this.disabled!==null;return c` `}handleClick(e){if(this.isDisabled())return;const t=this.buildDetail("click");this.flashPressed(),this.hasAttribute("hold")?(this.emitKey("os-key-down",t),this.emitKey("os-key-up",t)):this.emitKey("os-key",t),e.stopPropagation()}handleKeyboardDown(e){if(this.isDisabled()||!this.matchesEvent(e)||this._keyHeldByKeyboard)return;this._keyHeldByKeyboard=!0,this.classList.add(Ls);const t=this.buildDetail("keyboard");this.hasAttribute("hold")?this.emitKey("os-key-down",t):this.emitKey("os-key",t)}handleKeyboardUp(e){!this._keyHeldByKeyboard||!this.matchesEvent(e,!0)||(this._keyHeldByKeyboard=!1,this.classList.remove(Ls),this.hasAttribute("hold")&&this.emitKey("os-key-up",this.buildDetail("keyboard")))}matchesEvent(e,t=!1){const o=this.code||"",i=this.key||"";if(o){if(e.code!==o)return!1}else if(i){if(e.key!==i)return!1}else return!1;const n=this.modifier||"",r=new Set(n.split("+").map(p=>p.trim().toLowerCase()).filter(Boolean)),a=r.has("ctrl")||r.has("control"),l=r.has("alt"),u=r.has("shift"),h=r.has("meta")||r.has("cmd")||r.has("command");return e.ctrlKey===a&&e.altKey===l&&e.shiftKey===u&&e.metaKey===h}buildDetail(e){const t=this.label||this.textContent?.trim()||"";return{key:this.key||"",code:this.code||"",label:t,source:e}}isDisabled(){return this.disabled!==null}emitKey(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}flashPressed(){this.classList.add(Ls),window.setTimeout(()=>{this.classList.remove(Ls)},120)}};Ot.props=["key","code","label","variant","fill-cell","hold","modifier","disabled"],Ot.styles=[Uh],Ot.help=void 0;let _i=Ot;w("os-key",_i);const qh=v`:host{display:inline}:host( [ hidden ] ){display:none}code{font-family:var( --os-ui-code-font-family,ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace );font-size:var( --os-ui-code-font-size,0.92em );padding:var( --os-ui-code-padding,0.1em 0.4em );border-radius:var( --os-ui-code-border-radius,4px );background:var( --os-ui-code-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-code-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-code-border,1px solid rgba( 0,0,0,0.08 ) );white-space:var( --os-ui-code-white-space,nowrap );overflow-wrap:anywhere}:host( [ block ] ){display:block}:host( [ block ] ) code{display:block;padding:var( --os-ui-code-block-padding,10px 12px );white-space:pre;max-block-size:var( --os-ui-code-block-max-block-size,none );overflow:auto}:host( [ wrap ] ) code{white-space:pre-wrap;overflow-wrap:anywhere}:host( [ copy ] ){position:relative}:host( [ copy ] ):not( [ block ] ){display:inline-flex;align-items:center;gap:var( --os-ui-code-copy-gap,8px )}.copy{appearance:none;display:inline-flex;align-items:center;justify-content:center;flex:none;inline-size:var( --os-ui-code-copy-size,24px );block-size:var( --os-ui-code-copy-size,24px );background:transparent;border:0;border-radius:4px;padding:0;margin:0;font:inherit;cursor:pointer;color:var( --os-ui-code-copy-color,var( --os-ui-fg-muted,#57606a ) );opacity:var( --os-ui-code-copy-opacity,0.6 );transition:opacity 120ms ease,color 120ms ease,background-color 120ms ease;line-height:1;font-size:1.05em}.copy:hover,.copy:focus-visible{opacity:1;color:var( --os-ui-code-copy-color-hover,var( --wp-admin-theme-color,#007cba ) );background:var( --os-ui-code-copy-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) )}:host( [ block ] ) .copy{position:absolute;top:6px;inset-inline-end:6px;background:var( --os-ui-code-copy-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );opacity:var( --os-ui-code-copy-opacity,0.6 )}:host( [ block ] ):hover .copy,:host( [ block ] ):focus-within .copy{opacity:1}:host( [ block ][ copy ] ) code{padding-inline-end:var( --os-ui-code-copy-inset,42px )}`,Wt=class Wt extends _{constructor(){super(...arguments),this._copied=!1,this._resetTimer=null,this._onCopy=e=>{e.stopPropagation();const t=this._readSlotText();if(t==="")return;const o=n=>{n&&(this._copied=!0,this.requestUpdate(),this.emit("os-copy",{text:t}),this._resetTimer&&clearTimeout(this._resetTimer),this._resetTimer=setTimeout(()=>{this._copied=!1,this._resetTimer=null,this.requestUpdate()},1500))},i=navigator.clipboard;i&&typeof i.writeText=="function"?i.writeText(t).then(()=>o(!0),()=>o(this._fallbackCopy(t))):o(this._fallbackCopy(t))}}_readSlotText(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedNodes({flatten:!0}).map(i=>i.textContent??"").join("").trim():(this.textContent||"").trim()}_fallbackCopy(e){try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select();const o=document.execCommand("copy");return document.body.removeChild(t),o}catch{return!1}}render(){const e=this.getAttribute("copy")!==null;return c`${e?c``:""}`}};Wt.props=["block","copy","wrap"],Wt.styles=[qh],Wt.help=void 0;let wi=Wt;w("os-code",wi);const Fh=v` ${C}:host{display:inline-flex;align-items:center;gap:var( --os-ui-badge-gap,6px );padding:var( --os-ui-badge-padding,2px 8px );font:var( --os-ui-badge-font,500 12px/1.4 var( --os-font,system-ui ) );color:var( --os-ui-badge-color,var( --os-ui-fg,#1d2327 ) );background:var( --os-ui-badge-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );border:var( --os-ui-badge-border,1px solid transparent );border-radius:var( --os-ui-badge-border-radius,999px );white-space:nowrap;vertical-align:baseline}:host( [ hidden ] ){display:none}.dot{width:var( --os-ui-badge-dot-size,8px );height:var( --os-ui-badge-dot-size,8px );border-radius:50%;background:currentColor;flex:0 0 auto}:host( [ tone="success" ] ){--os-ui-badge-color:var( --os-ui-badge-success,var( --os-ui-success-fg,#1a7f37 ) );--os-ui-badge-bg:var( --os-ui-badge-success-bg,rgba( 26,127,55,0.12 ) )}:host( [ tone="warning" ] ){--os-ui-badge-color:var( --os-ui-badge-warning,var( --os-ui-warning-fg,#9a6700 ) );--os-ui-badge-bg:var( --os-ui-badge-warning-bg,rgba( 154,103,0,0.12 ) )}:host( [ tone="danger" ] ){--os-ui-badge-color:var( --os-ui-badge-danger,var( --os-ui-danger,#cf222e ) );--os-ui-badge-bg:var( --os-ui-badge-danger-bg,rgba( 207,34,46,0.12 ) )}:host( [ tone="info" ] ){--os-ui-badge-color:var( --os-ui-badge-info,var( --os-ui-info-fg,#0969da ) );--os-ui-badge-bg:var( --os-ui-badge-info-bg,rgba( 9,105,218,0.12 ) )}:host( [ tone="neutral" ] ){--os-ui-badge-color:var( --os-ui-badge-neutral,var( --os-ui-fg-muted,#57606a ) );--os-ui-badge-bg:var( --os-ui-badge-neutral-bg,rgba( 87,96,106,0.12 ) )}:host( [ tone="accent" ] ){--os-ui-badge-color:var( --os-ui-badge-accent,var( --_holo-ink ) );background-color:transparent;background-image:var( --os-ui-badge-accent-bg,var( --_holo-fill ) );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;box-shadow:var( --_holo-glow );font-weight:600}:host( [ tone="accent" ] ) .dot{display:none}:host( [ no-dot ] ) .dot{display:none}`,Ht=class Ht extends _{render(){return c``}};Ht.props=["tone","noDot"],Ht.styles=[Fh],Ht.help=void 0;let yi=Ht;w("os-badge",yi);const Vh=v`:host{position:absolute;width:var( --os-ui-ribbon-size,90px );height:var( --os-ui-ribbon-size,90px );overflow:hidden;pointer-events:none;z-index:var( --os-ui-ribbon-z,2 )}:host( [ hidden ] ){display:none}.banner{position:absolute;display:block;width:var( --os-ui-ribbon-banner-width,140px );padding:var( --os-ui-ribbon-padding,4px 0 );text-align:center;font:var( --os-ui-ribbon-font,700 10px/1.4 var( --os-font,system-ui ) );letter-spacing:var( --os-ui-ribbon-tracking,0.06em );text-transform:uppercase;color:var( --os-ui-ribbon-fg,var( --os-ui-fg-on-accent,#fff ) );background:var( --os-ui-ribbon-bg,var( --wp-admin-theme-color,#2271b1 ) );background-size:260% 260%;background-position:30% 40%;box-shadow:var( --os-ui-ribbon-shadow,0 2px 4px rgba( 0,0,0,0.2 ) )}:host(:not( [ placement ] ) ),:host( [ placement='top-end' ] ){inset-block-start:0;inset-inline-end:0}:host(:not( [ placement ] ) ) .banner,:host( [ placement='top-end' ] ) .banner{inset-block-start:var( --os-ui-ribbon-banner-offset,20px );inset-inline-end:var( --os-ui-ribbon-banner-pull,-36px );transform:rotate( 45deg )}:host( [ placement='top-start' ] ){inset-block-start:0;inset-inline-start:0}:host( [ placement='top-start' ] ) .banner{inset-block-start:var( --os-ui-ribbon-banner-offset,20px );inset-inline-start:var( --os-ui-ribbon-banner-pull,-36px );transform:rotate( -45deg )}:host( [ placement='bottom-end' ] ){inset-block-end:0;inset-inline-end:0}:host( [ placement='bottom-end' ] ) .banner{inset-block-end:var( --os-ui-ribbon-banner-offset,20px );inset-inline-end:var( --os-ui-ribbon-banner-pull,-36px );transform:rotate( -45deg )}:host( [ placement='bottom-start' ] ){inset-block-end:0;inset-inline-start:0}:host( [ placement='bottom-start' ] ) .banner{inset-block-end:var( --os-ui-ribbon-banner-offset,20px );inset-inline-start:var( --os-ui-ribbon-banner-pull,-36px );transform:rotate( 45deg )}:host-context( [ dir='rtl' ] ):host(:not( [ placement ] ) ) .banner,:host-context( [ dir='rtl' ] ):host( [ placement='top-end' ] ) .banner{transform:rotate( -45deg )}:host-context( [ dir='rtl' ] ):host( [ placement='top-start' ] ) .banner{transform:rotate( 45deg )}:host-context( [ dir='rtl' ] ):host( [ placement='bottom-end' ] ) .banner{transform:rotate( 45deg )}:host-context( [ dir='rtl' ] ):host( [ placement='bottom-start' ] ) .banner{transform:rotate( -45deg )}:host( [ tone='success' ] ) .banner{background:var( --os-ui-ribbon-success,var( --os-ui-success-fg,#1a7f37 ) )}:host( [ tone='warning' ] ) .banner{background:var( --os-ui-ribbon-warning,var( --os-ui-warning-bg,#9a6700 ) )}:host( [ tone='danger' ] ) .banner{background:var( --os-ui-ribbon-danger,var( --os-ui-danger,#cf222e ) )}:host( [ tone='info' ] ) .banner{background:var( --os-ui-ribbon-info,var( --os-ui-info-bg,#0969da ) )}:host( [ tone='neutral' ] ) .banner{background:var( --os-ui-ribbon-neutral,var( --os-ui-surface,#57606a ) )}`,Ut=class Ut extends _{render(){return c``}};Ut.props=["placement","tone"],Ut.styles=[Vh],Ut.help=void 0;let xi=Ut;w("os-ribbon",xi);const jh=v`:host{display:inline-block}`,M="os-file-tile",ma={draft:"Draft",pending:"Pending",private:"Private",future:"Scheduled"};function Kh(){const s=window.wp?.os?.getOsSettings;if(typeof s!="function")return!0;try{return s()?.showPostStatusRibbons!==!1}catch{return!0}}function Bh(){return window.wp?.os?.dragManager??null}const Gh=["type","ref","label","icon","thumbnail","kind","status","selected","selectable","missing","access-gated","drag-kind","drag-title","drag-icon"],Le=class Le extends _{constructor(){super(...arguments),this._pointerdownHandler=null,this._keydownHandler=null,this._onSettingsSave=e=>{e.detail?.phase==="saved"&&this._paint()}}connectedCallback(){super.connectedCallback(),this._keydownHandler||(this._keydownHandler=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.click())},this.addEventListener("keydown",this._keydownHandler)),document.addEventListener("os-settings-save-lifecycle",this._onSettingsSave),this._paint()}disconnectedCallback(){this._pointerdownHandler&&(this.removeEventListener("pointerdown",this._pointerdownHandler),this._pointerdownHandler=null),this._keydownHandler&&(this.removeEventListener("keydown",this._keydownHandler),this._keydownHandler=null),document.removeEventListener("os-settings-save-lifecycle",this._onSettingsSave)}requestUpdate(){this.isConnected&&this._paint()}attributeChangedCallback(e,t,o){if(t!==o){if(e==="selected"||e==="selectable"||e==="aria-selected"){this._paintSelection();return}super.attributeChangedCallback(e,t,o)}}_paintSelection(){const e=this.hasAttribute("selected"),t=this.hasAttribute("selectable");if(this.classList.toggle(`${M}--selected`,e),this.setAttribute("role",t?"option":"listitem"),t){const o=e?"true":"false";this.getAttribute("aria-selected")!==o&&this.setAttribute("aria-selected",o)}else this.removeAttribute("aria-selected")}render(){return c``}_paint(){const e=this.getAttribute("type")??"",t=this.getAttribute("ref")??"",o=this.getAttribute("label")??"",i=this.getAttribute("icon")??"",n=this.getAttribute("thumbnail")??"",r=this.getAttribute("kind")??"entry",a=this.getAttribute("status")??"",l=this.hasAttribute("selected"),u=this.hasAttribute("selectable"),h=this.hasAttribute("missing"),p=this.hasAttribute("access-gated"),g=[M,`${M}--folder`,`${M}--missing`,`${M}--access-gated`,`${M}--selected`];for(const k of g)this.classList.remove(k);this.classList.add(M),r==="folder"&&this.classList.add(`${M}--folder`),h&&this.classList.add(`${M}--missing`),p&&this.classList.add(`${M}--access-gated`),l&&this.classList.add(`${M}--selected`),this.dataset.fileType=e,this.dataset.fileRef=t,r&&(this.dataset.role=r),this.setAttribute("role",u?"option":"listitem"),u?this.setAttribute("aria-selected",l?"true":"false"):this.removeAttribute("aria-selected"),this.setAttribute("aria-label",o),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const b="You don’t have permission to open this — ask the folder owner for access.";p?(this.title=b,this.setAttribute("aria-disabled","true")):(this.removeAttribute("aria-disabled"),this.title===b&&this.removeAttribute("title"));const m=[`${M}__visual`,`${M}__label`,`${M}__lock`];for(const k of m)this.querySelectorAll(`:scope > .${k}`).forEach(f=>f.remove());this.querySelectorAll(":scope > os-ribbon").forEach(k=>k.remove());const x=document.createElement("span");if(x.className=`${M}__visual`,n){const k=document.createElement("img");k.src=n,k.alt="",k.loading="lazy",k.decoding="async",k.className=`${M}__preview`,k.draggable=!1,x.appendChild(k)}else if(i){const k=Jr(i,{title:o,className:`${M}__icon`});x.appendChild(k)}this.appendChild(x);const y=document.createElement("span");if(y.className=`${M}__label`,y.textContent=o,this.appendChild(y),p){const k=document.createElement("span");k.className=`${M}__lock dashicons dashicons-lock`,k.setAttribute("aria-hidden","true"),this.appendChild(k)}if(a&&a!=="publish"&&ma[a]&&Kh()){const k=document.createElement("os-ribbon");k.setAttribute("placement","top-end"),k.setAttribute("tone",Xh(a)),k.textContent=ma[a],this.appendChild(k)}rc(this),be("os.tile.rendered",{tile:this}),this._wireDragOut()}_wireDragOut(){this._pointerdownHandler&&(this.removeEventListener("pointerdown",this._pointerdownHandler),this._pointerdownHandler=null);const e=this.getAttribute("drag-kind");if(!e)return;const t=o=>{if(o.button!==0)return;const i=Bh();if(!i)return;const n=this.getAttribute("ref")??"",r=this.getAttribute("drag-title")??this.getAttribute("label")??void 0,a=this.getAttribute("drag-icon")??this.getAttribute("icon")??void 0,l=this.getBoundingClientRect();i.start({payload:{type:"shortcut",source:this,data:{kind:e,ref:n,title:r,icon:a},ghost:{offsetX:o.clientX-l.left,offsetY:o.clientY-l.top}},origin:o})};this._pointerdownHandler=t,this.addEventListener("pointerdown",t)}};Le.shadow=!1,Le.props=Gh,Le.styles=[jh],Le.help=void 0;let ki=Le;function Xh(s){switch(s){case"draft":return"warning";case"pending":return"info";case"private":return"danger";case"future":return"primary";default:return"primary"}}w("os-tile",ki);const Zh=v`:host{display:block;position:relative;overflow-y:auto;overflow-x:hidden;font:var( --os-ui-log-font,12px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace );color:var( --os-ui-log-fg,var( --os-ui-fg,#1d2327 ) );background:var( --os-ui-log-bg,transparent );border:var( --os-ui-log-border,1px solid rgba( 0,0,0,0.06 ) );border-radius:var( --os-ui-log-border-radius,4px );min-height:var( --os-ui-log-min-height,120px );contain:strict}:host( [ hidden ] ){display:none}.spacer{position:relative;width:100%}.window{position:absolute;left:0;right:0;top:0}.row{box-sizing:border-box;display:block;padding:var( --os-ui-log-row-padding,2px 8px );min-height:var( --os-ui-log-row-height,22px );border-bottom:var( --os-ui-log-row-border,1px solid rgba( 0,0,0,0.04 ) );white-space:var( --os-ui-log-row-white-space,pre );overflow:hidden;text-overflow:ellipsis}:host( [ auto-row-height ] ) .row{min-height:0;overflow:visible;text-overflow:clip;white-space:var( --os-ui-log-row-white-space,normal )}.empty{display:flex;align-items:center;justify-content:center;padding:16px;color:var( --os-ui-fg-muted,#57606a );font-style:italic}`;function va(s){const e=document.createElement("span");let t;if(typeof s=="string")t=s;else try{t=JSON.stringify(s)}catch{t=String(s)}return e.textContent=t,e}const qt=class qt extends _{constructor(){super(...arguments),this._entries=[],this._renderRow=va,this._stickToBottom=!0,this._heights=[],this._offsets=[],this._offsetsValid=!1,this._onScroll=()=>{const e=this.scrollHeight-this.clientHeight-this.scrollTop;this._stickToBottom=e<=4,this._paintWindow()},this._resizeObserver=null}connectedCallback(){super.connectedCallback(),this.addEventListener("scroll",this._onScroll,{passive:!0}),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._paintWindow()),this._resizeObserver.observe(this)),queueMicrotask(()=>{this._paintSpacer(),this._stickToBottom&&(this.scrollTop=this.scrollHeight),this._paintWindow()})}disconnectedCallback(){this.removeEventListener("scroll",this._onScroll),this._resizeObserver?.disconnect(),this._resizeObserver=null}get renderRow(){return this._renderRow}set renderRow(e){this._renderRow=typeof e=="function"?e:va,this._heights=[],this._invalidateOffsets(),this._paintSpacer(),this._paintWindow()}get entries(){return this._entries}set entries(e){this._entries=Array.isArray(e)?e.slice():[],this._heights=[],this._invalidateOffsets(),this._enforceMaxRows(),this._afterEntriesMutation()}push(e){this._entries.push(e),this._enforceMaxRows(),this._afterEntriesMutation(),this.emit("os-log-append",{entry:e,length:this._entries.length})}pushMany(e){if(!(!Array.isArray(e)||e.length===0)){for(const t of e)this._entries.push(t);this._enforceMaxRows(),this._afterEntriesMutation()}}clear(){this._entries=[],this._heights=[],this._invalidateOffsets(),this._afterEntriesMutation()}scrollToBottom(){this._stickToBottom=!0,this.scrollTop=this.scrollHeight}_enforceMaxRows(){const e=this._readMaxRows();if(e>0&&this._entries.length>e){const t=this._entries.length-e;this._entries.splice(0,t),this._heights.length>0&&this._heights.splice(0,Math.min(t,this._heights.length)),this._invalidateOffsets()}}_afterEntriesMutation(){this._paintSpacer(),this._stickToBottom&&(this.scrollTop=this.scrollHeight),this._paintWindow()}_readRowHeight(){const e=parseFloat(this.getAttribute("row-height")||"22");return Number.isFinite(e)&&e>0?e:22}_readMaxRows(){const e=parseFloat(this.getAttribute("max-rows")||"0");return Number.isFinite(e)&&e>0?Math.floor(e):0}_readOverscan(){const e=parseFloat(this.getAttribute("overscan")||"6");return Number.isFinite(e)&&e>=0?Math.floor(e):6}_isAutoHeight(){return this.getAttribute("auto-row-height")!==null}_invalidateOffsets(){this._offsetsValid=!1,this._offsets=[]}_ensureOffsets(){if(this._offsetsValid)return;const e=this._readRowHeight(),t=new Array(this._entries.length);let o=0;for(let i=0;i0?n:e}this._offsets=t,this._totalHeight=o,this._offsetsValid=!0}_totalContentHeight(){return this._isAutoHeight()?(this._ensureOffsets(),this._totalHeight??0):this._entries.length*this._readRowHeight()}_findIndexAtOffset(e){const t=this._offsets;if(t.length===0)return 0;let o=0,i=t.length-1;for(;o.5)&&(this._heights[m]=y,g=!0)}if(g){this._invalidateOffsets(),this._ensureOffsets();for(const{idx:m,el:x}of p)x.style.top=`${this._offsets[m]}px`;this._paintSpacer(),this._stickToBottom&&(this.scrollTop=this.scrollHeight)}}render(){const e=this.getAttribute("empty")||"No entries";return c`
${e}
`}};qt.props=["rowHeight","maxRows","overscan","empty","autoRowHeight"],qt.styles=[Zh],qt.help=void 0;let $i=qt;w("os-log",$i);const Yh=v`:host{display:block;counter-reset:os-step}:host( [ hidden ] ){display:none}.os-steps__list{display:flex;flex-direction:column;gap:var( --os-ui-steps-gap,16px );margin:0;padding:0;list-style:none}:host( [ horizontal ] ){--os-ui-step-connector-width:20px;--os-ui-step-title-color:var( --os-ui-fg-muted,#646970 );--os-ui-step-title-weight:400}:host( [ horizontal ] ) .os-steps__list{flex-direction:row;align-items:center;flex-wrap:wrap;gap:var( --os-ui-steps-gap,10px )}`,Jh=v`:host{display:grid;grid-template-columns:var( --os-ui-step-chip-size,28px ) 1fr var( --os-ui-step-connector-width,0 );column-gap:var( --os-ui-step-gap,12px );align-items:start;counter-increment:os-step}:host( [ hidden ] ){display:none}:host::before{content:counter( os-step );display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-step-chip-size,28px );height:var( --os-ui-step-chip-size,28px );box-sizing:border-box;border-radius:50%;background:var( --os-ui-step-chip-bg,var( --wp-admin-theme-color,#2271b1 ) );background-size:200% 200%;background-position:30% 40%;color:var( --os-ui-step-chip-fg,var( --os-ui-fg-on-accent,#fff ) );border:var( --os-ui-step-chip-border,0 );font-family:var( --os-ui-step-chip-family,inherit );font-size:var( --os-ui-step-chip-font-size,13px );font-weight:600;line-height:1;flex-shrink:0}:host( [ done ] )::before{content:'✓';background:var( --os-ui-step-chip-done-bg,var( --os-ui-fg-muted,#646970 ) )}:host( [ current ] ) .os-step__title{color:var( --os-ui-fg,#1d2327 );font-weight:600}:host( [ interactive ] ){cursor:pointer}:host( [ interactive ] ) .os-step__title{transition:color 120ms ease}:host( [ interactive ] )::before{transition:border-color 120ms ease}:host( [ interactive ]:hover ) .os-step__title{color:var( --os-ui-step-title-hover-color,var( --os-ui-fg,#1d2327 ) )}:host( [ interactive ]:hover )::before{border-color:var( --os-ui-step-title-hover-color,var( --os-ui-fg,#1d2327 ) )}:host( [ interactive ]:focus-visible ){outline:var( --os-ui-focus-ring,2px solid #2271b1 );outline-offset:2px;border-radius:var( --os-ui-radius,4px )}:host::after{content:'';inline-size:var( --os-ui-step-connector-width,0 );block-size:1px;background:var( --os-ui-border,rgba( 0,0,0,0.08 ) );align-self:center}:host(:last-of-type )::after{content:none}.os-step__body{min-width:0}:host( [ trail ] ){align-items:center}:host( [ trail ] ) .os-step__title{margin:0}.os-step__title{margin:0 0 4px;font-family:var( --os-ui-step-title-family,inherit );font-size:var( --os-ui-step-title-size,14px );font-weight:var( --os-ui-step-title-weight,600 );color:var( --os-ui-step-title-color,var( --os-ui-fg,#1d2327 ) );text-transform:var( --os-ui-step-title-transform,none );letter-spacing:var( --os-ui-step-title-spacing,normal );line-height:1.3}.os-step__title:empty{display:none}.os-step__body::slotted( * ){margin-block:0}`,Ft=class Ft extends _{constructor(){super(...arguments),this.syncTrail=()=>{const e=this.hasAttribute("horizontal");for(const t of Array.from(this.children))t.tagName==="OS-STEP"&&t.toggleAttribute("trail",e)}}connectedCallback(){super.connectedCallback(),this.syncTrail()}render(){return this.syncTrail(),c`
`}};Ft.props=["horizontal"],Ft.styles=[Yh],Ft.help=void 0;let Ai=Ft;w("os-steps",Ai);const Vt=class Vt extends _{constructor(){super(...arguments),this.onClick=e=>{if(!this.isInteractive())return;const t=e.composedPath();for(const o of t){if(o===this)break;if(o instanceof HTMLElement&&o.hasAttribute("data-noclick"))return}this.dispatchEvent(new CustomEvent("os-step-click",{bubbles:!0,composed:!0}))},this.onKeyDown=e=>{if(!this.isInteractive()||e.key!=="Enter"&&e.key!==" ")return;const t=e.target;t instanceof HTMLElement&&t!==this&&t.closest("button, a, input, select, textarea")||(e.preventDefault(),this.onClick(e))}}isInteractive(){return this.hasAttribute("interactive")}syncRoles(){this.hasAttribute("current")?this.setAttribute("aria-current","step"):this.removeAttribute("aria-current"),this.isInteractive()?(this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0")):(this.removeAttribute("role"),this.removeAttribute("tabindex"))}connectedCallback(){super.connectedCallback(),this.syncRoles(),this.addEventListener("click",this.onClick),this.addEventListener("keydown",this.onKeyDown)}disconnectedCallback(){this.removeEventListener("click",this.onClick),this.removeEventListener("keydown",this.onKeyDown)}render(){const e=this.title||"";return this.syncRoles(),c`
${e}
`}};Vt.props=["title","done","current","interactive"],Vt.styles=[Jh],Vt.help={title:"Step",summary:"A single numbered step inside . Renders an auto-numbered chip and an optional bold title above the slotted body.",status:"stable",props:[{name:"title",type:"string",description:"Optional bold title rendered above the body."},{name:"done",type:"boolean",description:"When present, the chip shows a ✓ in a muted colour instead of the number."},{name:"current",type:"boolean",description:'Marks the step the reader is on. Mirrors aria-current="step" onto the host.'},{name:"interactive",type:"boolean",description:"Makes the step a jump target: focusable, activated by click or Enter/Space, and emits os-step-click. Lifts the title to full contrast on hover."}],events:[{name:"os-step-click",detail:"none",description:"Fired when an interactive step is activated by pointer or keyboard."}],slots:[{name:"(default)",description:"Step body content."}],cssProps:[{name:"--os-ui-step-gap",default:"12px"},{name:"--os-ui-step-chip-size",default:"28px"},{name:"--os-ui-step-chip-bg",default:"var(--wp-admin-theme-color)"},{name:"--os-ui-step-chip-fg",default:"#fff"},{name:"--os-ui-step-chip-done-bg",default:"var(--os-ui-fg-muted)"},{name:"--os-ui-step-chip-font-size",default:"13px"},{name:"--os-ui-step-title-hover-color",default:"var(--os-ui-fg)",description:"Ink an interactive step takes on hover, on its title and on an outlined chip."}],example:c` Open OpenStation Preferences → AI. Key confirmed. `};let Ei=Vt;w("os-step",Ei);const Qh=v` ${C} ${$s}:host{display:block;--_bg:var( --os-ui-table-bg,var( --os-ui-surface,#fff ) );--_border:var( --os-ui-table-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_column-border:var( --os-ui-table-column-border,var( --os-ui-border-strong,rgba( 0,0,0,0.14 ) ) );--_header-bg:var( --os-ui-table-header-bg,var( --os-ui-surface-elevated,#f6f7f7 ) );--_row-hover:var( --os-ui-table-row-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );--_stripe:var( --os-ui-table-stripe,var( --os-ui-surface-subtle,rgba( 0,0,0,0.03 ) ) );--_cell-padding:var( --os-ui-table-cell-padding,8px 12px );--_font-size:var( --os-ui-table-font-size,13px );--_max-height:var( --os-ui-table-max-height,none );font-size:var( --_font-size );color:inherit}:host( [ hidden ] ){display:none}.scroll{position:relative;overflow:auto;max-height:var( --_max-height );border:1px solid var( --_border );border-radius:4px;background:var( --_bg )}table{width:100%;border-collapse:separate;border-spacing:0;background:var( --_bg )}thead th{text-align:start;font-weight:600;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );padding:var( --_cell-padding );border-bottom:1px solid var( --_border );white-space:nowrap}tbody td{padding:var( --_cell-padding );border-bottom:1px solid var( --_border );background-color:var( --_bg );vertical-align:middle}tbody tr:last-child td{border-bottom:0}:host( [ striped ] ) tbody tr:nth-child( odd ) td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ hover ] ) tbody tr:hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) ),linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ compact ] ){--os-ui-table-cell-padding:4px 8px;--os-ui-table-font-size:12px}:host( [ bordered ] ) thead th,:host( [ bordered ] ) tbody td{border-inline-end:1px solid var( --_column-border )}:host( [ bordered ] ) thead th:last-child,:host( [ bordered ] ) tbody td:last-child{border-inline-end:0}th.is-sticky,td.is-sticky{position:sticky;z-index:10}tbody td.is-sticky{background-color:var( --_bg )}thead th.is-sticky{background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );z-index:30}:host( [ sticky-header ] ) thead th{position:sticky;top:0;z-index:20}:host( [ sticky-header ] ) thead tr.filter-row th{top:var( --os-ui-table-header-height,33px );z-index:20}:host( [ sticky-header ] ) thead th.is-sticky{z-index:40}:host( [ sticky-header ] ) thead tr.filter-row th.is-sticky{z-index:40}th.is-sticky-edge,td.is-sticky-edge{border-inline-end:var( --os-ui-table-sticky-edge,2px solid var( --_border ) )}.align-center{text-align:center}.align-end{text-align:end}.filter-row th{padding:4px 8px;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );border-bottom:1px solid var( --_border );font-weight:400}.filter-input,.filter-select{width:100%;min-width:60px;box-sizing:border-box;padding:4px 6px;font:inherit;color:inherit;background-color:var( --_bg );border:1px solid var( --_border );border-radius:3px}.filter-input:focus,.filter-select:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.expander{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;border-radius:3px;font-size:11px;line-height:1}.expander:hover{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) )}td.col-expander,th.col-expander{width:36px;min-width:36px;padding-left:0;padding-right:0;text-align:center}tr.subtable td{padding:0;background-color:var( --_bg );background-image:linear-gradient( var( --_stripe ),var( --_stripe ) );border-bottom:1px solid var( --_border )}tr.subtable .subtable-inner{padding:8px 12px 8px 32px}tr.empty td{padding:24px;text-align:center;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );font-style:italic}thead th.is-sortable{cursor:pointer;user-select:none}thead th.is-sortable:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}thead th.is-sortable:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.sort-indicator{font-size:10px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );margin-inline-start:2px}thead th.sort-asc .sort-indicator,thead th.sort-desc .sort-indicator{color:var( --wp-admin-theme-color,#2271b1 )}td.col-select,th.col-select{width:40px;min-width:40px;padding-left:0;padding-right:0;text-align:center}.select-all-checkbox,.select-row-checkbox{cursor:pointer;margin:0}tbody tr.is-selected td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none}tbody tr.is-selected:hover td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 16%,var( --_bg ) )}tbody tr.is-selected td:first-child{box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}tbody:dir( rtl ) tr.is-selected td:first-child{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) .scroll{border:0;border-radius:0}:host( [ stacked ] ) table,:host( [ stacked ] ) tbody{display:block;width:100%}:host( [ stacked ] ) colgroup,:host( [ stacked ] ) thead{display:none}:host( [ stacked ] ) tbody tr{display:flex;align-items:flex-start;gap:12px;padding:12px 14px;border-bottom:1px solid var( --_border );background-color:var( --_bg )}:host( [ stacked ] ) tbody tr:last-child{border-bottom:0}:host( [ stacked ] ) tbody td{display:block;padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none;min-width:0;width:auto;vertical-align:baseline}:host( [ stacked ] ) tbody tr.is-selected td,:host( [ stacked ] ) tbody tr.is-selected:hover td,:host( [ stacked ][ striped ] ) tbody tr:nth-child( odd ) td,:host( [ stacked ][ hover ] ) tbody tr:hover td,:host( [ stacked ][ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td,:host( [ stacked ][ bordered ] ) tbody td{padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none}:host( [ stacked ][ hover ] ) tbody tr:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ stacked ] ) tbody tr.is-selected,:host( [ stacked ] ) tbody tr.is-selected:hover{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none;box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody:dir( rtl ) tr.is-selected{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody td.col-select,:host( [ stacked ] ) tbody td.col-expander{flex:0 0 auto;display:flex;align-items:center;justify-content:center;min-width:0}:host( [ stacked ] ) tbody td.col-select{width:44px;height:44px;margin:-11px 0 -11px -11px;cursor:pointer}:host( [ stacked ] ) .select-row-checkbox{width:22px;height:22px}:host( [ stacked ] ) tbody td.col-expander{width:28px;height:22px;margin-inline-start:-4px}:host( [ stacked ] ) tbody td.stack-body{flex:1 1 auto;display:flex;flex-direction:column;gap:4px;min-width:0}.stack-cell{display:flex;align-items:baseline;gap:6px;min-width:0;line-height:1.4}.stack-title{font-size:15px;font-weight:600;line-height:1.35}.stack-meta{font-size:13px}.stack-label{flex:0 0 auto;font-size:12px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) )}.stack-label::after{content:'·';margin-inline-start:6px}.stack-value{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.stack-actions{margin-block-start:6px}.stack-actions .stack-value{gap:8px}.stack-actions .stack-value>*{justify-content:flex-start;max-width:100%}:host( [ stacked ] ) tr.subtable,:host( [ stacked ] ) tr.empty{display:block;padding:0}:host( [ stacked ] ) tr.subtable td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ stacked ] ) tr.subtable .subtable-inner{padding:8px 14px 12px}:host( [ stacked ] ) tr.empty td{padding:24px}:host( [ stacked ] ) tr.skeleton{display:block;padding:14px;border-bottom:1px solid var( --_border )}:host( [ stacked ] ) tr.skeleton td.stack-body{gap:8px}:host( [ stacked ] ) tr.skeleton .skeleton-bar:first-child{height:15px}tbody tr.skeleton td{padding:var( --_cell-padding )}.skeleton-bar{display:block;height:12px;border-radius:3px;background:linear-gradient( 90deg,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 0%,var( --os-ui-table-skeleton-highlight,var( --os-ui-hover,rgba( 0,0,0,0.14 ) ) ) 50%,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 100% );background-size:200% 100%;animation:os-table-skeleton-pulse 1.4s ease-in-out infinite}@keyframes os-table-skeleton-pulse{0%{background-position:200% 50%}100%{background-position:-200% 50%}}@media ( prefers-reduced-motion:reduce ){.skeleton-bar{animation:none}}`,Se="__wpd_expander__",Ce="__wpd_select__",jt=class jt extends _{constructor(){super(...arguments),this._data=[],this._columns=[],this._filters={},this._expanded=new Set,this._subTable=null,this._sort=null,this._selection=new Set,this._getRowId=(e,t)=>t,this._filterCache=new Map,this._paintScheduled=!1,this._stacked=!1,this._stickyHeaderWarned=!1,this._stickyRaceWarned=!1,this._resizeObserver=null,this._stickyMicroScheduled=!1,this._stickyRafHandle=null,this._loadingDesyncWarned=!1,this._lastStickyIndex=-1}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e.slice():[],this._expanded.clear(),this._schedulePaint()}get columns(){return this._columns}set columns(e){this._columns=Array.isArray(e)?e.slice():[];const t=new Set(this._columns.map(o=>o.key));for(const o of Object.keys(this._filters))t.has(o)||delete this._filters[o];for(const o of Array.from(this._filterCache.keys()))t.has(o)||this._filterCache.delete(o);this._sort&&!t.has(this._sort.key)&&(this._sort=null),this._schedulePaint()}get filters(){return{...this._filters}}set filters(e){this._filters=e?{...e}:{},this._schedulePaint()}get sort(){return this._sort?{...this._sort}:null}set sort(e){this._sort=e?{...e}:null,this._schedulePaint()}get selection(){return new Set(this._selection)}set selection(e){this._selection=new Set(e??[]),this._schedulePaint()}get selectedRows(){const e=[];return this._data.forEach((t,o)=>{this._selection.has(this._getRowId(t,o))&&e.push(t)}),e}get visibleRows(){return this._filteredRows().map(e=>e.row)}get getRowId(){return this._getRowId}set getRowId(e){this._getRowId=typeof e=="function"?e:(t,o)=>o,this._schedulePaint()}get subTable(){return this._subTable}set subTable(e){this._subTable=typeof e=="function"?e:null,this._expanded.clear(),this._schedulePaint()}get expanded(){return new Set(this._expanded)}set expanded(e){this._expanded=new Set(e??[]),this._schedulePaint()}expand(e){e<0||e>=this._data.length||this._expanded.has(e)||(this._expanded.add(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!0}),this._schedulePaint())}collapse(e){this._expanded.has(e)&&(this._expanded.delete(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!1}),this._schedulePaint())}expandAll(){if(!this._subTable)return;let e=!1;for(let t=0;t0&&l===a,r.indeterminate=l>0&&l
`}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){const e=this.shadowRoot;if(!e)return;e.querySelector("tbody")||Ee(this.render(),e);const t=e.querySelector("colgroup"),o=e.querySelector("thead"),i=e.querySelector("tbody");if(!t||!o||!i)return;const n=this._effectiveColumns();this._stacked=this.hasAttribute("stacked");const r=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(n,r),this._paintColgroup(t,n),this._paintHead(o,n,r),this._paintBody(i,n,r),this._applyStickyOffsets(),this._measureHeaderHeight(),this._scheduleStickyOffsets(),this._maybeWarnStickyHeader(),this._maybeWarnLoadingDesync(i),this._ensureResizeObserver()}_maybeWarnLoadingDesync(e){this._loadingDesyncWarned||this.hasAttribute("loading")&&(e.querySelector("tr.skeleton")||(this._loadingDesyncWarned=!0,console.warn("[os-table] `loading` attribute is set but no skeleton rows rendered. Either attributeChangedCallback didn't route through requestUpdate (framework regression), or `loading` was set after the most recent paint and no follow-up trigger ran. Toggling `data` will force a paint as a workaround.")))}_scheduleStickyOffsets(){this._stickyMicroScheduled||(this._stickyMicroScheduled=!0,queueMicrotask(()=>{this._stickyMicroScheduled=!1,this.isConnected&&this._applyStickyOffsets()})),this._stickyRafHandle===null&&typeof requestAnimationFrame<"u"&&(this._stickyRafHandle=requestAnimationFrame(()=>{this._stickyRafHandle=null,this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight())}))}_ensureResizeObserver(){if(this._resizeObserver||typeof ResizeObserver>"u")return;const e=this.shadowRoot?.querySelector(".scroll");e&&(this._resizeObserver=new ResizeObserver(()=>{this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight(),this._stickyHeaderWarned=!1,this._maybeWarnStickyHeader())}),this._resizeObserver.observe(e),this._resizeObserver.observe(this))}_paintColgroup(e,t){const o=[];for(const i of t){const n=document.createElement("col");i.width&&(n.style.width=i.width),o.push(n)}e.replaceChildren(...o)}_paintHead(e,t,o){const i=document.createElement("tr");i.setAttribute("part","header-row");for(let l=0;l tr[part="header-row"]');n?e.replaceChild(i,n):e.insertBefore(i,e.firstChild);const r=t.some(l=>l.filter||Array.isArray(l.filterOptions)||typeof l.filterRender=="function");let a=e.querySelector(":scope > tr.filter-row");if(r){const l=[];for(let p=0;p0&&l===a,r.indeterminate=l>0&&l{r.checked?this.selectAll():this.clearSelection()}),i.appendChild(r)}return i}if(i.textContent=e.label??(e.key===Se?"":e.key),e.sortable){i.classList.add("is-sortable");const n=this._sort?.key===e.key,r=document.createElement("span");r.className="sort-indicator";let a="";n&&(a=this._sort.direction==="asc"?" ▲":" ▼"),r.textContent=a,i.appendChild(r),n&&i.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),i.addEventListener("click",()=>this._cycleSort(e.key))}return i}_buildFilterCell(e,t,o){const i=this._filterCache.get(e.key),n=Array.isArray(e.filterOptions),r=typeof e.filterRender=="function";let a;if(!e.filter&&!n&&!r||e.key===Se||e.key===Ce?a="none":r?a="custom":e.filter==="select"||n?a="select":a="text",i&&i.kind===a){if(i.th.className="",this._applyCellClasses(i.th,e,t,o),a==="select"){const p=i.control,g=this._resolveFilterOptions(e),b=g.map(m=>m.value).join("|");b!==i.optionsKey?(this._populateSelect(p,g,this._filters[e.key]??""),i.optionsKey=b):p.value=this._filters[e.key]??""}else if(a==="text"){const p=i.control,g=this._filters[e.key]??"";p.value!==g&&p.ownerDocument.activeElement!==p&&(p.value=g)}else a==="custom"&&e.filterRender&&e.filterRender(i.th,{value:this._filters[e.key]??"",setValue:p=>this._onFilterChange(e.key,p),col:e});return i.th}const l=document.createElement("th");if(this._applyCellClasses(l,e,t,o),a==="none")return this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"none"}),l;if(a==="custom"&&e.filterRender)return e.filterRender(l,{value:this._filters[e.key]??"",setValue:p=>this._onFilterChange(e.key,p),col:e}),this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"custom"}),l;let u,h="";if(a==="select"){const p=document.createElement("select");p.classList.add("filter-select"),p.setAttribute("data-noclick",""),p.setAttribute("aria-label",`Filter ${e.label??e.key}`);const g=this._resolveFilterOptions(e);this._populateSelect(p,g,this._filters[e.key]??""),h=g.map(b=>b.value).join("|"),p.addEventListener("change",()=>{this._onFilterChange(e.key,p.value)}),u=p}else{const p=document.createElement("input");p.type="search",p.classList.add("filter-input"),p.setAttribute("data-noclick",""),p.setAttribute("placeholder","Filter…"),p.setAttribute("aria-label",`Filter ${e.label??e.key}`),p.value=this._filters[e.key]??"",p.addEventListener("input",()=>{this._onFilterChange(e.key,p.value)}),u=p}return l.appendChild(u),this._filterCache.set(e.key,{th:l,control:u,optionsKey:h,kind:a}),l}_populateSelect(e,t,o){e.replaceChildren();const i=document.createElement("option");i.value="",i.textContent="All",e.appendChild(i);for(const n of t){const r=document.createElement("option");r.value=n.value,r.textContent=n.label,n.value===o&&(r.selected=!0),e.appendChild(r)}e.value=o}_resolveFilterOptions(e){return Array.isArray(e.filterOptions)?e.filterOptions:this._uniqueValues(e.key).map(t=>({value:t,label:t}))}_paintBody(e,t,o){if(e.replaceChildren(),this.hasAttribute("loading")){const n=this._readLoadingRows();for(let r=0;r{this._onRowClick(e,t,a)});for(let a=0;a{this._onRowClick(e,t,u)});const r=document.createElement("td");r.className="stack-body";let a=0,l=0;for(let u=0;u{h.checked?this.select(u):this.deselect(u)}),r.appendChild(h),this._stacked&&(r.setAttribute("data-noclick",""),r.addEventListener("click",p=>{p.target===r&&(h.checked=!h.checked,h.dispatchEvent(new Event("change")))})),r}if(e.key===Se){if(!(this._subTable?!!this._subTable(o,i):!1))return r;const h=this._expanded.has(i),p=document.createElement("button");return p.type="button",p.className="expander",p.setAttribute("data-noclick",""),p.setAttribute("aria-expanded",h?"true":"false"),p.setAttribute("aria-label",h?"Collapse row":"Expand row"),p.textContent=h?"▾":"▸",p.addEventListener("click",g=>{this._toggleRow(i,o,g)}),r.appendChild(p),r}const a=o[e.key],l=Ts(a);if(e.render){const u=e.render(a,o,i);this._mountCellContent(r,u)}else l!==null?r.appendChild(this._slotFor(l)):a!=null&&(r.textContent=String(a));return r}_slotFor(e){const t=document.createElement("slot");return t.name=e,t}_buildSubTableRow(e,t){const o=document.createElement("tr");o.classList.add("subtable"),o.setAttribute("part","subtable-row");const i=document.createElement("td");i.colSpan=t;const n=document.createElement("div");if(n.classList.add("subtable-inner"),e instanceof Node)n.appendChild(e);else if(_a(e))Ee(e,n);else{const r=document.createElement("os-table");r.columns=e.columns,r.data=e.data,e.subTable&&(r.subTable=e.subTable),n.appendChild(r)}return i.appendChild(n),o.appendChild(i),o}_mountCellContent(e,t){if(typeof t=="string"){e.textContent=t;return}if(t instanceof Node){e.appendChild(t);return}_a(t)&&Ee(t,e)}_onFilterChange(e,t){t===""?delete this._filters[e]:this._filters[e]=t,this.emit("os-table-filter-change",{filters:{...this._filters}});const i=this.shadowRoot?.querySelector("tbody");if(i){const n=this._effectiveColumns(),r=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(n,r),this._paintBody(i,n,r),this._applyStickyOffsets()}}_onRowClick(e,t,o){const i=o.composedPath?.()??[];for(const n of i){if(n instanceof Element&&n.hasAttribute("data-noclick"))return;if(n===this)break}this.emit("os-table-row-click",{row:e,index:t,originalEvent:o})}_toggleRow(e,t,o){o.stopPropagation();const i=this._expanded.has(e);i?this._expanded.delete(e):this._expanded.add(e),this.emit("os-table-expand-change",{row:t,index:e,expanded:!i}),this._schedulePaint()}_cycleSort(e){!this._sort||this._sort.key!==e?this._sort={key:e,direction:"asc"}:this._sort.direction==="asc"?this._sort={key:e,direction:"desc"}:this._sort=null,this.emit("os-table-sort-change",{sort:this._sort?{...this._sort}:null}),this._schedulePaint()}_emitSelectionChange(){this.emit("os-table-selection-change",{selection:Array.from(this._selection),rows:this.selectedRows})}_filteredRows(){const e=[],t=Object.keys(this._filters).filter(o=>this._filters[o]!=="");for(let o=0;op.key===r);if(a&&typeof a.filterRender=="function")continue;const l=this._filters[r]??"",u=i[r],h=Ci(u);if(a?.filter==="select"){if(h!==l){n=!1;break}}else if(!h.toLowerCase().includes(l.toLowerCase())){n=!1;break}}n&&e.push({row:i,index:o})}return e}_sortedRows(e){if(!this._sort)return e;const t=this._columns.find(n=>n.key===this._sort.key);if(!t)return e;const o=this._sort.direction==="desc"?-1:1,i=e.slice();return i.sort((n,r)=>{const a=n.row[t.key],l=r.row[t.key],u=t.sortValue?t.sortValue(n.row,a):wa(a),h=t.sortValue?t.sortValue(r.row,l):wa(l);return tp(u,h)*o}),i}_uniqueValues(e){const t=new Set;for(const o of this._data){const i=o[e];i!=null&&t.add(Ci(i))}return Array.from(t).sort()}_visibleSelectionStats(){let e=0,t=0;for(const{row:o,index:i}of this._filteredRows())e++,this._selection.has(this._getRowId(o,i))&&t++;return{total:e,selected:t}}_readStickyColumns(){const e=parseInt(this.getAttribute("sticky-columns")||"0",10);return Number.isFinite(e)&&e>0?e:0}_readLoadingRows(){const e=parseInt(this.getAttribute("loading-rows")||"5",10);return Number.isFinite(e)&&e>0?Math.min(e,100):5}_readSelectable(){const e=this.getAttribute("selectable");return e==="single"?"single":e==="multi"||e===""?"multi":null}_isStickyIndex(e,t,o){return this._stacked||o.sticky===!1?!1:o.sticky===!0?!0:e{const l=Array.from(a.children);for(let u=0;u0&&this.style.setProperty("--os-ui-table-header-height",`${o}px`)}_maybeWarnStickyHeader(){if(this._stickyHeaderWarned||!this.hasAttribute("sticky-header")||this.hasAttribute("loading")||this._data.length<8)return;const e=this.shadowRoot?.querySelector(".scroll");e&&e.offsetWidth!==0&&e.scrollHeight<=e.clientHeight+1&&(this._stickyHeaderWarned=!0,console.warn("[os-table] sticky-header is set but the table has no scroll container. Set --os-ui-table-max-height on the host (or wrap it in a scrolling parent) so the header has something to stick to."))}};jt.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],jt.styles=[Qh],jt.help=void 0;let Si=jt;function _a(s){return!!s&&s.__wpdHtml===!0}function ep(s,e){return s.stack?s.stack:e===0?"title":s.label?"meta":"actions"}function Ts(s){return s&&typeof s=="object"&&typeof s.slot=="string"?s.slot:null}function Ci(s){if(s==null)return"";if(Ts(s)!==null){const e=s.text;return e==null?"":String(e)}return String(s)}function wa(s){return Ts(s)!==null?Ci(s):s}function tp(s,e){if(s===e)return 0;if(s==null)return-1;if(e==null)return 1;if(typeof s=="number"&&typeof e=="number")return s-e;if(s instanceof Date&&e instanceof Date)return s.getTime()-e.getTime();const t=Number(s),o=Number(e);return Number.isFinite(t)&&Number.isFinite(o)?t-o:String(s).localeCompare(String(e))}w("os-table",Si);const sp=v`: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}}`,ya=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}}),K=61.26,B=61.26,xa=58.453,op='',Kt=class Kt extends _{constructor(){super(...arguments),this._paintScheduled=!1}connectedCallback(){super.connectedCallback(),this._schedulePaint()}render(){return c`
`}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){this._syncCssVars();const e=this.shadowRoot?.querySelector(".root");e&&(e.innerHTML=this._buildSvg())}_syncCssVars(){const e=(t,o,i)=>{const n=this.getAttribute(t);n===null?this.style.removeProperty(o):this.style.setProperty(o,i?i(n):n)};e("color","--os-ui-spinner-color"),e("accent","--os-ui-spinner-accent"),e("size","--os-ui-spinner-size",t=>/^-?\d+(\.\d+)?$/.test(t.trim())?`${t}px`:t)}_effectiveConfig(){const e=this.getAttribute("preset")??"classic",t=ya[e]??ya.classic,o=(r,a)=>{const l=this.getAttribute(r);if(l===null)return a;const u=parseFloat(l);return Number.isFinite(u)?u:a},i=(r,a)=>{const l=this.getAttribute(r);if(l===null)return a;const u=l.toLowerCase();return u==="-1"||u==="ccw"||u==="reverse"?-1:1},n=()=>{const r=this.getAttribute("pulse");return r==="scale"||r==="opacity"||r==="both"||r==="none"?r:t.pulse};return{sp1:o("sp1",t.sp1),sp2:o("sp2",t.sp2),sp3:o("sp3",t.sp3),a1:o("a1",t.a1),a2:o("a2",t.a2),a3:o("a3",t.a3),gap:o("gap",t.gap),dir2:i("dir2",t.dir2),dir3:i("dir3",t.dir3),pulse:n(),dots:Math.max(0,Math.floor(o("dots",t.dots)))}}_buildInlineSvg(e){const t=ka(this.getAttribute("label")??"Loading"),o=9,i=(e.sp1/10).toFixed(2);return``}_buildSvg(){const e=this._effectiveConfig();if(this.getAttribute("preset")==="inline")return this._buildInlineSvg(e);const t=ka(this.getAttribute("label")??"Loading"),o=e.gap*3+14,i=-o,n=122.52+o*2,r=xa+e.gap+2,a=r+e.gap+2,l=a+e.gap+1.5,u=`animation: os-spinner-spin ${(e.sp1/10).toFixed(2)}s linear infinite`,h=`animation: os-spinner-spin ${(e.sp2/10).toFixed(2)}s linear infinite${e.dir2<0?" reverse":""}`,p=`animation: os-spinner-spin ${(e.sp3/10).toFixed(2)}s linear infinite${e.dir3<0?" reverse":""}`,g=(e.sp1*1.8/10).toFixed(1),b=(e.sp1*2.3/10).toFixed(1);let m="";e.pulse==="scale"?m=`animation: os-spinner-scale ${g}s ease-in-out infinite`:e.pulse==="opacity"?m=`animation: os-spinner-opacity ${b}s ease-in-out infinite`:e.pulse==="both"&&(m=`animation: os-spinner-scale ${g}s ease-in-out infinite, os-spinner-opacity ${b}s ease-in-out infinite`);let x="";if(e.dots>0){const y=l+e.gap+1,k=2*Math.PI*y,f=1.6,A=(e.sp1*.65/10).toFixed(2);for(let $=0;$`}}return`${op}`+x+""}};Kt.props=["preset","size","color","accent","sp1","sp2","sp3","a1","a2","a3","gap","dir2","dir3","pulse","dots","label"],Kt.styles=[sp],Kt.help=void 0;let Ii=Kt;function Ds(s,e){const t=2*Math.PI*s,o=e/100*t,i=t-o;return`${o.toFixed(2)} ${i.toFixed(2)}`}function ka(s){return String(s).replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}w("os-spinner",Ii);const ip=v`:host{display:inline;color:inherit;font:inherit}`,Ps=new Set;let Ue=null;const np=3e4;function rp(){Ue===null&&(Ue=window.setInterval(()=>{for(const s of Ps)s.tick()},np))}function ap(){Ue!==null&&Ps.size===0&&(window.clearInterval(Ue),Ue=null)}function lp(s){if(!s)return null;const e=t=>{const o=new Date(t);return Number.isNaN(o.getTime())?null:o};return cp(s)?e(s):e(s.replace(" ","T")+"Z")}function cp(s){const e=Math.max(s.indexOf("T"),s.indexOf(" ")),t=e===-1?"":s.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(t)}let Ri=null,Li=null;function $a(){return typeof navigator<"u"&&navigator.language||"en"}function dp(){return Ri||(Ri=new Intl.RelativeTimeFormat($a(),{numeric:"auto"})),Ri}function Aa(){return Li||(Li=new Intl.RelativeTimeFormat($a(),{numeric:"always",style:"narrow"})),Li}function up(s,e){const t=dp(),o=s.getTime()-e,i=Math.round(o/1e3),n=Math.abs;return n(i)<45?t.format(0,"second"):Ea(t,i)}function Ea(s,e){const t=Math.abs,o=Math.round(e/60);if(t(o)<45)return s.format(o,"minute");const i=Math.round(o/60);if(t(i)<22)return s.format(i,"hour");const n=Math.round(i/24);if(t(n)<26)return s.format(n,"day");const r=Math.round(n/30);if(t(r)<11)return s.format(r,"month");const a=Math.round(n/365);return s.format(a,"year")}function hp(s,e){const t=Math.round((s.getTime()-e)/1e3),o=Math.abs;return o(t)<45?Aa().format(0,"second"):o(t)>604800?s.toLocaleDateString(void 0,{month:"short",day:"numeric"}):Ea(Aa(),t)}const Bt=class Bt extends _{connectedCallback(){super.connectedCallback(),Ps.add(this),rp()}disconnectedCallback(){Ps.delete(this),ap()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=lp(e);if(!t)return c`${e??""}`;const o=Date.now(),i=this.hasAttribute("compact")?hp(t,o):up(t,o),n=t.toLocaleString();return c``}};Bt.props=["datetime","compact"],Bt.styles=[ip],Bt.help=void 0;let Ti=Bt;w("os-relative-time",Ti);const pp=v`:host{display:block;position:relative;color:var( --os-ui-fg,#1d2327 );font-family:var( --os-ui-font,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif );font-size:12px}.head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-block-end:6px}:host(:not( [legend] ):not( [heading] ) ) .head{display:none}.heading{margin:0;font-size:13px;font-weight:600;color:var( --os-ui-fg,#1d2327 )}.heading[hidden]{display:none}.legend{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-inline-start:auto}:host(:not( [legend] ) ) .legend{display:none}.chip{display:inline-flex;align-items:center;gap:6px;padding:3px 9px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:999px;background:transparent;color:var( --os-ui-fg-muted,#646970 );font:inherit;cursor:pointer;transition:opacity 0.12s ease,border-color 0.12s ease}.chip[aria-pressed='false']{opacity:0.45}.chip:hover{border-color:var( --os-ui-border-strong,#8c8f94 );color:var( --os-ui-fg,#1d2327 )}.chip:focus-visible{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:1px}.count{font-variant-numeric:tabular-nums;color:var( --os-ui-fg,#1d2327 )}.swatch{display:inline-block;width:10px;height:10px;border-radius:3px;flex:none}.swatch,.seg{background:var( --_tone );fill:var( --_tone )}[data-tone='danger']{--_tone:var( --os-ui-danger,#d63638 )}[data-tone='warning']{--_tone:var( --os-ui-warning,#dba617 )}[data-tone='info']{--_tone:var( --os-ui-info-fg,#72aee6 )}[data-tone='success']{--_tone:var( --os-ui-success,#00a32a )}[data-tone='accent']{--_tone:var( --os-ui-accent,#2271b1 )}[data-tone='neutral']{--_tone:var( --os-ui-fg-muted,#646970 )}.chart{position:relative}svg{display:block;inline-size:100%}.grid{stroke:var( --os-ui-border,#dcdcde );stroke-width:1}.tick{fill:var( --os-ui-fg-muted,#646970 );font-size:10px;font-variant-numeric:tabular-nums}.hit{fill:transparent;cursor:crosshair}.hover{fill:var( --os-ui-surface-raised,rgba( 0,0,0,0.04 ) );pointer-events:none}.empty{padding:40px 0;text-align:center;font-size:13px;color:var( --os-ui-fg-muted,#646970 )}.tooltip{position:absolute;inset-block-start:4px;transform:translateX( -50% );min-inline-size:150px;padding:8px 10px;border-radius:6px;border:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface-elevated,#fff );box-shadow:var( --os-ui-shadow,0 2px 8px rgba( 0,0,0,0.15 ) );pointer-events:none;z-index:2}.tooltip[hidden]{display:none}.tooltip-head{margin-block-end:6px;color:var( --os-ui-fg-muted,#646970 );font-size:11px}.tooltip-row{display:flex;align-items:center;gap:6px;line-height:1.6}.tooltip-label{flex:1}.tooltip-value{font-variant-numeric:tabular-nums;font-weight:600}`,gp="http://www.w3.org/2000/svg",qe=8,fp=20,Y=8,bp=40,mp=24,Di=2,vp=150,_p=new Set(["danger","warning","info","success","accent","neutral"]);function Sa(s,e){if(!s)return e;try{return JSON.parse(s)}catch{return e}}function wp(s){if(s<=5)return Math.max(1,s);const e=Math.pow(10,Math.floor(Math.log10(s)));for(const t of[1,2,5,10])if(t*e>=s)return t*e;return 10*e}function he(s,e){const t=document.createElementNS(gp,s);for(const[o,i]of Object.entries(e))t.setAttribute(o,i);return t}function yp(s,e,t,o){const i=Math.min(3,o/2,t/2);return`M ${s} ${e+o} L ${s} ${e+i} Q ${s} ${e} ${s+i} ${e} L ${s+t-i} ${e} Q ${s+t} ${e} ${s+t} ${e+i} L ${s+t} ${e+o} Z`}const Gt=class Gt extends _{constructor(){super(...arguments),this._resize=null,this._tooltip=null}connectedCallback(){super.connectedCallback(),typeof ResizeObserver<"u"&&(this._resize=new ResizeObserver(()=>this.paint()),this._resize.observe(this))}disconnectedCallback(){this._resize?.disconnect(),this._resize=null}requestUpdate(){super.requestUpdate(),queueMicrotask(()=>this.paint())}get seriesList(){const e=Sa(this.getAttribute("series"),[]);return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&typeof t.key=="string").map(t=>({key:t.key,label:typeof t.label=="string"?t.label:t.key,tone:t.tone&&_p.has(t.tone)?t.tone:"neutral"})):[]}get columnList(){const e=Sa(this.getAttribute("columns"),[]);return Array.isArray(e)?e.map(t=>Array.isArray(t)?t.map(o=>Number.isFinite(Number(o))?Math.max(0,Number(o)):0):[]):[]}get hiddenSet(){return new Set((this.getAttribute("hidden-series")??"").split(",").map(e=>e.trim()).filter(e=>e!==""))}totals(){const e=this.seriesList,t=e.map(()=>0);for(const o of this.columnList)e.forEach((i,n)=>{t[n]+=o[n]??0});return t}toggleSeries(e){const t=this.hiddenSet;t.has(e)?t.delete(e):t.add(e);const o=Array.from(t);o.length>0?this.setAttribute("hidden-series",o.join(",")):this.removeAttribute("hidden-series"),this.emit("os-series-toggle",{key:e,hidden:o})}render(){const e=this.seriesList,t=this.totals(),o=this.hiddenSet,i=this.getAttribute("heading")??"";return c`

${i}

${e.map((n,r)=>c` `)}
`}paint(){const e=this.shadowRoot,t=e?.querySelector(".chart"),o=e?.querySelector(".tooltip");if(!t||!o)return;this._tooltip=o,o.hidden=!0,t.textContent="";const i=this.columnList,n=i.some(D=>D.some(z=>z>0));if(i.length===0||!n){const D=document.createElement("div");D.className="empty",D.textContent=this.getAttribute("empty")??"",t.appendChild(D);return}const r=this.seriesList,a=this.hiddenSet,l=r.map((D,z)=>a.has(D.key)?-1:z).filter(D=>D>=0),u=parseInt(this.getAttribute("height")??"",10),h=Number.isFinite(u)&&u>40?u:vp,p=Math.max(280,this.clientWidth||640),g=p-Y-bp,b=h-qe-fp,m=i.length,x=g/m,y=Math.max(2,Math.min(mp,x-Di)),k=i.reduce((D,z)=>{const te=l.reduce((se,Us)=>se+(z[Us]??0),0);return Math.max(D,te)},0),f=wp(k),A=b/f,$=he("svg",{width:String(p),height:String(h),viewBox:`0 0 ${p} ${h}`,role:"img"});for(const D of[0,.5,1]){const z=f*D,te=qe+b-z*A;$.appendChild(he("line",{class:"grid",x1:String(Y),y1:String(te),x2:String(Y+g),y2:String(te)}));const se=he("text",{class:"tick",x:String(Y+g+6),y:String(te+3.5)});se.textContent=Number.isInteger(z)?z.toLocaleString():String(z),$.appendChild(se)}const R=Number(this.getAttribute("start"))||0,I=Number(this.getAttribute("end"))||R+m,O=Math.max(1,(I-R)/m),H=I-R>36*3600,X=D=>new Date(D*1e3).toLocaleString([],H?{month:"short",day:"numeric"}:{hour:"2-digit",minute:"2-digit"}),ye=D=>new Date(D*1e3).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),af=[[R,Y,"start"],[R+(I-R)/2,Y+g/2,"middle"],[I,Y+g,"end"]];for(const[D,z,te]of af){const se=he("text",{class:"tick",x:String(z),y:String(h-5),"text-anchor":te});se.textContent=X(D),$.appendChild(se)}const Hs=he("rect",{class:"hover",y:String(qe),width:String(x),height:String(b),visibility:"hidden"});$.appendChild(Hs),i.forEach((D,z)=>{const te=Y+z*x+(x-y)/2;let se=qe+b;const Us=l.filter(ps=>(D[ps]??0)>0),lf=Us[Us.length-1];for(const ps of l){const nl=D[ps]??0;if(nl===0)continue;const rl=r[ps].tone??"neutral",rn=nl*A,an=se-rn;ps===lf?$.appendChild(he("path",{class:"seg","data-tone":rl,d:yp(te,an,y,Math.max(1.5,rn))})):$.appendChild(he("rect",{class:"seg","data-tone":rl,x:String(te),y:String(an+Di),width:String(y),height:String(Math.max(1.5,rn-Di))})),se=an}const nn=he("rect",{class:"hit",x:String(Y+z*x),y:String(qe),width:String(x),height:String(b)});nn.addEventListener("pointerenter",()=>{Hs.setAttribute("x",String(Y+z*x)),Hs.setAttribute("visibility","visible"),this.showTooltip(z,D,x,p,{head:`${ye(R+z*O)} – ${X(R+(z+1)*O)}`,series:r,visibleIndexes:l})}),nn.addEventListener("pointerleave",()=>{Hs.setAttribute("visibility","hidden"),o.hidden=!0}),$.appendChild(nn)}),t.appendChild($)}showTooltip(e,t,o,i,n){const r=this._tooltip;if(!r)return;r.textContent="";const a=document.createElement("div");a.className="tooltip-head",a.textContent=n.head,r.appendChild(a);let l=0;for(const h of[...n.visibleIndexes].reverse()){const p=t[h]??0;if(p===0)continue;l++;const g=document.createElement("div");g.className="tooltip-row";const b=document.createElement("span");b.className="swatch",b.dataset.tone=n.series[h].tone??"neutral";const m=document.createElement("span");m.className="tooltip-label",m.textContent=n.series[h].label;const x=document.createElement("span");x.className="tooltip-value",x.textContent=p.toLocaleString(),g.append(b,m,x),r.appendChild(g)}if(l===0){const h=document.createElement("div");h.className="tooltip-row",h.textContent="—",r.appendChild(h)}r.hidden=!1;const u=Y+e*o+o/2;r.style.left=`${Math.max(60,Math.min(u,i-60))}px`}};Gt.props=["heading","series","columns","start","end","hidden-series","legend","empty","height"],Gt.styles=[pp],Gt.help=void 0;let Pi=Gt;w("os-histogram",Pi);const xp=v`:host{--_gap-row:var( --os-ui-facts-row-gap,6px );--_gap-column:var( --os-ui-facts-column-gap,14px );display:block;font-size:var( --os-ui-facts-font-size,13px );min-inline-size:0}:host( [ hidden ] ){display:none}dl{display:grid;grid-template-columns:max-content minmax( 0,1fr );gap:var( --_gap-row ) var( --_gap-column );align-items:var( --os-ui-facts-align,baseline );margin:0}:host( [ layout='between' ] ) dl{display:block}:host( [ layout='between' ] )::slotted( os-fact ){display:flex;justify-content:space-between;gap:var( --_gap-column );margin-block:var( --_gap-row )}:host( [ stacked ] ) dl{display:block}:host( [ stacked ] )::slotted( os-fact ){display:block;margin-block:var( --_gap-row )}`,kp=v`:host{display:contents}:host( [ hidden ] ){display:none}dt{color:var( --os-ui-facts-label-color,var( --os-ui-fg-muted,#646970 ) )}dd{margin:0;overflow-wrap:anywhere}::slotted( os-code ){--os-ui-code-bg:var( --os-ui-facts-code-bg,transparent );--os-ui-code-border:var( --os-ui-facts-code-border,none );--os-ui-code-padding:var( --os-ui-facts-code-padding,0 );--os-ui-code-font-size:var( --os-ui-facts-code-font-size,1em )}`,Xt=class Xt extends _{render(){const e=this.label||"";return c`
${e}
`}};Xt.props=["label"],Xt.styles=[kp],Xt.help=void 0;let Ni=Xt;w("os-fact",Ni);const Zt=class Zt extends _{render(){return c`
`}};Zt.props=["layout"],Zt.styles=[xp],Zt.help={title:"Facts",summary:'Label/value list — a real
whose rows are children. Labels sit in a content-sized column beside their values; `layout="between"` spreads each pair across its own line and `stacked` puts the label above the value.',status:"stable",props:[{name:"layout",type:"'columns' | 'between'",description:"`columns` (default) aligns every value in one column. `between` gives each pair its own line with the value pushed to the far edge."},{name:"stacked",type:"boolean",description:"Label above the value rather than beside it, for a narrow pane."}],slots:[{name:"(default)",description:" children."}],cssProps:[{name:"--os-ui-facts-font-size",default:"13px"},{name:"--os-ui-facts-row-gap",default:"6px"},{name:"--os-ui-facts-column-gap",default:"14px"},{name:"--os-ui-facts-label-color",default:"var(--os-ui-fg-muted, #646970)"},{name:"--os-ui-facts-align",default:"baseline"}],example:c` class-foo.php Plugin: Akismet 1,204 `};let Mi=Zt;w("os-facts",Mi);const $p=v`:host{--_border:var( --os-ui-stat-border,var( --os-ui-border,#dcdcde ) );--_bg:var( --os-ui-stat-bg,transparent );--_value-color:var( --os-ui-stat-value-color,var( --wp-admin-theme-color,#2271b1 ) );--_value-size:var( --os-ui-stat-value-size,20px );--_label-color:var( --os-ui-stat-label-color,var( --os-ui-fg-muted,#646970 ) );display:flex;flex-direction:column;gap:2px;padding:var( --os-ui-stat-padding,10px 12px );border:1px solid var( --_border );border-radius:var( --os-ui-stat-radius,8px );background:var( --_bg );min-inline-size:0}:host( [ hidden ] ){display:none}.value{font-size:var( --_value-size );font-weight:700;line-height:1.1;color:var( --_value-color );font-variant-numeric:tabular-nums}.label{display:inline-flex;align-items:center;gap:6px;font-size:11px;letter-spacing:0.05em;text-transform:uppercase;color:var( --_label-color )}.caption{font-size:11px;color:var( --_label-color )}.swatch{display:inline-block;inline-size:10px;block-size:10px;border-radius:3px;flex:none;background:var( --os-app-tone,var( --os-ui-fg-muted,#646970 ) )}`,Yt=class Yt extends _{render(){const e=this,t=e.caption||"";return c` ${e.value||""} ${this.hasAttribute("swatch")?c``:""} ${e.label||""} ${t?c`${t}`:""} `}};Yt.props=["value","label","caption","swatch"],Yt.styles=[$p],Yt.help=void 0;let zi=Yt;w("os-stat",zi);const Ap=v`:host{display:inline-flex;position:relative;width:var( --os-ui-avatar-size,32px );height:var( --os-ui-avatar-size,32px );flex:0 0 auto;vertical-align:middle;line-height:0;perspective:calc( var( --os-ui-avatar-size,32px ) * 8 );--os-ui-avatar-tilt-x:0deg;--os-ui-avatar-tilt-y:0deg;--os-ui-avatar-hover:0;--os-ui-avatar-glare-x:50%;--os-ui-avatar-glare-y:50%}:host( [ hidden ] ){display:none}.os-avatar__tile{position:relative;width:100%;height:100%;border-radius:50%;overflow:hidden;background:var( --os-window-bg,#f0f0f1 );color:var( --os-ui-fg-on-accent,#fff );display:flex;align-items:center;justify-content:center;font-weight:700;font-size:calc( var( --os-ui-avatar-size,32px ) * 0.48 );line-height:1;letter-spacing:0;font-feature-settings:'tnum' 1;user-select:none;transform-style:preserve-3d;transform:rotateX( var( --os-ui-avatar-tilt-x ) ) rotateY( var( --os-ui-avatar-tilt-y ) ) scale( calc( 1 + var( --os-ui-avatar-hover ) * 0.07 ) );transition:transform 220ms cubic-bezier( 0.2,0.8,0.2,1 ),box-shadow 220ms cubic-bezier( 0.2,0.8,0.2,1 );box-shadow:inset 0 0 0 1px rgba( 255,255,255,calc( 0.18 + 0.22 * var( --os-ui-avatar-hover ) ) ),inset 0 0 0 calc( 1px + var( --os-ui-avatar-hover ) * 1px ) rgba( 0,0,0,calc( 0.08 + 0.04 * var( --os-ui-avatar-hover ) ) ),0 calc( 1px + var( --os-ui-avatar-hover ) * 8px ) calc( 6px + var( --os-ui-avatar-hover ) * 18px ) rgba( 0,0,0,calc( 0.08 + 0.18 * var( --os-ui-avatar-hover ) ) )}.os-avatar__tile::after{content:'';position:absolute;inset:0;border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),var( --os-ui-scrim,rgba( 255,255,255,0.55 ) ) 0%,var( --os-ui-hover,rgba( 255,255,255,0 ) ) 55% );opacity:var( --os-ui-avatar-hover );mix-blend-mode:overlay;pointer-events:none;transition:opacity 220ms cubic-bezier( 0.2,0.8,0.2,1 )}.os-avatar__tile::before{content:'';position:absolute;inset:calc( var( --os-ui-avatar-hover ) * -3px );border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),color-mix( in srgb,var( --os-ui-avatar-halo,rgb( 99,102,241 ) ) calc( 35% * var( --os-ui-avatar-hover ) ),transparent ) 0%,transparent 70% );filter:blur( 4px );pointer-events:none;z-index:-1;transition:inset 220ms cubic-bezier( 0.2,0.8,0.2,1 ),background 220ms}.os-avatar__tile img{width:calc( 100% + 2px );height:calc( 100% + 2px );margin:-1px;object-fit:cover;display:block;transform:translateZ( 1px )}.os-avatar__dot{position:absolute;bottom:0;inset-inline-end:0;width:calc( var( --os-ui-avatar-size,32px ) * 0.32 );height:calc( var( --os-ui-avatar-size,32px ) * 0.32 );min-width:8px;min-height:8px;border-radius:50%;box-sizing:border-box;border:2px solid var( --os-ui-avatar-dot-ring,var( --os-window-bg,#fff ) );background:var( --os-ui-avatar-dot-color,transparent );z-index:2}.os-avatar__dot--online{background:var( --os-ui-success-fg,#00a32a )}.os-avatar__dot--online::after{content:'';position:absolute;inset:-2px;border-radius:50%;border:1px solid var( --os-ui-success-fg,#00a32a );animation:os-avatar-presence 6s var( --os-ui-ease-out,cubic-bezier( 0.22,0.9,0.28,1 ) ) infinite;pointer-events:none}@keyframes os-avatar-presence{0%{opacity:0.6;transform:scale( 1 )}20%{opacity:0;transform:scale( 2.2 )}100%{opacity:0;transform:scale( 2.2 )}}.os-avatar__dot--inactive{background:var( --os-ui-warning-fg,#dba617 )}.os-avatar__dot--offline{background:var( --os-ui-fg-muted,#8c8f94 )}@media ( prefers-reduced-motion:reduce ){.os-avatar__dot--online::after{animation:none;opacity:0.6}.os-avatar__tile{transform:none;transition:box-shadow 200ms}.os-avatar__tile::after,.os-avatar__tile::before{display:none}}`,Ca={xs:20,sm:24,md:40,lg:64,xl:96},Ia=new Set(["online","inactive","offline"]),Jt=class Jt extends _{constructor(){super(...arguments),this._presenceHandler=null,this._imgFailed=!1,this._onPointerMove=null,this._onPointerEnter=null,this._onPointerLeave=null,this._tiltRaf=0,this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%"}connectedCallback(){super.connectedCallback(),this._maybeAttachPresenceListener(),this._attachHoverEffect()}disconnectedCallback(){this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null),this._detachHoverEffect()}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",o=this._attr("alt"),i=o!==null?o:t,n=this._attr("size"),r=this._resolveSize(n),a=this._presenceForRender(),l=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${r}px`);const u=e&&!this._imgFailed?"":this._initialsBg(t),h=e&&!this._imgFailed?c`${i}this._onImgError()} loading="lazy" />`:this._initials(t),p=a?c``:c``;return l?c` ${p} `:c` ${p} `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in Ca)return Ca[e];const t=Number(e);return Number.isFinite(t)&&t>0?t:32}_initials(e){const t=e.trim();return t?Array.from(t)[0]?.toUpperCase()??"?":"?"}_initialsBg(e){const t=sr(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&Ia.has(e)?e:null}_presenceLabel(e){switch(e){case"online":return"Online";case"inactive":return"Inactive";case"offline":return"Offline"}}_onImgError(){this._imgFailed=!0,this.requestUpdate()}_onClick(e){const t=this._attr("user-id"),o={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",o)}_attachHoverEffect(){typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||(this._onPointerEnter=()=>{this.style.setProperty("--os-ui-avatar-hover","1")},this._onPointerLeave=()=>{this.style.setProperty("--os-ui-avatar-hover","0"),this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%",this._flushTilt()},this._onPointerMove=t=>{const o=this.getBoundingClientRect();if(o.width===0||o.height===0)return;const i=(t.clientX-o.left)/o.width-.5,n=(t.clientY-o.top)/o.height-.5,r=14;this._pendingTiltY=`${(i*r).toFixed(2)}deg`,this._pendingTiltX=`${(-n*r).toFixed(2)}deg`;const a=Math.max(0,Math.min(100,(i+.5)*100)),l=Math.max(0,Math.min(100,(n+.5)*100));this._pendingGlareX=`${a.toFixed(1)}%`,this._pendingGlareY=`${l.toFixed(1)}%`,this._tiltRaf||(this._tiltRaf=requestAnimationFrame(()=>this._flushTilt()))},this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("pointermove",this._onPointerMove))}_flushTilt(){this._tiltRaf=0,this.style.setProperty("--os-ui-avatar-tilt-x",this._pendingTiltX),this.style.setProperty("--os-ui-avatar-tilt-y",this._pendingTiltY),this.style.setProperty("--os-ui-avatar-glare-x",this._pendingGlareX),this.style.setProperty("--os-ui-avatar-glare-y",this._pendingGlareY)}_detachHoverEffect(){this._onPointerMove&&(this.removeEventListener("pointermove",this._onPointerMove),this._onPointerMove=null),this._onPointerEnter&&(this.removeEventListener("pointerenter",this._onPointerEnter),this._onPointerEnter=null),this._onPointerLeave&&(this.removeEventListener("pointerleave",this._onPointerLeave),this._onPointerLeave=null),this._tiltRaf&&(cancelAnimationFrame(this._tiltRaf),this._tiltRaf=0)}_maybeAttachPresenceListener(){const e=this._attr("user-id"),t=this._attr("presence"),o=!!e&&!t;o&&!this._presenceHandler?(this._presenceHandler=i=>{const n=i.detail;n&&String(n.userId)===String(e)&&n.newStatus&&Ia.has(n.newStatus)&&this.setAttribute("presence",n.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!o&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};Jt.props=["src","alt","name","size","presence","userId","clickable"],Jt.styles=[Ap],Jt.help=void 0;let Oi=Jt;w("os-avatar",Oi);const Ep=v` ${C} ${_o}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-textarea__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}textarea{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:8px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:var( --_field-radius );font:inherit;font-size:var( --_field-size );line-height:1.45;color:var( --os-ui-fg,#1d2327 );resize:vertical}textarea:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}textarea[ aria-invalid='true' ],textarea[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}textarea[ aria-invalid='true' ]:focus,textarea[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}:host( [ auto-grow ] ) textarea{resize:none;overflow:hidden}`,Qt=class Qt extends _{constructor(){super(...arguments),this._textareaEl=null}connectedCallback(){super.connectedCallback(),He(this)}render(){const e=this._attr("label")||"",t=this._attr("value")??"",o=this._attr("placeholder")||"",i=this._boolAttr("disabled"),n=this._boolAttr("readonly"),r=this._attr("aria-label")||e,a=this._attr("name")||"",l=Number(this._attr("rows"))||3,u=this._attr("maxlength"),h=this._attr("minlength"),p=this._boolAttr("invalid"),b=`${this.id||"os-unnamed"}__field`;return c` ${e?c``:c``} `}_attr(e){return this.getAttribute(e)}_boolAttr(e){return this.getAttribute(e)!==null}_onInput(e){const t=e.target;this._textareaEl=t,this.setAttribute("value",t.value),this.emit("os-input-change",{value:t.value}),this._boolAttr("auto-grow")&&this._autosize(t)}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(!(!this._boolAttr("submit-on-enter")||e.isComposing||e.keyCode===229)&&e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){e.preventDefault();const t=e.target;this.emit("os-submit",{value:t.value})}}_autosize(e){const t=Number(this._attr("max-rows"))||8,o=window.getComputedStyle(e),i=parseFloat(o.fontSize)||13,n=o.lineHeight,r=n==="normal"?i*1.45:parseFloat(n)||i*1.45,a=parseFloat(o.paddingTop)||0,l=parseFloat(o.paddingBottom)||0,u=(parseFloat(o.borderTopWidth)||0)+(parseFloat(o.borderBottomWidth)||0),h=r*t+a+l+u;e.style.height="auto",e.style.overflowY="hidden";const p=e.value?e.scrollHeight+u:r*(Number(this._attr("rows"))||3)+a+l+u,g=Math.min(p,h);e.style.height=`${Math.ceil(g)}px`,e.style.overflowY=p>Math.ceil(h)?"auto":"hidden"}refreshAutosize(){this._textareaEl&&this._boolAttr("auto-grow")&&this._autosize(this._textareaEl)}focusInput(){(this.shadowRoot??this).querySelector("textarea")?.focus()}clear(){this.setAttribute("value","");const t=(this.shadowRoot??this).querySelector("textarea");t&&(t.value="",this._boolAttr("auto-grow")&&this._autosize(t))}};Qt.props=["label","value","placeholder","disabled","readonly","ariaLabel","name","rows","maxlength","minlength","invalid","autoGrow","maxRows","submitOnEnter"],Qt.styles=[Ep],Qt.help=void 0;let Wi=Qt;w("os-textarea",Wi);const Sp=v` ${C}:host{display:inline-flex;max-width:100%;vertical-align:middle}:host( [ hidden ] ){display:none}.os-chip{display:inline-flex;align-items:center;gap:var( --os-ui-chip-gap,4px );padding:var( --os-ui-chip-padding,2px 8px );border-radius:var( --os-ui-chip-radius,999px );font-size:var( --os-ui-chip-font-size,12px );line-height:var( --os-ui-chip-line-height,1.6 );font-weight:var( --os-ui-chip-font-weight,500 );background:var( --os-ui-chip-bg,var( --os-ui-surface,#f0f0f1 ) );color:var( --os-ui-chip-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-chip-border,1px solid transparent );max-width:100%;box-sizing:border-box;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease,transform 0.12s ease,opacity 0.12s ease}:host( [ tone='accent' ] ) .os-chip{background:var( --os-ui-chip-bg,color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 14%,transparent ) );color:var( --os-ui-chip-fg,var( --wp-admin-theme-color,#2271b1 ) )}:host( [ tone='positive' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 30,132,73,0.14 ) );color:var( --os-ui-chip-fg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ tone='warning' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 217,119,6,0.18 ) );color:var( --os-ui-chip-fg,var( --os-ui-warning-fg,#8a4a06 ) )}:host( [ tone='danger' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 214,54,56,0.14 ) );color:var( --os-ui-chip-fg,var( --os-ui-danger-hover,#a02622 ) )}:host( [ pending ] ) .os-chip{opacity:0.65;animation:os-chip-pulse 1.2s ease-in-out infinite}@keyframes os-chip-pulse{0%,100%{opacity:0.55}50%{opacity:0.95}}.os-chip__label{max-width:var( --os-ui-chip-label-max,220px );overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-chip__icon{display:inline-flex;align-items:center;flex-shrink:0}.os-chip__icon::slotted( * ){display:inline-flex}.os-chip__dismiss{appearance:none;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:16px;height:16px;margin-inline-start:2px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer;opacity:0.55;transition:opacity 0.12s ease,background-color 0.12s ease}.os-chip__dismiss:hover,.os-chip__dismiss:focus-visible{opacity:1;background:var( --os-ui-hover,rgba( 0,0,0,0.12 ) );outline:none}.os-chip__dismiss:focus-visible{box-shadow:var( --_holo-focus )}.os-chip__dismiss[ disabled ]{opacity:0.35;cursor:not-allowed}.os-chip__dismiss svg{display:block;width:14px;height:14px}:host( [ disabled ] ) .os-chip{opacity:0.55;cursor:not-allowed}:host( [ size='compact' ] ) .os-chip{padding:var( --os-ui-chip-padding,1px 6px );font-size:var( --os-ui-chip-font-size,11px )}:host( [ selected ] ) .os-chip{position:relative;background:var( --os-ui-chip-bg,var( --os-ui-accent-soft,rgba( 34,113,177,0.14 ) ) );color:var( --os-ui-chip-fg,var( --os-ui-fg,#1d2327 ) )}:host( [ selected ] ) .os-chip::after{content:'';position:absolute;inset:0;border-radius:inherit;padding:1px;background-image:var( --_holo-edge );pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude}`,es=class es extends _{constructor(){super(...arguments),this._onHostKeyDown=e=>{if(this.dismissible!==null&&(e.key==="Backspace"||e.key==="Delete")){if(e.preventDefault(),this.disabled!==null)return;const i=this.label??"";this.emit("os-chip-dismiss",{label:i})}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._onHostKeyDown)}disconnectedCallback(){this.removeEventListener("keydown",this._onHostKeyDown)}render(){const e=this.label??"",t=this.dismissible!==null,o=this.disabled!==null;return c` ${e===""?c``:e} ${t?c` `:c``} `}_onDismiss(e){if(e.stopPropagation(),this.disabled!==null)return;const o=this.label??"";this.emit("os-chip-dismiss",{label:o})}};es.props=["label","tone","size","dismissible","disabled","pending","selected"],es.styles=[Sp],es.help=void 0;let Hi=es;w("os-chip",Hi);const Cp=v`:host{display:inline-flex;max-width:100%}.os-tag-input{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-tag-input-gap,4px );padding:var( --os-ui-tag-input-padding,2px );min-height:24px;max-width:100%}.os-tag-input__chips{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-tag-input-gap,4px );min-width:0}.os-tag-input__add{appearance:none;display:inline-flex;align-items:center;gap:3px;padding:1px 8px;min-height:22px;font:inherit;font-size:11px;font-weight:500;line-height:1;color:var( --os-ui-tag-input-add-fg,var( --os-ui-fg-muted,#50575e ) );background:transparent;border:1px dashed var( --os-ui-tag-input-add-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease}.os-tag-input__add:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) );color:var( --os-ui-tag-input-add-fg-hover,var( --os-ui-fg,#1d2327 ) );border-color:var( --os-ui-tag-input-add-border-hover,var( --os-ui-border-strong,#8c8f94 ) )}.os-tag-input__add:focus-visible{outline:none;border-style:solid;box-shadow:var( --os-ui-focus-ring,0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px #2271b1 )}.os-tag-input__add:disabled{opacity:0.5;cursor:not-allowed}.os-tag-input__add svg{display:block}.os-tag-input__editor{position:relative;display:inline-flex;align-items:center;flex:0 1 auto;min-width:120px}.os-tag-input__input{appearance:none;font:inherit;font-size:var( --os-ui-field-font-size-compact,12px );line-height:1.4;padding:2px 8px;border:1px solid var( --os-ui-tag-input-input-border,var( --os-ui-border,#2271b1 ) );border-radius:999px;background:var( --os-ui-tag-input-input-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-tag-input-input-fg,var( --os-ui-fg,#1d2327 ) );min-width:80px;max-width:240px}.os-tag-input__input:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --os-ui-focus-ring-field,0 0 0 1px #2271b1,0 0 0 4px rgba( 34,113,177,0.18 ) )}.os-tag-input__suggestions{position:absolute;top:calc( 100% + 4px );left:0;min-width:220px;max-width:320px;max-height:240px;overflow-y:auto;padding:4px 0;background:var( --os-ui-tag-input-pop-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-tag-input-pop-fg,var( --os-ui-fg,#1d2327 ) );border:1px solid var( --os-ui-tag-input-pop-border,var( --os-ui-border,#c3c4c7 ) );border-radius:8px;box-shadow:0 6px 16px rgba( 0,0,0,0.08 ),0 1px 2px rgba( 0,0,0,0.06 );z-index:50}.os-tag-input__suggestion-item{display:flex;align-items:center;gap:6px;padding:6px 12px;font-size:13px;cursor:pointer;user-select:none}.os-tag-input__suggestion-item[ aria-selected='true' ]{background:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,transparent );color:var( --wp-admin-theme-color,#2271b1 )}.os-tag-input__suggestion-create{font-style:italic;color:var( --os-ui-tag-input-create-fg,var( --os-ui-fg-muted,#50575e ) );border-top:1px solid var( --os-ui-tag-input-pop-divider,var( --os-ui-border,#f0f0f1 ) )}.os-tag-input__suggestion-create[ aria-selected='true' ]{color:var( --wp-admin-theme-color,#2271b1 )}.os-tag-input__suggestion-empty,.os-tag-input__suggestion-loading{display:flex;align-items:center;gap:8px;padding:8px 12px;font-size:12px;color:var( --os-ui-tag-input-pop-muted,var( --os-ui-fg-muted,#646970 ) )}.os-tag-input__suggestion-spinner{display:inline-block;width:10px;height:10px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;animation:os-tag-input-spin 0.8s linear infinite}@keyframes os-tag-input-spin{to{transform:rotate( 360deg )}}:host( [ disabled ] ) .os-tag-input{opacity:0.6;pointer-events:none}`,ts=class ts extends _{constructor(){super(...arguments),this._value=[],this._suggestions=[],this._suggestionsLoading=!1,this._query="",this._highlight=-1,this._focusedChip=-1,this._onDocumentPointerDown=e=>{!this.isOpen||e.composedPath().includes(this)||this.closeInput()}}get _input(){const e=this.shadowRoot;return e?e.querySelector(".os-tag-input__input"):null}get value(){return this._value}set value(e){this._value=Array.isArray(e)?e.slice():[],this._focusedChip>=this._value.length&&(this._focusedChip=-1),this.requestUpdate()}get suggestions(){return this._suggestions}set suggestions(e){this._suggestions=Array.isArray(e)?e.slice():[],this._highlight=this._suggestions.length>0?0:-1,this._suggestionsLoading=!1,this.requestUpdate()}get suggestionsLoading(){return this._suggestionsLoading}set suggestionsLoading(e){this._suggestionsLoading=!!e,this.requestUpdate()}get query(){return this._query}get isOpen(){return this.open!==null}openInput(){this.isOpen||(this.open="",this._query="",this._highlight=-1,this.emit("os-tag-open",{}),queueMicrotask(()=>{this._input?.focus(),this._emitSuggest("")}))}closeInput(){this.isOpen&&(this.open=null,this._query="",this._suggestions=[],this._highlight=-1,this._suggestionsLoading=!1,this.emit("os-tag-close",{}),this.requestUpdate())}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocumentPointerDown,!0)}disconnectedCallback(){document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0)}render(){const e=this.isOpen,t=this.disabled!==null,o=this.readonly!==null,i=this.removable!==null||this.removable===null&&!o,n=this.creatable!==null,r=this["add-label"]||"Add",a=this.placeholder||"Add a tag…";return c` ${this._renderChips(i,t)} ${this._renderTrailing({isOpen:e,readonly:o,disabled:t,placeholder:a,creatable:n,addLabel:r})} `}_renderTrailing(e){return e.isOpen?this._renderEditor(e.placeholder,e.creatable):e.readonly||e.disabled?c``:this._renderTrigger(e.addLabel)}_renderChips(e,t){const o=this._value;return o.length===0?c``:c` ${o.map((i,n)=>{const r=i.tone??"neutral";return c` this._onChipDismiss(a,i)} @focus=${()=>this._focusedChip=n} > `})} `}_renderTrigger(e){const t=this.disabled!==null;return c` `}_renderEditor(e,t){const o=this._suggestions.length>0||this._suggestionsLoading||t&&this._query.trim().length>0;return c` =0?`os-tag-suggestion-${this._highlight}`:""} @input=${i=>this._onInput(i)} @keydown=${i=>this._onInputKeyDown(i)} @blur=${i=>this._onInputBlur(i)} /> ${o?this._renderSuggestions(t):c``} `}_renderSuggestions(e){const t=this._query.trim(),o=this._suggestions,i=e&&t.length>0&&!o.some(n=>n.label.toLowerCase()===t.toLowerCase())&&!this._value.some(n=>n.label.toLowerCase()===t.toLowerCase());return c`
${this._suggestionsLoading?c`
Searching…
`:c``} ${o.length===0&&!this._suggestionsLoading&&!i?c`
${t.length>0?"No matches.":"Type to search."}
`:c``} ${o.map((n,r)=>{const a=r===this._highlight;return c`
{l.preventDefault(),this._addSuggestion(n,!1)}} @mouseenter=${()=>{this._highlight=r,this.requestUpdate()}} > ${n.label}
`})} ${i?c`
{n.preventDefault(),this._addSuggestion({label:t},!0)}} @mouseenter=${()=>{this._highlight=o.length,this.requestUpdate()}} > Create "${t}"
`:c``}
`}_onChipDismiss(e,t){e.stopPropagation(),this.emit("os-tag-remove",{tag:t})}_onInput(e){const t=e.target.value;this._query=t,this._emitSuggest(t)}_emitSuggest(e){const t=parseInt(this["min-query"]||"0",10)||0;if(e.length0&&!o.some(a=>a.label.toLowerCase()===i.toLowerCase())&&!this._value.some(a=>a.label.toLowerCase()===i.toLowerCase()),r=o.length+(n?1:0);switch(e.key){case"ArrowDown":{if(r===0)return;e.preventDefault(),this._highlight=this._highlight+1>=r?0:this._highlight+1,this.requestUpdate();return}case"ArrowUp":{if(r===0)return;e.preventDefault(),this._highlight=this._highlight<=0?r-1:this._highlight-1,this.requestUpdate();return}case"Enter":{if(e.preventDefault(),this._highlight>=0&&this._highlight0){this._addSuggestion({label:i},!0);return}return}case"Escape":{e.preventDefault(),this.closeInput();return}case"Backspace":{if(this._query===""&&this._value.length>0){e.preventDefault();const a=this._value.length-1;this._focusedChip===a?(this.emit("os-tag-remove",{tag:this._value[a]}),this._focusedChip=-1):(this._focusedChip=a,this.requestUpdate())}return}default:this._focusedChip!==-1&&(this._focusedChip=-1)}}_onInputBlur(e){queueMicrotask(()=>{this.shadowRoot?.activeElement||this.closeInput()})}_addSuggestion(e,t){if(this._value.some(i=>i.label.toLowerCase()===e.label.toLowerCase())){this._query="",this._highlight=-1,this._suggestions=[],this.requestUpdate(),this._input?.focus();return}this.emit("os-tag-add",{tag:e,isNew:t}),this._query="",this._highlight=-1,this._suggestions=[],this._suggestionsLoading=!1,this.requestUpdate(),queueMicrotask(()=>{this._input?.focus()})}};ts.props=["name","label","placeholder","add-label","creatable","removable","disabled","readonly","size","min-query","open"],ts.styles=[Cp],ts.help=void 0;let Ui=ts;w("os-tag-input",Ui);function Ip(){return N("plus",{size:14})}const Rp=v`:host{display:block;container-type:inline-size;container-name:os-form;font-size:13px;color:var( --os-ui-fg,#1d2327 )}:host( [ hidden ] ){display:none}.header{margin:0 0 18px}.header:empty{display:none}.fields{display:grid;grid-template-columns:1fr;gap:14px 16px;margin:0 0 18px}@container os-form ( min-width:480px ){.fields{grid-template-columns:repeat( 2,minmax( 0,1fr ) )}}@container os-form ( min-width:760px ){:host( [ columns="3" ] ) .fields{grid-template-columns:repeat( 3,minmax( 0,1fr ) )}}:host( [ columns="1" ] ) .fields{grid-template-columns:1fr}:host( [ columns="2" ] ) .fields{grid-template-columns:repeat( 2,minmax( 0,1fr ) )}::slotted( [ full-width ] ){grid-column:1 / -1}::slotted( [ slot ] ){display:contents}.error{margin:0 0 14px;padding:10px 12px;border-radius:6px;background:var( --os-ui-notice-error-bg,rgba( 179,45,46,0.10 ) );color:var( --os-ui-danger-hover,#b32d2e );font-size:13px;line-height:1.4}.error[ hidden ]{display:none}.footer{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:flex-end;border-top:1px solid var( --os-ui-border,#dcdcde );padding-top:14px}:host( [ align="start" ] ) .footer{justify-content:flex-start}:host( [ align="stretch" ] ) .footer{justify-content:stretch}:host( [ align="stretch" ] ) .footer .footer-actions{flex:1 1 auto}.footer-leading,.footer-trailing{display:contents}.footer-actions{display:inline-flex;gap:8px;align-items:center;margin-inline-start:auto}:host( [ align="start" ] ) .footer-actions{margin-inline-start:0}:host( [ busy ] ){pointer-events:none}:host( [ busy ] ) .fields{opacity:0.6}:host( [ busy ] ) .footer{pointer-events:auto}.busy-spinner{display:inline-flex;width:14px;height:14px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:os-form-spin 0.7s linear infinite;vertical-align:-2px;margin-inline-end:6px}@keyframes os-form-spin{to{transform:rotate( 360deg )}}@media ( prefers-reduced-motion:reduce ){.busy-spinner{animation-duration:2s}}`;function Ra(s){if(s===null||typeof s!="object")return s;try{return structuredClone(s)}catch{return s}}const ss=class ss extends _{constructor(){super(...arguments),this._initial=new Map,this._captured=!1,this._fieldChangeListener=null,this._enterSubmitListener=null}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._captureInitialValues()),this._fieldChangeListener=e=>this._onAnyFieldInput(e),this.addEventListener("os-input-change",this._fieldChangeListener),this.addEventListener("os-input-commit",this._fieldChangeListener),this.addEventListener("os-checkbox-change",this._fieldChangeListener),this.addEventListener("os-select-change",this._fieldChangeListener),this.addEventListener("os-range-change",this._fieldChangeListener),this.addEventListener("os-color-change",this._fieldChangeListener),this.addEventListener("change",this._fieldChangeListener),this._enterSubmitListener=()=>this.submit(),this.addEventListener("os-submit",this._enterSubmitListener)}disconnectedCallback(){this._fieldChangeListener&&(this.removeEventListener("os-input-change",this._fieldChangeListener),this.removeEventListener("os-input-commit",this._fieldChangeListener),this.removeEventListener("os-checkbox-change",this._fieldChangeListener),this.removeEventListener("os-select-change",this._fieldChangeListener),this.removeEventListener("os-range-change",this._fieldChangeListener),this.removeEventListener("os-color-change",this._fieldChangeListener),this.removeEventListener("change",this._fieldChangeListener),this._fieldChangeListener=null),this._enterSubmitListener&&(this.removeEventListener("os-submit",this._enterSubmitListener),this._enterSubmitListener=null)}render(){const e=this["submit-label"]||"Submit",t=this["reset-label"]||"Reset",o=this.error||"",i=this.busy!==null,r=this["show-reset"]!=="false";return c`
${o?c``:c``}
${r?c`this.reset()} >${t}`:c``} this.submit()} > ${i?c``:c``} ${e}
`}getValues(){const e={};for(const t of this._namedFields()){const o=t.getAttribute("name");o&&(e[o]=this._readField(t))}return e}setValues(e){for(const[t,o]of Object.entries(e)){const i=this._fieldByName(t);i&&this._writeField(i,o)}}setBusy(e){e?this.setAttribute("busy",""):this.removeAttribute("busy")}setError(e){e?this.setAttribute("error",e):this.removeAttribute("error")}setFieldInvalid(e,t=!0,o=null){const i=this._fieldByName(e);i&&(t?(i.setAttribute("invalid",""),o!==null&&i.setAttribute("error",o)):(i.removeAttribute("invalid"),i.removeAttribute("error")))}clearErrors(){this.setError(null);for(const e of this._namedFields())e.removeAttribute("invalid"),e.removeAttribute("error")}reset(){this.clearErrors();for(const[e,t]of this._initial.entries()){const o=this._fieldByName(e);if(o){if(t.checked!==null){o.checked=t.checked,t.checked?o.setAttribute("checked",""):o.removeAttribute("checked");continue}this._writeField(o,Ra(t.value))}}this.dispatchEvent(new CustomEvent("os-form-reset",{bubbles:!0,composed:!0,detail:{form:this}}))}submit(){if(this.hasAttribute("busy"))return;const e=[];for(const i of this._namedFields()){const n=i.getAttribute("name");if(!n||!i.hasAttribute("required"))continue;const a=this._readField(i);if(a==null||a===""||Array.isArray(a)&&a.length===0){i.setAttribute("invalid","");const u=i.getAttribute("label");e.push(u||n)}}if(e.length>0){const i=e.join(", ");this.setError(`Required: ${i}`);return}const t=this.getValues(),o=new CustomEvent("os-form-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{values:t,form:this}});this.dispatchEvent(o)}_captureInitialValues(){if(this._captured)return;const e=this._namedFields();if(e.length!==0){for(const t of e){const o=t.getAttribute("name");if(!o)continue;const i=t.tagName==="OS-SWITCH"||t.tagName==="OS-CHECKBOX"||t.tagName==="OS-CHECKBOX-LABEL"||t.tagName==="INPUT"&&t.type==="checkbox";this._initial.set(o,{value:Ra(this._readField(t)),checked:i?!!this._readField(t):null})}this._captured=!0}}_namedFields(){return Array.from(this.querySelectorAll("[name]"))}_fieldByName(e){const t=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&");return this.querySelector(`[name="${t}"]`)}_readField(e){const t=e.tagName.toUpperCase();return t==="OS-SWITCH"||t==="OS-CHECKBOX"||t==="OS-CHECKBOX-LABEL"||t==="INPUT"&&e.type==="checkbox"?typeof e.checked=="boolean"?e.checked:e.hasAttribute("checked"):e.value!==void 0&&e.value!==null?e.value:e.getAttribute("value")??""}_writeField(e,t){const o=e.tagName.toUpperCase();if(o==="OS-SWITCH"||o==="OS-CHECKBOX"||o==="OS-CHECKBOX-LABEL"||o==="INPUT"&&e.type==="checkbox"){const r=!!t;e.checked=r,r?e.setAttribute("checked",""):e.removeAttribute("checked");return}if(t!==null&&typeof t=="object"||e.value!==null&&typeof e.value=="object"){e.value=t;return}const n=t==null?"":String(t);e.value=n,e.setAttribute("value",n)}_onAnyFieldInput(e){const t=e.target;if(!t)return;const o=t.getAttribute?.("name");o&&(this.dispatchEvent(new CustomEvent("os-form-input",{bubbles:!0,composed:!0,detail:{name:o,value:this._readField(t),form:this}})),t.hasAttribute("invalid")&&t.removeAttribute("invalid"))}};ss.props=["submit-label","reset-label","error","busy","columns","min-column","show-reset","align"],ss.styles=[Rp],ss.help=void 0;let qi=ss;w("os-form",qi);const Lp=v`: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%}`,La="os-settings-save-lifecycle",Tp=2200,Dp=6e3,os=class os extends _{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(e,t,o){if(super.attributeChangedCallback(e,t,o),(e==="auto"||e==="event")&&(this._removeAutoListener(),this.auto!==null&&this._installAutoListener()),e==="phase"){this._scheduleAutoClear();const i={phase:this.phase??"idle",error:this.error??void 0};this.emit("os-save-status-change",i)}}render(){const e=this.phase??"idle",t=this.mode??"dot",i=(this.error??"")||this._labelForPhase(e);return i?this.setAttribute("title",i):this.removeAttribute("title"),this.setAttribute("aria-live",e==="failed"?"assertive":"polite"),this.setAttribute("role",e==="failed"?"alert":"status"),c` ${t==="pill"?c`${this._labelForPhase(e)}`:c``} `}_renderGlyph(e){return e==="saved"?Pp():e==="failed"?Np():""}_labelForPhase(e){switch(e){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 e=this.event||La;this._docListener=t=>{const o=t.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(e,this._docListener)}_removeAutoListener(){if(!this._docListener)return;const e=this.event||La;document.removeEventListener(e,this._docListener),this._docListener=null}_scheduleAutoClear(){this._autoTimer!==null&&(window.clearTimeout(this._autoTimer),this._autoTimer=null);const e=this.phase??"idle",t=this._autoClearMsFor(e);t<=0||(this._autoTimer=window.setTimeout(()=>{this._autoTimer=null,this.phase="idle"},t))}_autoClearMsFor(e){if(e==="saved"){const t=this["auto-clear-saved-ms"];return parseInt(t||"",10)||Tp}if(e==="failed"){const t=this["auto-clear-failed-ms"];return parseInt(t||"",10)||Dp}return 0}};os.props=["phase","mode","variant","animation","auto","event","error","saving-label","saved-label","idle-label","auto-clear-saved-ms","auto-clear-failed-ms"],os.styles=[Lp],os.help=void 0;let Fi=os;w("os-save-status",Fi);function Pp(){return c` `}function Np(){return c` `}const Mp=v`:host{display:flex;width:100%;min-width:0;max-width:100%;align-items:stretch}.os-cat{display:flex;flex-direction:column;align-items:stretch;gap:4px;padding:var( --os-ui-cat-padding,2px );min-height:24px;max-width:100%;width:100%}.os-cat__chips{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-cat-gap,4px );min-width:0}.os-cat__chains{display:flex;flex-wrap:wrap;gap:4px;min-width:0}.os-cat__viz-host{display:flex;align-items:center;gap:4px;min-width:0;flex:1 1 auto;max-width:100%;min-height:28px;cursor:pointer;position:relative}.os-cat__viz-svg{display:block;width:100%;max-width:100%;min-width:0;overflow:visible;flex:1 1 auto}.os-cat__viz-svg .os-cat-edge{fill:none;stroke:var( --os-ui-cat-edge-color,currentColor );stroke-width:1.25;stroke-linecap:round;opacity:0.55;transition:stroke-width 0.18s ease,opacity 0.18s ease}.os-cat__viz-svg .os-cat-edge[ data-active='true' ]{stroke-width:2;opacity:1}.os-cat__viz-svg .os-cat-node{cursor:pointer;transition:r 0.2s cubic-bezier( 0.34,1.56,0.64,1 ),fill 0.18s ease,stroke-width 0.18s ease,filter 0.18s ease}.os-cat__viz-svg .os-cat-node[ data-selected='true' ]{filter:drop-shadow( 0 0 6px var( --os-ui-cat-node-glow,rgba( 0,0,0,0.18 ) ) )}.os-cat__viz-svg .os-cat-node:hover,.os-cat__viz-svg .os-cat-node:focus-visible{filter:drop-shadow( 0 0 8px var( --os-ui-cat-node-glow,rgba( 0,0,0,0.3 ) ) );outline:none}.os-cat__viz-svg .os-cat-label{font-family:var( --os-ui-font,system-ui,sans-serif );font-size:10.5px;fill:var( --os-ui-cat-label-fg,var( --os-ui-fg,#1d2327 ) );font-weight:500;pointer-events:none;user-select:none}.os-cat__viz-svg .os-cat-label[ data-selected='false' ]{fill:var( --os-ui-cat-label-muted,var( --os-ui-fg-muted,#8c8f94 ) );font-weight:400;font-style:italic}.os-cat__trigger{appearance:none;display:inline-flex;align-items:center;gap:4px;padding:1px 8px;min-height:22px;font:inherit;font-size:11px;font-weight:500;line-height:1;color:var( --os-ui-cat-trigger-fg,var( --os-ui-fg-muted,#50575e ) );background:transparent;border:1px dashed var( --os-ui-cat-trigger-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease}.os-cat__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) );color:var( --os-ui-cat-trigger-fg-hover,var( --os-ui-fg,#1d2327 ) );border-color:var( --os-ui-cat-trigger-border-hover,var( --os-ui-border-strong,#8c8f94 ) )}.os-cat__trigger:focus-visible{outline:none;border-style:solid;box-shadow:0 0 0 2px var( --wp-admin-theme-color,#2271b1 )}.os-cat__trigger svg{display:block}.os-cat__uncategorized{display:inline-flex;align-items:center;gap:4px;padding:1px 10px;min-height:22px;font-size:11px;font-weight:500;line-height:1.6;color:var( --os-ui-cat-uncat-fg,var( --os-ui-fg-muted,#8c8f94 ) );background:transparent;border:1px dashed var( --os-ui-cat-uncat-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;font-style:italic}.os-cat__popover{position:fixed;top:0;left:0;min-width:280px;max-width:360px;max-height:360px;display:flex;flex-direction:column;background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-cat-pop-fg,var( --os-ui-fg,#1d2327 ) );border:1px solid var( --os-ui-cat-pop-border,var( --os-ui-border,#c3c4c7 ) );border-radius:8px;box-shadow:0 6px 16px rgba( 0,0,0,0.08 ),0 1px 2px rgba( 0,0,0,0.06 );z-index:1000}.os-cat__editor{position:relative;display:inline-flex;align-items:center}.os-cat__search{appearance:none;font:inherit;font-size:13px;padding:8px 12px;border:0;border-bottom:1px solid var( --os-ui-cat-pop-divider,var( --os-ui-border,#f0f0f1 ) );background:transparent;color:inherit;outline:none}.os-cat__search:focus{border-bottom-color:var( --wp-admin-theme-color,#2271b1 )}.os-cat__tree{flex:1 1 auto;min-height:0;overflow-y:auto;padding:4px 0}.os-cat__row-block{display:contents}.os-cat__row{display:flex;align-items:center;gap:6px;padding:4px 8px 4px var( --os-ui-cat-row-indent,12px );cursor:pointer;user-select:none;font-size:13px;line-height:1.4;position:relative}.os-cat__row:hover,.os-cat__row[ data-focused='true' ]{background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) )}.os-cat__row[ data-selected='true' ]{color:var( --wp-admin-theme-color,#2271b1 );font-weight:600}.os-cat__row::before{content:'';position:absolute;left:0;top:0;bottom:0;width:var( --os-ui-cat-guide-width,0px );border-left:1px dotted var( --os-ui-cat-guide-color,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) )}.os-cat__expander{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;border:0;background:transparent;color:inherit;cursor:pointer;flex-shrink:0;opacity:0.65}.os-cat__expander:hover{opacity:1}.os-cat__expander svg{display:block;transition:transform 0.12s ease}.os-cat__row[ data-expanded='true' ] .os-cat__expander svg{transform:rotate( 90deg )}.os-cat__expander--placeholder{visibility:hidden}.os-cat__create-row{display:flex;align-items:center;padding:2px 8px 2px var( --os-ui-cat-row-indent,28px );position:relative}.os-cat__create-row::before{content:'';position:absolute;left:0;top:0;bottom:0;width:var( --os-ui-cat-guide-width,0px );border-left:1px dotted var( --os-ui-cat-guide-color,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) )}.os-cat__create-wrap{display:inline-flex;align-items:center;flex:1 1 auto;min-width:0;gap:4px;padding:1px 1px 1px 0;border:1px solid transparent;border-radius:6px;background:transparent;transition:border-color 0.12s ease,background-color 0.12s ease,box-shadow 0.12s ease}.os-cat__create-wrap:hover{border-color:var( --os-ui-border,rgba( 0,0,0,0.12 ) );background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) )}.os-cat__create-wrap:focus-within{border-color:var( --wp-admin-theme-color,#2271b1 );background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) );box-shadow:0 0 0 2px color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 15%,transparent )}.os-cat__create-input{flex:1 1 auto;min-width:0;appearance:none;font:inherit;font-size:var( --os-ui-field-font-size-compact,12px );padding:3px 6px;border:0;background:transparent;color:inherit;outline:none}.os-cat__create-input::placeholder{color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#8c8f94 ) );font-style:italic;opacity:1}.os-cat__create-submit{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;padding:0;border:0;border-radius:4px;background:transparent;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#8c8f94 ) );cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease}.os-cat__create-wrap:focus-within .os-cat__create-submit:not( [ disabled ] ){background:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) )}.os-cat__create-submit:hover:not( [ disabled ] ){filter:brightness( 1.05 )}.os-cat__create-submit[ disabled ]{cursor:default;opacity:0.5}.os-cat__create-submit svg{display:block}.os-cat__create-spinner{display:inline-block;width:12px;height:12px;margin:0 4px;border-radius:50%;border:2px solid var( --wp-admin-theme-color,#2271b1 );border-top-color:transparent;animation:os-cat-spin 0.8s linear infinite;flex-shrink:0}.os-cat__check{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;border:1.5px solid var( --os-ui-cat-check-border,var( --os-ui-border,#8c8f94 ) );border-radius:3px;color:transparent;transition:background-color 0.12s ease,border-color 0.12s ease,color 0.12s ease}.os-cat__row[ data-selected='true' ] .os-cat__check{background:var( --wp-admin-theme-color,#2271b1 );border-color:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) )}.os-cat__check svg{display:block;width:14px;height:14px}.os-cat__label{min-width:0;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-cat__delete{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:18px;height:18px;border:0;border-radius:50%;padding:0;background:transparent;color:var( --os-ui-cat-delete-color,var( --os-ui-danger,#d63638 ) );cursor:pointer;opacity:0;transition:opacity 0.12s ease,background-color 0.12s ease}.os-cat__row:hover .os-cat__delete,.os-cat__row[ data-focused='true' ] .os-cat__delete,.os-cat__delete:focus-visible{opacity:1}.os-cat__delete:hover,.os-cat__delete:focus-visible{background:var( --os-ui-badge-danger-bg,rgba( 214,54,56,0.12 ) )}.os-cat__delete svg{display:block;width:14px;height:14px}.os-cat__match{background:var( --os-ui-search-highlight-bg,rgba( 252,211,77,0.45 ) );border-radius:2px;padding:0 1px}.os-cat__empty,.os-cat__loading{padding:12px;font-size:12px;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#646970 ) );text-align:center}.os-cat__loading-spinner{display:inline-block;width:12px;height:12px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;animation:os-cat-spin 0.8s linear infinite;margin-inline-end:8px;vertical-align:middle}@keyframes os-cat-spin{to{transform:rotate( 360deg )}}.os-cat__footer{padding:8px 12px;font-size:11px;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#646970 ) );border-top:1px solid var( --os-ui-cat-pop-divider,var( --os-ui-border,#f0f0f1 ) );border-radius:10px;background:var( --os-ui-cat-pop-footer-bg,var( --os-ui-surface,#fafafb ) );display:flex;align-items:center;gap:6px;line-height:1.4}.os-cat__footer .dashicons{font-size:14px;width:14px;height:14px;flex-shrink:0}:host( [ disabled ] ) .os-cat{opacity:0.6;pointer-events:none}`,ee="10px",zp=v`:host{display:inline-flex;max-width:100%;align-items:center;min-width:0;font-family:var( --os-ui-font,system-ui,sans-serif );font-size:12px;line-height:1;font-weight:500}.os-crumb-chain{display:inline-flex;flex-wrap:nowrap;align-items:stretch;max-width:100%;min-width:0;min-height:22px;border-radius:999px;overflow:hidden;filter:drop-shadow( 0 1px 1px rgba( 0,0,0,0.06 ) )}.os-crumb{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:22px;padding:2px 12px;background:var( --os-ui-crumb-bg,var( --os-ui-surface,#c3c4c7 ) );color:var( --os-ui-crumb-fg,var( --os-ui-fg,#1d2327 ) );text-align:center;min-width:0;max-width:100%;flex-shrink:1;font-size:12px;font-weight:500;letter-spacing:0.01em;white-space:nowrap;cursor:grab;transition:filter 0.15s ease,transform 0.15s ease,background-color 0.12s ease}.os-crumb:active{cursor:grabbing}.os-crumb:hover{filter:brightness( 1.06 )}.os-crumb__remove{cursor:pointer}.os-crumb--first{padding-inline-end:22px;clip-path:polygon( 0 0,calc( 100% - ${ee} ) 0,100% 50%,calc( 100% - ${ee} ) 100%,0 100% )}.os-crumb--middle{padding-inline:22px;margin-inline-start:calc( -1 * ${ee} );clip-path:polygon( ${ee} 0,calc( 100% - ${ee} ) 0,100% 50%,calc( 100% - ${ee} ) 100%,${ee} 100%,0 50% )}.os-crumb--last{padding-inline-start:22px;padding-inline-end:14px;margin-inline-start:calc( -1 * ${ee} );clip-path:polygon( ${ee} 0,100% 0,100% 100%,${ee} 100%,0 50% )}.os-crumb--solo{padding:2px 12px;border-radius:999px}.os-crumb__label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.4}.os-crumb__remove{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer;opacity:0.65;transition:opacity 0.12s ease,background-color 0.12s ease,transform 0.12s ease}.os-crumb__remove:hover,.os-crumb__remove:focus-visible{opacity:1;background:var( --os-ui-scrim,rgba( 0,0,0,0.22 ) );outline:none;transform:scale( 1.1 )}.os-crumb__remove svg{display:block;width:100%;height:100%}.os-crumb-chain:hover{filter:drop-shadow( 0 2px 3px rgba( 0,0,0,0.12 ) )}:host( [ disabled ] ) .os-crumb-chain{opacity:0.55;pointer-events:none}`,is=class is extends _{constructor(){super(...arguments),this._segments=[]}get segments(){return this._segments}set segments(e){this._segments=Array.isArray(e)?e.slice():[],this.requestUpdate()}render(){const e=this.removable!==null,t=this._segments;return t.length===0?c``:c`
${t.map((o,i)=>{const n=Pa(i,t.length),r=o.color,a=r?`--os-ui-crumb-bg: ${r}; --os-ui-crumb-fg: ${Na(r)};`:"";return c` this._onSegmentClick(l,i,o)} @dragstart=${l=>this._onSegmentDragStart(l,i,o)} > ${o.name} ${e?c` `:c``} `})}
`}_onSegmentDragStart(e,t,o){if(e.target?.closest(".os-crumb__remove")){e.preventDefault();return}const n=this._segments.slice(t);if(e.dataTransfer){const r=Wp(n);document.body.appendChild(r);const a=e.currentTarget?.getBoundingClientRect(),l=a?Math.min(30,a.width/2):16,u=a?Math.min(16,a.height/2):12;e.dataTransfer.setDragImage(r,l,u),requestAnimationFrame(()=>r.remove())}this.emit("os-chain-segment-dragstart",{index:t,id:o.id,segment:o,segments:n,dragEvent:e})}_onSegmentClick(e,t,o){e.target?.closest(".os-crumb__remove")||this.emit("os-chain-segment-click",{index:t,id:o.id,segment:o})}_onRemove(e,t,o){e.stopPropagation(),this.emit("os-chain-remove",{index:t,id:o.id,segment:o})}};is.props=["removable","disabled"],is.styles=[zp],is.help=void 0;let Vi=is;w("os-crumb-chain",Vi);const Op=10;function Wp(s){const e=document.createElement("div");e.style.cssText=["display: inline-flex","align-items: stretch","border-radius: 999px","overflow: hidden","filter: drop-shadow( 0 1px 2px rgba( 0, 0, 0, 0.18 ) )",'font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',"font-size: 12px","line-height: 1","font-weight: 500","position: fixed","top: -10000px","left: -10000px","pointer-events: none","z-index: 2147483647"].join("; ");const t=s.length,o=Hp();return s.forEach((i,n)=>{const r=document.createElement("span"),a=i.color??o.bg,l=i.color?Na(i.color):o.fg,u=Pa(n,t),h=["display: inline-flex","align-items: center","justify-content: center","min-height: 22px",`background: ${a}`,`color: ${l}`,"white-space: nowrap","box-sizing: border-box","letter-spacing: 0.01em"],p=Op;u==="solo"?h.push("padding: 2px 12px","border-radius: 999px"):u==="first"?h.push("padding: 2px 22px 2px 12px",`clip-path: polygon( 0 0, calc( 100% - ${p}px ) 0, 100% 50%, calc( 100% - ${p}px ) 100%, 0 100% )`):u==="middle"?h.push("padding: 2px 22px",`margin-inline-start: -${p}px`,`clip-path: polygon( ${p}px 0, calc( 100% - ${p}px ) 0, 100% 50%, calc( 100% - ${p}px ) 100%, ${p}px 100%, 0 50% )`):h.push("padding: 2px 14px 2px 22px",`margin-inline-start: -${p}px`,`clip-path: polygon( ${p}px 0, 100% 0, 100% 100%, ${p}px 100%, 0 50% )`),r.style.cssText=h.join("; "),r.textContent=i.name,e.appendChild(r)}),e}const Ta="rgba( 0, 0, 0, 0.08 )",Da="#1d2327";function Hp(){if(typeof document>"u"||!document.body)return{bg:Ta,fg:Da};const s=getComputedStyle(document.body);return{bg:s.getPropertyValue("--os-ui-crumb-bg").trim()||Ta,fg:s.getPropertyValue("--os-ui-crumb-fg").trim()||Da}}function Pa(s,e){return e===1?"solo":s===0?"first":s===e-1?"last":"middle"}let Fe=null;function Na(s){Fe||(Fe=document.createElement("canvas"),Fe.width=1,Fe.height=1);const e=Fe.getContext("2d",{willReadFrequently:!0});if(!e)return"#1d2327";try{e.clearRect(0,0,1,1),e.fillStyle=s,e.fillRect(0,0,1,1);const t=e.getImageData(0,0,1,1).data,o=t[3]/255,i=t[0]*o+255*(1-o),n=t[1]*o+255*(1-o),r=t[2]*o+255*(1-o),a=u=>{const h=u/255;return h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4)};return .2126*a(i)+.7152*a(n)+.0722*a(r)>.55?"#1d2327":"#fff"}catch{return"#1d2327"}}function Up(){return N("close",{size:null})}const Ma="uncategorized",qp=1;function Ns(s){return s.id===qp?!0:(s.name||"").toLowerCase()===Ma}const ns=class ns extends _{constructor(){super(...arguments),this._items=[],this._value=[],this._query="",this._collapsed=new Set,this._focusedRow=-1,this._creatingValues=new Map,this._creatingPending=new Set,this._onCellClick=e=>{if(e.target?.closest(".os-cat-node")||this.isOpen)return;const o=this.disabled!==null,i=this.readonly!==null;o||i||this.openPicker()},this._onDocPointerDown=e=>{!this.isOpen||e.composedPath().includes(this)||this.closePicker()},this._onLayoutChange=()=>{this.isOpen&&this.closePicker()},this._onDocKeydown=e=>{this.isOpen&&e.key==="Escape"&&(e.preventDefault(),this.closePicker())}}get items(){return this._items}set items(e){this._items=Array.isArray(e)?e.slice():[],this.requestUpdate()}get value(){return this._value}set value(e){this._value=Array.isArray(e)?e.slice():[],this.requestUpdate()}get isOpen(){return this.open!==null}openPicker(){this.isOpen||(this.open="",this._query="",this._focusedRow=0,this.emit("os-categories-open",{}),queueMicrotask(()=>{this._positionPopover(),this._searchInput?.focus()}))}closePicker(){this.isOpen&&(this.open=null,this._query="",this._focusedRow=-1,this.emit("os-categories-close",{}),this.requestUpdate())}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocPointerDown,!0),document.addEventListener("keydown",this._onDocKeydown,!0),window.addEventListener("resize",this._onLayoutChange,{passive:!0}),window.addEventListener("scroll",this._onLayoutChange,{passive:!0,capture:!0})}disconnectedCallback(){document.removeEventListener("pointerdown",this._onDocPointerDown,!0),document.removeEventListener("keydown",this._onDocKeydown,!0),window.removeEventListener("resize",this._onLayoutChange),window.removeEventListener("scroll",this._onLayoutChange,{capture:!0})}get _searchInput(){return this.shadowRoot?.querySelector(".os-cat__search")??null}render(){const e=this.isOpen,t=this.disabled!==null,o=this.readonly!==null,i=this.loading!==null,n=this["add-label"]||"Categorize",r=this.placeholder||"Search categories…",a=Math.max(0,parseInt(this["max-visible"]||"2",10)||2);return c` ${this._renderChipRow(a,o,t,n)} ${e?this._renderPopover(r,i):c``} `}_renderChipRow(e,t,o,i){const n=this._selectedItemsInOrder();if(n.length===0)return c` ${"Uncategorized"} `;const r=this._buildChains(n);return c`
${r.map(a=>this._renderChain(a,t,o))}
`}_buildChains(e){const t=new Map;for(const a of this._items)t.set(a.id,a);const o=new Set(e.map(a=>a.id)),i=a=>{for(const l of o){if(l===a)continue;let u=t.get(l),h=16;for(;u&&h-- >0;){if(u.parent===a)return!0;if(!u.parent)break;u=t.get(u.parent)}}return!1},n=e.filter(a=>!i(a.id)),r=[];for(const a of n){const l=[];let u=a,h=16;for(;u&&h-- >0&&((u===a||o.has(u.id))&&l.unshift(u),!!u.parent);)u=t.get(u.parent);const p=l.map(g=>({id:g.id,name:g.name}));r.push({id:a.id,segments:p})}return r}_renderChain(e,t,o){const i=!t&&!o,n=a=>{a.stopPropagation();const l=a.detail,u=typeof l?.index=="number"?l.index:e.segments.length-1,h=new Set;for(const g of e.segments.slice(u))typeof g.id=="number"&&h.add(g.id);const p=this._value.filter(g=>!h.has(g));p.length!==this._value.length&&this.emit("os-categories-change",{value:p})},r=document.createElement("os-crumb-chain");return r.segments=e.segments,i&&r.setAttribute("removable",""),r.addEventListener("os-chain-remove",n),c`
${r}
`}_renderPopover(e,t){const o=this._buildTree(),i=this._filterTree(o,this._query),n=this._flattenForDisplay(i);return this._focusedRow>=n.length&&(this._focusedRow=n.length>0?n.length-1:-1),c` `}_renderTreeBody(e,t){return e?c`
${"Loading categories…"}
`:t.length===0?c`
${this._items.length===0?"No categories yet — create one in WordPress to assign.":"No matches."}
`:t.map((o,i)=>this._renderRow(o,i,t.length))}_renderRow(e,t,o){const{node:i,hasChildren:n}=e,r=this._value.includes(i.item.id),a=!this._collapsed.has(i.item.id),l=12+i.depth*16,u=i.depth>0?i.depth*16:0,h=t===this._focusedRow;return c`
{this._focusedRow=t,this.requestUpdate()}} @click=${p=>{p.preventDefault(),this._toggleSelection(i.item.id)}} > ${n?c``:c``} ${this._highlight(i.item.name,this._query)} ${Ns(i.item)?c``:c``}
${a&&!Ns(i.item)?this._renderCreateRow(i.item.id,12+(i.depth+1)*16,(i.depth+1)*16,i.item.name):c``}
`}_renderCreateRow(e,t,o,i){const n=this._creatingValues.get(e)??"",r=this._creatingPending.has(e),a=e===0?"Add new category…":`Add child of "${i}"…`;return c`
l.stopPropagation()} >
this._onCreateInput(l,e)} @keydown=${l=>this._onCreateKeydown(l,e)} /> ${r?c``:c``}
`}_onCreateInput(e,t){const o=e.target.value;o===""?this._creatingValues.delete(t):this._creatingValues.set(t,o),this.requestUpdate()}_onCreateKeydown(e,t){if(e.key==="Escape"){e.preventDefault(),this._creatingValues.delete(t),this.requestUpdate();return}e.key==="Enter"&&(e.preventDefault(),this._submitCreate(t))}_submitCreate(e){const t=(this._creatingValues.get(e)??"").trim();!t||this._creatingPending.has(e)||(this._creatingPending.add(e),this.requestUpdate(),this.emit("os-categories-create",{name:t,parent:e}))}endCreating(e=0){this._creatingPending.delete(e),this._creatingValues.delete(e),this.requestUpdate()}failCreating(e=0,t){this._creatingPending.delete(e),this.requestUpdate()}_buildTree(){const e=new Map;for(const n of this._items)e.set(n.id,{item:n,children:[],depth:0});const t=[];for(const n of e.values()){const r=n.item.parent;r&&e.has(r)?e.get(r).children.push(n):t.push(n)}const o=(n,r)=>{n.depth=r;for(const a of n.children)o(a,r+1)};for(const n of t)o(n,0);const i=n=>{n.sort((r,a)=>{const l=Ns(r.item),u=Ns(a.item);return l!==u?l?-1:1:r.item.name.localeCompare(a.item.name)});for(const r of n)i(r.children)};return i(t),t}_filterTree(e,t){const o=t.trim().toLowerCase();if(!o)return e;const i=n=>{if(n.item.name.toLowerCase().includes(o))return{item:n.item,children:n.children.slice(),depth:n.depth};const a=n.children.map(i).filter(l=>l!==null);return a.length>0?{item:n.item,children:a,depth:n.depth}:null};return e.map(i).filter(n=>n!==null)}_flattenForDisplay(e){const t=[],o=this._query.trim()!=="",i=n=>{for(const r of n)t.push({node:r,visible:!0,hasChildren:r.children.length>0}),!(this._collapsed.has(r.item.id)&&!o)&&r.children.length>0&&i(r.children)};return i(e),t}_selectedItemsInOrder(){const e=new Map;for(const i of this._items)e.set(i.id,i);const t=[],o=[];for(const i of this._value){const n=e.get(i);n&&(n.name.toLowerCase()===Ma||n.id===1?o.push(n):t.push(n))}return t.length>0?t:o.length>0?[]:t}_highlight(e,t){const o=t.trim();if(!o)return e;const i=e.toLowerCase(),n=o.toLowerCase(),r=i.indexOf(n);return r===-1?e:c`${e.slice(0,r)}${e.slice(r,r+o.length)}${e.slice(r+o.length)}`}_toggleSelection(e){const t=this._value.includes(e)?this._value.filter(o=>o!==e):[...this._value,e];this.emit("os-categories-change",{value:t})}_onDeleteClick(e,t){e.stopPropagation(),e.preventDefault(),this.emit("os-categories-delete",{id:t.id,name:t.name})}_toggleExpand(e){this._collapsed.has(e)?this._collapsed.delete(e):this._collapsed.add(e),this.requestUpdate()}_onSearchInput(e){this._query=e.target.value,this._focusedRow=0,this.requestUpdate()}_onSearchKeydown(e,t){switch(e.key){case"ArrowDown":{if(t.length===0)return;e.preventDefault(),this._focusedRow=this._focusedRow+1>=t.length?0:this._focusedRow+1,this.requestUpdate(),this._scrollFocusedIntoView();return}case"ArrowUp":{if(t.length===0)return;e.preventDefault(),this._focusedRow=this._focusedRow<=0?t.length-1:this._focusedRow-1,this.requestUpdate(),this._scrollFocusedIntoView();return}case"ArrowRight":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const o=t[this._focusedRow];o.hasChildren&&this._collapsed.has(o.node.item.id)&&(e.preventDefault(),this._toggleExpand(o.node.item.id));return}case"ArrowLeft":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const o=t[this._focusedRow];o.hasChildren&&!this._collapsed.has(o.node.item.id)&&(e.preventDefault(),this._toggleExpand(o.node.item.id));return}case"Enter":case" ":{if(this._focusedRow<0||this._focusedRow>=t.length)return;e.preventDefault();const o=t[this._focusedRow];this._toggleSelection(o.node.item.id);return}case"Escape":e.preventDefault(),this.closePicker()}}_scrollFocusedIntoView(){queueMicrotask(()=>{const e=this.shadowRoot?.querySelector(".os-cat__tree");if(!e)return;const t=e.querySelector('.os-cat__row[data-focused="true"]');if(!t)return;const o=t.getBoundingClientRect(),i=e.getBoundingClientRect();o.topi.bottom&&t.scrollIntoView({block:"nearest"})})}_positionPopover(){const e=this.shadowRoot?.querySelector(".os-cat__popover");if(!e)return;const t=this.getBoundingClientRect(),o=e.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,r=8;let a=t.bottom+4;const l=a+o.height+r>n,u=t.top-4-o.height>=r;l&&u?a=t.top-4-o.height:l&&(a=Math.max(r,n-o.height-r));let h=t.left;h+o.width+r>i&&(h=t.right-o.width),h=Math.max(r,Math.min(h,i-o.width-r)),e.style.top=`${a}px`,e.style.left=`${h}px`}};ns.props=["placeholder","add-label","disabled","readonly","open","loading","max-visible"],ns.styles=[Mp],ns.help=void 0;let ji=ns;w("os-category-picker",ji);function za(){return N("chevron-right",{size:14})}function Fp(){return N("plus",{size:16})}function Vp(){return N("check",{size:null})}function jp(){return N("close",{size:null})}const Kp=v` ${C} ${ks}:host(:not( [ interactive ] ) ) .os-holo-glint,:host( [ disabled ] ) .os-holo-glint{display:none}:host{display:flex;flex-direction:column;position:relative;gap:var( --os-ui-card-gap,12px );padding:var( --os-ui-card-padding,16px );border:1px solid var( --os-ui-card-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );border-radius:var( --os-ui-card-radius,12px );background:var( --os-ui-card-bg,var( --os-ui-surface,#fff ) );background-image:var( --os-ui-panel-bg-image,none );background-repeat:var( --os-ui-panel-bg-image-repeat,repeat );background-size:var( --os-ui-panel-bg-image-size,auto );background-position:var( --os-ui-panel-bg-image-position,center );color:var( --os-ui-card-fg,inherit );box-sizing:border-box;min-width:0;transition:transform 180ms ease,box-shadow 180ms ease,border-color 180ms ease}:host( [ hidden ] ){display:none}:host( [ compact ] ){padding:var( --os-ui-card-padding-compact,10px );gap:var( --os-ui-card-gap-compact,6px );border-radius:var( --os-ui-card-radius-compact,8px )}:host( [ interactive ] ){cursor:pointer;outline-offset:2px}:host( [ interactive ]:hover ),:host( [ interactive ]:focus-visible ){transform:translateY( -2px );box-shadow:var( --os-ui-card-shadow-hover,0 4px 16px rgba( 0,0,0,0.08 ) );border-color:var( --os-ui-card-border-hover,var( --os-ui-border-strong,rgba( 0,0,0,0.16 ) ) )}:host( [ interactive ]:focus-visible ){outline:none;box-shadow:var( --_holo-focus )}:host( [ selected ] ){border-color:var( --os-ui-card-border-selected,var( --wp-admin-theme-color,#2271b1 ) );box-shadow:var( --os-ui-card-shadow-selected,0 0 0 1px var( --wp-admin-theme-color,#2271b1 ) inset )}:host( [ selected ] )::after{content:'';position:absolute;inset:-1px;border-radius:inherit;padding:1px;background-image:var( --_holo-edge );pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude}:host( [ disabled ] ){opacity:0.55;pointer-events:none;cursor:not-allowed}@media ( prefers-reduced-motion:reduce ){:host{transition:none}:host( [ interactive ]:hover ),:host( [ interactive ]:focus-visible ){transform:none}}::slotted( header ){display:flex;align-items:center;gap:12px;min-width:0}::slotted( footer ){display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:auto}`,Oa="[data-noclick]",rs=class rs extends _{constructor(){super(...arguments),this._onClick=e=>{!this.hasAttribute("interactive")||this.hasAttribute("disabled")||e.target?.closest(Oa)||this._emitCardClick(e)},this._onKeyDown=e=>{if(!this.hasAttribute("interactive")||this.hasAttribute("disabled")||e.key!=="Enter"&&e.key!==" "&&e.key!=="Spacebar")return;const t=e.target;t&&t!==this&&t.closest(Oa)||t instanceof HTMLElement&&t!==this&&(t.tagName==="BUTTON"||t.tagName==="A"||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")||(e.preventDefault(),this._emitCardClick(e))}}connectedCallback(){super.connectedCallback(),this._syncRoles(),this.addEventListener("click",this._onClick),this.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){this.removeEventListener("click",this._onClick),this.removeEventListener("keydown",this._onKeyDown)}render(){return this._syncRoles(),c``}_syncRoles(){const e=this.hasAttribute("interactive"),t=this.hasAttribute("disabled");e?(this.hasAttribute("role")||this.setAttribute("role","button"),this.setAttribute("tabindex",t?"-1":"0"),this.setAttribute("aria-disabled",t?"true":"false")):(this.removeAttribute("role"),this.removeAttribute("tabindex"),this.removeAttribute("aria-disabled"))}_emitCardClick(e){this.dispatchEvent(new CustomEvent("os-card-click",{detail:{originalEvent:e},bubbles:!0,composed:!0}))}};rs.props=["interactive","selected","compact","disabled"],rs.styles=[Kp],rs.help=void 0;let Ki=rs;w("os-card",Ki);const Bp=v`:host{display:block;--_track:var( --os-ui-rating-track,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_fill:var( --os-ui-rating-fill,linear-gradient( 90deg,#f5af00 0%,#ffd245 100% ) );--_star:var( --os-ui-rating-star,#f5af00 );--_star-empty:var( --os-ui-rating-star-empty,var( --os-ui-fg-faint,rgba( 0,0,0,0.18 ) ) );--_surface:var( --os-ui-rating-surface,var( --os-ui-surface-elevated,rgba( 255,255,255,0.7 ) ) );--_border:var( --os-ui-rating-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_fg:var( --os-ui-rating-fg,var( --os-ui-fg,inherit ) );--_fg-muted:var( --os-ui-rating-fg-muted,var( --os-ui-fg-muted,#666 ) )}:host( [ hidden ] ){display:none}.summary-card{display:grid;grid-template-columns:minmax( 140px,180px ) 1fr;gap:28px;align-items:center;padding:18px 20px;background:var( --_surface );border:1px solid var( --_border );border-radius:14px;color:var( --_fg )}.summary{display:flex;flex-direction:column;align-items:center;gap:8px;padding-inline-end:20px;border-inline-end:1px solid var( --_border )}.big{font-size:44px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums;letter-spacing:-0.02em;color:var( --_fg )}.stars{display:inline-flex;gap:2px;color:var( --_star )}.stars svg{width:16px;height:16px;display:block}.stars .empty{color:var( --_star-empty )}.total{font-size:12px;color:var( --_fg-muted )}.bars{display:grid;gap:6px;min-width:0}.row{display:grid;grid-template-columns:42px 1fr 60px;gap:12px;align-items:center;font-size:12.5px;color:var( --_fg-muted )}.row__label{display:inline-flex;align-items:center;gap:4px;font-variant-numeric:tabular-nums;font-weight:600}.row__label svg{width:11px;height:11px;color:var( --_star )}.row__track{position:relative;height:10px;background:var( --_track );border-radius:999px;overflow:hidden}.row__fill{position:absolute;inset:0;background:var( --_fill );border-radius:999px;transform-origin:left center;transform:scaleX( var( --ratio,0 ) );transition:transform 600ms cubic-bezier( 0.2,0.8,0.2,1 )}:host(:dir( rtl ) ) .row__fill,:host-context( [ dir='rtl' ] ) .row__fill{transform-origin:right center}.row__count{text-align:end;font-variant-numeric:tabular-nums;color:var( --_fg )}@media ( prefers-reduced-motion:reduce ){.row__fill{transition:none}}@media ( max-width:540px ){.summary-card{grid-template-columns:1fr;gap:16px}.summary{padding-inline-end:0;border-inline-end:0;border-block-end:1px solid var( --_border );padding-block-end:14px}}`,as=class as extends _{constructor(){super(...arguments),this._ratings={}}get ratings(){return{...this._ratings}}set ratings(e){this._ratings=e?{...e}:{},this.requestUpdate()}render(){const e=Gp(Wa(this,"rating")),t=e/100*5,o=Wa(this,"total"),i=o>0?o:(this._ratings[5]??0)+(this._ratings[4]??0)+(this._ratings[3]??0)+(this._ratings[2]??0)+(this._ratings[1]??0),n=new Intl.NumberFormat,r=e>0?(e/100*5).toFixed(1):"—";return c` `}};as.props=["rating","total"],as.styles=[Bp],as.help=void 0;let Bi=as;function Wa(s,e){const t=s.getAttribute(e);if(t===null||t==="")return 0;const o=Number(t);return Number.isFinite(o)?o:0}function Gp(s){return s<0?0:s>100?100:s}function Xp(s,e){return e===0?"No ratings yet":`Average rating ${(s/100*5).toFixed(1)} out of 5, from ${e} ratings`}function Zp(s){const e=Math.floor(s),t=s-e>=.5?1:0,o=5-e-t,i=[];for(let n=0;n