PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.10
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.10
1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 All 34 releases
desktop-mode / assets / js / apps / os-settings.min.js

os-settings.min.js in OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin 1.1.10, at assets/js/apps/os-settings.min.js

2,428 lines 508.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var openStationApp_osSettings=function(Ts){"use strict";const Oa="desktop-mode";function Bi(){return window.wp?.i18n}function d(s,e=Oa){return Bi()?.__(s,e)??s}function V(s,...e){const t=Bi()?.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 Wa="desktop-mode-os-settings",Ds=1920,Ps=1080,Ha=40,Ua=300,as="custom-gradient",ie="custom-image",qa="galaxy",Ie="custom",Ki=[{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 Re(){const e=window.wp?.os?.config?.accentColors;if(!Array.isArray(e)||e.length===0)return Ki;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:Ki}function Gi(){const e=window.wp?.os?.config?.defaultWallpaper;return typeof e=="string"&&e!==""?e:qa}const Xi=[{id:"compact",label:"Compact",width:48,icon:18},{id:"default",label:"Default",width:56,icon:20},{id:"large",label:"Large",width:72,icon:26}],Zi=[{id:"sharp",label:"Sharp",value:0},{id:"default",label:"Default",value:8},{id:"round",label:"Round",value:16}],Yi=[{id:"static",label:"Static"},{id:"dynamic",label:"Dynamic"},{id:"hidden",label:"Hidden"}],Ns=[{id:"static",label:"Static"},{id:"dynamic",label:"Dynamic"}],Ji=[{id:"bottom",label:"Bottom"},{id:"left",label:"Left"},{id:"right",label:"Right"}],Fa=[{id:"unified",label:"Unified"},{id:"classic",label:"Split"}],Ms=Wa;function he(){return window.wp?.os}function D(){return he().getOsSettings()}function A(s){he()?.updateOsSettings(s,{windowId:Ms})}function Va(){he()?.resetOsSettings({windowId:Ms})}function Qi(s){return he()?.subscribeOsSettings(s)??(()=>{})}function en(s){const e=he()?.desktopThemes?.applyRecommendedOsSettings(s)??{};return Object.keys(e).length>0}function tn(){try{he()?.refreshMenu?.()}catch{}}function ja(s,e,t="dashicons-admin-settings"){const o=he();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 zs(){return window.openStationConfig??{}}const sn="__openStationSharedStores";function Ba(){const s=window;let e=s[sn];return e||(e=new Map,s[sn]=e),e}function Z(s,e){const t=Ba();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 on="X-WP-Nonce";function Ka(s,e){const t=Ga();if(!t)return e;const o=Xa(s);if(!o||!Za(o))return e;const i=e?.headers??(typeof Request<"u"&&s instanceof Request?s.headers:void 0),n=new Headers(i??{});return n.has(on)?e:(n.set(on,t),{...e??{},headers:n})}function Ga(){if(typeof window>"u")return;const e=window.openStationConfig?.restNonce;return typeof e=="string"&&e.length>0?e:void 0}function Xa(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 Za(s){return typeof window>"u"||!window.location||s.origin!==window.location.origin?!1:!!(s.pathname.includes("/wp-json/")||s.searchParams.has("rest_route"))}function nn(s,e,t={}){const o=window.wp?.os?.fetch;if(typeof o=="function")return o(s,e,t);const i=Ka(s,e);return fetch(s,i)}const rn=Z("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"})),an=rn.state.registry,ln=rn.state.listeners;function Ya(s){return an.get(s)}function Os(){return Array.from(an.values())}function Ja(s){return ln.add(s),()=>{ln.delete(s)}}function cn(){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 pe(s,e,...t){return cn().applyFilters(s,e,...t)}function ge(s,...e){cn().doAction(s,...e)}const U={INIT:"os.init",WALLPAPERS:"os.wallpapers",GAMES:"os.games",UNFOCUS_EFFECTS:"os.unfocus-effects",WINDOW_REVEALS:"os.window-reveals",WALLPAPER_MOUNTING:"os.wallpaper.mounting",WALLPAPER_MOUNTED:"os.wallpaper.mounted",WALLPAPER_UNMOUNTING:"os.wallpaper.unmounting",WALLPAPER_MOUNT_FAILED:"os.wallpaper.mount-failed",WALLPAPER_VISIBILITY:"os.wallpaper.visibility",WALLPAPER_SUSPEND:"os.wallpaper.suspend",WALLPAPER_PREVIEW_PARAMS:"os.wallpaper.preview-params",WALLPAPER_SETTINGS_CHANGED:"os.wallpaper.settings-changed",IFRAME_READY:"os.iframe.ready",IFRAME_ERROR:"os.iframe.error",IFRAME_NETWORK_COMPLETED:"os.iframe.network-completed",SHELL_ERROR:"os.shell.error",BROADCAST:"os.broadcast",MONITOR_ENTRY:"os.monitor.entry",WALLPAPER_SURFACES:"os.wallpaper.surfaces",DESKTOP_THEME_CHANGED:"os.os-theme.changed",DESKTOP_THEME_ICON:"os.os-theme.icon",DESKTOP_THEME_ICON_COLOR:"os.os-theme.icon-color",WALLPAPERS_SERVER_CHANGED:"os.wallpapers.server-changed",EXTENDED_OPTIONS_CHANGED:"os.extended-options.changed",WINDOW_GEOMETRY:"os.window.geometry",WINDOW_OPENED:"os.window.opened",WINDOW_CONTENT_LOADING:"os.window.content-loading",WINDOW_CONTENT_LOADED:"os.window.content-loaded",WINDOW_LOADING_OVERLAY:"os.window.loading-overlay",WINDOW_REOPENED:"os.window.reopened",WINDOW_MENU_OPENED:"os.window.menu-opened",WINDOW_CLOSING:"os.window.closing",WINDOW_CLOSED:"os.window.closed",WINDOW_FOCUSED:"os.window.focused",WINDOW_BLURRED:"os.window.blurred",WINDOW_MINIMIZED:"os.window.minimized",WINDOW_RESTORED:"os.window.restored",WINDOW_CHILD_BLOCKED:"os.window.child-blocked",WINDOW_MAXIMIZED:"os.window.maximized",WINDOW_UNMAXIMIZED:"os.window.unmaximized",WINDOW_FULLSCREEN_ENTERED:"os.window.fullscreen-entered",WINDOW_FULLSCREEN_EXITED:"os.window.fullscreen-exited",WINDOW_AUTO_EXIT_FULLSCREEN:"os.window.auto-exit-fullscreen",WINDOW_FOCUS_ON_DRAG_HOVER:"os.window.focus-on-drag-hover",WINDOW_BOUNDS_CHANGED:"os.window.bounds-changed",WINDOW_MOVED:"os.window.moved",WINDOW_RESIZED:"os.window.resized",WINDOW_DRAG_START:"os.window.drag-start",WINDOW_DRAG_END:"os.window.drag-end",WINDOW_RESIZE_START:"os.window.resize-start",WINDOW_RESIZE_END:"os.window.resize-end",WINDOW_DETACHED:"os.window.detached",WINDOW_RELOADED:"os.window.reloaded",WINDOW_TITLE_CHANGED:"os.window.title-changed",WINDOW_HIGHLIGHT_CHANGED:"os.window.highlight-changed",WINDOW_BODY_RESIZED:"os.window.body-resized",NATIVE_WINDOW_BEFORE_RENDER:"os.native-window.before-render",NATIVE_WINDOW_AFTER_RENDER:"os.native-window.after-render",NATIVE_WINDOW_BEFORE_CLOSE:"os.native-window.before-close",WINDOW_CHROME_THEME:"os.window.chrome.theme",WINDOW_CHROME_CONTROLS:"os.window.chrome.controls",WINDOW_CHROME_SLOT:"os.window.chrome.slot",WINDOW_CHROME_RENDER:"os.window.chrome.render",WINDOW_CHROME_APPLIED:"os.window.chrome.applied",WINDOW_CHROME_THEME_CHANGED:"os.window.chrome.theme-changed",DESKTOP_ICON_CLICKED:"os.os-icon.clicked",DESKTOP_ICONS_RENDERED:"os.os-icons.rendered",ICON_BADGE_CHANGED:"os.icon.badge-changed",COMPONENTS_REGISTERED:"os.components.registered",DOCK_ITEM_APPENDED:"os.dock.item-appended",DOCK_ITEM_REMOVED:"os.dock.item-removed",DOCK_BEFORE_RENDER:"os.dock.before-render",DOCK_AFTER_RENDER:"os.dock.after-render",DOCK_REFRESH_ACTIVE:"os.dock.refresh-active",DOCK_TILE_CLASS:"os.dock.tile-class",DOCK_TILE_ELEMENT:"os.dock.tile-element",DOCK_TILE_RENDERED:"os.dock.tile-rendered",DOCK_TILE_TOOLTIP:"os.dock.tile-tooltip",DOCK_PEEK_CARD_CONTENT:"os.dock.peek-card-content",DOCK_PEEK_CARD_ELEMENT:"os.dock.peek-card-element",CONSTELLATION_PANEL:"os.constellation.panel",CONSTELLATION_OPENED:"os.constellation.opened",CONSTELLATION_CLOSED:"os.constellation.closed",OVERVIEW_ENTERING:"os.overview.entering",OVERVIEW_ENTERED:"os.overview.entered",OVERVIEW_EXITING:"os.overview.exiting",OVERVIEW_EXITED:"os.overview.exited",OVERVIEW_WINDOW_HOVER:"os.overview.window-hover",OVERVIEW_WINDOW_UNHOVER:"os.overview.window-unhover",OVERVIEW_WINDOW_CLICK:"os.overview.window-click",WORK_AREA_CHANGED:"os.work-area.changed",ARRANGE_CASCADE_STARTING:"os.arrange.cascade.starting",ARRANGE_CASCADE_APPLIED:"os.arrange.cascade.applied",ARRANGE_TILE_STARTING:"os.arrange.tile.starting",ARRANGE_TILE_APPLIED:"os.arrange.tile.applied",ARRANGE_TILE_DIMENSIONS:"os.arrange.tile.dimensions",ARRANGE_COLUMNS_STARTING:"os.arrange.columns.starting",ARRANGE_COLUMNS_APPLIED:"os.arrange.columns.applied",ARRANGE_FOCUS_SPLIT:"os.arrange.focus.split",ARRANGE_FOCUS_STARTING:"os.arrange.focus.starting",ARRANGE_FOCUS_APPLIED:"os.arrange.focus.applied",ARRANGE_SNAP_CHANGED:"os.arrange.snap.changed",ARRANGE_SNAP_CELL_SIZE:"os.arrange.snap.cell-size",ARRANGE_CUSTOM_ACTION:"os.arrange.custom-action",POINTER_SHAKE:"os.pointer.shake",GRID_SNAP_DIMENSIONS:"os.grid-snap.dimensions",GRID_SNAP_ARMED:"os.grid-snap.armed",GRID_SNAP_CHANGED:"os.grid-snap.changed",GRID_SNAP_ANCHOR_RESET:"os.grid-snap.anchor-reset",GRID_SNAP_CANCELED:"os.grid-snap.canceled",GRID_SNAP_COMMITTED:"os.grid-snap.committed",GRID_SNAP_REFLOWED:"os.grid-snap.reflowed",SNAP_ZONE_PENDING:"os.snap.zone-pending",SNAP_ZONE_CANCELED:"os.snap.zone-canceled",SNAP_ZONE_COMMITTED:"os.snap.zone-committed",SNAP_SPLIT_FILLED:"os.snap.split-filled",WIDGETS:"os.widgets",WIDGET_MOUNTING:"os.widget.mounting",WIDGET_MOUNTED:"os.widget.mounted",WIDGET_UNMOUNTING:"os.widget.unmounting",WIDGET_MOUNT_FAILED:"os.widget.mount-failed",WIDGET_ADDED:"os.widget.added",WIDGET_REMOVED:"os.widget.removed",DESKTOP_CREATED:"os.os.created",DESKTOP_CLOSED:"os.os.closed",DESKTOP_SWITCHED:"os.os.switched",DESKTOP_RENAMED:"os.os.renamed",WINDOW_DESKTOP_CHANGED:"os.os.window-moved",PRIMARY_DESKTOP_ID:"os.primary-desktop-id",WORKSPACE_PRESETS:"os.workspaces.presets",WORKSPACE_PROFILE:"os.workspaces.profile",WORKSPACE_UPDATED:"os.workspaces.updated",WORKSPACE_PROVISIONED:"os.workspaces.provisioned",WINDOWS_BEFORE_CLOSE_ALL:"os.windows.before-close-all",WINDOWS_CLOSE_ALL:"os.windows.close-all",WINDOWS_AFTER_CLOSE_ALL:"os.windows.after-close-all",COMMAND_BEFORE_RUN:"os.command.before-run",COMMAND_AFTER_RUN:"os.command.after-run",COMMAND_ERROR:"os.command.error",SHELL_RESIZED:"os.shell.resized",SHELL_VISIBILITY:"os.shell.visibility",CONNECTION_OPENED:"os.connection.opened",CONNECTION_CLOSED:"os.connection.closed",CONNECTION_MESSAGE:"os.connection.message",IFRAME_CONNECTION_REQUEST:"os.iframe.connection-request",WINDOW_CONTENT_CHANGED:"os.window-links.content-changed",WINDOW_LINK_GROUPS_CHANGED:"os.window-links.groups-changed",WINDOW_LINKS_CONTENT:"os.window-links.content",WINDOW_LINK_GROUPS:"os.window-links.groups",WINDOW_LINK_EDGES:"os.window-links.edges",RELATED_ENTITIES_ITEMS:"os.related-entities.items",WINDOW_LINK_RENDERERS:"os.window-links.renderers",WINDOW_LINK_RENDERER:"os.window-links.renderer",EDITOR_PREVIEW_WINDOW_CONFIG:"os.editor-preview.window-config",EDITOR_PREVIEW_LIVE:"os.editor-preview.live",EDITOR_PREVIEW_OPENED:"os.editor-preview.opened",EDITOR_PREVIEW_CLOSED:"os.editor-preview.closed",REVISIONS_WINDOW_CONFIG:"os.revisions.window-config",REVISIONS_OPENED:"os.revisions.opened",FILE_DROP_FILES_DETECTED:"os.drop.files-detected",FILE_DROP_FILES_REJECTED:"os.drop.files-rejected",FILE_DROP_DIALOG_FIELDS:"os.drop.dialog-fields",FILE_DROP_BEFORE_UPLOAD:"os.drop.before-upload",FILE_DROP_UPLOAD_STARTED:"os.drop.upload-started",FILE_DROP_UPLOAD_PROGRESS:"os.drop.upload-progress",FILE_DROP_AFTER_UPLOAD:"os.drop.after-upload",FILE_DROP_UPLOAD_FAILED:"os.drop.upload-failed",AUTH_LOST:"os.auth.lost",AUTH_RESTORED:"os.auth.restored",MODE_CHANGED:"os.mode.changed",SESSION_SNAPSHOT:"os.session.snapshot"};function dn(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 Qa 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 Ws(s,e,t){if(e.length!==0)throw new Qa(s,e,t)}const ne=[[0,0],[100,0],[100,100],[0,100]],el=48,tl=80,Hs=6,Us=8,un=4,hn=3,pn=64,qs=105,re=2;function gn(s){return`${Math.round(s*1e3)/1e3}%`}function ae(s){return s.slice().reverse()}function Le(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<o;n++){const r=n/o*Math.PI*2;i.push([s+Math.cos(r)*t,e+Math.sin(r)*t])}return i}function Y(s,e=[]){const t=[],o=i=>{t.push(`${gn(i[0])} ${gn(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 fn(s){return Y(ne,[ae(sl(50,50,s,el))])}function bn(s){return Y(ne,[ae(Le(50-s,-re,50+s,100+re))])}function mn(s){const e=100/Hs,t=[];for(let o=0;o<Hs;o++){const i=o*e;t.push(ae(Le(-re,i,100+re,i+s)))}return Y(ne,t)}function vn(s){return Y(ne,[ae(Le(-re,50-s,100+re,50+s))])}function _n(s){const e=100/Us,t=[];for(let o=0;o<Us;o++){const i=o*e;t.push(ae(Le(i,-re,i+s,100+re)))}return Y(ne,t)}function wn(s){return Y(ne,[ae([[50,50-s],[50+s,50],[50,50+s],[50-s,50]])])}function yn(s){const e=100/un,t=100/hn,o=[];for(let i=0;i<hn;i++)for(let n=0;n<un;n++){const r=n*e+e/2,a=i*t+t/2,l=e/2*s,u=t/2*s;o.push(ae(Le(r-l,a-u,r+l,a+u)))}return Y(ne,o)}function xn(s){const e=-Math.PI/2,t=s/180*Math.PI,o=[[50,50]];for(let i=0;i<pn;i++){const n=e+i/(pn-1)*t;o.push([50+Math.cos(n)*qs,50+Math.sin(n)*qs])}return Y(ne,[ae(o)])}function ol(){return{from:fn(0),to:fn(tl)}}function il(){return{from:bn(0),to:bn(52)}}function nl(){return{from:mn(0),to:mn(100/Hs+.5)}}function rl(){return{from:vn(0),to:vn(52)}}function al(){return{from:_n(0),to:_n(100/Us+.5)}}function ll(){return{from:wn(0),to:wn(qs)}}function cl(){return{from:yn(0),to:yn(1.04)}}function dl(){return{from:xn(0),to:xn(360)}}function ul(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function hl(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function pl(){return{from:Y([[-60,0],[100,0],[100,100],[0,100]]),to:Y([[100,0],[260,0],[260,100],[160,100]])}}const Fs=6,Vs=100,we=Vs/2,ls=200,kn=90,$n=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],gl="#101014",fl=1.25,ye="http://www.w3.org/2000/svg";let bl=0;function cs(s){return Math.round(s*1e3)/1e3}function js(s){return s/Fs*Math.PI*2-Math.PI/2}function ml(s){const t=js(s)+Math.PI/Fs+Math.PI/2;return{x:Math.cos(t),y:Math.sin(t)}}function vl(s){const e=js(s),t=js(s+1);return[[we,we],[we+Math.cos(e)*ls,we+Math.sin(e)*ls],[we+Math.cos(t)*ls,we+Math.sin(t)*ls]]}function An(s,e){const t=vl(s),o=document.createElementNS(ye,"path");return o.setAttribute("d",`M ${t.map(([i,n])=>`${cs(i)} ${cs(n)}`).join(" L ")} Z`),e?o.setAttribute("fill","#fff"):(o.setAttribute("fill",$n[s%$n.length]),o.setAttribute("stroke",gl),o.setAttribute("stroke-width",String(fl)),o.setAttribute("vector-effect","non-scaling-stroke"),o.setAttribute("stroke-linejoin","round")),o}function _l(){const s=`os-iris-${++bl}`,e=document.createElementNS(ye,"svg");e.setAttribute("viewBox",`0 0 ${Vs} ${Vs}`),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(ye,"defs"),o=document.createElementNS(ye,"mask");o.setAttribute("id",s);const i=document.createElementNS(ye,"g"),n=document.createElementNS(ye,"g");n.setAttribute("mask",`url(#${s})`);const r=[];for(let l=0;l<Fs;l++){const u=An(l,!0),h=An(l,!1);i.appendChild(u),n.appendChild(h),r.push({el:u,index:l},{el:h,index:l})}o.appendChild(i),t.appendChild(o),e.appendChild(t),e.appendChild(n);const a=document.createElement("div");return a.appendChild(e),{element:a,play:l=>r.map(({el:u,index:h})=>{const p=ml(h),g=cs(p.x*kn),m=cs(p.y*kn);return u.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${g}px, ${m}px )`}],{duration:l.duration,easing:l.easing,delay:l.delay,fill:"both"})})}}const ds="none",En=Z("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),Bs=En.state.registry,Ks=En.state.listeners,Sn=/^[a-z0-9_/-]+$/;function Cn(s){const e=/^\s*([a-zA-Z-]+)\s*\(/.exec(s);return e?e[1].toLowerCase():""}const wl=0;function In(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=Cn(s.from),r=Cn(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 yl(s){if(typeof KeyframeEffect!="function")return!0;try{return new KeyframeEffect(null,null,{easing:s}),!0}catch{return!1}}function j(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)"):Sn.test(s.id.trim().toLowerCase())?s.id.trim().toLowerCase()===ds&&e.push('id ("none" is reserved)'):e.push(`id (must match ${Sn} — 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(...In(r,`layers[ ${a} ]`))})):e.push(...In(s,"").map(r=>r.replace(/^\./,"")))),s.easing!==void 0&&(typeof s.easing!="string"||s.easing.trim()===""?e.push("easing (not a non-empty string)"):yl(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)"))}Ws("WindowReveal",e,s);const t=s.id.trim().toLowerCase();Bs.set(t,{...s,id:t}),$l()}function Gs(){const s=Array.from(Bs.values()),e=pe(U.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 xl(s){return Bs.has(s)}function kl(s){return Ks.add(s),()=>{Ks.delete(s)}}function $l(){const s=Array.from(Ks);for(const e of s)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] window-reveal registry listener threw:",t)}}j({id:"sweep",label:d("Sweep"),description:d("A straight edge travels across the window, uncovering the page behind it."),...hl(),duration:420}),j({id:"iris",label:d("Iris"),description:d("The page opens out from the centre of the window, like a camera shutter."),...ol(),duration:520}),j({id:"curtain",label:d("Curtain"),description:d("Two panels part from the middle of the window and slide off the sides."),...il(),duration:480}),j({id:"blinds",label:d("Blinds"),description:d("Six horizontal slats retract at once, letting the page through between them."),...nl(),duration:560}),j({id:"diagonal",label:d("Diagonal"),description:d("A slanted edge sweeps off the trailing corner of the window."),...pl(),duration:460}),j({id:"rise",label:d("Rise"),description:d("The page rises into the window from the bottom edge upward."),...ul(),duration:440}),j({id:"shutter",label:d("Shutter"),description:d("Two panels part from the middle of the window and slide off the top and bottom."),...rl(),duration:480}),j({id:"slats",label:d("Slats"),description:d("Eight vertical slats retract at once, letting the page through between them."),...al(),duration:560}),j({id:"diamond",label:d("Diamond"),description:d("The page opens out from the centre of the window through a growing rhombus."),...ll(),duration:520}),j({id:"mosaic",label:d("Mosaic"),description:d("The page arrives as a grid of tiles, each opening out from its own centre."),...cl(),duration:600}),j({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:_l,duration:720,edgeLag:0}),j({id:"radar",label:d("Radar"),description:d("A spoke sweeps a full turn around the centre of the window, uncovering the page behind it."),...dl(),duration:760});const Rn={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},Ln=["dockRailRenderer","windowReveal","accent"],Tn={windowRevealDuration:{min:80,max:4e3}},Al=/^[a-z0-9_-]+$/;[...Object.keys(Rn),...Ln,...Object.keys(Tn)];function Dn(s){if(!s||typeof s!="object"||Array.isArray(s))return{};const e=s,t={},o={};for(const[i,n]of Object.entries(Rn)){const r=e[i];typeof r=="string"&&n.includes(r)&&(t[i]=r)}for(const i of Ln){const n=e[i];typeof n=="string"&&Al.test(n)&&(t[i]=n)}for(const[i,n]of Object.entries(Tn)){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 Pn(s){const e=Dn(s);return typeof e.dockRailRenderer=="string"&&Ya(e.dockRailRenderer)===void 0&&delete e.dockRailRenderer,typeof e.windowReveal=="string"&&e.windowReveal!==ds&&!xl(e.windowReveal)&&delete e.windowReveal,typeof e.accent=="string"&&!Re().some(t=>t.id===e.accent)&&delete e.accent,e}const El=/^[a-z0-9_-]+$/,Nn=128;function Sl(s){return typeof s!="string"||s===""||s.length>2048?!1:s.startsWith("dashicons-")||s.startsWith("https://")||s.startsWith("http://")||s.startsWith("data:image/")}function Mn(s){if(!s||typeof s!="object")return null;const e=s,t=typeof e.slug=="string"?e.slug:"";if(!El.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>=Nn)break;u===""||!Sl(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>=Nn)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:Dn(e.recommendedOsSettings),installedAt:typeof e.installedAt=="number"?e.installedAt:0,source:e.source==="code"?"code":"upload",cssDeferred:e.cssDeferred===!0}}function Cl(){const e=window.openStationConfig?.serverDesktopThemes,t=[];if(Array.isArray(e))for(const o of e){const i=Mn(o);i&&t.push(i)}return{themes:t,activeId:null,activeIcons:null,activeIconColors:null}}const se=Z("desktop-mode/desktop-themes",Cl);function zn(){return se}function Xs(){return se.getState().themes.slice()}function Il(s){if(typeof s!="string"||s==="")return null;const e=s.replace(/\//g,"-");return se.getState().themes.find(t=>t.slug===e||t.id===s)??null}function On(s){const e=Mn(s);if(!e)return null;const t=se.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)),se.setState({themes:t}),e}let Te=null;function Rl(){if(Te)return Te;const s=window.openStationConfig?.desktopThemesUrl;return s?(Te=nn(s,{method:"GET",credentials:"same-origin"},{source:"desktop-mode/desktop-themes"}).then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{for(const t of e?.themes??[])On(t)}).catch(()=>{Te=null}),Te):Promise.resolve()}function Ll(s){const e=se.state.themes.filter(t=>t.slug!==s);e.length!==se.state.themes.length&&se.setState({themes:e})}function Tl(s){return se.subscribe(s)}function Dl(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 Wn(s){if(!s)return 214;let e=5381;for(let t=0;t<s.length;t++)e=Math.imul(e,33)+s.charCodeAt(t);return(e%360+360)%360}function Pl(s){const e=zn().state;if(e.activeIcons===null||!s)return null;const t=e.activeIcons[s];if(typeof t!="string"||t==="")return null;const o=pe(U.DESKTOP_THEME_ICON,t,{slot:s,themeId:e.activeId??""});return typeof o=="string"&&o!==""?o:null}function Nl(s){const e=zn().state;if(e.activeIconColors===null||!s)return null;const t=e.activeIconColors[s];if(typeof t!="string"||t==="")return null;const o=pe(U.DESKTOP_THEME_ICON_COLOR,t,{slot:s,themeId:e.activeId??""});return typeof o=="string"&&o!==""?Ml(o):null}function Ml(s){const e=s.trim();if(e===""||e.length>64||/[;{}<>"'\\]/.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 zl(s){return typeof s!="string"||s===""||s.length>4096||!/^(https?:\/\/|data:image\/)/i.test(s)?!1:!/['"()\\<>\s]/.test(s)}function Hn(s,e,t){if(!zl(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 De={OS_SETTINGS:"OS_SETTINGS",RECYCLE_BIN:"RECYCLE_BIN",BUG_REPORT:"BUG_REPORT",EXIT_OPENSTATION:"EXIT_OPENSTATION",PWA_INSTALL:"PWA_INSTALL"},Ol={"desktop-mode-os-settings":De.OS_SETTINGS,"desktop-mode-recycle-bin":De.RECYCLE_BIN,"desktop-mode-bug-report":De.BUG_REPORT,"os-exit":De.EXIT_OPENSTATION,"os-pwa-install":De.PWA_INSTALL};function Wl(s){if(typeof s!="string"||s==="")return"";const e=Ol[s];if(e)return e;const t=s.toLowerCase().replace(/[^a-z0-9_-]/g,"");return t===""?"":`APP:${t}`}function Un(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 qn=new Map;function Hl(s){const e=qn.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 qn.set(s,t),t}function Ul(){const s=new Set,e=document.querySelectorAll('script[src*="load-scripts.php"]');for(const t of Array.from(e))for(const o of Hl(t.src))s.add(o);return s}const ql=["-js","-js-before","-js-after","-js-extra","-js-translations"];function Fl(s){return s?ql.some(e=>{const t=document.getElementById(s+e);return!!t&&t.tagName==="SCRIPT"}):!1}function Fn(s){return s.url&&Un(s.url)?!0:s.handle?Ul().has(s.handle)||Fl(s.handle):!1}const us=new Map,Vn=new Set;function Zs(s,e){const t=us.get(s);if(t)return t;const o=e?.deps;if(o&&o.length>0){const n=a=>Fn(a)?Promise.resolve():a.url?Zs(a.url,{...a,deps:void 0}):(Vl(a),Promise.resolve()),r=o.reduce((a,l)=>a.then(()=>n(l)),Promise.resolve(void 0)).then(()=>jn(s,e));return us.set(s,r),r}const i=jn(s,e);return us.set(s,i),i}function Vl(s){if(s.handle){if(Vn.has(s.handle))return;Vn.add(s.handle)}for(const e of s.l10n??[])fe(e);for(const e of s.before??[])fe(e);for(const e of s.after??[])fe(e)}function jn(s,e){return new Promise((t,o)=>{const i=`script[data-os-vendor="${jl(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=Un(s);if(r){r.dataset.osVendor=s,r.dataset.loaded="1",t();return}if(Fn({handle:e?.handle})){t();return}e?.translations&&fe(e.translations);for(const l of e?.l10n??[])fe(l);for(const l of e?.before??[])fe(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??[])fe(l);t()},{once:!0}),a.addEventListener("error",()=>{us.delete(s),a.remove(),o(new Error(`Failed to load ${s}`))},{once:!0}),document.head.appendChild(a)})}function fe(s){if(!s)return;const e=document.createElement("script");e.textContent=s,e.dataset.osVendorInline="1",document.head.appendChild(e)}function jl(s){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(s):s.replace(/["\\]/g,"\\$&")}Z("desktop-mode/native-url-remap",()=>({remaps:[],deps:null}));const Bl={core:"rail",plugin:"rail",app:"desktop",control:"rail"};function Kl(s,e){return s==="core"&&e==="classic"?"sidebar":"dock"}function Gl(s,e){return s.locked?"rail":e[s.id]??s.defaultPlacement??Bl[s.kind]}function Xl(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 Zl(){return window.wp?.os??null}function Ys(){return Zl()?.getNavItems?.()??[]}const Js="none",Bn=Z("desktop-mode/unfocus-effect-registry",()=>({registry:new Map,listeners:new Set})),Kn=Bn.state.registry,Qs=Bn.state.listeners,Gn=/^[a-z0-9_/-]+$/;function eo(s){const e=[];!s||typeof s!="object"?e.push("def (not an object)"):(typeof s.id!="string"||s.id.trim()===""?e.push("id (missing)"):Gn.test(s.id.trim().toLowerCase())?s.id.trim().toLowerCase()===Js&&e.push('id ("none" is reserved)'):e.push(`id (must match ${Gn} — 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)")),Ws("UnfocusEffect",e,s);const t=s.id.trim().toLowerCase();Kn.set(t,{...s,id:t}),Jl()}function to(){const s=Array.from(Kn.values()),e=pe(U.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 Yl(s){return Qs.add(s),()=>{Qs.delete(s)}}function Jl(){const s=Array.from(Qs);for(const e of s)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] unfocus-effect registry listener threw:",t)}}eo({id:"darken",label:d("Darken"),description:d("Dim unfocused windows so the focused one stands out."),className:"os-window--fx-darken"}),eo({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"}),eo({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 Xn="none",Zn=Z("desktop-mode/window-link-renderer-registry",()=>({registry:new Map,listeners:new Set})),Ql=Zn.state.registry,Yn=Zn.state.listeners;function so(){const s=Array.from(Ql.values()),e=pe(U.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 ec(s){return Yn.add(s),()=>{Yn.delete(s)}}const Jn=Z("desktop-mode/wallpaper-registry",()=>({seed:[],listeners:new Set})),hs=Jn.state.seed,oo=Jn.state.listeners;function Qn(s){Ws("Wallpaper",dn(s,er),s);const e=hs.findIndex(t=>t.id===s.id);e>=0?hs[e]=s:hs.push(s),sc()}function tc(s){return oo.add(s),()=>{oo.delete(s)}}function sc(){const s=Array.from(oo);for(const e of s)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] wallpaper registry listener threw:",t)}}function xe(){const s=hs.slice(),e=pe(U.WALLPAPERS,s);return Array.isArray(e)?e.filter(oc):(typeof console<"u"&&console.warn("[openstation] `os.wallpapers` filter returned a non-array; falling back to seed list."),s)}function Pe(s){return xe().find(e=>e.id===s)}const er=[{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 oc(s){return dn(s,er).length===0}const ic={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]},nc=["mioApiEnabled","mioShowOnWallpaper","windowLinksEnabled","windowLinkRaiseOnFocus","windowLinkHighlight","showDesktopOnWallpaperClick","showPostStatusRibbons","developerModeEnabled","foldersSharingEnabled","stationHomeEnabled","nativePostsEnabled","nativePagesEnabled","nativeUsersEnabled","nativePluginsEnabled","nativeCommentsEnabled","confirmCloseAllWindows","libraryHdOnly"];function io(){return{...ic,accent:[...Re().map(s=>s.id),"custom"],desktopTheme:["",...Xs().map(s=>s.slug)],wallpaper:xe().map(s=>s.id),dockRailRenderer:Os().map(s=>s.id),unfocusEffect:["none",...to().map(s=>s.id)],windowReveal:["none",...Gs().map(s=>s.id)],windowLinkRenderer:["none",...so().map(s=>s.id)]}}function tr(){return Ys().filter(s=>!s.locked&&!s.transient&&(s.menu||s.entry||s.tile?.placeable))}function sr(){return Ys().filter(s=>!s.locked&&!s.transient&&!!(s.windowId||s.tile||s.menu?.url||s.entry?.url))}async function rc(){return await Rl(),{choices:io(),themes:[{id:"",name:"OpenStation",description:"Built-in dark OpenStation palette.",surface:"#15151e"},...Xs().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:Re(),wallpapers:xe().map(s=>({id:s.id,label:s.label,configurable:!!s.renderConfig})),dockRenderers:Os().map(s=>({id:s.id,label:s.label})),unfocusEffects:to().map(s=>({id:s.id,label:s.label})),reveals:Gs().map(s=>({id:s.id,label:s.label})),linkRenderers:so().map(s=>({id:s.id,label:s.label})),navigation:tr().map(s=>({id:s.id,title:s.title})),phonePins:sr().map(s=>({id:s.id,title:s.title}))}}function or(s,e,t){const o=JSON.parse(JSON.stringify(D()));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=D(),m=Object.keys(g).flatMap(b=>{const y=b;return JSON.stringify(o[y])===JSON.stringify(g[y])?[]:[{setting:y,before:o[y],after:g[y]}]});i({saved:!0,changed:m.length>0,changes:m,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 m=D(),b=!t||Object.entries(t).every(([k,f])=>JSON.stringify(m[k])===JSON.stringify(f)),y=g.savedSettings,x=y&&Object.entries(t??m).every(([k,f])=>JSON.stringify(y[k])===JSON.stringify(f));if(b&&!x)return;a(b?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 ac={wind:{min:0,max:80},particleCount:{min:100,max:2e3},flakeSize:{min:6,max:40}},ir=Z("desktop-mode/wallpaper-settings",()=>({values:{}}));function nr(s){return{...ir.state.values[s]??{}}}function rr(s,e){ir.state.values[s]={...e},ge(U.WALLPAPER_SETTINGS_CHANGED,{id:s,settings:{...e}})}function c(s,...e){return{__wpdHtml:!0,strings:s,values:e}}function lc(s){return!!s&&s.__wpdHtml===!0}const cc="$$wpd$$",W=/\$\$wpd\$\$(\d+)\$\$/g,dc="$$wpd-node$$",uc=/^\$\$wpd-node\$\$(\d+)\$\$$/,hc=new Set(["style","script","textarea","title"]);function pc(s){let e="",t=!1,o=null,i=!1,n=null,r="",a=!1;for(let l=0;l<s.length;l++){const u=s[l];e+=u;for(let h=0;h<u.length;h++){const p=u[h];if(i){u.startsWith("-->",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,hc.has(r)&&(n=r),r=""):a&&(/[a-zA-Z0-9-]/.test(p)?r+=p.toLowerCase():a=!1);continue}if(u.startsWith("<!--",h)){i=!0,h+=3;continue}const g=u[h+1]??"";p==="<"&&/[a-zA-Z/!]/.test(g)&&(t=!0,r="",a=/[a-zA-Z]/.test(g))}l<s.length-1&&(e+=t||i||n!==null?`${cc}${l}$$`:`<!--${dc}${l}$$-->`)}return e}const ar=new WeakMap;function lr(s){const e=ar.get(s);if(e)return e;const t=document.createElement("template");t.innerHTML=pc(s);const o=[],i=(a,l)=>{if(a.nodeType===Node.ELEMENT_NODE){const p=a;for(const g of Array.from(p.attributes)){const m=g.name,b=g.value,y=m[0];if(W.test(b))if(W.lastIndex=0,y==="@"){const x=W.exec(b);W.lastIndex=0,o.push({path:l,kind:"event",name:m.slice(1),valueIndex:x?Number(x[1]):0}),p.removeAttribute(m)}else if(y==="."){const x=W.exec(b);W.lastIndex=0,o.push({path:l,kind:"prop",name:m.slice(1),valueIndex:x?Number(x[1]):0}),p.removeAttribute(m)}else if(y==="?"){const x=W.exec(b);W.lastIndex=0,o.push({path:l,kind:"bool",name:m.slice(1),valueIndex:x?Number(x[1]):0}),p.removeAttribute(m)}else{const x=[],k=[];let f=0,E;for(W.lastIndex=0;(E=W.exec(b))!==null;)x.push(b.slice(f,E.index)),k.push(Number(E[1])),f=E.index+E[0].length;x.push(b.slice(f)),o.push({path:l,kind:"attr",name:m,template:x,valueIndices:k}),p.setAttribute(m,"")}}}const u=Array.from(a.childNodes);let h=0;for(let p=0;p<u.length;p++){const g=u[p],m=p+h;if(g.nodeType===Node.COMMENT_NODE){const b=uc.exec(g.data);if(b){const y=document.createTextNode("");g.parentNode.replaceChild(y,g),o.push({path:[...l,m],kind:"node",valueIndex:Number(b[1])})}continue}if(g.nodeType===Node.TEXT_NODE){const b=g.textContent||"";if(!W.test(b)){W.lastIndex=0;continue}W.lastIndex=0;const y=g.parentNode;let x=0,k;const f=[],E=[];for(W.lastIndex=0;(k=W.exec(b))!==null;){k.index>x&&f.push(document.createTextNode(b.slice(x,k.index)));const $=document.createTextNode("");f.push($),E.push({path:[...l,m+f.length-1],kind:"node",valueIndex:Number(k[1])}),x=k.index+k[0].length}x<b.length&&f.push(document.createTextNode(b.slice(x)));for(const $ of f)y.insertBefore($,g);y.removeChild(g),h+=f.length-1,o.push(...E)}else i(g,[...l,m])}};i(t.content,[]);const r={template:t,buildParts:a=>{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 ar.set(s,r),r}const cr=new WeakMap;function gc(s,e){for(const t of s.nodes)if(t.parentNode!==e)return!1;return!0}function ke(s,e){const t=cr.get(e);if(t&&t.strings===s.strings&&gc(t,e)){ps(t.parts,s.values);return}const o=lr(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),ps(n,s.values),cr.set(e,{strings:s.strings,parts:n,nodes:r})}function ps(s,e){for(const t of s)if(t.kind==="node")gs(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let o=t.template[0];for(let i=0;i<t.valueIndices.length;i++)o+=dr(e[t.valueIndices[i]]),o+=t.template[i+1];o!==t.last&&(t.last=o,o===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,o))}else if(t.kind==="event"){const o=e[t.valueIndex];o!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),o&&t.element.addEventListener(t.name,o),t.current=o)}else if(t.kind==="prop"){const o=e[t.valueIndex];o!==t.last&&(t.last=o,t.element[t.name]=o)}else if(t.kind==="bool"){const o=!!e[t.valueIndex];o!==t.last&&(t.last=o,o?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function gs(s,e){if(e==null||e===!1){s.state&&(le(s.state),s.state=null);return}if(Array.isArray(e)){vc(s,e);return}if(lc(e)){mc(s,e);return}if(e instanceof Node){fc(s,e);return}bc(s,dr(e))}function fc(s,e){const t=s.state;t?.shape==="node"&&t.node===e||(t&&le(t),Ne(s,[e]),s.state={shape:"node",node:e})}function bc(s,e){const t=s.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&le(t);const o=document.createTextNode(e);Ne(s,[o]),s.state={shape:"text",node:o,text:e}}function mc(s,e){const t=s.state;if(t?.shape==="template"&&t.strings===e.strings){ps(t.parts,e.values);return}t&&le(t);const o=lr(e.strings),i=o.template.content.cloneNode(!0),n=o.buildParts(i),r=Array.from(i.childNodes);Ne(s,[i]),ps(n,e.values),s.state={shape:"template",strings:e.strings,parts:n,nodes:r}}function vc(s,e){const t=s.state;if(t?.shape==="array"){const i=Math.min(t.entries.length,e.length);for(let n=0;n<i;n++)gs(t.entries[n],e[n]);if(e.length<t.entries.length){for(let n=e.length;n<t.entries.length;n++){const r=t.entries[n];r.state&&le(r.state),r.anchor.remove()}t.entries.length=e.length}else for(let n=t.entries.length;n<e.length;n++){const r=document.createTextNode("");Ne(s,[r]);const a={anchor:r,state:null};gs(a,e[n]),t.entries.push(a)}return}t&&le(t);const o=[];for(const i of e){const n=document.createTextNode("");Ne(s,[n]);const r={anchor:n,state:null};gs(r,i),o.push(r)}s.state={shape:"array",entries:o}}function Ne(s,e){const t=s.anchor.parentNode;if(t)for(const o of e)t.insertBefore(o,s.anchor)}function le(s){if(s.shape==="text"){s.node.remove();return}if(s.shape==="template"){for(const e of s.parts)e.kind==="node"&&e.child.state&&(le(e.child.state),e.child.state=null);for(const e of s.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(s.shape==="node"){s.node.parentNode&&s.node.parentNode.removeChild(s.node);return}for(const e of s.entries)e.state&&le(e.state),e.anchor.remove()}function dr(s){return s==null||s===!1?"":String(s)}function _c(s,e){const t=e.local??{},o={id:s,hasLocal:r=>Object.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=>{ke(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 ur=Z("desktop-mode/settings-tab-registry",()=>({registry:new Map,listeners:new Set})),wc=ur.state.registry,hr=ur.state.listeners;function yc(){return Array.from(wc.values()).sort((s,e)=>(s.order??100)-(e.order??100))}function xc(s){return hr.add(s),()=>{hr.delete(s)}}function kc(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 $c(s,e){switch(s){case"compact":return d("Compact");case"default":return d("Default");case"large":return d("Large");default:return e}}function Ac(s,e){switch(s){case"sharp":return d("Sharp");case"default":return d("Default");case"round":return d("Round");default:return e}}function Ec(s,e){switch(s){case"static":return d("Static");case"dynamic":return d("Dynamic");case"hidden":return d("Hidden");default:return e}}function Sc(s,e){switch(s){case"static":return d("Static");case"dynamic":return d("Dynamic");default:return e}}function Cc(s,e){switch(s){case"bottom":return d("Bottom");case"left":return d("Left");case"right":return d("Right");default:return e}}function Ic(s,e){switch(s){case"classic":return d("Split");case"unified":return d("Unified");default:return e}}function Rc(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 Lc=()=>({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}),ce=s=>s.extra,S=s=>s.ui(Lc),pr=s=>s.detail??{},z=s=>String(pr(s).value??""),H=s=>pr(s).checked===!0,Tc="conic-gradient( #f252fc, #9af2ff, #93f0c6, #f8f2b6, #ff5a5a, #f252fc )";function Dc(s){const e=s.querySelector(".os-settings__accent-picker");if(e)try{e.showPicker()}catch{e.click()}}const Pc=s=>{const e=s.accent===Ie,t=i=>{const n=z(i);n!==Ie&&!Re().some(r=>r.id===n)||(A({accent:n}),n===Ie&&Dc(i.currentTarget))},o=i=>{const n=i.target.value;/^#[0-9a-fA-F]{6}$/.test(n)&&A({customAccent:n,accent:Ie})};return c`
2 <os-section
3 heading=${d("Accent color")}
4 description=${d("Used in focused window title bars, buttons, and focus rings.")}
5 >
6 <os-swatch-grid label=${d("Accent color")} mode="row" @os-pick=${t}>
7 ${Re().map(i=>c`<os-swatch
8 value=${i.id}
9 label=${kc(i.id,i.label)}
10 preview=${i.value}
11 size="small"
12 variant="accent"
13 ?selected=${s.accent===i.id}
14 ></os-swatch>`)}
15 <span class="os-settings__accent-custom">
16 <os-swatch
17 value=${Ie}
18 label=${d("Custom")}
19 preview=${e?s.customAccent:Tc}
20 size="small"
21 variant="accent"
22 ?selected=${e}
23 ></os-swatch>
24 <input
25 type="color"
26 class="os-settings__accent-picker"
27 tabindex="-1"
28 aria-hidden="true"
29 .value=${s.customAccent}
30 @input=${o}
31 />
32 </span>
33 </os-swatch-grid>
34 </os-section>
35 `},Nc={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%"}]},Me=(s,e)=>t=>{const o=z(t);s.some(i=>i.id===o)&&e(o)},gr=()=>Ns.map(s=>c`<os-segment value=${s.id}>${Sc(s.id,s.label)}</os-segment>`),Mc=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."),zc=s=>{const e=r=>a=>{a.target.closest(".os-settings__dock-option")||A({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`<div class="os-settings__dock-option">
36 <span class="os-settings__dock-option-label" id=${r}>${a}</span>
37 ${l}
38 ${u?c`<span class="os-settings__dock-option-hint">${u}</span>`:""}
39 </div>`,i=()=>c`<div class="os-settings__dock-options">
40 ${o("os-settings-dock-placement-label",d("Placement"),c`<os-segmented
41 value=${s.dockPlacement}
42 label=${d("Dock position")}
43 @os-pick=${Me(Ji,r=>A({dockPlacement:r}))}
44 >
45 ${Ji.map(r=>c`<os-segment value=${r.id}>${Cc(r.id,r.label)}</os-segment>`)}
46 </os-segmented>`)}
47 </div>`,n=()=>c`<div class="os-settings__dock-options">
48 ${o("os-settings-side-dock-behavior-label",d("Sidebar behavior"),c`<os-segmented
49 value=${s.sideDockBehavior}
50 label=${d("Sidebar behavior")}
51 @os-pick=${Me(Ns,r=>A({sideDockBehavior:r}))}
52 >
53 ${gr()}
54 </os-segmented>`)}
55 </div>`;return c`
56 <os-section heading=${d("Desktop layout")} description=${d("Where the menus live.")}>
57 <div class="os-settings__layout-grid" role="radiogroup" aria-label=${d("Desktop layout")}>
58 ${Fa.map(r=>{const a=s.desktopLayout===r.id;return c`<div class=${t(r.id)} @click=${e(r.id)}>
59 <button
60 type="button"
61 class="os-settings__layout-choice"
62 role="radio"
63 aria-checked=${a?"true":"false"}
64 >
65 <span class="os-settings__layout-preview" aria-hidden="true">
66 ${(Nc[r.id]??[]).map(l=>c`<span
67 class="os-settings__layout-${l.kind}${l.rail?` is-accent is-${l.rail}`:""}"
68 style=${l.style}
69 ></span>`)}
70 </span>
71 <span class="os-settings__layout-name">${Ic(r.id,r.label)}</span>
72 <span class="os-settings__layout-desc">${Rc(r.id)}</span>
73 </button>
74 ${r.id==="classic"?n():i()}
75 </div>`})}
76 </div>
77 <div class="os-settings__dock-options os-settings__dock-options--page">
78 ${o("os-settings-dock-size-label",d("Dock size"),c`<os-segmented
79 value=${s.dockSize}
80 label=${d("Dock size")}
81 @os-pick=${Me(Xi,r=>A({dockSize:r}))}
82 >
83 ${Xi.map(r=>c`<os-segment value=${r.id}>${$c(r.id,r.label)}</os-segment>`)}
84 </os-segmented>`)}
85 ${o("os-settings-dock-behavior-label",d("Dock behavior"),c`<os-segmented
86 value=${s.dockBehavior}
87 label=${d("Dock behavior")}
88 @os-pick=${Me(Ns,r=>A({dockBehavior:r}))}
89 >
90 ${gr()}
91 </os-segmented>`,Mc(s.dockBehavior))}
92 </div>
93 </os-section>
94 `},Oc=s=>{const e=Os();return e.length<=1?c``:c`
95 <os-section
96 heading=${d("Dock style")}
97 description=${d("How the rail itself paints — the shipped icon strip, or anything a plugin replaces it with. Switching is instant; the dock rebuilds with the new renderer.")}
98 >
99 <os-segmented
100 value=${s.dockRailRenderer}
101 label=${d("Dock style")}
102 @os-pick=${t=>{const o=z(t);o!==""&&A({dockRailRenderer:o})}}
103 >
104 ${e.map(t=>c`<os-segment value=${t.id}>${t.label}</os-segment>`)}
105 </os-segmented>
106 </os-section>
107 `};function Wc(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 Hc=s=>c`
108 <os-section heading=${d("Admin bar")} description=${Wc(s.adminBarMode)}>
109 <os-segmented
110 value=${s.adminBarMode}
111 label=${d("Admin bar")}
112 @os-pick=${Me(Yi,e=>A({adminBarMode:e}))}
113 >
114 ${Yi.map(e=>c`<os-segment value=${e.id}>${Ec(e.id,e.label)}</os-segment>`)}
115 </os-segmented>
116 </os-section>
117 `;function Uc(s,e,t){return c`
118 ${Pc(s)}
119 ${e}
120 ${zc(s)}
121 ${Oc(s)}
122 ${Hc(s)}
123 `}const ue=class ue 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(fr)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,o){if(t===o)return;const i=qc(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=fr(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&&ke(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(!ue._lightStylesAdopted.has(e)){ue._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)}}}};ue.props=[],ue.styles=[],ue.shadow=!0,ue._lightStylesAdopted=new WeakSet;let _=ue;function w(s,e){customElements.get(s)||customElements.define(s,e)}function fr(s){return s.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function qc(s){return s.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const Fc=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function v(s,...e){let t=s[0];for(let o=1;o<s.length;o++){const i=e[o-1];if(typeof i=="string"||typeof i=="number")t+=String(i);else if(i&&i.__wpdCss)t+=i.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof i);t+=s[o]}if(Fc){const o=new CSSStyleSheet;return o.replaceSync(t),{__wpdCss:!0,sheet:o,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function Vc(s){const e=[],t=[];let o=null,i=s.parentElement;for(;i&&!(i===document.body||i===document.documentElement);){const r=i.id||"";if(r.startsWith("wp-window-")){o=r.slice(10);break}if(i.tagName.toLowerCase()==="os-tabpanel"){const a=i.getAttribute("for");a&&t.unshift(a)}i=i.parentElement}o&&e.push(no(o));for(const r of t)e.push("tab-"+no(r));const n=s.getAttribute("label");return n&&e.push(no(n)),e.length===0?"os-unnamed":"os-"+e.filter(r=>r!=="").join("-")}function no(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ze(s){if(s.id)return s.id;const e=Vc(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 ) )}`,jc=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%}}`,fs=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%}}`,br=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}}`,bs=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}}`,ro=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}}`,mr=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%}}`,ao=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}}`,lo=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}}`,ms=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}}`,vr=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} ${jc} ${fs} ${br} ${bs} ${ro} ${mr} ${ao} ${lo} ${ms} ${vr} `;const Bc=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}`,_r='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',Ve=class Ve 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(_r)),o=Array.from(e.querySelectorAll(_r));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`
124 <div part="dialog" class="dialog" tabindex="-1">
125 ${e?c`
126 <div class="header">
127 <h2 class="title">${e}</h2>
128 <div class="header-actions">
129 <slot name="header-actions"></slot>
130 ${t?c``:c`<button
131 type="button"
132 class="close"
133 aria-label="Close"
134 @click=${()=>this._cancel()}
135 >×</button>`}
136 </div>
137 </div>
138 `:c``}
139 <div class="body">
140 <slot></slot>
141 </div>
142 <div class="footer">
143 <slot name="footer"></slot>
144 </div>
145 </div>
146 `}};Ve.props=["open","title","size","mandatory"],Ve.styles=[Bc],Ve.help=void 0;let co=Ve;w("os-modal",co);const Kc=v` ${C} ${fs} ${br} ${bs} ${ro} ${vr}: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 )}}`,je=class je extends _{render(){const e=this.disabled!==null,t=this.busy!==null,o=this.type||"button";return c`
147 <button
148 part="button"
149 class="os-holo-edge os-holo-sheen"
150 type=${o}
151 ?disabled=${e||t}
152 aria-busy=${t?"true":"false"}
153 >
154 ${t?c`<span class="os-button__spinner" aria-hidden="true"></span>`:""}
155 <slot></slot>
156 <!--
157 The two motion layers. Elements rather than
158 pseudo-elements because the sheen and the hairline
159 have already taken this button's ::before and
160 ::after — see the pseudo-element budget note in
161 src/ui/holo.ts. Both are inert and aria-hidden.
162 -->
163 <span class="os-holo-glint" aria-hidden="true"></span>
164 <span class="os-holo-ring" aria-hidden="true"></span>
165 </button>
166 `}};je.props=["variant","disabled","type","busy","fill-cell"],je.styles=[Kc],je.help=void 0;let uo=je;w("os-button",uo);function ho(s){return!!s&&typeof s=="object"&&typeof s.then=="function"}function po(s){const{from:e,to:t,angle:o}=s.customGradient;return`linear-gradient(${o}deg, ${e}, ${t})`}function Gc(s,e){Qn({id:as,label:d("Custom gradient"),type:"css",preview:po(s()),description:d("Mix your own two-colour gradient and set the angle — your desk, your palette."),resolveValue:()=>po(s()),...e?{renderEditor:e}:{}})}function Xc(s){return s.replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"wallpaper"}function Zc(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 Yc(s){if(!s)return"";const e=document.createElement("div");return e.innerHTML=s,e.textContent?.trim()||""}async function wr(s,e){try{const t=await s.json();if(t&&typeof t.message=="string")return t.message}catch{}return e}async function Jc(s,e,t,o){const i=new URL(ce(s).mediaUrl);i.searchParams.set("media_type","image"),i.searchParams.set("per_page",String(Ha)),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(Ds)),i.searchParams.set("openstation_min_height",String(Ps)));const n=await s.fetch(i.toString());if(!n.ok)throw new Error(await wr(n,`HTTP ${n.status}`));const r=n.headers.get("X-WP-TotalPages"),a=r?parseInt(r,10):1;return{items:(await n.json()).filter(Zc),totalPages:a||1}}async function Qc(s,e){const t=await s.fetch(ce(s).mediaUrl,{method:"POST",headers:{"Content-Type":e.type,"Content-Disposition":`attachment; filename="${Xc(e.name)}"`},body:e});if(!t.ok)throw new Error(await wr(t,`Upload failed (HTTP ${t.status}).`));const o=await t.json();return{id:o.id,url:o.source_url}}function yr(s){A({customImage:s,wallpaper:ie})}async function xr(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{yr(await Qc(s,e))}catch(i){o(i instanceof Error?i.message:d("Upload failed."))}finally{t.uploading=!1,s.repaint()}}function ed(s,e,t){return s?c`<span class="os-settings__upload-status">${d("Uploading…")}</span>`:e?c`<os-button
167 variant="danger"
168 class="os-settings__upload-remove"
169 aria-label=${d("Remove custom image")}
170 @click=${t}
171 >${d("Remove")}</os-button>`:c`<div class="os-settings__upload-inner">
172 <span class="os-settings__upload-plus" aria-hidden="true">+</span>
173 <span class="os-settings__upload-prompt">${d("Drop an image here, or click to upload")}</span>
174 <span class="os-settings__upload-hint">${d("JPEG, PNG, or WebP · goes straight to your Media Library")}</span>
175 </div>`}const td=(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(),A({customImage:null,...s.wallpaper===ie?{wallpaper:Gi()}:{}})},a=()=>{if(!t.uploading){if(s.customImage){A({wallpaper:ie});return}n()?.click()}},l=h=>{const p=h.currentTarget,g=p.files?.[0];g&&xr(e,g),p.value=""},u=h=>{t.dragover!==h&&(t.dragover=h,e.repaint())};return c`
176 <input
177 type="file"
178 accept="image/*"
179 class="os-settings__file-input"
180 data-os-upload-input
181 @change=${l}
182 />
183 <div
184 class=${i.join(" ")}
185 data-wallpaper-id=${ie}
186 aria-pressed=${s.wallpaper===ie?"true":"false"}
187 aria-label=${d(o?"Custom image wallpaper":"Upload a wallpaper image")}
188 style=${o?`background-image: url("${encodeURI(s.customImage.url)}")`:""}
189 @click=${a}
190 @dragover=${h=>{h.preventDefault(),u(!0)}}
191 @dragleave=${()=>u(!1)}
192 @drop=${h=>{h.preventDefault(),u(!1);const p=h.dataTransfer?.files?.[0];p&&xr(e,p)}}
193 >
194 ${ed(t.uploading,o,r)}
195 ${t.uploadError?c`<span class="os-settings__upload-error" role="status">${t.uploadError}</span>`:""}
196 </div>
197 `};function sd(s,e){return s.libraryHdOnly?e.filter(t=>t.media_details.width>=Ds&&t.media_details.height>=Ps):e}async function go(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 Jc(s,e.page+1,e.query,D().libraryHdOnly);e.page+=1,e.totalPages=t.totalPages,e.loaded=e.loaded.concat(t.items)}catch(t){e.error=t instanceof Error?V(d("Couldn’t load your media: %s"),t.message):d("Couldn’t load your media.")}finally{e.loading=!1,s.repaint()}}}function kr(s){const e=S(s).library;e.page=0,e.totalPages=0,e.loaded=[],go(s)}const od=(s,e)=>{const t=s.wallpaper===ie&&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||Yc(e.title?.rendered||"")||`Image #${e.id}`;return c`<button
198 type="button"
199 class=${t?"os-settings__library-tile os-settings__library-tile--selected":"os-settings__library-tile"}
200 data-media-id=${String(e.id)}
201 aria-pressed=${t?"true":"false"}
202 aria-label=${n}
203 title=${n}
204 style=${`background-image: url("${encodeURI(i)}")`}
205 @click=${()=>yr({id:e.id,url:e.source_url})}
206 >
207 <span class="os-settings__library-tile-dims">${e.media_details.width}×${e.media_details.height}</span>
208 </button>`},id=(s,e)=>{const t=S(e).library,o=sd(s,t.loaded),i=t.loaded.length-o.length,n=[V(d("Showing %d"),o.length)];s.libraryHdOnly&&i>0&&n.push(V(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(),kr(e)},Ua)},a=u=>{A({libraryHdOnly:H(u)}),kr(e)},l=()=>t.error?c`<p class="os-settings__library-error">${t.error}</p>`:t.loading&&t.page===0?Array.from({length:8},()=>c`<div class="os-settings__library-tile os-settings__library-tile--skeleton"></div>`):o.length===0&&!t.loading?c`<p class="os-settings__library-empty">
209 ${s.libraryHdOnly?d("No HD images found. Try unchecking the filter, or upload a larger image."):d("No images in your Media Library yet.")}
210 </p>`:o.map(u=>od(s,u));return c`
211 <div class="os-settings__library">
212 <div class="os-settings__library-toolbar">
213 <input
214 type="search"
215 class="os-settings__library-search"
216 placeholder=${d("Search your media")}
217 aria-label=${d("Search media")}
218 @input=${r}
219 />
220 <os-checkbox-label
221 label=${V(d("Only HD (≥%1$d×%2$d)"),Ds,Ps)}
222 ?checked=${s.libraryHdOnly}
223 @os-checkbox-change=${a}
224 ></os-checkbox-label>
225 </div>
226 <div class="os-settings__library-grid">${l()}</div>
227 <div class="os-settings__library-footer">
228 <span class="os-settings__library-meta">${n.join(" · ")}</span>
229 <os-button
230 variant="ghost"
231 ?hidden=${t.totalPages>0&&t.page>=t.totalPages}
232 ?disabled=${t.loading}
233 @click=${()=>void go(e)}
234 >${d("Load more")}</os-button>
235 </div>
236 </div>
237 `};function $r(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||$r(s)!=="library")return;const t=e.library;t.page===0&&!t.loading&&!t.error&&go(s)}const rd=(s,e)=>{const t=e.data.canUpload,o=$r(e),i=n=>{const r=z(n);(r==="upload"||r==="library")&&(S(e).imageSource=r,e.repaint())};return c`
238 <div class="os-settings__uploader">
239 ${t?c`<os-tabs value=${o} label=${d("Image source")} @os-tab-change=${i}>
240 <os-tab value="upload">${d("Upload new")}</os-tab>
241 <os-tab value="library">${d("Media Library")}</os-tab>
242 </os-tabs>`:""}
243 <div class="os-settings__tab-pane">
244 ${o==="upload"?td(s,e):id(s,e)}
245 </div>
246 </div>
247 `},ad="[data-os-editor-slot]";function Ar(s){return{id:s,pluginUrl:"",prefersReducedMotion:typeof window.matchMedia=="function"&&window.matchMedia("( prefers-reduced-motion: reduce )").matches,visible:!document.hidden,settings:nr(s)}}function ld(s){const e=s.root.querySelector(ad);if(!e)return;const t=S(s),o=D().wallpaper;if(t.editor.id===o&&e.firstElementChild)return;Er(s),t.editor.id=o;const i=document.createElement("div");i.className="os-settings__editor-slot-inner",e.textContent="",e.appendChild(i);const n=Pe(o);if(n?.renderEditor)try{const r=n.renderEditor(i,Ar(n.id));ho(r)?r.then(a=>{t.editor.teardown=a}):t.editor.teardown=r}catch(r){console.error(`[openstation] Wallpaper "${n.id}" renderEditor threw:`,r)}}function Er(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 cd(s){s.classList.add("os-settings__gradient-editor-inner");const e=o=>{A({customGradient:{...D().customGradient,...o}}),t()},t=()=>{const{from:o,to:i,angle:n}=D().customGradient;ke(c`
248 <div class="os-settings__gradient-row">
249 <os-color-field
250 variant="block"
251 label=${d("From")}
252 value=${o}
253 @os-color-change=${r=>e({from:z(r)})}
254 ></os-color-field>
255 <os-color-field
256 variant="block"
257 label=${d("To")}
258 value=${i}
259 @os-color-change=${r=>e({to:z(r)})}
260 ></os-color-field>
261 </div>
262 <os-range-field
263 label=${d("Angle")}
264 min="0"
265 max="360"
266 step="1"
267 suffix="°"
268 value=${String(n)}
269 @os-range-change=${r=>e({angle:Number(z(r))})}
270 ></os-range-field>
271 `,s)};return t(),()=>{}}function Sr(s){if(typeof s.renderConfig!="function")return;const e=document.createElement("os-modal");e.setAttribute("size","sm"),e.setAttribute("title",V(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={...Ar(s.id),setSettings:l=>{const u=D(),h={...u.wallpaperSettings[s.id]??{},...l};A({wallpaperSettings:{...u.wallpaperSettings,[s.id]:h}}),rr(s.id,h)}};document.body.appendChild(e),e.setAttribute("open","");try{const l=s.renderConfig(t,a);ho(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 dd=(s,e)=>{const t=S(e),o=Pe(s.wallpaper),i=typeof o?.renderConfig=="function",n=typeof o?.renderEditor=="function",r=l=>{const u=Pe(z(l));u&&u.id!==ie&&A({wallpaper:u.id})},a=xe().filter(l=>l.id!==ie).sort((l,u)=>+(l.id===as)-+(u.id===as));return c`
272 <os-section
273 heading=${d("Wallpaper")}
274 description=${d("The backdrop behind your windows. Pick a preset, mix your own gradient, or drop in an image.")}
275 >
276 <div class="os-settings__grid os-settings__grid--wallpapers" @os-pick=${r}>
277 ${a.map(l=>c`<os-swatch
278 value=${l.id}
279 label=${l.label}
280 preview=${l.id===as?po(s):l.preview}
281 variant="wallpaper"
282 data-wallpaper-id=${l.id}
283 ?selected=${s.wallpaper===l.id}
284 >
285 <span class="os-settings__swatch-label">${l.label}</span>
286 </os-swatch>`)}
287 <button
288 type="button"
289 class="os-settings__wallpaper-add"
290 aria-expanded=${t.imagePickerOpen?"true":"false"}
291 @click=${()=>{t.imagePickerOpen=!t.imagePickerOpen,e.repaint()}}
292 >
293 <span class="os-settings__wallpaper-add-plus" aria-hidden="true">+</span>
294 <span>${d("Use your own image")}</span>
295 </button>
296 </div>
297 <div
298 class="os-settings__wallpaper-config-slot"
299 data-expanded=${i?"true":"false"}
300 style=${i?"margin-top:12px":""}
301 >
302 <div class="os-settings__wallpaper-config-slot-inner">
303 ${i?c`<div class="os-settings__wallpaper-config">
304 <os-button variant="secondary" @click=${()=>Sr(o)}>
305 <os-icon name="admin-generic"></os-icon>
306 ${d("Wallpaper settings")}
307 </os-button>
308 </div>`:""}
309 </div>
310 </div>
311 <div
312 class="os-settings__editor-slot"
313 data-os-editor-slot
314 data-expanded=${n?"true":"false"}
315 ></div>
316 <div class="os-settings__image-picker-slot" data-expanded=${t.imagePickerOpen?"true":"false"}>
317 <div class="os-settings__image-picker-slot-inner">${rd(s,e)}</div>
318 </div>
319 </os-section>
320 `},ud=s=>c`
321 <os-section heading=${d("Window corners")} description=${d("How rounded the corners of windows are.")}>
322 <os-segmented
323 value=${s.windowRadius}
324 label=${d("Window corners")}
325 @os-pick=${e=>{const t=z(e);Zi.some(o=>o.id===t)&&A({windowRadius:t})}}
326 >
327 ${Zi.map(e=>c`<os-segment value=${e.id}>${Ac(e.id,e.label)}</os-segment>`)}
328 </os-segmented>
329 </os-section>
330 `,Cr=[{value:wl,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")}],hd=[{id:"focus",label:()=>d("When a related window is focused")},{id:"always",label:()=>d("Always")},{id:"off",label:()=>d("Off")}],fo=(s,e,t,o,i)=>c`<os-select
331 value=${e}
332 label=${s}
333 @os-pick=${n=>{const r=z(n);r!==""&&(r===t||o.some(a=>a.id===r))&&i(r)}}
334 >
335 <os-option value=${t}>${d("None")}</os-option>
336 ${o.map(n=>c`<os-option value=${n.id}>${n.label}</os-option>`)}
337 </os-select>`,pd=s=>{const e=to(),t=Gs(),o=so(),i=(n,r,a,l)=>{const u=n.find(h=>h.id===r);return r!==a&&u?.description?u.description:l};return c`
338 <os-section
339 heading=${d("Unfocused windows")}
340 description=${i(e,s.unfocusEffect,Js,d("Apply a visual treatment to every window except the one you are working in."))}
341 >
342 ${fo(d("Unfocused window effect"),s.unfocusEffect,Js,e,n=>A({unfocusEffect:n}))}
343 </os-section>
344 <os-section
345 heading=${d("Window reveal")}
346 description=${i(t,s.windowReveal,ds,d("Uncover a window’s content when it finishes loading, instead of fading it in."))}
347 >
348 ${fo(d("Reveal style"),s.windowReveal,ds,t,n=>A({windowReveal:n}))}
349 <os-select
350 value=${String(s.windowRevealDuration)}
351 label=${d("Reveal speed")}
352 @os-pick=${n=>{const r=Number(z(n));Cr.some(a=>a.value===r)&&A({windowRevealDuration:r})}}
353 >
354 ${Cr.map(n=>c`<os-option value=${String(n.value)}>${n.label()}</os-option>`)}
355 </os-select>
356 </os-section>
357 <os-section
358 heading=${d("Window links")}
359 description=${i(o,s.windowLinkRenderer,Xn,d("Draw a visual tie between windows showing related content — a post and its comments or media."))}
360 >
361 ${fo(d("Link style"),s.windowLinkRenderer,Xn,o,n=>A({windowLinkRenderer:n}))}
362 <os-select
363 value=${s.windowLinkVisibility}
364 label=${d("Show links")}
365 @os-pick=${n=>{const r=z(n);(r==="focus"||r==="always"||r==="off")&&A({windowLinkVisibility:r})}}
366 >
367 ${hd.map(n=>c`<os-option value=${n.id}>${n.label()}</os-option>`)}
368 </os-select>
369 </os-section>
370 `},gd=s=>c`
371 <os-section
372 heading=${d("Closing every window")}
373 description=${d("⌥⌘W on macOS, Ctrl+Alt+W elsewhere, closes every open window on the desktop you are looking at. Unticked, it closes them without asking — a page holding unsaved changes still gets to raise its own prompt.")}
374 >
375 <os-checkbox-label
376 label=${d("Ask before closing all windows")}
377 ?checked=${s.confirmCloseAllWindows}
378 @os-checkbox-change=${e=>A({confirmCloseAllWindows:H(e)})}
379 ></os-checkbox-label>
380 </os-section>
381 `,fd=(s,e)=>c`
382 ${ud(s)}
383 ${pd(s)}
384 ${gd(s)}
385 `,bd=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform||navigator.userAgent||"")?"⌘K":"Ctrl+K";let bo=!1;document.addEventListener("os-settings-save-lifecycle",s=>{if(!bo)return;const e=s.detail?.phase;e!=="saved"&&e!=="failed"||(bo=!1,e==="saved"&&tn())});const K=(s,e,t,o,i=!1,n="")=>c`
386 <div class="os-features__item">
387 <os-checkbox-label
388 label=${s}
389 ?checked=${e}
390 ?disabled=${i}
391 @os-checkbox-change=${t}
392 ></os-checkbox-label>
393 <p class="os-features__hint">${o}</p>
394 ${n}
395 </div>
396 `,md=s=>c`
397 <os-notice tone="warning" not-dismissible>
398 ${d("This feature requires an AI provider configured in")}
399 <a
400 href=${s}
401 @click=${e=>{e.preventDefault(),s&&ja(s,d("Connectors"))}}
402 >${d("Settings → Connectors")}</a>.
403 </os-notice>
404 `;async function vd(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 Ir(s){const e=zs(),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 _d=(s,e)=>{const{aiAssistant:t,isAdmin:o}=e.data,i=S(e).features,n=r=>{const a=Number(z(r));if([15,30,45,60].includes(a)){A({heartbeatRate:a});try{window.wp?.heartbeat?.interval?.(a>=60?"slow":"standard")}catch{}}};return c`
405 <os-section
406 heading=""
407 description=${d("Watch the dot in the OpenStation Preferences title bar to see when a change has been saved.")}
408 >
409 ${t?.available?K(d("AI assistant"),s.ai.enabled,r=>A({ai:{...s.ai,enabled:H(r)}}),V(d("Adds an AI mode to the %s command palette: find content and ask about your site."),bd),!t.assistantProviderConfigured,t.assistantProviderConfigured?"":md(t.connectorsUrl)):""}
410 ${K(d("MIO API"),s.mioApiEnabled,r=>A({mioApiEnabled:H(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."))}
411 ${K(d("Show MIO on wallpaper"),s.mioShowOnWallpaper,r=>A({mioShowOnWallpaper:H(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."))}
412 <div class="os-features__item">
413 <os-checkbox-label
414 label=${d("Window links")}
415 ?checked=${s.windowLinksEnabled}
416 @os-checkbox-change=${r=>A({windowLinksEnabled:H(r)})}
417 ></os-checkbox-label>
418 <p class="os-features__hint">
419 ${d("Draws connector lines between related windows. Line style and visibility live in Windows → Window links.")}
420 </p>
421 ${K(d("Bring related windows to front"),s.windowLinkRaiseOnFocus,r=>A({windowLinkRaiseOnFocus:H(r)}),d("Clicking a window also surfaces its parent and children."),!s.windowLinksEnabled)}
422 ${K(d("Highlight related windows"),s.windowLinkHighlight,r=>A({windowLinkHighlight:H(r)}),d("Related windows get an accent outline while one of them is focused."),!s.windowLinksEnabled)}
423 </div>
424 ${K(d("Show desktop when clicking the wallpaper"),s.showDesktopOnWallpaperClick,r=>A({showDesktopOnWallpaperClick:H(r)}),d("A click on the empty desktop minimizes every window; a second click restores them."))}
425 ${K(d("Show post/page status ribbon"),s.showPostStatusRibbons,r=>A({showPostStatusRibbons:H(r)}),d("Marks unpublished posts and pages with a corner ribbon on their tiles."))}
426 ${K(d("Enable developer mode"),s.developerModeEnabled,r=>{A({developerModeEnabled:H(r)}),bo=!0},d("Unlocks developer surfaces meant for plugin authors."))}
427 ${K(d("Folder sharing"),s.foldersSharingEnabled,r=>A({foldersSharingEnabled:H(r)}),d("Share desktop folders with other users or roles, with read or write access."),!1,o?c`<div class="os-features__danger-row">
428 <p class="os-features__hint">${d("Removes every share and its access list. Cannot be undone.")}</p>
429 <os-button
430 variant="danger"
431 os-action="purge-shares"
432 os-confirm=${d("This drops every shares table on the site (current + legacy). All invites, accept/deny decisions, and share rows are permanently removed. Recipients lose their access until someone shares with them again. The empty tables are recreated on the next admin load so the feature keeps working — but every existing share is gone.")}
433 os-confirm-title=${d("Delete folder sharing data?")}
434 os-confirm-label=${d("Delete data")}
435 os-confirm-danger
436 >${d("Delete folder sharing data")}</os-button>
437 </div>`:"")}
438 <div class="os-features__item">
439 <label class="os-features__select-label">
440 <span class="os-features__select-title">${d("WordPress Heartbeat rate")}</span>
441 <os-select value=${String(s.heartbeatRate)} @os-pick=${n}>
442 <os-option value="15">${d("Fast (15s, not recommended)")}</os-option>
443 <os-option value="30">${d("Medium (30s)")}</os-option>
444 <os-option value="45">${d("Slow (45s)")}</os-option>
445 <os-option value="60">${d("Very slow (60s, default)")}</os-option>
446 </os-select>
447 </label>
448 <p class="os-features__hint">
449 ${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.")}
450 </p>
451 </div>
452 <div class="os-features__row">
453 <p class="os-features__hint">
454 ${d("Brings back the one-time announcements you have dismissed, such as the welcome dialog.")}
455 </p>
456 <os-button variant="secondary" ?disabled=${i.resetting} @click=${()=>void vd(e)}>
457 ${i.resetting?d("Resetting…"):d("Reset what’s-new dialogs")}
458 </os-button>
459 </div>
460 </os-section>
461 `},wd=s=>{const e=(t,o,i)=>K(o,s[t]===!0,n=>A({[t]:H(n)}),i);return c`
462 <os-section
463 heading=${d("Beta features")}
464 description=${d("Experimental redesigns of core admin screens, off by default. Each toggle affects only your account and takes effect immediately.")}
465 >
466 ${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."))}
467 ${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."))}
468 ${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."))}
469 ${e("nativeUsersEnabled",d("Use the native Users window"),d("A native Users list with bulk role changes, online indicators, and one-click password resets."))}
470 ${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."))}
471 ${e("nativeCommentsEnabled",d("Use the native Comments window"),d("A native two-pane Comments window: a list of conversations beside the full reply thread."))}
472
473 </os-section>
474 `};let mo=0;async function yd(s,e){const t=S(s).features;t.extendedSaving=!0,t.extendedError="",s.data.extendedOptions&&Object.assign(s.data.extendedOptions,e),s.repaint(),mo++;try{const o=await s.dispatch("extended",{options:e});if(o&&s.data.extendedOptions)try{ge(U.EXTENDED_OPTIONS_CHANGED,{options:s.data.extendedOptions})}catch{}else o||(t.extendedError=d("The options could not be saved."))}finally{mo--,t.extendedSaving=mo>0,s.repaint()}}const xd=(s,e)=>{const t=e.data.extendedOptions;if(!t)return c``;const o=S(e).features,i=(n,r,a)=>K(r,t[n],l=>void yd(e,{...t,[n]:H(l)}),a);return c`
475 <os-section
476 heading=${d("Extended options")}
477 description=${d("Site-wide enhancements that apply to every user. Toggling requires the affected page to be reloaded for the change to take effect.")}
478 >
479 ${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."))}
480 ${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."))}
481 ${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."))}
482 ${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."))}
483 ${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."))}
484 ${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."))}
485 ${o.extendedError?c`<p class="os-ext__error">${o.extendedError}</p>`:""}
486 ${o.extendedSaving?c`<p class="os-ext__saving">${d("Saving…")}</p>`:""}
487 </os-section>
488 `},kd=(s,e)=>c`
489 ${_d(s,e)}
490 ${wd(s)}
491 ${e.data.isAdmin?xd(s,e):""}
492 `,$d="",Ad={accent:"pulse",desktopLayout:"unified",dockPlacement:"bottom"};function Ed(s){if(s===$d)return Object.keys(Pn(Ad)).length>0;const e=Il(s);return e?Object.keys(Pn(e.recommendedOsSettings)).length>0:!1}const vs="",Rr="OpenStation";function Sd(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()}async function Lr(s,e){try{const t=await s.json();if(t&&typeof t.message=="string"&&t.message!=="")return t.message}catch{}return`${e} (HTTP ${s.status}).`}function Tr(s){const e=s?.serverWallpapers;Array.isArray(e)&&ge(U.WALLPAPERS_SERVER_CHANGED,{wallpapers:e})}async function Cd(s,e){const t=new FormData;t.append("file",e,e.name);const o=await s.fetch(ce(s).desktopThemesUrl,{method:"POST",body:t});if(!o.ok)throw new Error(await Lr(o,"Theme upload failed"));const i=await o.json();return Tr(i),i}async function Id(s,e){const t=await s.fetch(`${ce(s).desktopThemesUrl}/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw new Error(await Lr(t,"Theme delete failed"));try{Tr(await t.json())}catch{}}async function Dr(s,e){const t=S(s).themes;if(!t.busy){t.busy=!0,t.error="",s.repaint();try{On(await Cd(s,e))}catch(o){t.error=o instanceof Error?o.message:d("That theme could not be installed.")}finally{t.busy=!1,s.repaint()}}}async function Rd(s,e){if(!await s.host.confirm?.({title:d("Delete this theme?"),message:V(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 Id(s,e.slug),Ll(e.slug),D().desktopTheme===e.slug&&A({desktopTheme:vs})}catch(i){o.error=i instanceof Error?i.message:d("That theme could not be deleted.")}s.repaint()}const Ld=(s,e,t,o)=>c`
493 <div class="os-settings__theme-card-wrap">
494 <button
495 type="button"
496 class="os-settings__theme-card"
497 aria-pressed=${t?"true":"false"}
498 data-theme-slug=${e.slug}
499 @click=${()=>A({desktopTheme:e.slug})}
500 >
501 <span class="os-settings__theme-preview">
502 ${e.previewUrl?c`<img src=${e.previewUrl} alt="" aria-hidden="true" draggable="false" />`:c`<span class="os-settings__theme-initials" aria-hidden="true">${Sd(e.name)}</span>`}
503 </span>
504 <span class="os-settings__theme-name">${e.name}</span>
505 <span class="os-settings__theme-meta">
506 ${e.version!==""?V(d("Version %s"),e.version):""}
507 </span>
508 </button>
509 ${o&&e.source!=="code"?c`<button
510 type="button"
511 class="os-settings__theme-delete"
512 aria-label=${V(d("Delete %s"),e.name)}
513 @click=${()=>void Rd(s,e)}
514 >×</button>`:""}
515 </div>
516 `,Td=s=>c`
517 <div class="os-settings__theme-card-wrap">
518 <button
519 type="button"
520 class="os-settings__theme-card os-settings__theme-card--system"
521 aria-pressed=${s?"true":"false"}
522 @click=${()=>A({desktopTheme:vs})}
523 >
524 <span class="os-settings__theme-preview os-settings__theme-preview--system" aria-hidden="true"></span>
525 <span class="os-settings__theme-name">${Rr}</span>
526 <span class="os-settings__theme-meta">${d("The look OpenStation ships with")}</span>
527 </button>
528 </div>
529 `,Dd=s=>{const e=S(s).themes,t=o=>o.dataTransfer?.files?.[0]??o.currentTarget.files?.[0];return c`<div
530 class=${e.busy?"os-settings__theme-upload os-settings__theme-upload--busy":"os-settings__theme-upload"}
531 @dragover=${o=>{o.preventDefault(),o.currentTarget.classList.add("os-settings__theme-upload--dragover")}}
532 @dragleave=${o=>{o.currentTarget.classList.remove("os-settings__theme-upload--dragover")}}
533 @drop=${o=>{o.preventDefault(),o.currentTarget.classList.remove("os-settings__theme-upload--dragover");const i=t(o);i&&Dr(s,i)}}
534 >
535 <label class="os-settings__theme-upload-label">
536 <input
537 type="file"
538 accept=".zip,application/zip"
539 class="os-settings__file-input"
540 ?disabled=${e.busy}
541 @change=${o=>{const i=o.currentTarget,n=i.files?.[0];n&&Dr(s,n),i.value=""}}
542 />
543 <span class="os-settings__theme-upload-plus" aria-hidden="true">+</span>
544 <span class="os-settings__theme-upload-prompt">
545 ${e.busy?d("Installing…"):d("Drop a theme .zip here, or click to upload")}
546 </span>
547 </label>
548 </div>`},Pd=(s,e)=>{if(!Ed(s))return"";const t=s===vs?Rr:e.find(o=>o.slug===s)?.name;return t===void 0?"":c`<div class="os-settings__theme-recommendation">
549 <os-button variant="secondary" @click=${()=>en(s)}>
550 ${V(d("Apply %s’s recommended layout and effects"),t)}
551 </os-button>
552 </div>`},Nd=(s,e)=>{const t=Xs(),o=e.data.canManageDesktopThemes,i=S(e).themes.error;return c`
553 ${i!==""?c`<os-notice tone="error">${i}</os-notice>`:""}
554 <os-section heading=${d("Installed")}>
555 <div class="os-settings__theme-grid" role="group" aria-label=${d("Desktop theme")}>
556 ${Td(s.desktopTheme===vs)}
557 ${t.map(n=>Ld(e,n,s.desktopTheme===n.slug,o))}
558 ${o?Dd(e):""}
559 </div>
560 ${Pd(s.desktopTheme,t)}
561 </os-section>
562 `},Pr="data:image/svg+xml;base64,",_s=new Map;function Md(s){const e=_s.get(s);if(e!==void 0)return e;let t=!1;try{t=atob(s.slice(Pr.length)).includes("currentColor")}catch{}return _s.size>=256&&_s.clear(),_s.set(s,t),t}function Nr(s,e){const t=e.className??"",o=e.title??"";let i=null;if(e.slot){const l=Pl(e.slot);l!==null&&(s=l),i=Nl(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",Hn(l,s,i))return l}if(typeof s=="string"&&s.startsWith("data:image/svg+xml;base64,")){const l=s.slice(Pr.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",Md(s)&&Hn(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 Mr(s,t)}if(typeof s=="string"&&(s.startsWith("http://")||s.startsWith("https://")))return Mr(s,t);const n=document.createElement("span");n.className=`${t} os-icon-letter`.trim(),n.setAttribute("aria-hidden","true");const r=zd(o);n.textContent=r;const a=Wn(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 Mr(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 zd(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 Od=[{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 Wd(){const s=window.wp?.os;return typeof s?.getNavItems=="function"?s.getNavItems():[]}function Hd(s){return s.locked||s.transient?!1:s.menu||s.entry?!0:s.tile?.placeable===!0}const Ud=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."),qd=(s,e)=>[{id:"rail",label:Kl(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")}],Fd=(s,e)=>c`<div class="os-nav-settings__row" data-item-id=${s.id}>
563 <div class="os-nav-settings__identity">
564 ${Nr(s.icon,{title:s.title,className:"os-nav-settings__icon",slot:Wl(s.id)})}
565 <div class="os-nav-settings__title">${s.title}</div>
566 </div>
567 <os-select
568 plain
569 label=${s.title}
570 value=${Gl(s,e.navPlacement)}
571 @os-pick=${t=>{const o=z(t);(o==="both"||o==="rail"||o==="desktop"||o==="hidden")&&A({navPlacement:{...e.navPlacement,[s.id]:o}})}}
572 >
573 ${qd(s.kind,e.desktopLayout).map(t=>c`<os-option value=${t.id}>${t.label}</os-option>`)}
574 </os-select>
575 </div>`,Vd=s=>{const e=Wd().filter(Hd),t=Od.map(o=>({...o,rows:Xl(e.filter(i=>o.kinds.includes(i.kind)))})).filter(o=>o.rows.length>0);return c`
576 <p class="os-settings__page-description os-nav-settings__lead">${Ud(s.desktopLayout)}</p>
577 ${t.length===0?c`<os-empty-state
578 heading=${d("Nothing registered yet")}
579 description=${d("Plugins and the admin menu will appear here once they’re registered.")}
580 ></os-empty-state>`:t.map(o=>c`
581 <os-section class="os-nav-settings" heading=${o.heading()} description=${o.description()}>
582 ${o.rows.map(i=>Fd(i,s))}
583 </os-section>
584 `)}
585 `},zr={close:{a:'fill="currentColor"',b:'<path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z" />'},check:{a:'fill="currentColor"',b:'<path d="M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" />'},"chevron-right":{a:'fill="currentColor"',b:'<path d="M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" />'},"arrow-up-right":{a:'fill="currentColor"',b:'<path d="M10 6H18V14H16.5V8.5L7 18L6 17L15.5 7.5H10V6Z" />'},plus:{a:'fill="currentColor"',b:'<path d="M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" />'},search:{a:'fill="currentColor"',b:'<path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" />'},pin:{a:'fill="currentColor"',b:'<path d="m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" />'},trash:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" />'},download:{a:'fill="currentColor"',b:'<path d="M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" />'},settings:{a:'fill="currentColor"',b:'<path d="m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" /><path d="m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" />'},info:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" />'},bell:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M17 11.5c0 1.353.17 2.368.976 3 .266.209.602.376 1.024.5v1H5v-1c.422-.124.757-.291 1.024-.5.806-.632.976-1.647.976-3V9c0-2.8 2.2-5 5-5s5 2.2 5 5v2.5ZM15.5 9v2.5c0 .93.066 1.98.515 2.897l.053.103H7.932a4.018 4.018 0 0 0 .053-.103c.449-.917.515-1.967.515-2.897V9c0-1.972 1.528-3.5 3.5-3.5s3.5 1.528 3.5 3.5Zm-5.492 9.008c0-.176.023-.346.065-.508h3.854A1.996 1.996 0 0 1 12 20c-1.1 0-1.992-.892-1.992-1.992Z" />'},more:{a:'fill="currentColor"',b:'<path d="M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z" />'},maximize:{a:'fill="currentColor"',b:'<path d="M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" />'},edit:{a:'fill="currentColor"',b:'<path d="m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" />'},color:{a:'fill="currentColor"',b:'<path d="M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" />'},wallpaper:{a:'fill="currentColor"',b:'<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" />'},warning:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-.75 12v-1.5h1.5V16h-1.5Zm0-8v5h1.5V8h-1.5Z" />'},minimize:{a:'fill="currentColor"',b:'<path d="M5 11.25h14v1.5H5z" />'},window:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="5.4375" width="15.75" height="13.125" rx="1.75"/><path d="M4.125 9.8125h15.75"/><circle cx="7.275" cy="7.625" r="0.7438" fill="currentColor" stroke="none"/>'},windows:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="8.5" width="11.375" height="10.0625" rx="1.75"/><path d="M3.6875 12h11.375"/><path d="M8.5 8.5V7.1875a1.75 1.75 0 0 1 1.75-1.75h7.875A1.75 1.75 0 0 1 19.875 7.1875v7a1.75 1.75 0 0 1-1.75 1.75h-3.0625"/>'},dock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.25" y="8.5" width="17.5" height="7" rx="3.5"/><circle cx="7.625" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="16.375" cy="12" r="1.0062" fill="currentColor" stroke="none"/>'},spaces:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><rect x="12.875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><circle cx="9.375" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="12" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="14.625" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/>'},copilot:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M10 2.5Q10.9 8.5 17.5 10Q10.9 11.5 10 17.5Q9.1 11.5 2.5 10Q9.1 8.5 10 2.5Z" fill="currentColor" stroke="none"/><path d="M17.9 14Q18.35 17.1 21.5 17.6Q18.35 18.1 17.9 21.2Q17.45 18.1 14.3 17.6Q17.45 17.1 17.9 14Z" fill="currentColor" stroke="none"/>'},snap:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="16.625" height="13.125" rx="1.75"/><path d="M12 5.4375v13.125"/><path d="M12 12h8.3125"/>'},command:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M14.625 6.75v10.5a2.625 2.625 0 1 0 2.625-2.625H6.75a2.625 2.625 0 1 0 2.625 2.625V6.75a2.625 2.625 0 1 0-2.625 2.625h10.5a2.625 2.625 0 1 0-2.625-2.625"/>'},apps:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="4.125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/>'},widgets:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="3.6875" width="9.625" height="9.625" rx="1.75"/><rect x="15.0625" y="3.6875" width="5.25" height="5.25" rx="1.75"/><rect x="15.0625" y="10.6875" width="5.25" height="9.625" rx="1.75"/><rect x="3.6875" y="15.0625" width="9.625" height="5.25" rx="1.75"/>'},user:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<circle cx="12" cy="8.9375" r="3.5"/><path d="M5.4375 19.4375a6.5625 6.5625 0 0 1 13.125 0"/>'},lock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="5.4375" y="10.6875" width="13.125" height="8.75" rx="1.75"/><path d="M8.5 10.6875V8.0625a3.5 3.5 0 0 1 7 0v2.625"/>'}};function Or(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Wr(s){return Object.prototype.hasOwnProperty.call(zr,s)?zr[s]:null}function jd(s){return Wr(s)!==null}function Bd(s,e={}){const t=Wr(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="${Or(i)}"`),n?a.push('role="img"',`aria-label="${Or(n)}"`):a.push('aria-hidden="true"','focusable="false"');const l=r?`<g transform="rotate(${r} 12 12)">${t.b}</g>`:t.b;return`<svg ${a.join(" ")}>${l}</svg>`}function P(s,e={}){const t=Bd(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 ws=3,Hr=[{id:"auto",label:()=>d("Automatic")},{id:"desktop",label:()=>d("Always desktop")},{id:"mobile",label:()=>d("Always mobile")}];function Kd(s){return s.filter(e=>!e.locked&&!e.transient&&!!(e.windowId||e.tile||e.menu?.url||e.entry?.url))}const Gd=(s,e)=>{const t=Kd(Ys()),o=new Set(t.map(u=>u.id)),i=(zs().mode?.tabBar??[]).filter(u=>o.has(u)),n=(s.mobileTabs.length>0?s.mobileTabs:i).slice(0,ws),r=n.length>=ws,a=u=>{const h=z(u);Hr.some(p=>p.id===h)&&A({mobileLayout:h})},l=u=>h=>{const p=H(h),g=n.filter(m=>m!==u);p&&g.length<ws&&g.push(u),A({mobileTabs:g})};return c`
586 <os-section
587 heading=${d("Layout")}
588 description=${d("Automatic follows the screen: phones get the phone layer, everything wider gets the desktop. Force either to preview or to opt out.")}
589 >
590 <os-segmented value=${s.mobileLayout} label=${d("Mobile layout")} @os-pick=${a}>
591 ${Hr.map(u=>c`<os-segment value=${u.id}>${u.label()}</os-segment>`)}
592 </os-segmented>
593 </os-section>
594
595 <os-section
596 heading=${d("Tab bar")}
597 description=${V(d("Home and the app switcher are always there. Pin up to %d apps between them; leave it empty for the default set."),ws)}
598 >
599 ${t.length===0?c`<p class="os-features__hint">${d("Nothing to pin yet.")}</p>`:t.map(u=>{const h=n.includes(u.id);return c`
600 <div class="os-features__item">
601 <os-checkbox-label
602 label=${u.title}
603 ?checked=${h}
604 ?disabled=${!h&&r}
605 @os-checkbox-change=${l(u.id)}
606 ></os-checkbox-label>
607 </div>
608 `})}
609 </os-section>
610 `},Xd=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 )}`,Be=class Be extends _{render(){const e=this.heading||"",t=this.description||"";return c`
611 ${e?c`<h3 class="os-section__heading">${e}</h3>`:""}
612 ${t?c`<p class="os-section__description">${t}</p>`:""}
613 <div class="os-section__body" part="body"><slot></slot></div>
614 `}};Be.props=["heading","description","stack"],Be.styles=[Xd],Be.help=void 0;let vo=Be;w("os-section",vo);const Zd=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 )}`,Ke=class Ke extends _{render(){const e=this.selected!==null,t=this.label||"",o=this.preview||"";return c`
615 <button
616 type="button"
617 aria-pressed=${e?"true":"false"}
618 aria-label=${t}
619 title=${t}
620 style="background: ${o}"
621 @click=${()=>this._onPick()}
622 >
623 <slot></slot>
624 </button>
625 `}_onPick(){this.emit("os-pick",{value:this.value})}};Ke.props=["value","label","selected","preview","size","variant"],Ke.styles=[Zd],Ke.help=void 0;let _o=Ke;w("os-swatch",_o);const Yd=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}`,Ge=class Ge 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`<slot></slot>`}};Ge.props=["label","columns","mode"],Ge.styles=[Yd],Ge.help=void 0;let wo=Ge;w("os-swatch-grid",wo);const Jd=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}}`,Qd=v` ${C} ${fs}: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}`,Xe=class Xe extends _{render(){return this.setAttribute("role","radio"),c`
626 <button
627 type="button"
628 class="os-holo-sheen"
629 @click=${()=>this._onPick()}
630 >
631 <slot></slot>
632 </button>
633 `}_onPick(){this.emit("os-segment-pick",{value:this.value})}};Xe.props=["value"],Xe.styles=[Qd],Xe.help=void 0;let yo=Xe;w("os-segment",yo);const Ze=class Ze 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`<span class="os-segmented__thumb" aria-hidden="true"></span
634 ><slot></slot>`}};Ze.props=["value","label"],Ze.styles=[Jd],Ze.help={title:"Segmented",summary:"iOS-style segmented radio group. Pill-shaped bar of equal-width <os-segment> 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:'<os-segment value="…"> 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`
635 <os-segmented value="md" label="Dock size">
636 <os-segment value="sm">Small</os-segment>
637 <os-segment value="md">Medium</os-segment>
638 <os-segment value="lg">Large</os-segment>
639 </os-segmented>
640 `};let xo=Ze;w("os-segmented",xo);const eu=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}`,Ye=class Ye extends _{render(){return c``}};Ye.props=["value","disabled"],Ye.styles=[tu],Ye.help=void 0;let ko=Ye;w("os-option",ko);const Je=class Je 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(),ze(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(b=>b.value===t),u=l?l.label:o,h=this.id||"os-unnamed",p=`${h}__listbox`,g=`${h}__trigger`,m=this._open&&this._activeIndex>=0?`${h}__opt-${this._activeIndex}`:"";return c`
641 ${e?c`<label
642 class="os-select__label"
643 for=${g}
644 >${e}</label>`:c``}
645 <button
646 type="button"
647 class="os-select__trigger"
648 id=${g}
649 role="combobox"
650 aria-haspopup="listbox"
651 aria-expanded=${this._open?"true":"false"}
652 aria-controls=${p}
653 aria-label=${r}
654 aria-activedescendant=${m}
655 ?disabled=${i}
656 @click=${()=>this._toggle()}
657 @keydown=${b=>this._onTriggerKeydown(b)}
658 >
659 <span
660 class="os-select__value${l?"":" os-select__value--placeholder"}"
661 >${u}</span
662 >
663 ${P("chevron-right",{size:16,rotate:90,className:"os-select__chevron"})}
664 </button>
665 <div
666 class="os-select__popup"
667 id=${p}
668 role="listbox"
669 popover="auto"
670 aria-label=${r}
671 @toggle=${b=>this._onPopoverToggle(b)}
672 >
673 ${a.map((b,y)=>c`
674 <div
675 class="os-select__option"
676 id=${`${h}__opt-${y}`}
677 role="option"
678 data-value=${b.value}
679 aria-selected=${b.value===t?"true":"false"}
680 aria-disabled=${b.disabled?"true":"false"}
681 ?data-active=${this._open&&y===this._activeIndex}
682 @click=${()=>this._onOptionClick(b)}
683 @pointermove=${()=>this._setActive(y)}
684 >
685 ${P("check",{size:16,className:"os-select__check"})}
686 <span class="os-select__option-label"
687 >${b.label}</span
688 >
689 </div>
690 `)}
691 </div>
692 `}_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<t.length&&(o=Math.min(Math.max(o+e,0),t.length-1),!(!t[o]?.disabled||o===0||o===t.length-1));i++);o!==this._activeIndex&&t[o]&&!t[o].disabled&&(this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView())}_scrollActiveIntoView(){queueMicrotask(()=>{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)}}}};Je.props=["value","label","placeholder","disabled","name"],Je.styles=[eu],Je.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 <os-segmented> 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:'<os-option value="…"> 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`
693 <os-select value="eur" label="Currency">
694 <os-option value="eur">Euro</os-option>
695 <os-option value="usd">US Dollar</os-option>
696 <os-option value="jpy">Japanese Yen</os-option>
697 </os-select>
698 `};let $o=Je;w("os-select",$o);const su=v`
699 :host {
700 display: flex;
701 flex-direction: column;
702 gap: 4px;
703 font-size: 13px;
704 color: var( --os-ui-fg, #1d2327 );
705 min-width: 0;
706 }
707
708 :host( [ hidden ] ) {
709 display: none;
710 }
711
712 .os-multiselect__label {
713 font-size: 12px;
714 color: var( --os-ui-fg-muted, #646970 );
715 }
716
717 .os-multiselect__trigger {
718 appearance: none;
719 display: inline-flex;
720 align-items: center;
721 justify-content: space-between;
722 gap: 8px;
723 width: 100%;
724 min-width: 0;
725 padding: 7px 12px 7px 12px;
726 background: var( --os-ui-hover, rgba( 0, 0, 0, 0.05 ) );
727 border: 1px solid transparent;
728 border-radius: 7px;
729 font: inherit;
730 font-size: 13px;
731 color: var( --os-ui-fg, #1d2327 );
732 cursor: pointer;
733 text-align: start;
734 transition: background-color 0.12s ease, border-color 0.12s ease,
735 box-shadow 0.12s ease;
736 }
737
738 .os-multiselect__trigger:hover {
739 background: var( --os-ui-hover, rgba( 0, 0, 0, 0.08 ) );
740 }
741
742 .os-multiselect__trigger:focus-visible {
743 outline: none;
744 border-color: var( --os-ui-accent, #2271b1 );
745 box-shadow: var(
746 --os-ui-focus-ring-field,
747 0 0 0 1px #2271b1, 0 0 0 4px rgba( 34, 113, 177, 0.18 )
748 );
749 }
750
751 .os-multiselect__trigger:disabled {
752 opacity: 0.5;
753 cursor: not-allowed;
754 }
755
756 .os-multiselect__trigger[ data-active='true' ] {
757 color: var( --wp-admin-theme-color, #2271b1 );
758 font-weight: 600;
759 }
760
761 .os-multiselect__summary {
762 flex: 1 1 auto;
763 min-width: 0;
764 overflow: hidden;
765 text-overflow: ellipsis;
766 white-space: nowrap;
767 }
768
769 .os-multiselect__chevron {
770 color: var( --os-ui-fg-muted, #646970 );
771 flex-shrink: 0;
772 transition: color 0.12s ease, transform 0.18s ease;
773 }
774
775 .os-multiselect__trigger:hover .os-multiselect__chevron,
776 .os-multiselect__trigger:focus-visible .os-multiselect__chevron {
777 color: var( --os-ui-fg, #1d2327 );
778 }
779
780 :host( [ open ] ) .os-multiselect__chevron {
781 transform: rotate( 180deg );
782 }
783 `;function ou(){const s="os-multiselect-popover-styles";if(document.getElementById(s))return;const e=document.createElement("style");e.id=s,e.textContent=`
784 .os-multiselect__popover {
785 position: fixed;
786 z-index: 100000;
787 max-height: 320px;
788 overflow-y: auto;
789 min-width: 200px;
790 padding: 4px 0;
791 background: var( --os-window-bg, #fff );
792 color: var( --os-ui-fg, #1d2327 );
793 border: 1px solid var( --os-window-border, #c3c4c7 );
794 border-radius: 8px;
795 box-shadow: 0 8px 28px rgba( 0, 0, 0, 0.18 );
796 font: inherit;
797 font-size: 13px;
798 }
799
800 .os-multiselect__clear {
801 display: block;
802 width: 100%;
803 padding: 6px 12px;
804 font: inherit;
805 font-size: 11px;
806 font-weight: 600;
807 letter-spacing: 0.04em;
808 text-transform: uppercase;
809 text-align: start;
810 border: 0;
811 border-bottom: 1px solid var( --os-window-border, #dcdcde );
812 background: transparent;
813 color: var( --wp-admin-theme-color, #2271b1 );
814 cursor: pointer;
815 }
816
817 .os-multiselect__clear:hover {
818 background: color-mix(
819 in srgb,
820 var( --wp-admin-theme-color, #2271b1 ) 10%,
821 transparent
822 );
823 }
824
825 .os-multiselect__option {
826 display: flex;
827 align-items: center;
828 gap: 8px;
829 padding: 6px 12px;
830 cursor: pointer;
831 user-select: none;
832 }
833
834 .os-multiselect__option:hover {
835 background: var( --os-ui-hover, rgba( 0, 0, 0, 0.05 ) );
836 }
837
838 .os-multiselect__option[ data-disabled='true' ] {
839 opacity: 0.5;
840 cursor: not-allowed;
841 }
842
843 .os-multiselect__option > span {
844 flex: 1 1 auto;
845 min-width: 0;
846 overflow: hidden;
847 text-overflow: ellipsis;
848 white-space: nowrap;
849 }
850
851 .os-multiselect__option > input[ type='checkbox' ] {
852 margin: 0;
853 flex-shrink: 0;
854 accent-color: var( --wp-admin-theme-color, #2271b1 );
855 }
856
857 .os-multiselect__empty {
858 padding: 8px 12px;
859 color: var( --os-ui-fg-muted, #646970 );
860 font-style: italic;
861 }
862
863 .os-multiselect__loading {
864 display: flex;
865 align-items: center;
866 gap: 8px;
867 padding: 8px 12px;
868 color: var( --os-ui-fg-muted, #646970 );
869 font-size: 12px;
870 }
871
872 .os-multiselect__spinner {
873 display: inline-block;
874 width: 12px;
875 height: 12px;
876 border-radius: 50%;
877 border: 2px solid currentColor;
878 border-top-color: transparent;
879 animation: os-multiselect-spin 0.8s linear infinite;
880 }
881
882 @keyframes os-multiselect-spin {
883 to { transform: rotate( 360deg ); }
884 }
885 `,document.head.appendChild(e)}typeof document<"u"&&ou();const Qe=class Qe 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(),ze(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`
886 ${e?c`<label
887 class="os-multiselect__label"
888 for=${l}
889 >${e}</label>`:c``}
890 <button
891 id=${l}
892 type="button"
893 class="os-multiselect__trigger"
894 aria-haspopup="listbox"
895 aria-expanded=${this._isOpen()?"true":"false"}
896 aria-label=${i}
897 ?disabled=${o}
898 data-active=${r?"true":"false"}
899 @click=${u=>this._onTriggerClick(u)}
900 >
901 <span class="os-multiselect__summary">${n}</span>
902 ${P("chevron-right",{size:16,rotate:90,className:"os-multiselect__chevron"})}
903 </button>
904 `}_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})}};Qe.props=["value","label","placeholder","disabled","name","open"],Qe.styles=[su],Qe.help=void 0;let Ao=Qe;w("os-multiselect",Ao);const iu=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}`,et=class et 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`
905 <label>
906 <span class="os-color-field__label">${e}</span>
907 <input
908 type="color"
909 .value=${t}
910 @input=${o=>this._onInput(o)}
911 />
912 </label>
913 `}_onInput(e){const t=e.target;this.value=t.value,this.emit("os-color-change",{value:t.value})}};et.props=["label","value","variant"],et.styles=[iu],et.help=void 0;let Eo=et;w("os-color-field",Eo);const nu=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 ru(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 au(s){const e=s.indexOf(".");return e<0?0:Math.min(3,s.length-e-1)}function lu(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 tt=class tt 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)):au(n),u=Number.parseFloat(t),h=Number.isFinite(u)?u.toFixed(l):t,p=lu(o,i,l,r);return c`
914 <label class="os-range-field__label">${e}</label>
915 <input
916 type="range"
917 min=${o}
918 max=${i}
919 step=${n}
920 style="--_fill: ${ru(t,o,i)}"
921 .value=${t}
922 @input=${g=>this._onInput(g)}
923 />
924 <span
925 class="os-range-field__value"
926 style="--os-ui-range-readout-width: ${p}ch"
927 >${h}${r}</span
928 >
929 `}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}))}};tt.props=["label","value","min","max","step","suffix","decimals"],tt.styles=[nu],tt.help=void 0;let So=tt;w("os-range-field",So);const Ur=v` ${C} ${lo}: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 )}.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}`,st=class st extends _{constructor(){super(...arguments),this._revealed=!1}connectedCallback(){super.connectedCallback(),ze(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,m=this.pattern||"",b=this.name||"",y=this.suffix||"",x=this.invalid!==null,k=this.reveal!==null,f=this.clearable!==null,E=l==="password",$=E&&!(k&&this._revealed);let L;E||k&&this._revealed?L="text":L=l;const Q=["os-text-field__row",k?"os-text-field__row--has-reveal":"",f?"os-text-field__row--has-clear":""].filter(Boolean).join(" "),X=$?"os-text-field__input os-text-field__input--masked":"os-text-field__input",B=`${this.id||"os-unnamed"}__input`;return c`
930 ${e?c`<label
931 class=${t?"os-text-field__label os-text-field__label--hidden":"os-text-field__label"}
932 for=${B}
933 >${e}</label>`:c``}
934 <span class=${Q}>
935 <input
936 id=${B}
937 class=${X}
938 type=${L}
939 .value=${o}
940 placeholder=${i}
941 ?disabled=${n}
942 ?readonly=${r}
943 autocomplete=${h}
944 maxlength=${p??""}
945 minlength=${g??""}
946 pattern=${m}
947 name=${b}
948 aria-invalid=${x?"true":"false"}
949 aria-label=${e||""}
950 @input=${_e=>this._onInput(_e)}
951 @change=${_e=>this._onChange(_e)}
952 @keydown=${_e=>this._onKeyDown(_e)}
953 />
954 ${y?c`<span class="os-text-field__suffix">${y}</span>`:c``}
955 ${f&&o!==""?this._renderClearButton(n):c``}
956 ${k?this._renderRevealButton(n):c``}
957 </span>
958 `}_renderClearButton(e){return c`
959 <button
960 type="button"
961 class="os-text-field__clear"
962 aria-label="Clear"
963 ?disabled=${e}
964 tabindex="0"
965 @click=${()=>this._onClear()}
966 >
967 ${cu()}
968 </button>
969 `}_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`
970 <button
971 type="button"
972 class="os-text-field__reveal"
973 aria-label=${t}
974 aria-pressed=${this._revealed?"true":"false"}
975 ?disabled=${e}
976 tabindex="0"
977 @click=${()=>this._onToggleReveal()}
978 >
979 ${this._revealed?uu():du()}
980 </button>
981 `}_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})}}};st.props=["label","hideLabel","value","placeholder","disabled","readonly","autocomplete","type","maxlength","minlength","pattern","name","suffix","invalid","reveal","clearable"],st.styles=[Ur],st.help=void 0;let Co=st;w("os-text-field",Co);function cu(){return c`
982 <svg
983 viewBox="0 0 16 16"
984 width="14"
985 height="14"
986 fill="none"
987 stroke="currentColor"
988 stroke-width="1.5"
989 stroke-linecap="round"
990 aria-hidden="true"
991 focusable="false"
992 >
993 <path d="M4 4l8 8M12 4l-8 8" />
994 </svg>
995 `}function du(){return c`
996 <svg
997 viewBox="0 0 16 16"
998 width="14"
999 height="14"
1000 fill="none"
1001 stroke="currentColor"
1002 stroke-width="1.5"
1003 stroke-linecap="round"
1004 stroke-linejoin="round"
1005 aria-hidden="true"
1006 focusable="false"
1007 >
1008 <path d="M1 8C1 8 3.5 3 8 3s7 5 7 5-2.5 5-7 5S1 8 1 8z" />
1009 <circle cx="8" cy="8" r="2" />
1010 </svg>
1011 `}function uu(){return c`
1012 <svg
1013 viewBox="0 0 16 16"
1014 width="14"
1015 height="14"
1016 fill="none"
1017 stroke="currentColor"
1018 stroke-width="1.5"
1019 stroke-linecap="round"
1020 stroke-linejoin="round"
1021 aria-hidden="true"
1022 focusable="false"
1023 >
1024 <path d="M1 8C1 8 3.5 3 8 3s7 5 7 5-2.5 5-7 5S1 8 1 8z" />
1025 <circle cx="8" cy="8" r="2" />
1026 <line x1="2" y1="2" x2="14" y2="14" />
1027 </svg>
1028 `}const ot=class ot extends _{connectedCallback(){super.connectedCallback(),ze(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,m=`${this.id||"os-unnamed"}__input`;return c`
1029 ${e?c`<label
1030 class="os-text-field__label"
1031 for=${m}
1032 >${e}</label>`:c``}
1033 <span class="os-text-field__row">
1034 <input
1035 id=${m}
1036 type="number"
1037 .value=${t}
1038 placeholder=${o}
1039 ?disabled=${i}
1040 ?readonly=${n}
1041 inputmode="decimal"
1042 autocomplete="off"
1043 min=${l??""}
1044 max=${u??""}
1045 step=${h}
1046 name=${r}
1047 aria-invalid=${p?"true":"false"}
1048 aria-label=${e||""}
1049 @input=${b=>this._onInput(b)}
1050 @change=${b=>this._onCommit(b)}
1051 @keydown=${b=>this._onKeyDown(b)}
1052 />
1053 ${a?c`<span class="os-text-field__suffix">${a}</span>`:c``}
1054 </span>
1055 `}_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 e<t?t:e>o?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})}}};ot.props=["label","value","placeholder","disabled","readonly","name","suffix","min","max","step","invalid"],ot.styles=[Ur],ot.help=void 0;let Io=ot;w("os-number-field",Io);const hu=v` ${C} ${ms}: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}`,it=class it extends _{render(){const e=this.checked!==null,t=this.disabled!==null,o=this.label||"",i=this.value;return c`
1056 <label>
1057 <input
1058 type="checkbox"
1059 .checked=${e}
1060 ?disabled=${t}
1061 .value=${i??""}
1062 @change=${n=>this._onChange(n)}
1063 />
1064 <span class="os-checkbox__label">${o}</span>
1065 </label>
1066 `}_onChange(e){const o=e.target.checked;o?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:o,value:this.value})}};it.props=["checked","value","label","disabled"],it.styles=[hu],it.help=void 0;let Ro=it;w("os-checkbox",Ro);const pu=v` ${C} ${ms}: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}`,nt=class nt extends _{render(){const e=this.label||"",t=this.checked!==null,o=this.disabled!==null;return c`
1067 <label>
1068 <input
1069 type="checkbox"
1070 ?checked=${t}
1071 ?disabled=${o}
1072 @change=${i=>this._onChange(i)}
1073 />
1074 <span class="os-checkbox-label__text">${e}</span>
1075 </label>
1076 `}_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})}};nt.props=["label","checked","disabled"],nt.styles=[pu],nt.help=void 0;let Lo=nt;w("os-checkbox-label",Lo);const gu=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}}`,fu=4,rt=class rt 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`
1077 <div class="os-switch__row">
1078 <span class="os-switch__text">
1079 <span class="os-switch__label">${o}</span>
1080 <span class="os-switch__description" id="os-switch-desc"
1081 >${i}</span
1082 >
1083 </span>
1084 <button
1085 type="button"
1086 role="switch"
1087 aria-checked=${e?"true":"false"}
1088 aria-label=${o||"Toggle"}
1089 aria-describedby=${i?"os-switch-desc":""}
1090 ?disabled=${t}
1091 @click=${()=>this._onClick()}
1092 @keydown=${n=>this._onKeyDown(n)}
1093 @pointerdown=${n=>this._onPointerDown(n)}
1094 @pointermove=${n=>this._onPointerMove(n)}
1095 @pointerup=${n=>this._onPointerUp(n)}
1096 @pointercancel=${()=>this._endGesture()}
1097 >
1098 <span class="os-switch__knob"></span>
1099 </button>
1100 </div>
1101 `}_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)>=fu&&(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}};rt.props=["checked","value","label","description","disabled","size","tone","block","labelPosition"],rt.styles=[gu],rt.help=void 0;let To=rt;w("os-switch",To);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}`,mu=v` ${C}:host{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}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}}`,Cs=class Cs extends _{connectedCallback(){super.connectedCallback(),this.setAttribute("aria-live","polite")}render(){return c`<slot></slot>`}};Cs.styles=[bu],Cs.help=void 0;let Do=Cs;w("os-toast-container",Do);const at=class at 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");return c`
1102 <span class="os-toast__label"><slot></slot></span>
1103 <button
1104 type="button"
1105 ?hidden=${!e}
1106 @click=${o=>this._onAction(o)}
1107 >
1108 ${e}
1109 </button>
1110 <button
1111 type="button"
1112 class="os-toast__close"
1113 aria-label=${d("Dismiss")}
1114 ?hidden=${!t}
1115 @click=${o=>this._onDismiss(o)}
1116 >
1117 ${P("close",{size:16})}
1118 </button>
1119 `}_onAction(e){e.preventDefault(),e.stopPropagation(),this.emit("os-toast-action",{})}_onDismiss(e){e.preventDefault(),e.stopPropagation(),this.emit("os-toast-dismiss",{})}};at.props=["action","state","dismissible"],at.styles=[mu],at.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:"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`
1120 <os-toast state="in" action="Undo">Post moved to trash.</os-toast>
1121 `};let Po=at;w("os-toast",Po);const vu=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}`,_u=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}`,wu=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}}`,lt=class lt extends _{render(){return this.setAttribute("role","tab"),c`
1122 <button type="button" @click=${()=>this._onPick()}>
1123 <slot></slot>
1124 </button>
1125 `}_onPick(){this.emit("os-tab-pick",{value:this.value})}};lt.props=["value"],lt.styles=[wu],lt.help=void 0;let No=lt;w("os-tab",No);const ct=class ct 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){yu(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")}qr(this,o)}),c`<slot></slot>`}};ct.props=["value","label","orientation"],ct.styles=[vu],ct.help={title:"Tabs",summary:'Underline-accent tab strip. Pair with sibling <os-tabpanel for="…"> 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 <os-tab> 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:'<os-tab value="…"> children forming the strip.'}],events:[{name:"os-tab-change",description:"Fires when the active tab changes.",detail:"{ value: string }"}],example:c`
1126 <os-tabs value="one" label="Demo tabs">
1127 <os-tab value="one">One</os-tab>
1128 <os-tab value="two">Two</os-tab>
1129 <os-tab value="three">Three</os-tab>
1130 </os-tabs>
1131 <os-tabpanel for="one">First panel.</os-tabpanel>
1132 <os-tabpanel for="two">Second panel.</os-tabpanel>
1133 <os-tabpanel for="three">Third panel.</os-tabpanel>
1134 `};let Mo=ct;w("os-tabs",Mo);const dt=class dt extends _{connectedCallback(){super.connectedCallback(),this.setAttribute("role","tabpanel"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const e=xu(this);e&&qr(e,e.getAttribute("value"))}render(){return c`<slot></slot>`}};dt.props=["for"],dt.styles=[_u],dt.help={title:"Tab panel",summary:'Auto-managed panel paired with a sibling <os-tabs>. Declares which tab it belongs to via `for="<tab-value>"`; 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 <os-tab>. Panel is shown when its parent tabs strip is on that value."}],slots:[{name:"(default)",description:"Panel body content."}],example:c`
1135 <os-tabs value="two" label="Demo tabs">
1136 <os-tab value="one">One</os-tab>
1137 <os-tab value="two">Two</os-tab>
1138 </os-tabs>
1139 <os-tabpanel for="one">
1140 Hidden — the strip is on "two".
1141 </os-tabpanel>
1142 <os-tabpanel for="two">
1143 Visible, because this panel's <code>for</code> matches the
1144 strip's <code>value</code>.
1145 </os-tabpanel>
1146 `};let zo=dt;w("os-tabpanel",zo);function yu(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 xu(s){const e=s.parentElement;if(!e)return null;const t=e.querySelector(":scope > os-tabs");return t||s.closest("os-tabs")}function qr(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 ku=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}`,$u={minimize:'<path d="M3 6h6" stroke="currentColor" stroke-width="1.25" stroke-linecap="round"/>',maximize:'<rect x="3" y="3" width="6" height="6" rx="1" stroke="currentColor" stroke-width="1.25" fill="none"/>',fullscreen:'<path d="M4.5 2H2v2.5M10 4.5V2H7.5M4.5 10H2V7.5M10 7.5V10H7.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',"fullscreen-exit":'<path d="M2 4.5H4.5V2M7.5 2V4.5H10M2 7.5H4.5V10M7.5 10V7.5H10" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',detach:'<path d="M5 2H2.5v7.5H10V7M6.5 2H10v3.5M10 2L5.5 6.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',reload:'<g transform="translate(0.6 0.6) scale(0.021)" fill="currentColor"><path d="m504.554 233.704-76.447 91.467c-6.329 7.572-15.417 11.479-24.571 11.479a31.872 31.872 0 0 1-20.504-7.447l-91.467-76.447c-13.561-11.334-15.366-31.515-4.032-45.075s31.515-15.366 45.075-4.032l37.506 31.347c-10.274-74.891-74.668-132.774-152.337-132.774C132.984 102.223 64 171.207 64 256s68.984 153.777 153.777 153.777c17.673 0 32 14.327 32 32s-14.327 32-32 32c-58.17 0-112.859-22.653-153.991-63.785C22.653 368.859 0 314.17 0 256s22.653-112.859 63.786-153.992c41.132-41.132 95.821-63.785 153.991-63.785s112.859 22.653 153.992 63.785c32.517 32.516 53.471 73.508 60.829 117.991l22.849-27.339c11.334-13.56 31.515-15.364 45.075-4.032 13.56 11.335 15.365 31.516 4.032 45.076z"/></g>',close:'<path d="M3.25 3.25l5.5 5.5M3.25 8.75l5.5-5.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round"/>',menu:'<circle cx="3" cy="6" r="1.2" fill="currentColor"/><circle cx="6" cy="6" r="1.2" fill="currentColor"/><circle cx="9" cy="6" r="1.2" fill="currentColor"/>'};function Au(s){const e=(s??"").trim();return e===""||e.length>4096||!/^(https?:\/\/|data:image\/)/i.test(e)||/['"()\\<>\s]/.test(e)?"":e}const ut=class ut extends _{constructor(){super(...arguments),this._activateWired=!1}static get observedAttributes(){return[...super.observedAttributes,"aria-label","aria-pressed"]}render(){const e=Au(this["icon-src"]||this.getAttribute("icon-src")||""),t=e?"":this.icon||"",o=$u[t]||"",i=this.getAttribute("aria-label")||"";return e?c`
1147 <button type="button" aria-label="${i}" aria-pressed="${this.getAttribute("aria-pressed")||""}" ?disabled="${this.hasAttribute("disabled")}">
1148 <span
1149 class="themed-icon"
1150 aria-hidden="true"
1151 style="-webkit-mask: url('${e}') center / contain no-repeat; mask: url('${e}') center / contain no-repeat;"
1152 ></span>
1153 <slot></slot>
1154 </button>
1155 `:c`
1156 <button type="button" aria-label="${i}" aria-pressed="${this.getAttribute("aria-pressed")||""}" ?disabled="${this.hasAttribute("disabled")}">
1157 <svg
1158 width="14"
1159 height="14"
1160 viewBox="0 0 12 12"
1161 aria-hidden="true"
1162 focusable="false"
1163 ></svg>
1164 <slot></slot>
1165 </button>
1166 <span data-svg-buffer style="display:none">${o}</span>
1167 `}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}))}))}};ut.props=["icon","icon-src","active","danger","disabled"],ut.styles=[ku],ut.help=void 0;let Oo=ut;w("os-window-button",Oo);const Eu=v` ${C} ${ao}: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}}`,Su=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}`,ht=class ht extends _{render(){return c`
1168 <slot></slot>
1169 `}connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}};ht.props=["open"],ht.styles=[Eu],ht.help=void 0;let Wo=ht;w("os-context-menu",Wo);const pt=class pt 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`
1170 ${o?c`<span class="check" aria-hidden="true">✓</span>`:c``}
1171 ${e?c`<span class="icon dashicons ${e}" aria-hidden="true"></span>`:c``}
1172 <span class="label"><slot></slot></span>
1173 ${t?c`<span class="chevron" aria-hidden="true">›</span>`:c``}
1174 `}};pt.props=["value","icon","disabled","danger","heading","has-children","checked"],pt.styles=[Su],pt.help={title:"Context menu option",summary:"Single row inside <os-context-menu>. 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`
1175 <os-context-menu open style="position: relative; z-index: 0">
1176 <os-context-menu-option heading>Every variant</os-context-menu-option>
1177 <os-context-menu-option value="plain">Plain</os-context-menu-option>
1178 <os-context-menu-option value="icon" icon="dashicons-admin-page">
1179 With an icon
1180 </os-context-menu-option>
1181 <os-context-menu-option value="checked" checked>
1182 Checked
1183 </os-context-menu-option>
1184 <os-context-menu-option value="children" has-children>
1185 With a submenu
1186 </os-context-menu-option>
1187 <os-context-menu-option value="off" disabled>Disabled</os-context-menu-option>
1188 <os-context-menu-option value="del" danger icon="dashicons-trash">
1189 Danger
1190 </os-context-menu-option>
1191 </os-context-menu>
1192 `};let Ho=pt;w("os-context-menu-option",Ho);function Cu(s,e){s.style.visibility="hidden";const t=()=>{s.isConnected&&(e(s.getBoundingClientRect()),s.style.visibility="")};typeof requestAnimationFrame=="function"?requestAnimationFrame(t):t()}const Iu=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)}`,gt=class gt 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`<os-button variant="ghost" @click=${()=>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"} <span class="chevron" aria-hidden="true"></span></os-button>
1193 <div class="panel" popover="manual" hidden><os-context-menu open aria-label=${this.getAttribute("label")||"Actions"}><slot></slot></os-context-menu></div>`}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;Cu(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)}};gt.props=["label","text"],gt.styles=[Iu],gt.help=void 0;let Uo=gt;w("os-action-menu",Uo);const Ru=v` ${C} ${ao}: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}`,Lu=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 )}`,Is=class Is extends _{connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}render(){return c`<slot></slot>`}};Is.styles=[Ru],Is.help=void 0;let qo=Is;w("os-menu",qo);const ft=class ft 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`
1194 <button type="button" @click=${i=>this._onPick(i)}>
1195 <span
1196 class="os-menu-item__check"
1197 ?hidden=${!t}
1198 ></span>
1199 <span
1200 class="os-menu-item__icon dashicons ${e}"
1201 aria-hidden="true"
1202 ?hidden=${t||!e}
1203 ></span>
1204 <span class="os-menu-item__label">
1205 <slot></slot>
1206 </span>
1207 </button>
1208 `}_onPick(e){e.preventDefault(),this.emit("os-menu-item-click",{value:this.value})}};ft.props=["icon","value","checked"],ft.styles=[Lu],ft.help={title:"Menu item",summary:'Single row inside a <os-menu>. Supports three looks: plain label, left-aligned dashicon (icon="dashicons-…"), or a checkbox indicator (role="menuitemcheckbox" + checked).',status:"stable",props:[{name:"icon",type:"string (dashicons class)",description:'Dashicons class rendered on the left. Ignored when role="menuitemcheckbox".'},{name:"value",type:"string",description:"Identifier emitted in os-menu-item-click.detail.value."},{name:"checked",type:"boolean attribute",description:'Visible check indicator. Only honoured when role="menuitemcheckbox".'}],slots:[{name:"(default)",description:"Menu item label."}],events:[{name:"os-menu-item-click",description:"Fires when the item is clicked; bubbles so the <os-menu> parent can delegate.",detail:"{ value: string | null }"}],example:c`
1209 <os-menu>
1210 <os-menu-item value="plain">Plain item</os-menu-item>
1211 <os-menu-item value="icon" icon="dashicons-external">
1212 With an icon
1213 </os-menu-item>
1214 <os-menu-item value="startup" role="menuitemcheckbox" checked>
1215 Checked (menuitemcheckbox)
1216 </os-menu-item>
1217 </os-menu>
1218 `};let Fo=ft;w("os-menu-item",Fo);const Tu=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 )}`,Fr='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Du(s){let e=s?.activeElement??null;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e&&e!==s?.body?e:null}function Vr(s){const e=s.composedPath(),t=e.length>0?e[0]:s.target;return t instanceof HTMLElement?t:null}function jr(s){return s!==null&&s.matches(Fr)}const bt=class bt 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(jr(Vr(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=Du(this.ownerDocument),this._focusTries=0,queueMicrotask(this._focusInitial)):this._restoreFocus())}_focusables(){const e=this.shadowRoot;return e?Array.from(e.querySelectorAll(Fr)):[]}_trapTab(e){const t=this._focusables();if(t.length===0)return;const o=t[0],i=t[t.length-1],n=Vr(e),r=!jr(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`
1219 <div class="dialog" tabindex="-1">
1220 ${a?c`<button
1221 type="button"
1222 class="close"
1223 aria-label="Close"
1224 @click=${()=>this._cancel()}
1225 >&times;</button>`:c``}
1226 ${e?c`<h2 class="title">${e}</h2>`:c``}
1227 ${t?c`<p class="message">${t}</p>`:c``}
1228 ${l?c`<label class="remember">
1229 <input type="checkbox" class="remember__box" />
1230 <span class="remember__label">${l}</span>
1231 </label>`:c``}
1232 <div class="actions">
1233 ${r?c``:c`<button
1234 type="button"
1235 class="btn btn--secondary"
1236 @click=${()=>this._cancel()}
1237 >
1238 ${i}
1239 </button>`}
1240 <button
1241 type="button"
1242 class="btn ${n?"btn--danger":"btn--primary"}"
1243 @click=${()=>this._confirm()}
1244 >
1245 ${o}
1246 </button>
1247 </div>
1248 </div>
1249 `}};bt.props=["open","title","message","confirm-label","cancel-label","danger","hide-cancel","dismissable","remember-label"],bt.styles=[Tu],bt.help=void 0;let Vo=bt;w("os-confirm-dialog",Vo);const Pu=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}`,mt=class mt 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 nn(n,r,{source:"desktop-mode/files-user-search",silent:!0});if(!a.ok)throw new Error(`HTTP ${a.status}`);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`<div class="empty">Searching…</div>`;if(this._phase==="error")return c`<div class="empty error">${this._error}</div>`;if(this._results.length===0){const e=this._query?"No matches.":"No users available.";return c`<div class="empty">${e}</div>`}return this._results.map(e=>c`
1250 <button
1251 type="button"
1252 class="item"
1253 role="option"
1254 @mousedown=${t=>t.preventDefault()}
1255 @click=${()=>this._pick(e)}
1256 >
1257 <img class="avatar" src=${e.avatarUrl} alt="" />
1258 <div>
1259 <div class="name">${e.name}</div>
1260 <div class="slug">${e.slug}</div>
1261 </div>
1262 </button>
1263 `)}render(){const e=this.getAttribute("placeholder")||"Search users…";return c`
1264 <input
1265 class="input"
1266 type="search"
1267 placeholder=${e}
1268 autocomplete="off"
1269 @input=${this._onInput}
1270 @focus=${this._onFocus}
1271 @blur=${this._onBlur}
1272 .value=${this._query}
1273 />
1274 ${this._open?c`
1275 <div class="dropdown" role="listbox" style=${this._dropdownStyle}>
1276 ${this._dropdownContent()}
1277 </div>
1278 `:c``}
1279 `}};mt.props=["placeholder","exclude","endpoint"],mt.styles=[Pu],mt.help=void 0;let jo=mt;w("os-user-search",jo);const Nu=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}`,vt=class vt 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`<span class="empty">No eligible roles.</span>`;const t=this._selectedSet();return c`
1280 ${e.map(o=>{const i=t.has(o.slug);return c`
1281 <button
1282 type="button"
1283 class="chip"
1284 aria-pressed=${i?"true":"false"}
1285 @click=${()=>this._onToggle(o.slug)}
1286 >${o.name}</button>
1287 `})}
1288 `}};vt.props=["selected","roles"],vt.styles=[Nu],vt.help=void 0;let Bo=vt;w("os-role-picker",Bo);const Mu=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}}`,Br=["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(","),zu="[data-flyout-close]",_t=class _t 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?.(zu);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(Br)??null}_allFocusable(){return Array.from(this.querySelectorAll(Br)).filter(e=>!e.disabled)}render(){return c`<slot></slot>`}};_t.props=["open","placement","scope","aria-label","aria-labelledby"],_t.styles=[Mu],_t.help=void 0;let Ko=_t;w("os-flyout",Ko);const Ou=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}}`,Wu={detach:'<path d="M5 2H2.5v7.5H10V7M6.5 2H10v3.5M10 2L5.5 6.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',close:'<path d="M2.5 2.5l7 7M9.5 2.5l-7 7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>'},wt=class wt extends _{render(){const e=this.variant||"",t=Wu[e]||"";return c`
1289 <button type="button">
1290 <svg
1291 viewBox="0 0 12 12"
1292 aria-hidden="true"
1293 focusable="false"
1294 ></svg>
1295 <slot></slot>
1296 </button>
1297 <span data-svg-buffer style="display:none">${t}</span>
1298 `}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)}}};wt.props=["variant"],wt.styles=[Ou],wt.help=void 0;let Go=wt;w("os-tab-chip",Go);const Hu=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}`,yt=class yt 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`<slot></slot>`}};yt.props=["gap","align","padding"],yt.styles=[Hu],yt.help=void 0;let Xo=yt;w("os-stack",Xo);const Uu=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}`,xt=class xt 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`<slot></slot>`}};xt.props=["gap","justify","align"],xt.styles=[Uu],xt.help=void 0;let Zo=xt;w("os-cluster",Zo);const qu=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 ys=null;function Fu(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 Kr(){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=Fu(a);l&&s.set(r[1],l)}}return s}function Vu(s){ys||(ys=Kr());const e=s.startsWith("dashicons-")?s.slice(10):s;return ys.get(e)??null}function ju(){ys=Kr()}let Gr=!1;function Bu(){if(Gr||typeof window>"u")return;Gr=!0;const s=()=>{ju()};document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",s,{once:!0}),window.addEventListener("load",s,{once:!0})}Bu();const kt=class kt 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=Vu(t);return i?c`<span
1299 class="os-icon__glyph os-icon__glyph--char dashicons dashicons-${t}"
1300 aria-hidden="true"
1301 >${i}</span>`:c`<span
1302 class="os-icon__glyph dashicons dashicons-${t}"
1303 aria-hidden="true"
1304 ></span>`}};kt.props=["name","size"],kt.styles=[qu],kt.help=void 0;let Yo=kt;w("os-icon",Yo);const Ku=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}`,$t=class $t 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`<slot></slot>`}};$t.props=["gap","padding","scroll"],$t.styles=[Ku],$t.help=void 0;let Jo=$t;w("os-body",Jo);const Gu=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}`,At=class At 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`<slot></slot>`}};At.props=["gap","padding"],At.styles=[Gu],At.help=void 0;let Qo=At;w("os-panel",Qo);const Xu=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}`,Et=class Et 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`<slot></slot>`}};Et.props=["gap","column-gap","row-gap"],Et.styles=[Xu],Et.help=void 0;let ei=Et;w("os-row",ei);const Zu=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}`,St=class St extends _{render(){return c`<div><slot name="header"></slot></div>
1305 <div><slot name="toolbar"></slot></div>
1306 <div class="content" part="content"><slot></slot></div>
1307 <div><slot name="footer"></slot></div>`}};St.props=["contained"],St.styles=[Zu],St.help=void 0;let ti=St;w("os-app-frame",ti);const Yu=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}}`,Ct=class Ct 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`<div class="layout ${this.isCompact()?"compact "+r:""}">
1308 <div class="pane start" part="start" id="start" tabindex="-1"><slot name="start"></slot></div>
1309 <div class="divider ${e?"enabled":""} ${this.drag?"dragging":""}" part="divider"
1310 role=${e?"separator":"presentation"} aria-hidden=${e?"false":"true"} tabindex=${e?"0":"-1"}
1311 aria-label=${this.getAttribute("label")||d("Resize panes")}
1312 aria-controls="start" aria-orientation=${this.isVertical()?"horizontal":"vertical"}
1313 aria-valuemin=${String(o)} aria-valuemax=${String(i)} aria-valuenow=${String(t)}
1314 @pointerdown=${this.onDown} @pointermove=${this.onMove} @pointerup=${this.onUp}
1315 @pointercancel=${this.onCancel} @lostpointercapture=${this.onLostCapture} @keydown=${this.onKey}></div>
1316 <div class="pane end" part="end" tabindex="-1"><slot name="end"></slot></div>
1317 </div><div class="shield" ?hidden=${!this.drag} aria-hidden="true"></div>`}};Ct.props=["position","min-start","min-end","resizable","direction","collapse-at","narrow","compact","label"],Ct.styles=[Yu],Ct.help=void 0;let si=Ct;w("os-split",si);const Ju=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}`,It=class It 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`<slot></slot>`}};It.props=["columns","rows","gap","column-gap","row-gap","min-item-width"],It.styles=[Ju],It.help=void 0;let oi=It;w("os-grid",oi);const Qu=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}`,Xr={sm:"16px",md:"20px",lg:"28px",xl:"40px"},Rt=class Rt 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",Xr[t]||Xr.lg),this.style.setProperty("--os-ui-display-align",o),c`
1318 <output part="output" class="os-display__output">
1319 ${e??c`<slot></slot>`}
1320 </output>
1321 `}};Rt.props=["value","size","align"],Rt.styles=[Qu],Rt.help=void 0;let ii=Rt;w("os-display",ii);const eh=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 th=0;const Lt=class Lt extends _{constructor(){super(...arguments),this.bodyId=`os-disclosure-body-${++th}`,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`
1322 <button
1323 type="button"
1324 class="os-disclosure__summary"
1325 part="summary"
1326 aria-expanded=${o?"true":"false"}
1327 aria-controls=${this.bodyId}
1328 @click=${this.onToggle}
1329 >
1330 <span class="os-disclosure__marker" aria-hidden="true"></span>
1331 <h3 part="heading" class="os-disclosure__heading">${e}</h3>
1332 ${t?c`<span class="os-disclosure__hint">${t}</span>`:""}
1333 </button>
1334 <div
1335 id=${this.bodyId}
1336 class="os-disclosure__body"
1337 part="body"
1338 ?hidden=${!o}
1339 >
1340 <slot></slot>
1341 </div>
1342 `}};Lt.props=["heading","hint","open"],Lt.styles=[eh],Lt.help=void 0;let ni=Lt;w("os-disclosure",ni);const sh=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}`,Tt=class Tt extends _{render(){const e=this.icon||"",t=this.heading||"",o=this.description||"";return c`
1343 ${e?c`<os-icon
1344 class="os-empty-state__icon"
1345 name=${e}
1346 size="28"
1347 ></os-icon>`:null}
1348 <h3 class="os-empty-state__heading">${t}</h3>
1349 <p class="os-empty-state__description">${o}</p>
1350 <div class="os-empty-state__cta">
1351 <slot name="cta"></slot>
1352 </div>
1353 <slot></slot>
1354 `}};Tt.props=["icon","heading","description"],Tt.styles=[sh],Tt.help=void 0;let ri=Tt;w("os-empty-state",ri);const oh=v` ${C} ${fs} ${bs} ${ro}: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}`,xs="os-key--pressed",Dt=class Dt 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`
1355 <button
1356 part="button"
1357 class="os-holo-sheen"
1358 type="button"
1359 ?disabled=${t}
1360 @click=${o=>this.handleClick(o)}
1361 >
1362 ${e!=null&&e!==""?e:c`<slot></slot>`}
1363 <span class="os-holo-glint" aria-hidden="true"></span>
1364 <span class="os-holo-ring" aria-hidden="true"></span>
1365 </button>
1366 `}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(xs);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(xs),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(xs),window.setTimeout(()=>{this.classList.remove(xs)},120)}};Dt.props=["key","code","label","variant","fill-cell","hold","modifier","disabled"],Dt.styles=[oh],Dt.help=void 0;let ai=Dt;w("os-key",ai);const ih=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 )}`,Pt=class Pt 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`<code><slot></slot></code>${e?c`<button
1367 type="button"
1368 class="copy"
1369 part="copy"
1370 aria-label="${this._copied?"Copied":"Copy code to clipboard"}"
1371 title="${this._copied?"Copied":"Copy to clipboard"}"
1372 @click=${this._onCopy}
1373 >
1374 ${this._copied?"✓":"⧉"}
1375 </button>`:""}`}};Pt.props=["block","copy","wrap"],Pt.styles=[ih],Pt.help=void 0;let li=Pt;w("os-code",li);const nh=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}`,Nt=class Nt extends _{render(){return c`<span class="dot" aria-hidden="true"></span><slot></slot>`}};Nt.props=["tone","noDot"],Nt.styles=[nh],Nt.help=void 0;let ci=Nt;w("os-badge",ci);const rh=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 ) )}`,Mt=class Mt extends _{render(){return c`<span class="banner" part="banner"><slot></slot></span>`}};Mt.props=["placement","tone"],Mt.styles=[rh],Mt.help=void 0;let di=Mt;w("os-ribbon",di);const ah=v`:host{display:inline-block}`,N="os-file-tile",Zr={draft:"Draft",pending:"Pending",private:"Private",future:"Scheduled"};function lh(){const s=window.wp?.os?.getOsSettings;if(typeof s!="function")return!0;try{return s()?.showPostStatusRibbons!==!1}catch{return!0}}function ch(){return window.wp?.os?.dragManager??null}const dh=["type","ref","label","icon","thumbnail","kind","status","selected","selectable","missing","access-gated","drag-kind","drag-title","drag-icon"],Ce=class Ce 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(`${N}--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=[N,`${N}--folder`,`${N}--missing`,`${N}--access-gated`,`${N}--selected`];for(const k of g)this.classList.remove(k);this.classList.add(N),r==="folder"&&this.classList.add(`${N}--folder`),h&&this.classList.add(`${N}--missing`),p&&this.classList.add(`${N}--access-gated`),l&&this.classList.add(`${N}--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 m="You don’t have permission to open this — ask the folder owner for access.";p?(this.title=m,this.setAttribute("aria-disabled","true")):(this.removeAttribute("aria-disabled"),this.title===m&&this.removeAttribute("title"));const b=[`${N}__visual`,`${N}__label`,`${N}__lock`];for(const k of b)this.querySelectorAll(`:scope > .${k}`).forEach(f=>f.remove());this.querySelectorAll(":scope > os-ribbon").forEach(k=>k.remove());const y=document.createElement("span");if(y.className=`${N}__visual`,n){const k=document.createElement("img");k.src=n,k.alt="",k.loading="lazy",k.decoding="async",k.className=`${N}__preview`,k.draggable=!1,y.appendChild(k)}else if(i){const k=Nr(i,{title:o,className:`${N}__icon`});y.appendChild(k)}this.appendChild(y);const x=document.createElement("span");if(x.className=`${N}__label`,x.textContent=o,this.appendChild(x),p){const k=document.createElement("span");k.className=`${N}__lock dashicons dashicons-lock`,k.setAttribute("aria-hidden","true"),this.appendChild(k)}if(a&&a!=="publish"&&Zr[a]&&lh()){const k=document.createElement("os-ribbon");k.setAttribute("placement","top-end"),k.setAttribute("tone",uh(a)),k.textContent=Zr[a],this.appendChild(k)}Dl(this),ge("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=ch();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)}};Ce.shadow=!1,Ce.props=dh,Ce.styles=[ah],Ce.help=void 0;let ui=Ce;function uh(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",ui);const hh=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 Yr(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 zt=class zt extends _{constructor(){super(...arguments),this._entries=[],this._renderRow=Yr,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:Yr,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;i<this._entries.length;i++){t[i]=o;const n=this._heights[i];o+=Number.isFinite(n)&&n>0?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<i;){const n=Math.floor((o+i+1)/2);t[n]<=e?o=n:i=n-1}return o}_paintSpacer(){const e=this.shadowRoot?.querySelector(".spacer");e&&(e.style.height=`${this._totalContentHeight()}px`)}_paintWindow(){const e=this.shadowRoot?.querySelector(".window"),t=this.shadowRoot?.querySelector(".empty");if(!e)return;if(this._entries.length===0){e.replaceChildren(),t&&(t.style.display="");return}t&&(t.style.display="none");const o=this._isAutoHeight(),i=this._readRowHeight(),n=this._readOverscan(),r=this.clientHeight,a=this.scrollTop;let l,u;if(o){this._ensureOffsets();const b=this._findIndexAtOffset(a),y=this._findIndexAtOffset(a+r);l=Math.max(0,b-n),u=Math.min(this._entries.length,y+1+n)}else l=Math.max(0,Math.floor(a/i)-n),u=Math.min(this._entries.length,Math.ceil((a+r)/i)+n);const h=document.createDocumentFragment(),p=[];for(let b=l;b<u;b++){const y=this._renderRow(this._entries[b],b);let x;y instanceof HTMLElement?x=y:(x=document.createElement("span"),x.textContent=String(y)),x.classList.add("row"),x.style.position="absolute",x.style.left="0",x.style.right="0",o?(x.style.top=`${this._offsets[b]}px`,x.style.height="auto"):(x.style.top=`${b*i}px`,x.style.height=`${i}px`),h.appendChild(x),p.push({idx:b,el:x})}if(e.replaceChildren(h),!o)return;let g=!1;const m=this._readRowHeight();for(const{idx:b,el:y}of p){const x=y.offsetHeight||m,k=this._heights[b];(!Number.isFinite(k)||Math.abs(k-x)>.5)&&(this._heights[b]=x,g=!0)}if(g){this._invalidateOffsets(),this._ensureOffsets();for(const{idx:b,el:y}of p)y.style.top=`${this._offsets[b]}px`;this._paintSpacer(),this._stickToBottom&&(this.scrollTop=this.scrollHeight)}}render(){const e=this.getAttribute("empty")||"No entries";return c`
1376 <div class="spacer">
1377 <div class="window" part="window"></div>
1378 </div>
1379 <div class="empty" part="empty">${e}</div>
1380 `}};zt.props=["rowHeight","maxRows","overscan","empty","autoRowHeight"],zt.styles=[hh],zt.help=void 0;let hi=zt;w("os-log",hi);const ph=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 )}`,gh=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 ]: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}`,Ot=class Ot 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`<ol class="os-steps__list"><slot @slotchange=${this.syncTrail}></slot></ol>`}};Ot.props=["horizontal"],Ot.styles=[ph],Ot.help=void 0;let pi=Ot;w("os-steps",pi);const Wt=class Wt 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`
1381 <div class="os-step__body">
1382 <div class="os-step__title">${e}</div>
1383 <slot></slot>
1384 </div>
1385 `}};Wt.props=["title","done","current","interactive"],Wt.styles=[gh],Wt.help={title:"Step",summary:"A single numbered step inside <os-steps>. 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 way back: focusable, activated by click or Enter/Space, and emits os-step-click."}],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"}],example:c`
1386 <os-steps>
1387 <os-step title="Configure">Open OpenStation Preferences → AI.</os-step>
1388 <os-step title="Connect" done>Key confirmed.</os-step>
1389 </os-steps>
1390 `};let gi=Wt;w("os-step",gi);const fh=v` ${C} ${ms}: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}}`,$e="__wpd_expander__",Ae="__wpd_select__",Ht=class Ht 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;t<this._data.length;t++)this._subTable(this._data[t],t)&&(this._expanded.has(t)||(this._expanded.add(t),e=!0));e&&this._schedulePaint()}collapseAll(){this._expanded.size!==0&&(this._expanded.clear(),this._schedulePaint())}isExpanded(e){return this._expanded.has(e)}clearFilters(){Object.keys(this._filters).length!==0&&(this._filters={},this.emit("os-table-filter-change",{filters:{}}),this._schedulePaint())}clearSort(){this._sort!==null&&(this._sort=null,this.emit("os-table-sort-change",{sort:null}),this._schedulePaint())}select(e){if(this._selection.has(e))return;const t=this._readSelectable(),o=t==="single"?Array.from(this._selection):[];t==="single"&&this._selection.clear(),this._selection.add(e),this._emitSelectionChange(),this._syncSelectionDom([e,...o])}deselect(e){this._selection.delete(e)&&(this._emitSelectionChange(),this._syncSelectionDom([e]))}selectAll(){if(this._readSelectable()==="multi"){for(const{row:e,index:t}of this._filteredRows())this._selection.add(this._getRowId(e,t));this._emitSelectionChange(),this._syncSelectionDom("all")}}clearSelection(){this._selection.size!==0&&(this._selection.clear(),this._emitSelectionChange(),this._syncSelectionDom("all"))}_syncSelectionDom(e){const t=this.shadowRoot;if(!t)return;const o=t.querySelector("tbody");if(!o)return;let i=null;if(e!=="all"){i=new Set;for(const a of e)i.add(String(a))}const n=o.querySelectorAll("tr[data-row-id]");for(const a of n){const l=a.dataset.rowId;if(l===void 0||i&&!i.has(l))continue;const u=Number(a.dataset.rowIndex);if(!Number.isFinite(u))continue;const h=this._data[u];if(h===void 0)continue;const p=this._getRowId(h,u),g=this._selection.has(p);a.classList.toggle("is-selected",g);const m=a.querySelector("input.select-row-checkbox");m&&m.checked!==g&&(m.checked=g)}const r=t.querySelector("thead .select-all-checkbox");if(r){const{total:a,selected:l}=this._visibleSelectionStats();r.checked=a>0&&l===a,r.indeterminate=l>0&&l<a}}scrollToRow(e){const t=this.shadowRoot;if(!t)return;const i=t.querySelectorAll("tbody tr:not(.subtable):not(.empty):not(.skeleton)")[e];i&&i.scrollIntoView({block:"nearest",inline:"nearest"})}connectedCallback(){super.connectedCallback(),this._schedulePaint()}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null,this._stickyRafHandle!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this._stickyRafHandle),this._stickyRafHandle=null)}recomputeLayout(){this._applyStickyOffsets(),this._measureHeaderHeight()}render(){return c`
1391 <div class="scroll" part="scroll">
1392 <table part="table">
1393 <colgroup></colgroup>
1394 <thead></thead>
1395 <tbody></tbody>
1396 </table>
1397 </div>
1398 `}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")||ke(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<t.length;l++)i.appendChild(this._buildHeaderCell(t[l],l,o));const n=e.querySelector(':scope > 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;p<t.length;p++)l.push(this._buildFilterCell(t[p],p,o));a||(a=document.createElement("tr"),a.classList.add("filter-row"),a.setAttribute("part","filter-row"),e.appendChild(a));const u=Array.from(a.children);let h=u.length===l.length;if(h){for(let p=0;p<l.length;p++)if(u[p]!==l[p]){h=!1;break}}if(!h){const p=new Set(l);for(const g of l)a.appendChild(g);for(const g of Array.from(a.children))p.has(g)||a.removeChild(g)}}else a&&a.remove()}_buildHeaderCell(e,t,o){const i=document.createElement("th");if(i.setAttribute("scope","col"),i.dataset.key=e.key,this._applyCellClasses(i,e,t,o),e.minWidth&&(i.style.minWidth=e.minWidth),e.key===Ae){if(this._readSelectable()==="multi"){const r=document.createElement("input");r.type="checkbox",r.className="select-all-checkbox",r.setAttribute("data-noclick",""),r.setAttribute("aria-label","Select all rows");const{total:a,selected:l}=this._visibleSelectionStats();r.checked=a>0&&l===a,r.indeterminate=l>0&&l<a,r.addEventListener("change",()=>{r.checked?this.selectAll():this.clearSelection()}),i.appendChild(r)}return i}if(i.textContent=e.label??(e.key===$e?"":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===$e||e.key===Ae?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),m=g.map(b=>b.value).join("|");m!==i.optionsKey?(this._populateSelect(p,g,this._filters[e.key]??""),i.optionsKey=m):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(m=>m.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<n;r++)e.appendChild(this._buildSkeletonRow(t,r));return}const i=this._sortedRows(this._filteredRows());if(i.length===0){e.appendChild(this._buildEmptyRow(t.length));return}for(const{row:n,index:r}of i)if(e.appendChild(this._stacked?this._buildStackedRow(n,r,t):this._buildBodyRow(n,r,t,o)),this._expanded.has(r)&&this._subTable){const a=this._subTable(n,r);a&&e.appendChild(this._buildSubTableRow(a,t.length))}}_buildEmptyRow(e){const t=document.createElement("tr");t.classList.add("empty");const o=document.createElement("td");o.colSpan=e;const i=document.createElement("slot");return i.name="empty",i.textContent=this.getAttribute("empty")||"No data",o.appendChild(i),t.appendChild(o),t}_buildSkeletonRow(e,t){const o=document.createElement("tr");if(o.classList.add("skeleton"),o.setAttribute("aria-hidden","true"),this._stacked){o.classList.add("stack-row");const i=document.createElement("td");i.className="stack-body",i.colSpan=Math.max(1,e.length);for(const n of[55+t*7%25,30+t*11%15]){const r=document.createElement("span");r.className="skeleton-bar",r.style.width=`${n}%`,i.appendChild(r)}return o.appendChild(i),o}for(const i of e){const n=document.createElement("td"),r=document.createElement("span");r.className="skeleton-bar";const a=50+(t*7+o.children.length*13)%40;r.style.width=`${a}%`,n.appendChild(r),o.appendChild(n)}return o}_buildBodyRow(e,t,o,i){const n=document.createElement("tr");n.setAttribute("part","row"),n.dataset.rowIndex=String(t);const r=this._getRowId(e,t);n.dataset.rowId=String(r),this._selection.has(r)&&n.classList.add("is-selected"),n.addEventListener("click",a=>{this._onRowClick(e,t,a)});for(let a=0;a<o.length;a++)n.appendChild(this._buildBodyCell(o[a],a,e,t,i));return n}_buildStackedRow(e,t,o){const i=document.createElement("tr");i.setAttribute("part","row"),i.classList.add("stack-row"),i.dataset.rowIndex=String(t);const n=this._getRowId(e,t);i.dataset.rowId=String(n),this._selection.has(n)&&i.classList.add("is-selected"),i.addEventListener("click",u=>{this._onRowClick(e,t,u)});const r=document.createElement("td");r.className="stack-body";let a=0,l=0;for(let u=0;u<o.length;u++){const h=o[u];if(h.key===Ae||h.key===$e){i.appendChild(this._buildBodyCell(h,u,e,t,0));continue}l++;const p=bh(h,a++);if(p==="hidden")continue;const g=document.createElement("div");if(g.className=`stack-cell stack-${p}`,g.dataset.key=h.key,p==="meta"&&h.label){const y=document.createElement("span");y.className="stack-label",y.textContent=h.label,g.appendChild(y)}const m=document.createElement("span");m.className="stack-value";const b=e[h.key];h.render?this._mountCellContent(m,h.render(b,e,t)):b!=null&&(m.textContent=String(b)),g.appendChild(m),r.appendChild(g)}return r.colSpan=Math.max(1,l),i.appendChild(r),i}_buildBodyCell(e,t,o,i,n){const r=document.createElement("td");if(this._applyCellClasses(r,e,t,n),e.minWidth&&(r.style.minWidth=e.minWidth),e.key===Ae){const l=this._getRowId(o,i),u=document.createElement("input");return u.type="checkbox",u.className="select-row-checkbox",u.setAttribute("data-noclick",""),u.setAttribute("aria-label","Select row"),u.checked=this._selection.has(l),u.addEventListener("change",()=>{u.checked?this.select(l):this.deselect(l)}),r.appendChild(u),this._stacked&&(r.setAttribute("data-noclick",""),r.addEventListener("click",h=>{h.target===r&&(u.checked=!u.checked,u.dispatchEvent(new Event("change")))})),r}if(e.key===$e){if(!(this._subTable?!!this._subTable(o,i):!1))return r;const u=this._expanded.has(i),h=document.createElement("button");return h.type="button",h.className="expander",h.setAttribute("data-noclick",""),h.setAttribute("aria-expanded",u?"true":"false"),h.setAttribute("aria-label",u?"Collapse row":"Expand row"),h.textContent=u?"▾":"▸",h.addEventListener("click",p=>{this._toggleRow(i,o,p)}),r.appendChild(h),r}const a=o[e.key];if(e.render){const l=e.render(a,o,i);this._mountCellContent(r,l)}else a!=null&&(r.textContent=String(a));return r}_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(Jr(e))ke(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}Jr(t)&&ke(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;o<this._data.length;o++){const i=this._data[o];let n=!0;for(const r of t){const a=this._columns.find(p=>p.key===r);if(a&&typeof a.filterRender=="function")continue;const l=this._filters[r]??"",u=i[r],h=u==null?"":String(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=t.sortValue?t.sortValue(n.row,n.row[t.key]):n.row[t.key],l=t.sortValue?t.sortValue(r.row,r.row[t.key]):r.row[t.key];return mh(a,l)*o}),i}_uniqueValues(e){const t=new Set;for(const o of this._data){const i=o[e];i!=null&&t.add(String(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<t}_computeLastStickyIndex(e,t){let o=-1;for(let i=0;i<e.length;i++)this._isStickyIndex(i,t,e[i])&&(o=i);return o}_applyCellClasses(e,t,o,i){t.key===$e&&e.classList.add("col-expander"),t.key===Ae&&e.classList.add("col-select"),t.align==="center"&&e.classList.add("align-center"),t.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(o,i,t)&&(e.classList.add("is-sticky"),o===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:Ae,label:"",width:"40px",align:"center"}),this._subTable&&e.push({key:$e,label:"",width:"36px",align:"center"}),e.push(...this._columns),e}_applyStickyOffsets(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const o=Array.from(t.children),i=[];let n=0;for(let a=0;a<o.length;a++)i[a]=n,o[a].classList.contains("is-sticky")&&(n+=o[a].offsetWidth);e.querySelectorAll("thead tr, tbody tr:not(.subtable):not(.empty):not(.skeleton)").forEach(a=>{const l=Array.from(a.children);for(let u=0;u<l.length;u++)l[u].classList.contains("is-sticky")&&(l[u].style.insetInlineStart=`${i[u]}px`)}),this._maybeWarnStickyOffsetRace(o,i)}_maybeWarnStickyOffsetRace(e,t){if(this._stickyRaceWarned)return;const o=this._readStickyColumns();if(o<2)return;const i=Math.min(o-1,e.length-1);if(i<=0||t[i]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const n=e[0]?.offsetWidth??0;console.warn(`[os-table] sticky-columns: column ${i} resolved to inset-inline-start: 0px while the host is visible. ths[0].offsetWidth was ${n}px at measurement time. Likely a layout race — call recomputeLayout() after the panel finishes its mount/transition, or wrap the assignment of \`data\` in a requestAnimationFrame.`)}_measureHeaderHeight(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const o=t.offsetHeight;o>0&&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."))}};Ht.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],Ht.styles=[fh],Ht.help=void 0;let fi=Ht;function Jr(s){return!!s&&s.__wpdHtml===!0}function bh(s,e){return s.stack?s.stack:e===0?"title":s.label?"meta":"actions"}function mh(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",fi);const vh=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}}`,Qr=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}}),q=61.26,F=61.26,ea=58.453,_h='<path d="m8.708 61.26c0 20.802 12.089 38.779 29.619 47.298l-25.069-68.686c-2.916 6.536-4.55 13.769-4.55 21.388z"/><path d="m96.74 58.608c0-6.495-2.333-10.993-4.334-14.494-2.664-4.329-5.161-7.995-5.161-12.324 0-4.831 3.664-9.328 8.825-9.328.233 0 .454.029.681.042-9.35-8.566-21.807-13.796-35.489-13.796-18.36 0-34.513 9.42-43.91 23.688 1.233.037 2.395.063 3.382.063 5.497 0 14.006-.667 14.006-.667 2.833-.167 3.167 3.994.337 4.329 0 0-2.847.335-6.015.501l19.138 56.925 11.501-34.493-8.188-22.434c-2.83-.166-5.511-.501-5.511-.501-2.832-.166-2.5-4.496.332-4.329 0 0 8.679.667 13.843.667 5.496 0 14.006-.667 14.006-.667 2.835-.167 3.168 3.994.337 4.329 0 0-2.853.335-6.015.501l18.992 56.494 5.242-17.517c2.272-7.269 4.001-12.49 4.001-16.989z"/><path d="m62.184 65.857-15.768 45.819c4.708 1.384 9.687 2.141 14.846 2.141 6.12 0 11.989-1.058 17.452-2.979-.141-.225-.269-.464-.374-.724z"/><path d="m107.376 36.046c.226 1.674.354 3.471.354 5.404 0 5.333-.996 11.328-3.996 18.824l-16.053 46.413c15.624-9.111 26.133-26.038 26.133-45.426.001-9.137-2.333-17.729-6.438-25.215z"/>',Ut=class Ut extends _{constructor(){super(...arguments),this._paintScheduled=!1}connectedCallback(){super.connectedCallback(),this._schedulePaint()}render(){return c`<div class="root" part="root"></div>`}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){this._syncCssVars();const e=this.shadowRoot?.querySelector(".root");e&&(e.innerHTML=this._buildSvg())}_syncCssVars(){const e=(t,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=Qr[e]??Qr.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=ta(this.getAttribute("label")??"Loading"),o=9,i=(e.sp1/10).toFixed(2);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-label="${t}"><circle cx="12" cy="12" r="${o}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-opacity="0.22"/><circle cx="12" cy="12" r="${o}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-dasharray="${ks(o,e.a1)}" style="transform-origin:12px 12px;animation: os-spinner-spin ${i}s linear infinite"/></svg>`}_buildSvg(){const e=this._effectiveConfig();if(this.getAttribute("preset")==="inline")return this._buildInlineSvg(e);const t=ta(this.getAttribute("label")??"Loading"),o=e.gap*3+14,i=-o,n=122.52+o*2,r=ea+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),m=(e.sp1*2.3/10).toFixed(1);let b="";e.pulse==="scale"?b=`animation: os-spinner-scale ${g}s ease-in-out infinite`:e.pulse==="opacity"?b=`animation: os-spinner-opacity ${m}s ease-in-out infinite`:e.pulse==="both"&&(b=`animation: os-spinner-scale ${g}s ease-in-out infinite, os-spinner-opacity ${m}s ease-in-out infinite`);let y="";if(e.dots>0){const x=l+e.gap+1,k=2*Math.PI*x,f=1.6,E=(e.sp1*.65/10).toFixed(2);for(let $=0;$<e.dots;$++){const L=-($/e.dots)*k;y+=`<circle cx="${q}" cy="${F}" r="${x.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="${f}" stroke-dasharray="${f.toFixed(2)} ${(k-f).toFixed(2)}" stroke-dashoffset="${L.toFixed(2)}" stroke-linecap="round" stroke-opacity="0.65" style="transform-origin:${q}px ${F}px;animation: os-spinner-spin ${E}s linear infinite"/>`}}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${i} ${i} ${n} ${n}" role="img" aria-label="${t}"><g style="transform-origin:${q}px ${F}px${b?";"+b:""}"><circle cx="${q}" cy="${F}" r="${ea}" fill="currentColor"/><g class="mark">${_h}</g></g><circle cx="${q}" cy="${F}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.6" stroke-opacity="0.2"/><circle cx="${q}" cy="${F}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="2.2" stroke-dasharray="${ks(r,e.a1)}" stroke-linecap="round" style="transform-origin:${q}px ${F}px;${u}"/><circle cx="${q}" cy="${F}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.5" stroke-opacity="0.15"/><circle cx="${q}" cy="${F}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-opacity="0.8" stroke-dasharray="${ks(a,e.a2)}" stroke-linecap="round" style="transform-origin:${q}px ${F}px;${h}"/><circle cx="${q}" cy="${F}" r="${l.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.4" stroke-opacity="0.12"/><circle cx="${q}" cy="${F}" r="${l.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.0" stroke-opacity="0.6" stroke-dasharray="${ks(l,e.a3)}" stroke-linecap="round" style="transform-origin:${q}px ${F}px;${p}"/>`+y+"</svg>"}};Ut.props=["preset","size","color","accent","sp1","sp2","sp3","a1","a2","a3","gap","dir2","dir3","pulse","dots","label"],Ut.styles=[vh],Ut.help=void 0;let bi=Ut;function ks(s,e){const t=2*Math.PI*s,o=e/100*t,i=t-o;return`${o.toFixed(2)} ${i.toFixed(2)}`}function ta(s){return String(s).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}w("os-spinner",bi);const wh=v`:host{display:inline;color:inherit;font:inherit}`,$s=new Set;let Oe=null;const yh=3e4;function xh(){Oe===null&&(Oe=window.setInterval(()=>{for(const s of $s)s.tick()},yh))}function kh(){Oe!==null&&$s.size===0&&(window.clearInterval(Oe),Oe=null)}function $h(s){if(!s)return null;const e=t=>{const o=new Date(t);return Number.isNaN(o.getTime())?null:o};return Ah(s)?e(s):e(s.replace(" ","T")+"Z")}function Ah(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 mi=null,vi=null;function sa(){return typeof navigator<"u"&&navigator.language||"en"}function Eh(){return mi||(mi=new Intl.RelativeTimeFormat(sa(),{numeric:"auto"})),mi}function oa(){return vi||(vi=new Intl.RelativeTimeFormat(sa(),{numeric:"always",style:"narrow"})),vi}function Sh(s,e){const t=Eh(),o=s.getTime()-e,i=Math.round(o/1e3),n=Math.abs;return n(i)<45?t.format(0,"second"):ia(t,i)}function ia(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 Ch(s,e){const t=Math.round((s.getTime()-e)/1e3),o=Math.abs;return o(t)<45?oa().format(0,"second"):o(t)>604800?s.toLocaleDateString(void 0,{month:"short",day:"numeric"}):ia(oa(),t)}const qt=class qt extends _{connectedCallback(){super.connectedCallback(),$s.add(this),xh()}disconnectedCallback(){$s.delete(this),kh()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=$h(e);if(!t)return c`<span>${e??""}</span>`;const o=Date.now(),i=this.hasAttribute("compact")?Ch(t,o):Sh(t,o),n=t.toLocaleString();return c`<time datetime=${t.toISOString()} title=${n}
1399 >${i}</time
1400 >`}};qt.props=["datetime","compact"],qt.styles=[wh],qt.help=void 0;let _i=qt;w("os-relative-time",_i);const Ih=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}`,Rh="http://www.w3.org/2000/svg",We=8,Lh=20,G=8,Th=40,Dh=24,wi=2,Ph=150,Nh=new Set(["danger","warning","info","success","accent","neutral"]);function na(s,e){if(!s)return e;try{return JSON.parse(s)}catch{return e}}function Mh(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 de(s,e){const t=document.createElementNS(Rh,s);for(const[o,i]of Object.entries(e))t.setAttribute(o,i);return t}function zh(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 Ft=class Ft 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=na(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&&Nh.has(t.tone)?t.tone:"neutral"})):[]}get columnList(){const e=na(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`
1401 <div class="head" part="head">
1402 <h2 class="heading" part="heading" ?hidden=${i===""}>${i}</h2>
1403 <div class="legend" part="legend" role="group">
1404 ${e.map((n,r)=>c`
1405 <button
1406 type="button"
1407 class="chip"
1408 data-tone=${n.tone??"neutral"}
1409 aria-pressed=${o.has(n.key)?"false":"true"}
1410 @click=${()=>this.toggleSeries(n.key)}
1411 >
1412 <span class="swatch"></span>
1413 <span class="label">${n.label}</span>
1414 <span class="count">${t[r].toLocaleString()}</span>
1415 </button>
1416 `)}
1417 </div>
1418 </div>
1419 <div class="chart" part="chart"></div>
1420 <div class="tooltip" part="tooltip" hidden></div>
1421 `}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(T=>T.some(M=>M>0));if(i.length===0||!n){const T=document.createElement("div");T.className="empty",T.textContent=this.getAttribute("empty")??"",t.appendChild(T);return}const r=this.seriesList,a=this.hiddenSet,l=r.map((T,M)=>a.has(T.key)?-1:M).filter(T=>T>=0),u=parseInt(this.getAttribute("height")??"",10),h=Number.isFinite(u)&&u>40?u:Ph,p=Math.max(280,this.clientWidth||640),g=p-G-Th,m=h-We-Lh,b=i.length,y=g/b,x=Math.max(2,Math.min(Dh,y-wi)),k=i.reduce((T,M)=>{const ee=l.reduce((te,Ls)=>te+(M[Ls]??0),0);return Math.max(T,ee)},0),f=Mh(k),E=m/f,$=de("svg",{width:String(p),height:String(h),viewBox:`0 0 ${p} ${h}`,role:"img"});for(const T of[0,.5,1]){const M=f*T,ee=We+m-M*E;$.appendChild(de("line",{class:"grid",x1:String(G),y1:String(ee),x2:String(G+g),y2:String(ee)}));const te=de("text",{class:"tick",x:String(G+g+6),y:String(ee+3.5)});te.textContent=Number.isInteger(M)?M.toLocaleString():String(M),$.appendChild(te)}const L=Number(this.getAttribute("start"))||0,Q=Number(this.getAttribute("end"))||L+b,X=Math.max(1,(Q-L)/b),O=Q-L>36*3600,B=T=>new Date(T*1e3).toLocaleString([],O?{month:"short",day:"numeric"}:{hour:"2-digit",minute:"2-digit"}),_e=T=>new Date(T*1e3).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),wg=[[L,G,"start"],[L+(Q-L)/2,G+g/2,"middle"],[Q,G+g,"end"]];for(const[T,M,ee]of wg){const te=de("text",{class:"tick",x:String(M),y:String(h-5),"text-anchor":ee});te.textContent=B(T),$.appendChild(te)}const Rs=de("rect",{class:"hover",y:String(We),width:String(y),height:String(m),visibility:"hidden"});$.appendChild(Rs),i.forEach((T,M)=>{const ee=G+M*y+(y-x)/2;let te=We+m;const Ls=l.filter(rs=>(T[rs]??0)>0),yg=Ls[Ls.length-1];for(const rs of l){const Ma=T[rs]??0;if(Ma===0)continue;const za=r[rs].tone??"neutral",Vi=Ma*E,ji=te-Vi;rs===yg?$.appendChild(de("path",{class:"seg","data-tone":za,d:zh(ee,ji,x,Math.max(1.5,Vi))})):$.appendChild(de("rect",{class:"seg","data-tone":za,x:String(ee),y:String(ji+wi),width:String(x),height:String(Math.max(1.5,Vi-wi))})),te=ji}const Fi=de("rect",{class:"hit",x:String(G+M*y),y:String(We),width:String(y),height:String(m)});Fi.addEventListener("pointerenter",()=>{Rs.setAttribute("x",String(G+M*y)),Rs.setAttribute("visibility","visible"),this.showTooltip(M,T,y,p,{head:`${_e(L+M*X)} – ${B(L+(M+1)*X)}`,series:r,visibleIndexes:l})}),Fi.addEventListener("pointerleave",()=>{Rs.setAttribute("visibility","hidden"),o.hidden=!0}),$.appendChild(Fi)}),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 m=document.createElement("span");m.className="swatch",m.dataset.tone=n.series[h].tone??"neutral";const b=document.createElement("span");b.className="tooltip-label",b.textContent=n.series[h].label;const y=document.createElement("span");y.className="tooltip-value",y.textContent=p.toLocaleString(),g.append(m,b,y),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=G+e*o+o/2;r.style.left=`${Math.max(60,Math.min(u,i-60))}px`}};Ft.props=["heading","series","columns","start","end","hidden-series","legend","empty","height"],Ft.styles=[Ih],Ft.help=void 0;let yi=Ft;w("os-histogram",yi);const Oh=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 ) )}`,Vt=class Vt extends _{render(){const e=this,t=e.caption||"";return c`
1422 <span class="value" part="value">${e.value||""}</span>
1423 <span class="label" part="label">
1424 ${this.hasAttribute("swatch")?c`<i class="swatch" aria-hidden="true"></i>`:""}
1425 ${e.label||""}
1426 </span>
1427 ${t?c`<span class="caption" part="caption">${t}</span>`:""}
1428 `}};Vt.props=["value","label","caption","swatch"],Vt.styles=[Oh],Vt.help=void 0;let xi=Vt;w("os-stat",xi);const Wh=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}}`,ra={xs:20,sm:24,md:40,lg:64,xl:96},aa=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`<img
1429 src=${e}
1430 alt=${i}
1431 @error=${()=>this._onImgError()}
1432 loading="lazy"
1433 />`:this._initials(t),p=a?c`<span
1434 class=${`os-avatar__dot os-avatar__dot--${a}`}
1435 aria-label=${this._presenceLabel(a)}
1436 ></span>`:c``;return l?c`
1437 <button
1438 type="button"
1439 class="os-avatar__tile"
1440 aria-label=${i||"User"}
1441 style=${u?`background:${u};`:""}
1442 @click=${g=>this._onClick(g)}
1443 >${h}</button>
1444 ${p}
1445 `:c`
1446 <div
1447 class="os-avatar__tile"
1448 role="img"
1449 aria-label=${i||"User"}
1450 style=${u?`background:${u};`:""}
1451 >${h}</div>
1452 ${p}
1453 `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in ra)return ra[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=Wn(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&aa.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&&aa.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=[Wh],jt.help=void 0;let ki=jt;w("os-avatar",ki);const Hh=v` ${C} ${lo}: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}`,Bt=class Bt extends _{constructor(){super(...arguments),this._textareaEl=null}connectedCallback(){super.connectedCallback(),ze(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"),m=`${this.id||"os-unnamed"}__field`;return c`
1454 ${e?c`<label class="os-textarea__label" for=${m}>${e}</label>`:c``}
1455 <textarea
1456 id=${m}
1457 part="textarea"
1458 .value=${t}
1459 placeholder=${o}
1460 ?disabled=${i}
1461 ?readonly=${n}
1462 rows=${l}
1463 maxlength=${u??""}
1464 minlength=${h??""}
1465 name=${a}
1466 aria-invalid=${p?"true":"false"}
1467 aria-label=${r||""}
1468 @input=${b=>this._onInput(b)}
1469 @change=${b=>this._onChange(b)}
1470 @keydown=${b=>this._onKeyDown(b)}
1471 ></textarea>
1472 `}_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))}};Bt.props=["label","value","placeholder","disabled","readonly","ariaLabel","name","rows","maxlength","minlength","invalid","autoGrow","maxRows","submitOnEnter"],Bt.styles=[Hh],Bt.help=void 0;let $i=Bt;w("os-textarea",$i);const Uh=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}`,Kt=class Kt 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`
1473 <span part="chip" class="os-chip">
1474 <span class="os-chip__icon">
1475 <slot name="icon"></slot>
1476 </span>
1477 <span class="os-chip__label">
1478 ${e===""?c`<slot></slot>`:e}
1479 </span>
1480 ${t?c`
1481 <button
1482 part="dismiss"
1483 class="os-chip__dismiss"
1484 type="button"
1485 aria-label=${`Remove ${e||"chip"}`}
1486 ?disabled=${o}
1487 @click=${i=>this._onDismiss(i)}
1488 >
1489 ${P("close",{size:null})}
1490 </button>
1491 `:c``}
1492 </span>
1493 `}_onDismiss(e){if(e.stopPropagation(),this.disabled!==null)return;const o=this.label??"";this.emit("os-chip-dismiss",{label:o})}};Kt.props=["label","tone","size","dismissible","disabled","pending","selected"],Kt.styles=[Uh],Kt.help=void 0;let Ai=Kt;w("os-chip",Ai);const qh=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}`,Gt=class Gt 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`
1494 <span
1495 class="os-tag-input"
1496 role="group"
1497 aria-label=${this.label??""}
1498 >
1499 ${this._renderChips(i,t)}
1500 ${this._renderTrailing({isOpen:e,readonly:o,disabled:t,placeholder:a,creatable:n,addLabel:r})}
1501 </span>
1502 `}_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`
1503 <span class="os-tag-input__chips" role="list">
1504 ${o.map((i,n)=>{const r=i.tone??"neutral";return c`
1505 <os-chip
1506 role="listitem"
1507 size="compact"
1508 tone=${r}
1509 label=${i.label}
1510 ?dismissible=${e&&!t}
1511 ?disabled=${t}
1512 ?pending=${!!i.pending}
1513 tabindex=${n===this._focusedChip?"0":"-1"}
1514 data-idx=${String(n)}
1515 @os-chip-dismiss=${a=>this._onChipDismiss(a,i)}
1516 @focus=${()=>this._focusedChip=n}
1517 ></os-chip>
1518 `})}
1519 </span>
1520 `}_renderTrigger(e){const t=this.disabled!==null;return c`
1521 <button
1522 type="button"
1523 class="os-tag-input__add"
1524 aria-label=${e}
1525 aria-haspopup="listbox"
1526 aria-expanded="false"
1527 ?disabled=${t}
1528 @click=${()=>this.openInput()}
1529 >
1530 ${Fh()}
1531 <span>${e}</span>
1532 </button>
1533 `}_renderEditor(e,t){const o=this._suggestions.length>0||this._suggestionsLoading||t&&this._query.trim().length>0;return c`
1534 <span class="os-tag-input__editor">
1535 <input
1536 class="os-tag-input__input"
1537 type="text"
1538 autocomplete="off"
1539 autocapitalize="off"
1540 spellcheck="false"
1541 placeholder=${e}
1542 .value=${this._query}
1543 aria-autocomplete="list"
1544 aria-expanded=${o?"true":"false"}
1545 aria-activedescendant=${this._highlight>=0?`os-tag-suggestion-${this._highlight}`:""}
1546 @input=${i=>this._onInput(i)}
1547 @keydown=${i=>this._onInputKeyDown(i)}
1548 @blur=${i=>this._onInputBlur(i)}
1549 />
1550 ${o?this._renderSuggestions(t):c``}
1551 </span>
1552 `}_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`
1553 <div
1554 class="os-tag-input__suggestions"
1555 role="listbox"
1556 >
1557 ${this._suggestionsLoading?c`
1558 <div class="os-tag-input__suggestion-loading">
1559 <span class="os-tag-input__suggestion-spinner" aria-hidden="true"></span>
1560 <span>Searching…</span>
1561 </div>
1562 `:c``}
1563 ${o.length===0&&!this._suggestionsLoading&&!i?c`
1564 <div class="os-tag-input__suggestion-empty">
1565 ${t.length>0?"No matches.":"Type to search."}
1566 </div>
1567 `:c``}
1568 ${o.map((n,r)=>{const a=r===this._highlight;return c`
1569 <div
1570 id=${`os-tag-suggestion-${r}`}
1571 role="option"
1572 aria-selected=${a?"true":"false"}
1573 class="os-tag-input__suggestion-item"
1574 @mousedown=${l=>{l.preventDefault(),this._addSuggestion(n,!1)}}
1575 @mouseenter=${()=>{this._highlight=r,this.requestUpdate()}}
1576 >
1577 <span>${n.label}</span>
1578 </div>
1579 `})}
1580 ${i?c`
1581 <div
1582 id=${`os-tag-suggestion-${o.length}`}
1583 role="option"
1584 aria-selected=${this._highlight===o.length?"true":"false"}
1585 class="os-tag-input__suggestion-item os-tag-input__suggestion-create"
1586 @mousedown=${n=>{n.preventDefault(),this._addSuggestion({label:t},!0)}}
1587 @mouseenter=${()=>{this._highlight=o.length,this.requestUpdate()}}
1588 >
1589 Create "${t}"
1590 </div>
1591 `:c``}
1592 </div>
1593 `}_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.length<t){this._suggestions=[],this._suggestionsLoading=!1,this.requestUpdate();return}this._suggestionsLoading=!0,this.requestUpdate(),this.emit("os-tag-suggest",{query:e})}_onInputKeyDown(e){const t=this.creatable!==null,o=this._suggestions,i=this._query.trim(),n=t&&i.length>0&&!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._highlight<o.length){this._addSuggestion(o[this._highlight],!1);return}if(this._highlight===o.length&&n){this._addSuggestion({label:i},!0);return}if(n&&i.length>0){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()})}};Gt.props=["label","placeholder","add-label","creatable","removable","disabled","readonly","size","min-query","open"],Gt.styles=[qh],Gt.help=void 0;let Ei=Gt;w("os-tag-input",Ei);function Fh(){return P("plus",{size:14})}const Vh=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}}`,Xt=class Xt 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("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("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`
1594 <div class="header" part="header">
1595 <slot name="header"></slot>
1596 </div>
1597 <div class="fields" part="fields">
1598 <slot></slot>
1599 </div>
1600 <slot name="error">
1601 ${o?c`<p class="error" role="alert" part="error">${o}</p>`:c`<p class="error" role="alert" part="error" hidden></p>`}
1602 </slot>
1603 <footer class="footer" part="footer">
1604 <span class="footer-leading"
1605 ><slot name="footer-leading"></slot
1606 ></span>
1607 <span class="footer-actions">
1608 ${r?c`<os-button
1609 variant="ghost"
1610 data-os-form-action="reset"
1611 ?disabled=${i}
1612 @click=${()=>this.reset()}
1613 >${t}</os-button>`:c``}
1614 <os-button
1615 variant="primary"
1616 data-os-form-action="submit"
1617 ?disabled=${i}
1618 @click=${()=>this.submit()}
1619 >
1620 ${i?c`<span class="busy-spinner" aria-hidden="true"></span>`:c``}
1621 ${e}
1622 </os-button>
1623 </span>
1624 <span class="footer-trailing"
1625 ><slot name="footer-trailing"></slot
1626 ></span>
1627 </footer>
1628 `}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,t.value)}}this.dispatchEvent(new CustomEvent("os-form-reset",{bubbles:!0,composed:!0,detail:{form:this}}))}submit(){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-CHECKBOX"||t.tagName==="OS-CHECKBOX-LABEL"||t.tagName==="INPUT"&&t.type==="checkbox";this._initial.set(o,{value:this._readField(t),checked:i?!!t.checked: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-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-CHECKBOX"||o==="OS-CHECKBOX-LABEL"||o==="INPUT"&&e.type==="checkbox"){const r=!!t;e.checked=r,r?e.setAttribute("checked",""):e.removeAttribute("checked");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"))}};Xt.props=["submit-label","reset-label","error","busy","columns","min-column","show-reset","align"],Xt.styles=[Vh],Xt.help=void 0;let Si=Xt;w("os-form",Si);const jh=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",Bh=2200,Kh=6e3,Zt=class Zt 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`
1629 <span class="os-save-status">
1630 <span class="os-save-status__indicator" aria-hidden="true">
1631 <span class="os-save-status__glyph">${this._renderGlyph(e)}</span>
1632 </span>
1633 ${t==="pill"?c`<span class="os-save-status__label"
1634 >${this._labelForPhase(e)}</span
1635 >`:c``}
1636 </span>
1637 `}_renderGlyph(e){return e==="saved"?Gh():e==="failed"?Xh():""}_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)||Bh}if(e==="failed"){const t=this["auto-clear-failed-ms"];return parseInt(t||"",10)||Kh}return 0}};Zt.props=["phase","mode","variant","animation","auto","event","error","saving-label","saved-label","idle-label","auto-clear-saved-ms","auto-clear-failed-ms"],Zt.styles=[jh],Zt.help=void 0;let Ci=Zt;w("os-save-status",Ci);function Gh(){return c`
1638 <svg
1639 viewBox="0 0 12 12"
1640 aria-hidden="true"
1641 focusable="false"
1642 fill="none"
1643 stroke="currentColor"
1644 stroke-width="2"
1645 stroke-linecap="round"
1646 stroke-linejoin="round"
1647 >
1648 <path d="M2.5 6 L5 8.5 L9.5 4" />
1649 </svg>
1650 `}function Xh(){return c`
1651 <svg
1652 viewBox="0 0 12 12"
1653 aria-hidden="true"
1654 focusable="false"
1655 fill="currentColor"
1656 >
1657 <path
1658 d="M5 2 H7 V7 H5 z M5 8.5 H7 V10.5 H5 z"
1659 />
1660 </svg>
1661 `}const Zh=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}`,J="10px",Yh=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% - ${J} ) 0,100% 50%,calc( 100% - ${J} ) 100%,0 100% )}.os-crumb--middle{padding-inline:22px;margin-inline-start:calc( -1 * ${J} );clip-path:polygon( ${J} 0,calc( 100% - ${J} ) 0,100% 50%,calc( 100% - ${J} ) 100%,${J} 100%,0 50% )}.os-crumb--last{padding-inline-start:22px;padding-inline-end:14px;margin-inline-start:calc( -1 * ${J} );clip-path:polygon( ${J} 0,100% 0,100% 100%,${J} 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}`,Yt=class Yt 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`
1662 <div class="os-crumb-chain" role="group">
1663 ${t.map((o,i)=>{const n=ua(i,t.length),r=o.color,a=r?`--os-ui-crumb-bg: ${r}; --os-ui-crumb-fg: ${ha(r)};`:"";return c`
1664 <span
1665 class=${`os-crumb os-crumb--${n}`}
1666 style=${a}
1667 title=${o.name}
1668 draggable="true"
1669 @click=${l=>this._onSegmentClick(l,i,o)}
1670 @dragstart=${l=>this._onSegmentDragStart(l,i,o)}
1671 >
1672 <span class="os-crumb__label">${o.name}</span>
1673 ${e?c`
1674 <button
1675 type="button"
1676 class="os-crumb__remove"
1677 aria-label=${`Remove ${o.name}`}
1678 draggable="false"
1679 @click=${l=>this._onRemove(l,i,o)}
1680 >${tp()}</button>
1681 `:c``}
1682 </span>
1683 `})}
1684 </div>
1685 `}_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=Qh(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})}};Yt.props=["removable","disabled"],Yt.styles=[Yh],Yt.help=void 0;let Ii=Yt;w("os-crumb-chain",Ii);const Jh=10;function Qh(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=ep();return s.forEach((i,n)=>{const r=document.createElement("span"),a=i.color??o.bg,l=i.color?ha(i.color):o.fg,u=ua(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=Jh;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 ca="rgba( 0, 0, 0, 0.08 )",da="#1d2327";function ep(){if(typeof document>"u"||!document.body)return{bg:ca,fg:da};const s=getComputedStyle(document.body);return{bg:s.getPropertyValue("--os-ui-crumb-bg").trim()||ca,fg:s.getPropertyValue("--os-ui-crumb-fg").trim()||da}}function ua(s,e){return e===1?"solo":s===0?"first":s===e-1?"last":"middle"}let He=null;function ha(s){He||(He=document.createElement("canvas"),He.width=1,He.height=1);const e=He.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 tp(){return P("close",{size:null})}const pa="uncategorized",sp=1;function As(s){return s.id===sp?!0:(s.name||"").toLowerCase()===pa}const Jt=class Jt 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`
1686 <span class="os-cat" role="group">
1687 ${this._renderChipRow(a,o,t,n)}
1688 ${e?this._renderPopover(r,i):c``}
1689 </span>
1690 `}_renderChipRow(e,t,o,i){const n=this._selectedItemsInOrder();if(n.length===0)return c`
1691 <span class="os-cat__chips" role="list">
1692 <span
1693 class="os-cat__uncategorized"
1694 title=${'Posts with no category appear as "Uncategorized" in WordPress.'}
1695 @click=${this._onCellClick}
1696 >${"Uncategorized"}</span>
1697 </span>
1698 `;const r=this._buildChains(n);return c`
1699 <div
1700 class="os-cat__chains"
1701 role="list"
1702 @click=${this._onCellClick}
1703 >
1704 ${r.map(a=>this._renderChain(a,t,o))}
1705 </div>
1706 `}_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`<div role="listitem">${r}</div>`}_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`
1707 <div class="os-cat__popover" role="dialog" aria-label="Choose categories">
1708 <input
1709 class="os-cat__search"
1710 type="text"
1711 autocomplete="off"
1712 placeholder=${e}
1713 .value=${this._query}
1714 @input=${r=>this._onSearchInput(r)}
1715 @keydown=${r=>this._onSearchKeydown(r,n)}
1716 />
1717 <div class="os-cat__tree" role="listbox" aria-multiselectable="true">
1718 ${this._renderCreateRow(0,12,0,"")}
1719 ${this._renderTreeBody(t,n)}
1720 </div>
1721 <div class="os-cat__footer">
1722 <span class="dashicons dashicons-info-outline" aria-hidden="true"></span>
1723 <span>
1724 Posts with no category appear as
1725 <strong>Uncategorized</strong>.
1726 </span>
1727 </div>
1728 </div>
1729 `}_renderTreeBody(e,t){return e?c`
1730 <div class="os-cat__loading">
1731 <span class="os-cat__loading-spinner" aria-hidden="true"></span>
1732 ${"Loading categories…"}
1733 </div>
1734 `:t.length===0?c`
1735 <div class="os-cat__empty">
1736 ${this._items.length===0?"No categories yet — create one in WordPress to assign.":"No matches."}
1737 </div>
1738 `: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`
1739 <div class="os-cat__row-block">
1740 <div
1741 class="os-cat__row"
1742 role="option"
1743 aria-selected=${r?"true":"false"}
1744 data-selected=${r?"true":"false"}
1745 data-expanded=${a?"true":"false"}
1746 data-focused=${h?"true":"false"}
1747 data-row-id=${String(i.item.id)}
1748 style=${`--os-ui-cat-row-indent: ${l}px; --os-ui-cat-guide-width: ${u}px;`}
1749 @mouseenter=${()=>{this._focusedRow=t,this.requestUpdate()}}
1750 @click=${p=>{p.preventDefault(),this._toggleSelection(i.item.id)}}
1751 >
1752 ${n?c`<button
1753 type="button"
1754 class="os-cat__expander"
1755 aria-label=${a?"Collapse":"Expand"}
1756 @click=${p=>{p.stopPropagation(),this._toggleExpand(i.item.id)}}
1757 >${ga()}</button>`:c`<span class="os-cat__expander os-cat__expander--placeholder" aria-hidden="true">${ga()}</span>`}
1758 <span class="os-cat__check" aria-hidden="true">${ip()}</span>
1759 <span class="os-cat__label">${this._highlight(i.item.name,this._query)}</span>
1760 ${As(i.item)?c``:c`<button
1761 type="button"
1762 class="os-cat__delete"
1763 aria-label=${`Delete ${i.item.name}`}
1764 title=${`Delete ${i.item.name}`}
1765 @click=${p=>this._onDeleteClick(p,i.item)}
1766 >${np()}</button>`}
1767 </div>
1768 ${a&&!As(i.item)?this._renderCreateRow(i.item.id,12+(i.depth+1)*16,(i.depth+1)*16,i.item.name):c``}
1769 </div>
1770 `}_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`
1771 <div
1772 class="os-cat__create-row"
1773 style=${`--os-ui-cat-row-indent: ${t}px; --os-ui-cat-guide-width: ${o}px;`}
1774 @click=${l=>l.stopPropagation()}
1775 >
1776 <div class="os-cat__create-wrap">
1777 <input
1778 class="os-cat__create-input"
1779 type="text"
1780 autocomplete="off"
1781 spellcheck="false"
1782 placeholder=${a}
1783 aria-label=${a}
1784 .value=${n}
1785 ?disabled=${r}
1786 @input=${l=>this._onCreateInput(l,e)}
1787 @keydown=${l=>this._onCreateKeydown(l,e)}
1788 />
1789 ${r?c`<span class="os-cat__create-spinner" aria-hidden="true"></span>`:c`<button
1790 type="button"
1791 class="os-cat__create-submit"
1792 aria-label=${e===0?"Create category":`Create child of ${i}`}
1793 ?disabled=${n.trim().length===0}
1794 @click=${l=>{l.stopPropagation(),this._submitCreate(e)}}
1795 >${op()}</button>`}
1796 </div>
1797 </div>
1798 `}_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=As(r.item),u=As(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()===pa||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)}<span class="os-cat__match"
1799 >${e.slice(r,r+o.length)}</span
1800 >${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.top<i.top?t.scrollIntoView({block:"nearest"}):o.bottom>i.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`}};Jt.props=["placeholder","add-label","disabled","readonly","open","loading","max-visible"],Jt.styles=[Zh],Jt.help=void 0;let Ri=Jt;w("os-category-picker",Ri);function ga(){return P("chevron-right",{size:14})}function op(){return P("plus",{size:16})}function ip(){return P("check",{size:null})}function np(){return P("close",{size:null})}const rp=v` ${C} ${bs}: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}`,fa="[data-noclick]",Qt=class Qt extends _{constructor(){super(...arguments),this._onClick=e=>{!this.hasAttribute("interactive")||this.hasAttribute("disabled")||e.target?.closest(fa)||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(fa)||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`<span class="os-holo-glint" aria-hidden="true"></span
1801 ><slot name="header"></slot><slot></slot><slot name="footer"></slot>`}_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}))}};Qt.props=["interactive","selected","compact","disabled"],Qt.styles=[rp],Qt.help=void 0;let Li=Qt;w("os-card",Li);const ap=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}}`,es=class es extends _{constructor(){super(...arguments),this._ratings={}}get ratings(){return{...this._ratings}}set ratings(e){this._ratings=e?{...e}:{},this.requestUpdate()}render(){const e=lp(ba(this,"rating")),t=e/100*5,o=ba(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`
1802 <div class="summary-card" role="img" aria-label=${cp(e,i)}>
1803 <div class="summary">
1804 <div class="big">${r}</div>
1805 <div class="stars" aria-hidden="true">
1806 ${dp(t)}
1807 </div>
1808 <div class="total">
1809 ${i===1?"1 rating":`${n.format(i)} ratings`}
1810 </div>
1811 </div>
1812 <div class="bars">
1813 ${[5,4,3,2,1].map(a=>{const l=this._ratings[String(a)]??0,u=i===0?0:l/i;return c`
1814 <div
1815 class="row"
1816 role="presentation"
1817 aria-label=${`${a} stars: ${n.format(l)}`}
1818 >
1819 <span class="row__label">
1820 ${a} ${ma()}
1821 </span>
1822 <span class="row__track">
1823 <span
1824 class="row__fill"
1825 style=${`--ratio: ${u.toFixed(4)}`}
1826 ></span>
1827 </span>
1828 <span class="row__count">${n.format(l)}</span>
1829 </div>
1830 `})}
1831 </div>
1832 </div>
1833 `}};es.props=["rating","total"],es.styles=[ap],es.help=void 0;let Ti=es;function ba(s,e){const t=s.getAttribute(e);if(t===null||t==="")return 0;const o=Number(t);return Number.isFinite(o)?o:0}function lp(s){return s<0?0:s>100?100:s}function cp(s,e){return e===0?"No ratings yet":`Average rating ${(s/100*5).toFixed(1)} out of 5, from ${e} ratings`}function dp(s){const e=Math.floor(s),t=s-e>=.5?1:0,o=5-e-t,i=[];for(let n=0;n<e;n++)i.push(ma());for(let n=0;n<t;n++)i.push(up());for(let n=0;n<o;n++)i.push(hp());return i}function ma(){return c`
1834 <svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">
1835 <path
1836 d="M8 1.5l2.06 4.17 4.6.67-3.33 3.25.79 4.58L8 12L3.88 14.17l.79-4.58L1.34 6.34l4.6-.67L8 1.5z"
1837 />
1838 </svg>
1839 `}function up(){return c`
1840 <svg viewBox="0 0 16 16" aria-hidden="true">
1841 <defs>
1842 <linearGradient id="os-half-star">
1843 <stop offset="50%" stop-color="currentColor" />
1844 <stop
1845 offset="50%"
1846 stop-color="currentColor"
1847 stop-opacity="0.22"
1848 />
1849 </linearGradient>
1850 </defs>
1851 <path
1852 fill="url(#os-half-star)"
1853 d="M8 1.5l2.06 4.17 4.6.67-3.33 3.25.79 4.58L8 12L3.88 14.17l.79-4.58L1.34 6.34l4.6-.67L8 1.5z"
1854 />
1855 </svg>
1856 `}function hp(){return c`
1857 <svg
1858 class="empty"
1859 viewBox="0 0 16 16"
1860 fill="currentColor"
1861 aria-hidden="true"
1862 >
1863 <path
1864 d="M8 1.5l2.06 4.17 4.6.67-3.33 3.25.79 4.58L8 12L3.88 14.17l.79-4.58L1.34 6.34l4.6-.67L8 1.5z"
1865 />
1866 </svg>
1867 `}w("os-rating-summary",Ti);const pp=v`:host{display:flex;align-items:flex-start;gap:10px;width:100%;box-sizing:border-box;padding:10px 14px;font:var( --os-ui-notice-font,13px/1.5 var( --os-font,system-ui ) );color:var( --os-ui-notice-color,var( --os-ui-fg,#1d2327 ) );background:var( --os-ui-notice-bg,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );border-block-end:1px solid var( --os-ui-notice-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );border-inline-start:4px solid var( --os-ui-notice-accent,var( --os-ui-border,#646970 ) )}:host( [ hidden ] ){display:none}.os-notice__icon{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;color:var( --os-ui-notice-accent,var( --os-ui-accent,#646970 ) )}.os-notice__icon[ hidden ]{display:none}.os-notice__label{flex:1;min-width:0;word-wrap:break-word}::slotted( a ){color:var( --os-ui-notice-link,var( --wp-admin-theme-color,#2271b1 ) );border-radius:2px}::slotted( a:hover ),::slotted( a:focus-visible ){color:var( --os-ui-notice-link-hover,var( --os-ui-accent-strong,#135e96 ) )}::slotted( a:focus-visible ){outline:2px solid var( --os-ui-notice-link-hover,var( --os-ui-accent-strong,#135e96 ) );outline-offset:2px}::slotted( p:first-child ){margin-block-start:0}::slotted( p:last-child ){margin-block-end:0}.os-notice__close{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;color:inherit;opacity:0.6;cursor:pointer;border-radius:4px;transition:opacity 0.12s ease,background-color 0.12s ease}.os-notice__close:hover{opacity:1;background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) )}.os-notice__close:focus-visible{opacity:1;outline:2px solid var( --wp-admin-theme-color,#2271b1 );outline-offset:1px}.os-notice__close[ hidden ]{display:none}.os-notice__close svg{width:14px;height:14px}:host( [ tone='info' ] ){--os-ui-notice-accent:var( --os-ui-notice-info,var( --os-ui-info-fg,#0969da ) );--os-ui-notice-bg:var( --os-ui-notice-info-bg,rgba( 9,105,218,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-info-border,rgba( 9,105,218,0.16 ) )}:host( [ tone='success' ] ){--os-ui-notice-accent:var( --os-ui-notice-success,var( --os-ui-success-fg,#1a7f37 ) );--os-ui-notice-bg:var( --os-ui-notice-success-bg,rgba( 26,127,55,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-success-border,rgba( 26,127,55,0.16 ) )}:host( [ tone='warning' ] ){--os-ui-notice-accent:var( --os-ui-notice-warning,var( --os-ui-warning-fg,#9a6700 ) );--os-ui-notice-bg:var( --os-ui-notice-warning-bg,rgba( 154,103,0,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-warning-border,rgba( 154,103,0,0.16 ) )}:host( [ tone='error' ] ),:host( [ tone='danger' ] ){--os-ui-notice-accent:var( --os-ui-notice-error,var( --os-ui-danger,#cf222e ) );--os-ui-notice-bg:var( --os-ui-notice-error-bg,rgba( 207,34,46,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-error-border,rgba( 207,34,46,0.16 ) )}:host( [ tone='neutral' ] ){--os-ui-notice-accent:var( --os-ui-notice-neutral,var( --os-ui-fg-muted,#57606a ) );--os-ui-notice-bg:var( --os-ui-notice-neutral-bg,rgba( 87,96,106,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-neutral-border,rgba( 87,96,106,0.16 ) )}`,gp="desktop-mode-notice-dismissed";function fp(){const e=window.wp?.os?.config?.currentUserId;return typeof e=="number"&&e>0?String(e):"anon"}function va(){return`${gp}:${fp()}`}function Di(){try{const s=window.localStorage.getItem(va());if(!s)return{};const e=JSON.parse(s);if(e&&typeof e=="object"&&!Array.isArray(e))return e}catch{}return{}}function _a(s){try{window.localStorage.setItem(va(),JSON.stringify(s))}catch{}}function bp(s){return s?Di()[s]===!0:!1}function mp(s){if(!s)return;const e=Di();e[s]=!0,_a(e)}function vp(s){if(!s)return;const e=Di();e[s]&&(delete e[s],_a(e))}const ts=class ts extends _{connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("tone")||this.setAttribute("tone","info");const e=this.getAttribute("notice-id");e&&bp(e)&&(this.hidden=!0)}dismiss(){this.hidden=!0;const e=this.getAttribute("notice-id");e&&mp(e),this.emit("os-notice-dismiss",{noticeId:e??void 0})}undismiss(){const e=this.getAttribute("notice-id");e&&vp(e),this.hidden=!1}render(){const e=this.getAttribute("icon"),t=!this.hasAttribute("not-dismissible");return c`
1868 <span
1869 class="os-notice__icon dashicons ${e??""}"
1870 ?hidden=${!e}
1871 aria-hidden="true"
1872 ></span>
1873 <span class="os-notice__label"><slot></slot></span>
1874 <button
1875 type="button"
1876 class="os-notice__close"
1877 ?hidden=${!t}
1878 aria-label=${d("Dismiss notice")}
1879 @click=${o=>this._onDismiss(o)}
1880 >
1881 ${P("close",{size:null})}
1882 </button>
1883 `}_onDismiss(e){e.preventDefault(),e.stopPropagation(),this.dismiss()}};ts.props=["tone","notDismissible","icon","noticeId"],ts.styles=[pp],ts.help=void 0;let Pi=ts;w("os-notice",Pi);const _p=v` ${C} ${mr}:host{display:block;--_track-bg:var( --os-ui-progress-track-bg,var( --os-ui-surface-sunken,rgba( 0,0,0,0.08 ) ) );--_fill:var( --os-ui-progress-fill,var( --wp-admin-theme-color,#2271b1 ) );--_height:var( --os-ui-progress-height,6px );--_radius:var( --os-ui-progress-radius,999px );--_label-color:var( --os-ui-progress-label-color,inherit );--_label-size:var( --os-ui-progress-label-size,12px );--_label-gap:var( --os-ui-progress-label-gap,4px );width:100%;font:inherit;color:var( --_label-color )}:host( [ hidden ] ){display:none}.header{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:var( --_label-gap );font-size:var( --_label-size );line-height:1.3}.label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.percent{font-variant-numeric:tabular-nums;opacity:0.75;flex-shrink:0}.track{position:relative;width:100%;height:var( --_height );background:var( --_track-bg );border-radius:var( --_radius );overflow:hidden}.fill{position:absolute;inset-block:0;inset-inline-start:0;width:0;background:var( --_fill );border-radius:inherit;transition:width 0.18s ease-out}:host( [ tone='success' ] ){--os-ui-progress-fill:var( --os-ui-success-fg,#3a8a3a )}:host( [ tone='warning' ] ){--os-ui-progress-fill:var( --os-ui-warning-fg,#dba617 )}:host( [ tone='danger' ] ){--os-ui-progress-fill:var( --os-ui-danger,#d63638 )}:host( [ indeterminate ] ) .fill{width:100%;transition:none;background-image:var( --_fill );background-size:300% 300%;background-repeat:no-repeat;animation:os-holo-shimmer 2.4s var( --_holo-loop ) infinite}:host( [ indeterminate ][ tone ] ) .fill{width:33%;background-image:none;animation:os-progress-sweep 1.1s linear infinite}@keyframes os-progress-sweep{0%{transform:translateX( -120% )}100%{transform:translateX( 320% )}}@media ( prefers-reduced-motion:reduce ){.fill{transition:none}:host( [ indeterminate ] ) .fill,:host( [ indeterminate ][ tone ] ) .fill{animation:none;width:100%;opacity:0.6}}`,ss=class ss extends _{constructor(){super(...arguments),this._ownedAriaLabel=null}render(){return c`<div class="root" part="root">
1884 <div class="header" part="header" hidden>
1885 <span class="label" part="label"></span>
1886 <span class="percent" part="percent"></span>
1887 </div>
1888 <div class="track" part="track">
1889 <div class="fill" part="fill"></div>
1890 </div>
1891 </div>`}requestUpdate(){super.requestUpdate(),queueMicrotask(()=>this._paint())}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paint())}_paint(){const e=this.shadowRoot;if(!e)return;const t=this._readMax(),o=this.hasAttribute("indeterminate")||t<=0,i=o?0:this._readValue(t),n=o?0:i/t,r=Math.round(n*100),a=this.getAttribute("label")??"",l=this.hasAttribute("show-percent"),u=e.querySelector(".fill");u&&!o?u.style.width=`${(n*100).toFixed(2)}%`:u&&o&&u.style.removeProperty("width");const h=e.querySelector(".header"),p=e.querySelector(".label"),g=e.querySelector(".percent");if(h&&p&&g){const b=a||l&&!o;h.hidden=!b,p.textContent=a,g.hidden=!(l&&!o),g.textContent=`${r}%`}this._syncAria(t,i,o,a);const m=e.querySelector(".track");m&&(m.setAttribute("role","progressbar"),m.setAttribute("aria-valuemin","0"),o?(m.removeAttribute("aria-valuenow"),m.removeAttribute("aria-valuemax")):(m.setAttribute("aria-valuemax",String(t)),m.setAttribute("aria-valuenow",String(i))),a?m.setAttribute("aria-label",a):m.removeAttribute("aria-label"))}_syncAria(e,t,o,i){this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),o?(this.removeAttribute("aria-valuenow"),this.removeAttribute("aria-valuemax")):(this.setAttribute("aria-valuemax",String(e)),this.setAttribute("aria-valuenow",String(t)));const n=this.getAttribute("aria-label");i?(n===null||n===this._ownedAriaLabel)&&(this.setAttribute("aria-label",i),this._ownedAriaLabel=i):n!==null&&n===this._ownedAriaLabel&&(this.removeAttribute("aria-label"),this._ownedAriaLabel=null)}_readMax(){const e=this.getAttribute("max");if(e===null)return 100;const t=parseFloat(e);return Number.isFinite(t)?t:100}_readValue(e){const t=parseFloat(this.getAttribute("value")??"0");return!Number.isFinite(t)||t<0?0:t>e?e:t}};ss.props=["value","max","indeterminate","tone","label","showPercent"],ss.styles=[_p],ss.help=void 0;let Ni=ss;w("os-progress-bar",Ni);const wp=v`:host{--_gap:var( --os-ui-field-row-gap,6px );--_label-width:var( --os-ui-field-row-label-width,12rem );display:flex;flex-direction:column;gap:var( --_gap );container-type:inline-size}:host( [ hidden ] ){display:none}.os-field-row__head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:0}.os-field-row__head:empty{display:none}.os-field-row__label{font-size:13px;font-weight:500;line-height:1.4;color:var( --os-ui-fg,#1d2327 );cursor:default}.os-field-row__required{margin-inline-start:2px;color:var( --os-ui-danger,#d63638 )}.os-field-row__action:empty{display:none}.os-field-row__control{min-width:0}.os-field-row__hint,.os-field-row__error{margin:0;font-size:12px;line-height:1.4}.os-field-row__hint{color:var( --os-ui-fg-muted,#646970 )}.os-field-row__error{color:var( --os-ui-danger,#d63638 )}:host( [ layout='inline' ] ){display:grid;grid-template-columns:var( --_label-width ) minmax( 0,1fr );align-items:start;column-gap:12px;row-gap:2px}:host( [ layout='inline' ] ) .os-field-row__head{grid-column:1;grid-row:1;padding-block-start:5px}:host( [ layout='inline' ] ) .os-field-row__control{grid-column:2;grid-row:1}:host( [ layout='inline' ] ) .os-field-row__hint,:host( [ layout='inline' ] ) .os-field-row__error{grid-column:2;grid-row:2}@container ( max-width:30rem ){:host( [ layout='inline' ] ){display:flex;flex-direction:column;gap:var( --_gap )}:host( [ layout='inline' ] ) .os-field-row__head{padding-block-start:0}}::slotted( input:where(:not( [ type='checkbox' ],[ type='radio' ] ) ) ),::slotted( select ),::slotted( textarea ){box-sizing:border-box;width:100%;padding:6px 8px;border-radius:4px;background:var( --os-ui-field-bg,#fff );border:1px solid var( --os-ui-field-border,#8c8f94 );color:var( --os-ui-field-fg,#2c3338 );font:inherit}`,yp='input, select, textarea, [contenteditable="true"], [role="textbox"], [role="combobox"], [os-field-control]';let xp=0;const os=class os extends _{constructor(){super(...arguments),this.uid=`os-field-row-${++xp}`,this.syncControl=()=>{const e=this.control;if(!e)return;const t=this.error,o=this.hint,i=this.hasAttribute("required");let n="";t?n=`${this.uid}-error`:o&&(n=`${this.uid}-hint`);const r=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(l=>l&&!l.startsWith(this.uid)),a=n?[...r,n]:r;a.length?e.setAttribute("aria-describedby",a.join(" ")):e.removeAttribute("aria-describedby"),t?e.setAttribute("aria-invalid","true"):e.getAttribute("aria-invalid")==="true"&&e.removeAttribute("aria-invalid"),i&&(e.setAttribute("required",""),e.setAttribute("aria-required","true"))},this.focusControl=()=>{const e=this.control;e&&e.focus?.()}}get control(){const e=this["control-id"];return e?Array.from(this.querySelectorAll("[id]")).find(t=>t.id===e)??null:this.querySelector(yp)}render(){const e=this.label||"",t=this.hint||"",o=this.error||"",i=this.hasAttribute("required");queueMicrotask(this.syncControl);let n=null;return o?n=c`<p
1892 class="os-field-row__error"
1893 id="${this.uid}-error"
1894 role="alert"
1895 >
1896 ${o}
1897 </p>`:t&&(n=c`<p class="os-field-row__hint" id="${this.uid}-hint">
1898 ${t}
1899 </p>`),c`
1900 <div class="os-field-row__head">
1901 ${e?c`<span
1902 class="os-field-row__label"
1903 id="${this.uid}-label"
1904 @click=${this.focusControl}
1905 >
1906 ${e}${i?c`<span
1907 class="os-field-row__required"
1908 aria-hidden="true"
1909 >*</span
1910 >`:null}
1911 </span>`:null}
1912 <span class="os-field-row__action"><slot name="action"></slot></span>
1913 </div>
1914 <div class="os-field-row__control">
1915 <slot @slotchange=${this.syncControl}></slot>
1916 </div>
1917 ${n}
1918 `}};os.props=["label","hint","error","required","layout","control-id"],os.styles=[wp],os.help=void 0;let Mi=os;w("os-field-row",Mi);const kp=v`:host{--_gap:var( --os-ui-repeater-gap,8px );--_row-bg:var( --os-ui-repeater-row-bg,var( --os-ui-surface,#fff ) );--_border:var( --os-ui-repeater-row-border,var( --os-ui-border,#dcdcde ) );display:flex;flex-direction:column;gap:var( --_gap )}:host( [ hidden ] ){display:none}.os-repeater__rows{display:flex;flex-direction:column;gap:var( --_gap )}.os-repeater__row{display:flex;align-items:start;gap:6px;padding:8px;border:1px solid var( --_border );border-radius:6px;background:var( --_row-bg )}.os-repeater__content{flex:1 1 auto;min-width:0}.os-repeater__handles{display:flex;flex-direction:column;gap:2px;flex:0 0 auto}.os-repeater__handle,.os-repeater__remove{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:4px;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer}.os-repeater__handle:hover:not(:disabled ),.os-repeater__remove:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) );color:var( --os-ui-fg,#1d2327 )}.os-repeater__remove:hover:not(:disabled ){color:var( --os-ui-danger,#d63638 )}.os-repeater__handle:disabled,.os-repeater__remove:disabled{opacity:0.4;cursor:default}.os-repeater__handle:focus-visible,.os-repeater__remove:focus-visible{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:1px}.os-repeater__remove{flex:0 0 auto}.os-repeater__empty{padding:12px;border:1px dashed var( --_border );border-radius:6px;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-repeater__empty:has( slot[ name='empty' ]:not(:has( * ) ) ):empty{display:none}.os-repeater__footer{display:flex;align-items:center;gap:8px}`,is=class is extends _{constructor(){super(...arguments),this._keys=[],this.onAdd=()=>{this.isDisabled||this.emit("os-repeater-add",{keys:[...this._keys]})},this.onKeydown=e=>{if(!e.altKey||!this.hasAttribute("reorderable"))return;let t=0;if(e.key==="ArrowUp"?t=-1:e.key==="ArrowDown"&&(t=1),t===0)return;const i=e.target?.closest?.('[slot^="row-"]')?.getAttribute("slot")?.slice(4);i&&(e.preventDefault(),this.onMove(i,t))}}get keys(){return this._keys}set keys(e){this._keys=Array.isArray(e)?[...e]:[],this.requestUpdate()}get isDisabled(){return this.hasAttribute("disabled")}numeric(e){const t=this.getAttribute(e);if(t===null||t.trim()==="")return null;const o=Number(t);return Number.isFinite(o)?o:null}onRemove(e){if(this.isDisabled)return;const t=this._keys.indexOf(e);this.emit("os-repeater-remove",{key:e,index:t,keys:this._keys.filter(o=>o!==e)})}onMove(e,t){if(this.isDisabled)return;const o=this._keys.indexOf(e),i=o+t;if(o<0||i<0||i>=this._keys.length)return;const n=[...this._keys];n.splice(i,0,...n.splice(o,1)),this.emit("os-repeater-move",{key:e,from:o,to:i,keys:n})}render(){const e=this._keys,t=this.isDisabled,o=this.hasAttribute("reorderable"),i=this,n=i["row-label"]||"row",r=i["add-label"]||"Add row",a=i["empty-text"]||"",l=this.numeric("min"),u=this.numeric("max"),h=l===null||e.length>l,p=u===null||e.length<u;return c`
1919 <div class="os-repeater__rows" @keydown=${this.onKeydown}>
1920 ${e.length===0?c`<div class="os-repeater__empty">
1921 <slot name="empty">${a}</slot>
1922 </div>`:e.map((g,m)=>c`
1923 <div class="os-repeater__row" data-key=${g}>
1924 ${o?c`<div class="os-repeater__handles">
1925 <button
1926 type="button"
1927 class="os-repeater__handle"
1928 ?disabled=${t||m===0}
1929 aria-label="Move ${n} up"
1930 @click=${()=>this.onMove(g,-1)}
1931 >
1932 <os-icon name="arrow-up-alt2" size="14"></os-icon>
1933 </button>
1934 <button
1935 type="button"
1936 class="os-repeater__handle"
1937 ?disabled=${t||m===e.length-1}
1938 aria-label="Move ${n} down"
1939 @click=${()=>this.onMove(g,1)}
1940 >
1941 <os-icon name="arrow-down-alt2" size="14"></os-icon>
1942 </button>
1943 </div>`:null}
1944 <div class="os-repeater__content">
1945 <slot name="row-${g}"></slot>
1946 </div>
1947 <button
1948 type="button"
1949 class="os-repeater__remove"
1950 ?disabled=${t||!h}
1951 aria-label="Remove ${n}"
1952 @click=${()=>this.onRemove(g)}
1953 >
1954 <os-icon name="trash" size="14"></os-icon>
1955 </button>
1956 </div>
1957 `)}
1958 </div>
1959 <div class="os-repeater__footer">
1960 <os-button
1961 variant="secondary"
1962 size="small"
1963 ?disabled=${t||!p}
1964 @click=${this.onAdd}
1965 >${r}</os-button
1966 >
1967 <slot name="footer"></slot>
1968 </div>
1969 `}};is.props=["add-label","empty-text","disabled","reorderable","min","max","row-label"],is.styles=[kp],is.help=void 0;let zi=is;w("os-repeater",zi);const $p=v`:host{--_bg:var( --os-ui-token-field-bg,var( --os-ui-field-bg,#fff ) );--_border:var( --os-ui-token-field-border,var( --os-ui-field-border,#8c8f94 ) );--_fg:var( --os-ui-token-field-fg,var( --os-ui-field-fg,#2c3338 ) );--_chip-bg:var( --os-ui-token-field-chip-bg,var( --os-ui-surface-raised,rgba( 0,0,0,0.06 ) ) );display:block;position:relative}:host( [ hidden ] ){display:none}.os-token-field{display:flex;flex-direction:column;gap:6px}.os-token-field__label{font-size:13px;font-weight:500;color:var( --os-ui-fg,#1d2327 )}.os-token-field__input{box-sizing:border-box;width:100%;padding:6px 8px;border-radius:4px;background:var( --_bg );border:1px solid var( --_border );color:var( --_fg );font:inherit;resize:vertical}.os-token-field__input:focus-visible{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:1px}.os-token-field__input:disabled{opacity:0.6}.os-token-field__toolbar{display:flex;align-items:center;gap:6px}.os-token-field__catalogue{position:absolute;inset-inline-start:0;inset-block-start:100%;z-index:20;max-height:18rem;overflow-y:auto;width:100%;padding:4px;box-sizing:border-box;border:1px solid var( --os-ui-border,#dcdcde );border-radius:6px;background:var( --os-ui-surface-elevated,#fff );box-shadow:0 8px 24px rgba( 0,0,0,0.18 )}.os-token-field__group{margin:6px 6px 2px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.04em;color:var( --os-ui-fg-faint,#8c8f94 )}.os-token-field__option{display:grid;grid-template-columns:minmax( 0,1fr ) auto;gap:2px 8px;width:100%;padding:6px 8px;border:0;border-radius:4px;background:transparent;color:var( --os-ui-fg,#1d2327 );font:inherit;text-align:start;cursor:pointer}.os-token-field__option:hover,.os-token-field__option:focus-visible{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) );outline:none}.os-token-field__option-label{font-size:13px;min-width:0}.os-token-field__option-token{grid-column:2;grid-row:1;padding:1px 5px;border-radius:3px;background:var( --_chip-bg );font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;color:var( --os-ui-fg-muted,#646970 )}.os-token-field__option-sample,.os-token-field__option-description{grid-column:1 / -1;font-size:11px;color:var( --os-ui-fg-muted,#646970 )}.os-token-field__option-sample{font-style:italic}.os-token-field__hint{margin:0;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-token-field__preview{display:flex;gap:6px;margin:0;font-size:12px;line-height:1.4;color:var( --os-ui-fg-muted,#646970 )}.os-token-field__preview-label{flex:0 0 auto;font-weight:600}.os-token-field__preview-body{min-width:0;overflow-wrap:anywhere;white-space:pre-wrap}`,ns=class ns extends _{constructor(){super(...arguments),this._tokens=[],this._value="",this.caret=null,this.onInput=e=>{const t=e.target;this._value=t.value,this.emit("os-token-field-input",{value:this._value}),this.requestUpdate()},this.rememberCaret=()=>{const e=this.field;e&&(this.caret={start:e.selectionStart??e.value.length,end:e.selectionEnd??e.value.length})},this.toggleCatalogue=()=>{if(!(this.hasAttribute("disabled")||this.hasAttribute("readonly"))){if(this.isOpen){this.removeAttribute("open");return}this.rememberCaret(),this.setAttribute("open","")}},this.onKeydown=e=>{e.key==="Escape"&&this.isOpen&&(e.stopPropagation(),this.removeAttribute("open"),this.field?.focus())}}get tokens(){return this._tokens}set tokens(e){this._tokens=Array.isArray(e)?[...e]:[],this.requestUpdate()}get value(){return this._value}set value(e){this._value=typeof e=="string"?e:"";const t=this.field;t&&t.value!==this._value&&(t.value=this._value),this.requestUpdate()}get field(){return this.shadowRoot?.querySelector(".os-token-field__input")??null}get isOpen(){return this.hasAttribute("open")}grouped(){const e=new Map;for(const t of this._tokens){const o=t.group??"",i=e.get(o);i?i.push(t):e.set(o,[t])}return[...e.entries()].sort((t,o)=>t[0]===""?1:o[0]===""?-1:0)}preview(){let e=this._value,t=!1;for(const o of this._tokens)!o.sample||!e.includes(o.token)||(e=e.split(o.token).join(o.sample),t=!0);return t?e:null}insert(e){const t=this.field,o=this.caret??{start:this._value.length,end:this._value.length},i=this._value.slice(0,o.start),n=this._value.slice(o.end);this._value=`${i}${e.token}${n}`,this.removeAttribute("open"),t&&(t.value=this._value),this.emit("os-token-insert",{token:e.token,value:this._value}),this.emit("os-token-field-input",{value:this._value}),this.requestUpdate();const r=i.length+e.token.length;this.caret={start:r,end:r},queueMicrotask(()=>{const a=this.field;a?.focus(),a?.setSelectionRange?.(r,r)})}render(){const e=this.label||"",t=this.hint||"",o=this.placeholder||"",i=this,n=i["insert-label"]||"Insert a value",r=i["preview-label"]||"Reads as",a=this.hasAttribute("multiline"),l=this.hasAttribute("disabled"),u=this.hasAttribute("readonly"),h=Number(this.getAttribute("rows"))||4,p=this.preview(),g=this.grouped(),m=a?c`<textarea
1970 class="os-token-field__input"
1971 rows=${h}
1972 placeholder=${o}
1973 ?disabled=${l}
1974 ?readonly=${u}
1975 .value=${this._value}
1976 @input=${this.onInput}
1977 @keyup=${this.rememberCaret}
1978 @click=${this.rememberCaret}
1979 @blur=${this.rememberCaret}
1980 ></textarea>`:c`<input
1981 type="text"
1982 class="os-token-field__input"
1983 placeholder=${o}
1984 ?disabled=${l}
1985 ?readonly=${u}
1986 .value=${this._value}
1987 @input=${this.onInput}
1988 @keyup=${this.rememberCaret}
1989 @click=${this.rememberCaret}
1990 @blur=${this.rememberCaret}
1991 />`;return c`
1992 <div class="os-token-field" @keydown=${this.onKeydown}>
1993 ${e?c`<span class="os-token-field__label">${e}</span>`:null}
1994 ${m}
1995 <div class="os-token-field__toolbar">
1996 <os-button
1997 variant="ghost"
1998 size="small"
1999 ?disabled=${l||u||g.length===0}
2000 aria-expanded=${this.isOpen?"true":"false"}
2001 @click=${this.toggleCatalogue}
2002 >
2003 <os-icon name="editor-code" size="14"></os-icon>
2004 ${n}
2005 </os-button>
2006 <slot name="action"></slot>
2007 </div>
2008 ${this.isOpen?c`<div
2009 class="os-token-field__catalogue"
2010 role="listbox"
2011 aria-label=${n}
2012 >
2013 ${g.map(([b,y])=>c`
2014 ${b?c`<p class="os-token-field__group">${b}</p>`:null}
2015 ${y.map(x=>c`
2016 <button
2017 type="button"
2018 role="option"
2019 class="os-token-field__option"
2020 @click=${()=>this.insert(x)}
2021 >
2022 <span class="os-token-field__option-label"
2023 >${x.label}</span
2024 >
2025 <code class="os-token-field__option-token"
2026 >${x.token}</code
2027 >
2028 ${x.sample?c`<span class="os-token-field__option-sample"
2029 >${x.sample}</span
2030 >`:null}
2031 ${x.description?c`<span
2032 class="os-token-field__option-description"
2033 >${x.description}</span
2034 >`:null}
2035 </button>
2036 `)}
2037 `)}
2038 </div>`:null}
2039 ${t?c`<p class="os-token-field__hint">${t}</p>`:null}
2040 ${p!==null?c`<p class="os-token-field__preview">
2041 <span class="os-token-field__preview-label"
2042 >${r}</span
2043 >
2044 <span class="os-token-field__preview-body">${p}</span>
2045 </p>`:null}
2046 </div>
2047 `}};ns.props=["label","placeholder","hint","multiline","rows","disabled","readonly","insert-label","preview-label","open"],ns.styles=[$p],ns.help=void 0;let Oi=ns;w("os-token-field",Oi);const Ap=["os-section","os-button","os-swatch","os-swatch-grid","os-segmented","os-segment","os-select","os-option","os-multiselect","os-color-field","os-range-field","os-text-field","os-number-field","os-checkbox","os-checkbox-label","os-switch","os-toast","os-toast-container","os-tabs","os-tab","os-tabpanel","os-window-button","os-menu","os-menu-item","os-action-menu","os-context-menu","os-context-menu-option","os-confirm-dialog","os-modal","os-user-search","os-role-picker","os-flyout","os-tab-chip","os-stack","os-cluster","os-icon","os-body","os-panel","os-row","os-grid","os-app-frame","os-split","os-display","os-disclosure","os-empty-state","os-key","os-code","os-badge","os-ribbon","os-tile","os-log","os-steps","os-step","os-table","os-spinner","os-relative-time","os-histogram","os-stat","os-avatar","os-textarea","os-chip","os-tag-input","os-form","os-save-status","os-category-picker","os-crumb-chain","os-card","os-rating-summary","os-notice","os-progress-bar","os-field-row","os-repeater","os-token-field"];function Ep(s,e,t,o){const i=[s,e,...o];if(t){i.push(t.summary??"",t.status??"");for(const n of[t.props,t.slots,t.events,t.parts,t.cssProps])for(const r of n??[]){const{name:a,description:l}=r;i.push(a??"",l??"")}}return i.join(" ").toLowerCase()}function wa(s,e){return e.toLowerCase().split(/\s+/).filter(Boolean).every(o=>s.haystack.includes(o))}function Sp(s){const e=s.replace(/^os-/,"").replace(/-/g," ");return e.charAt(0).toUpperCase()+e.slice(1)}function Wi(){const s=[];for(const e of Ap){const t=customElements.get(e);if(!t)continue;const o=t.help??null,i=o?.title??Sp(e),n=t.props??[];s.push({tag:e,title:i,help:o,props:n,haystack:Ep(e,i,o,n)})}return s.sort((e,t)=>e.title.localeCompare(t.title)),s}const Cp=["<!-- 1 — invented name, nothing close in the registry. -->","<os-example-console-fail-due-to-unregistered-component>","</os-example-console-fail-due-to-unregistered-component>","","<!-- 2 — typo within edit distance of a real tag. -->","<os-buton></os-buton>"].join(`
2048 `);let ya=!1;function Ip(){if(ya)return;ya=!0,console.log(`%c⚠ wp.os — INTENTIONAL DEMO%c
2049 The next two console.error entries are fired ON PURPOSE by the
2050 OpenStation Preferences → Components tab to demonstrate the <os-*> missing-
2051 import warner. They are not real bugs.
2052
2053 1. <os-example-console-fail-due-to-unregistered-component>
2054 2. <os-buton> (typo of <os-button>)
2055
2056 Source: apps/os-settings/parts/components.ts — the "Missing-import
2057 warner — live demo" section. Remove that section in your fork
2058 if you want a quieter Components tab.`,"background: #ffb400;color: #1a1a1a;font-weight: 700;font-size: 12px;padding: 4px 8px;border-radius: 3px","color: #b25c00;font-weight: 500")}const Rp=s=>{switch(s){case"experimental":return d("Experimental");case"planned":return d("Planned");default:return d("Stable")}},Es=(s,e,t)=>e?.length?c`<section class="os-settings__help-group">
2059 <h4>${s}</h4>
2060 <ul class="os-settings__help-list">${e.map(o=>c`<li>${t(o)}</li>`)}</ul>
2061 </section>`:"",Ss=s=>s?c` — ${s}`:"";function Lp(s){const e=s.help?.props??[],t=new Set(e.map(i=>i.name)),o=s.props.filter(i=>!t.has(i));return e.length===0&&o.length===0?"":c`
2062 <section class="os-settings__help-group">
2063 <h4>${d("Props")}</h4>
2064 <table class="os-settings__help-table">
2065 <thead>
2066 <tr>
2067 <th>${d("Name")}</th>
2068 <th>${d("Type")}</th>
2069 <th>${d("Default")}</th>
2070 <th>${d("Description")}</th>
2071 </tr>
2072 </thead>
2073 <tbody>
2074 ${e.map(i=>c`<tr>
2075 <td><code>${i.name}</code></td>
2076 <td>${i.type??"—"}</td>
2077 <td>${i.default??"—"}</td>
2078 <td>${i.description??""}</td>
2079 </tr>`)}
2080 ${o.map(i=>c`<tr>
2081 <td><code>${i}</code></td>
2082 <td>—</td>
2083 <td>—</td>
2084 <td><em>${d("Undocumented — declared via static props.")}</em></td>
2085 </tr>`)}
2086 </tbody>
2087 </table>
2088 </section>
2089 `}function Tp(s){const e=s.help,t=e?.status??"stable";return c`
2090 <header class="os-settings__help-head">
2091 <h3 class="os-settings__help-title">${s.title}</h3>
2092 <code class="os-settings__help-code">&lt;${s.tag}&gt;</code>
2093 <span class="os-settings__help-badge is-${t}">${Rp(t)}</span>
2094 </header>
2095 ${e?.summary?c`<p class="os-settings__help-summary">${e.summary}</p>`:""}
2096 ${e?.example?c`<section class="os-settings__help-group">
2097 <h4>${d("Example")}</h4>
2098 <div class="os-settings__help-example">${e.example}</div>
2099 </section>`:""}
2100 ${Lp(s)}
2101 ${Es(d("Slots"),e?.slots,o=>c`<code>${o.name}</code>${Ss(o.description)}`)}
2102 ${Es(d("Events"),e?.events,o=>c`<code>${o.name}</code>${o.detail?c` — <code>${o.detail}</code>`:""}${Ss(o.description)}`)}
2103 ${Es(d("Shadow parts"),e?.parts,o=>c`<code>::part(${o.name})</code>${Ss(o.description)}`)}
2104 ${Es(d("CSS custom properties"),e?.cssProps,o=>c`<code>${o.name}</code>${o.default?c` (${d("default")} <code>${o.default}</code>)`:""}${Ss(o.description)}`)}
2105 ${e?"":c`<p class="os-settings__help-note">
2106 ${d("This component has no help descriptor yet. Add `static help` to its class for a fuller reference.")}
2107 </p>`}
2108 `}const Dp=()=>c`
2109 <os-disclosure
2110 class="os-settings__help-warner-section"
2111 heading=${d("Missing-import warner — live demo")}
2112 hint=${d("Developer mode")}
2113 >
2114 <div class="os-settings__help-warner">
2115 <p class="os-settings__help-warner-text">
2116 ${d('Both <os-*> tags in the next piece of code are intentionally bogus, one per answer the warner has. Open the browser console: within ~2 seconds you should see two console.error entries from the framework, each pointing the developer at the fix — a name nothing in the registry comes close to, and a typo the warner can suggest a fix for ("did you mean"). Live copies of the same two tags are rendered off-screen, so the demo fires without affecting layout — including while this section is folded away. Remove this section in your fork if you want a quieter Components tab.')}
2117 </p>
2118 <pre class="os-settings__help-warner-code"><code>${Cp}</code></pre>
2119 </div>
2120 </os-disclosure>
2121 <!--
2122 The live copies. Real elements, because the warner watches the
2123 document for tags nothing registered. Clipped rather than
2124 display:none, and OUTSIDE the disclosure (a closed disclosure's
2125 body is display:none), so the upgrade path runs exactly as it
2126 would on a visible element.
2127 -->
2128 <div
2129 class="os-settings__help-warner-demo"
2130 aria-hidden="true"
2131 os-preserve
2132 style="position:absolute;width:0;height:0;overflow:hidden;clip:rect(0 0 0 0);"
2133 >
2134 <os-example-console-fail-due-to-unregistered-component></os-example-console-fail-due-to-unregistered-component>
2135 <os-buton></os-buton>
2136 </div>
2137 `;function xa(s){const e=S(s).components;return e.entries??(e.entries=Wi()),e.entries}function ka(s){const e=S(s).components,t=xa(s).filter(o=>wa(o,e.query));return t.find(o=>o.tag===e.activeTag)??t[0]}const Pp=(s,e)=>{const t=S(e).components;s.developerModeEnabled&&Ip();const o=xa(e).filter(n=>wa(n,t.query)),i=ka(e);return c`
2138 ${s.developerModeEnabled?Dp():""}
2139 <div class="os-settings__help-layout">
2140 <div class="os-settings__help-sidebar">
2141 <os-text-field
2142 class="os-settings__help-search"
2143 type="search"
2144 label=${d("Search components")}
2145 placeholder=${d("Name, tag, prop, event…")}
2146 autocomplete="off"
2147 value=${t.query}
2148 @os-input-change=${n=>{t.query=z(n).trim(),e.repaint()}}
2149 ></os-text-field>
2150 <nav class="os-settings__help-nav" aria-label=${d("Components")}>
2151 ${o.length?"":c`<p class="os-settings__help-nav-empty">${d("No components match.")}</p>`}
2152 ${o.map(n=>c`<button
2153 type="button"
2154 class=${n.tag===i?.tag?"os-settings__help-nav-item is-active":"os-settings__help-nav-item"}
2155 aria-pressed=${n.tag===i?.tag?"true":"false"}
2156 @click=${()=>{t.activeTag=n.tag,e.repaint()}}
2157 >
2158 <span class="os-settings__help-nav-title">${n.title}</span>
2159 <span class="os-settings__help-nav-tag">&lt;${n.tag}&gt;</span>
2160 </button>`)}
2161 </nav>
2162 </div>
2163 <div class="os-settings__help-detail">
2164 ${i?Tp(i):c`<p>${d("No components registered.")}</p>`}
2165 </div>
2166 </div>
2167 `};function Np(s){const e=S(s).components,t=s.root.querySelector(".os-settings__help-detail");if(!t)return;const o=ka(s),i=o?.tag??"";i!==e.paintedTag&&(t.scrollTop=0,e.paintedTag=i);const n=o?.help?.exampleInit,r=t.querySelector(".os-settings__help-example");if(!(!n||!r||r.hasAttribute("data-os-example-ready"))){r.setAttribute("data-os-example-ready",""),customElements.upgrade(r);try{n(r)}catch(a){console.error(`[openstation] <${i}> exampleInit threw:`,a)}}}const $a="https://openstation.blog/",Aa="https://openstation.blog/feed/",Mp="https://github.com/WordPress/openstation/";function Hi(s){if(typeof s!="string"||s==="")return"";try{const e=new URL(s,window.location.href);return e.protocol==="http:"||e.protocol==="https:"?e.href:""}catch{return""}}const Ee=s=>typeof s=="string"?s.trim():"";function zp(s){if(!s||typeof s!="object")return null;const e=s,t=(Array.isArray(e.items)?e.items:[]).map(o=>{if(!o||typeof o!="object")return null;const i=o,n=Ee(i.title),r=Hi(i.url);return n===""||r===""?null:{title:n,url:r,author:Ee(i.author),publishedAt:Ee(i.publishedAt),excerpt:Ee(i.excerpt)}}).filter(o=>o!==null).slice(0,5);return{title:Ee(e.title)||d("OpenStation"),description:Ee(e.description)||d("A public dev diary — building a desktop OS for wp-admin."),homeUrl:Hi(e.homeUrl)||$a,feedUrl:Hi(e.feedUrl)||Aa,items:t,stale:e.stale===!0}}function Op(s){if(s==="")return"";const e=new Date(s);return Number.isNaN(e.getTime())?"":e.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Ea(s){const e=Op(s.publishedAt);return e&&s.author?V("%1$s · %2$s",e,s.author):e||s.author}const Wp=s=>c`
2168 <article class="os-settings__about-featured">
2169 <a href=${s.url} target="_blank" rel="noopener noreferrer">
2170 <div class="os-settings__about-featured-copy">
2171 <span class="os-settings__about-kicker">${d("Latest dispatch")}</span>
2172 <h3>${s.title}</h3>
2173 ${s.excerpt?c`<p>${s.excerpt}</p>`:""}
2174 </div>
2175 <footer>
2176 <span>${Ea(s)}</span>
2177 <strong>${d("Read the dispatch")} <span aria-hidden="true">↗</span></strong>
2178 </footer>
2179 </a>
2180 </article>
2181 `,Hp=s=>c`
2182 <article class="os-settings__about-card" role="listitem">
2183 <a href=${s.url} target="_blank" rel="noopener noreferrer">
2184 <span class="os-settings__about-card-meta">${Ea(s)}</span>
2185 <h3>${s.title}</h3>
2186 ${s.excerpt?c`<p>${s.excerpt}</p>`:""}
2187 <strong>${d("Read more")} <span aria-hidden="true">↗</span></strong>
2188 </a>
2189 </article>
2190 `,Ui=(s,e,t,o="",i=!1)=>c`
2191 <div class=${`os-settings__about-status${o}`} role=${t} aria-live=${t==="status"?"polite":null}>
2192 ${i?c`<span class="os-settings__about-spinner" aria-hidden="true"></span>`:c`<span class="dashicons dashicons-rss" aria-hidden="true"></span>`}
2193 <div>
2194 <strong>${s}</strong>
2195 <span>${e}</span>
2196 </div>
2197 </div>
2198 `;function Up(s){if(s.kind==="loading")return Ui(d("Opening the journal…"),d("The latest posts are arriving over RSS."),"status","",!0);if(s.kind==="error")return Ui(d("The journal could not be reached."),d("You can still read every post on openstation.blog."),"alert"," os-settings__about-status--error");if(s.feed.items.length===0)return Ui(d("No dispatches yet."),d("The journal is open and waiting for its next post."),"status");const[e,...t]=s.feed.items;return c`
2199 ${s.feed.stale?c`<p class="os-settings__about-stale" role="status">
2200 ${d("Showing the last saved copy while the journal reconnects.")}
2201 </p>`:""}
2202 <section class="os-settings__about-feed" aria-label=${d("Latest journal posts")}>
2203 ${Wp(e)}
2204 ${t.length>0?c`<div class="os-settings__about-grid" role="list">${t.map(Hp)}</div>`:""}
2205 </section>
2206 `}function qp(s,e){const t=e.kind==="ready"?e.feed:null,o=`${s.pluginUrl??""}/assets/images/openstation-mark.svg`,i=s.pluginVersion??"";return c`
2207 <div class="os-settings__about-inner">
2208 <header class="os-settings__about-overview">
2209 <div class="os-settings__about-identity">
2210 <img src=${o} alt="" width="64" height="64" />
2211 <div>
2212 <span class="os-settings__about-eyebrow">${d("About OpenStation")}</span>
2213 <h2>${d("A desktop for WordPress.")}</h2>
2214 <p>
2215 ${d("OpenStation reshapes wp-admin into a personal workspace, with movable windows, a dock, themes, and focused tools that keep your site close at hand.")}
2216 </p>
2217 </div>
2218 </div>
2219 <div class="os-settings__about-story">
2220 <p>
2221 ${d("It is a playful, open-source experiment by Automattic exploring what WordPress can feel like when the dashboard becomes a place of its own.")}
2222 </p>
2223 <div class="os-settings__about-meta">
2224 <span>
2225 <strong>OpenStation${i?` ${i}`:""}</strong>
2226 <small>${d("An experiment by Automattic")}</small>
2227 </span>
2228 <a href=${Mp} target="_blank" rel="noopener noreferrer">
2229 ${d("View the project")} <span aria-hidden="true">↗</span>
2230 </a>
2231 </div>
2232 </div>
2233 </header>
2234 <div class="os-settings__about-journal-head">
2235 <div>
2236 <span class="os-settings__about-eyebrow">${d("OpenStation Journal")}</span>
2237 <h2>${d("Latest from the station")}</h2>
2238 <p>${t?.description||d("A public dev diary — building a desktop OS for wp-admin.")}</p>
2239 </div>
2240 <a class="os-settings__about-journal-link" href=${t?.homeUrl||$a} target="_blank" rel="noopener noreferrer">
2241 ${d("Visit the journal")} <span aria-hidden="true">↗</span>
2242 </a>
2243 </div>
2244 ${Up(e)}
2245 <footer class="os-settings__about-footer">
2246 <p>
2247 <strong>${d("OpenStation Journal")}</strong>
2248 <span>${d("News and field notes, delivered over RSS.")}</span>
2249 </p>
2250 <a href=${t?.feedUrl||Aa} target="_blank" rel="noopener noreferrer">
2251 <span class="dashicons dashicons-rss" aria-hidden="true"></span>
2252 ${d("RSS feed")}
2253 </a>
2254 </footer>
2255 </div>
2256 `}const Fp=(s,e)=>c`<div class="os-settings__about">${qp(ce(e),S(e).about??{kind:"loading"})}</div>`;function Vp(s){const e=S(s);if(s.state.tab!=="about"||e.about!==null)return;e.about={kind:"loading"};const t=ce(s).aboutFeedUrl;if(!t){e.about={kind:"error"},s.repaint();return}(async()=>{try{const o=await s.fetch(t,{credentials:"same-origin"});if(!o.ok)throw new Error(`about feed returned ${o.status}`);const i=await o.json(),n=i.success?zp(i.data):null;if(!n)throw new Error("about feed returned an invalid payload");e.about={kind:"ready",feed:n}}catch(o){console.error("[openstation/about] journal feed failed:",o),e.about={kind:"error"}}s.repaint()})()}const be={size:null},oe={appearance:()=>P("color",be),themes:()=>{const s=document.createElementNS("http://www.w3.org/2000/svg","svg");return s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","currentColor"),s.setAttribute("aria-hidden","true"),s.innerHTML='<path fill-rule="evenodd" clip-rule="evenodd" d="M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z" />',s},windows:()=>P("windows",be),navigation:()=>{const s=document.createElementNS("http://www.w3.org/2000/svg","svg");return s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","currentColor"),s.setAttribute("aria-hidden","true"),s.innerHTML='<path d="M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" />',s},mobile:()=>P("window",be),features:()=>P("settings",be),help:()=>P("widgets",be),"os-file-associations":()=>{const s=document.createElementNS("http://www.w3.org/2000/svg","svg");return s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","currentColor"),s.setAttribute("aria-hidden","true"),s.innerHTML='<path d="M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" /><path d="M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" />',s},about:()=>P("info",be)};function jp(s,e){return e&&jd(e)?()=>P(e,be):oe[s]}const Sa=s=>`os-settings-tab-host-${s}`;function me(s,e=""){return c`
2257 <header class="os-settings__page-header">
2258 <h2 class="os-settings__page-title">${s}</h2>
2259 ${e?c`<p class="os-settings__page-description">${e}</p>`:""}
2260 </header>
2261 `}function Bp(s,e){return s.capability==="manage_options"?e:!0}function Ca(s){return s<20?1:s<40?2:3}function Ue(s){const e=s.data.isAdmin,t=[{id:"appearance",order:10,label:d("Appearance"),icon:oe.appearance,panel:(o,i)=>c`${me(d("Appearance"),d("Personalize your desktop. Changes apply instantly and are saved to this browser."))}${Uc(o,dd(o,i))}`},{id:"themes",order:12,label:d("Themes"),icon:oe.themes,panel:(o,i)=>c`${me(d("Themes"),d("A desktop theme repaints every token at once. A coarser version of what Appearance does one control at a time."))}${Nd(o,i)}`},{id:"windows",order:18,label:d("Windows"),icon:oe.windows,panel:(o,i)=>c`${me(d("Windows"),d("How windows look, how they arrive, and how they behave when they are not the one you are using."))}${fd(o)}`},{id:"navigation",order:22,label:d("Navigation"),icon:oe.navigation,panel:(o,i)=>c`${me(d("Navigation"))}${Vd(o)}`},{id:"mobile",order:24,label:d("Mobile"),icon:oe.mobile,panel:(o,i)=>c`${me(d("Mobile"),d("On a phone the desktop becomes a home screen, one full-screen app at a time, and a tab bar. Choose when that happens and what the bar holds."))}${Gd(o)}`},{id:"features",order:30,label:d("Features"),icon:oe.features,panel:(o,i)=>c`${me(d("Features"),d("The assistant, developer tools, and beta features for your account, plus site-wide Extended options for administrators."))}${kd(o,i)}`}];e&&t.push({id:"help",order:40,label:d("Components"),icon:oe.help,panel:(o,i)=>c`${me(d("Components"),d("Every <os-*> web component shipped by this plugin, with its props, slots, and a live example."))}${Pp(o,i)}`}),t.push({id:"about",order:Number.MAX_SAFE_INTEGER,label:d("About"),icon:oe.about,padding:"0",panel:Fp});for(const o of yc())Bp(o,e)&&t.push({id:`ext-${o.id}`,order:o.order??100,label:o.label,icon:jp(o.id,o.icon),tab:o,panel:()=>c`<div data-host=${Sa(o.id)}></div>`});return t.sort((o,i)=>o.order-i.order),t}function Kp(s,e){const t=S(s);for(const o of e){const i=o.tab;if(!i)continue;const n=s.root.querySelector(`[data-host="${Sa(i.id)}"]`);if(!(!n||t.mountedTabs.get(n)===i)){t.mountedTabs.set(n,i);try{i.render(n,{isAdmin:s.data.isAdmin,getOsSettings:D,subscribeOsSettings:Qi})}catch(r){console.error("[openstation] settings tab render threw:",i.id,r)}}}}const Gp=["heading","description","label","aria-label","placeholder"];function Xp(s,e){const t=new Map;for(const o of e){const i=s.querySelector(`os-tabpanel[for="${o.id}"]`),n=[o.label,i?.textContent??""];for(const r of Array.from(i?.querySelectorAll("[heading],[description],[label],[aria-label],[placeholder]")??[]))for(const a of Gp)n.push(r.getAttribute(a)??"");t.set(o.id,n.join(" ").replace(/\s+/g," ").toLowerCase())}return t}const Ia=["os-select","os-multiselect","os-segmented","os-swatch-grid","os-swatch","os-checkbox-label","os-checkbox","os-switch","os-text-field","os-number-field","os-range-field","os-color-field","os-textarea","os-button","input","select","textarea","button"].join(","),Zp=["label","aria-label","placeholder","description"],qe=["data-settings-search-control","data-settings-search-section","data-settings-search-page"];function Yp(s){const e=[s,...s.querySelectorAll("[label],[aria-label],[placeholder],[description]")];return[s.textContent??"",...e.flatMap(t=>Zp.map(o=>t.getAttribute(o)??""))].join(" ").replace(/\s+/g," ").trim().toLowerCase()}function Fe(s,e){return s=s.replace(/\s+/g," ").trim().toLowerCase(),s===e?3:s.startsWith(e)?2:Number(s.includes(e))}function Ra(s,e){if(e=e.replace(/\s+/g," ").trim().toLowerCase(),!e)return null;let t=null,o=0;for(const i of s.querySelectorAll(".os-settings > os-tabpanel"))for(const n of i.querySelectorAll(Ia)){if(n.parentElement?.closest(Ia)||n.closest("[os-preserve]"))continue;let r=!1;for(let h=n;h&&h!==i;h=h.parentElement)if(h.hidden||h.getAttribute("aria-hidden")==="true"){r=!0;break}if(r)continue;const a=n.closest("os-section"),l=Math.max(Fe(n.getAttribute("label")??"",e),Fe(n.getAttribute("aria-label")??"",e)),u=Math.max(l*100,Fe(Yp(n),e)*10,Fe(a?.getAttribute("heading")??"",e)*3,Fe(a?.getAttribute("description")??"",e));u<=o||(o=u,t={page:i.getAttribute("for")??"",control:n,section:a})}return t}function La(s,e){const t=s.root.querySelector(".os-settings__search-input");t&&t.value!==e&&(t.value=e);const o=S(s).search;o.index=Xp(s.root,Ue(s)),o.query=e.replace(/\s+/g," ").trim().toLowerCase();const i=Ra(s.root,o.query);i&&s.state.tab!==i.page?s.local("tab",{value:i.page}):s.repaint()}function Jp(s){const e=s.root.querySelector("[data-settings-search-control]");for(const o of qe)for(const i of s.root.querySelectorAll(`[${o}]`))i.removeAttribute(o);const t=Ra(s.root,S(s).search.query);if(t&&t.page===s.state.tab){t.control.setAttribute(qe[0],""),t.section?.setAttribute(qe[1],"");for(const o of s.root.querySelectorAll("#os-settings-nav > os-tab"))o.getAttribute("value")===t.page&&o.setAttribute(qe[2],"");e!==t.control&&requestAnimationFrame(()=>{t.control.isConnected&&t.control.hasAttribute(qe[0])&&!t.control.closest("[hidden]")&&t.control.scrollIntoView?.({block:"nearest",inline:"nearest",behavior:"instant"})})}}const Qp=["window_prewarm","admin_asset_cache","media_library_enhanced","games","agents","network"];function eg(s,e){const t=I({enabled:{type:"boolean"}}),o=n=>R(n,["enabled"])&&typeof n.enabled=="boolean",i=async(n,r)=>{if(!await s.dispatch(n,r))throw new Error("Preferences did not save this action.");return Ir(s),{saved:!0,extendedOptions:s.data.extendedOptions}};return[...Qp.map(n=>({name:`set_extended_${n}`,description:`Set site-wide ${n}. Administrator only. Affects all users; window prewarm and asset cache need shell reload.`,parameters:t,validate:o,allowed:()=>s.data.isAdmin&&!!s.data.extendedOptions,run:r=>i("extended",{options:{...s.data.extendedOptions,[n]:r.enabled}})})),{name:"set_ai_assistant",description:"Enable or disable the assistant for this account. Disabling ends future MIO requests.",parameters:t,validate:o,allowed:()=>!!s.data.aiAssistant?.assistantProviderConfigured,run:(n,r)=>e({ai:{enabled:n.enabled}},r)},{name:"show_introductions_again",description:"Show welcome introductions again on their next open. Does not delete settings or content.",parameters:I({}),validate:n=>R(n,[]),run:()=>i("reset-intros",{})},{name:"open_section",effect:"none",description:"Open a Preferences section. Use appearance, themes, windows, navigation, mobile, features, about, or help (Components; admin only).",parameters:I({id:{type:"string",enum:Ue(s).map(n=>n.id)}}),validate:n=>R(n,["id"])&&Ue(s).some(r=>r.id===n.id),run:n=>(s.local("tab",{value:n.id}),{opened:n.id})},{name:"search_settings",effect:"none",description:"Search Preferences and highlight the single best matching control.",parameters:I({query:{type:"string"}}),validate:n=>R(n,["query"])&&typeof n.query=="string"&&n.query.length<=200,run:n=>(La(s,n.query),{filtered:n.query})},{name:"open_image_picker",effect:"none",description:"Show the wallpaper image picker. Upload requires the user to select a local file; library offers existing images.",parameters:I({source:{type:"string",enum:["library","upload"]}}),validate:n=>R(n,["source"])&&(n.source==="library"||n.source==="upload"&&s.data.canUpload),run:n=>{const r=S(s);return r.imagePickerOpen=!0,r.imageSource=n.source,s.local("tab",{value:"appearance"}),s.repaint(),{opened:n.source,needsUserFile:n.source==="upload"}}},{name:"search_wallpaper_images",effect:"read",description:"Search image attachments in the media library. Returns verified ids and dimensions for select_wallpaper_image.",parameters:I({query:{type:"string"},page:{type:"integer",minimum:1,maximum:100}}),validate:n=>R(n,["query","page"])&&typeof n.query=="string"&&n.query.length<=200&&Number.isInteger(n.page)&&n.page>=1&&n.page<=100,run:async(n,r)=>{const a=new URL(ce(s).mediaUrl);a.searchParams.set("media_type","image"),a.searchParams.set("search",n.query),a.searchParams.set("page",String(n.page)),a.searchParams.set("per_page","12"),a.searchParams.set("_fields","id,title,media_details,source_url,mime_type");const l=await s.fetch(a.href,{signal:r});if(!l.ok)throw new Error("Could not search the media library.");return l.json()}},{name:"select_wallpaper_image",description:"Use an existing image attachment as wallpaper. Verifies the attachment on the server; never accepts a model-supplied URL.",parameters:I({id:{type:"integer",minimum:1}}),validate:n=>R(n,["id"])&&Number.isSafeInteger(n.id)&&n.id>0,run:async(n,r)=>{const a=await s.fetch(`${ce(s).mediaUrl}/${n.id}`,{signal:r});if(!a.ok)throw new Error("This image is unavailable.");const l=await a.json();if(typeof l.mime_type!="string"||!l.mime_type.startsWith("image/")||typeof l.source_url!="string"||!/^https?:\/\//.test(l.source_url))throw new Error("The attachment is not a usable image.");return e({customImage:{id:l.id,url:l.source_url},wallpaper:"custom-image"},r)}},{name:"clear_wallpaper_image",description:"Clear the selected wallpaper image without deleting its media attachment. Active image wallpaper returns to the default wallpaper.",parameters:I({}),validate:n=>R(n,[]),run:(n,r)=>e({customImage:null,...D().wallpaper==="custom-image"?{wallpaper:Gi()}:{}},r)},{name:"open_theme_upload",effect:"none",description:"Show the desktop theme upload tile. The user must choose the ZIP from their device.",parameters:I({}),validate:n=>R(n,[]),allowed:()=>s.data.canManageDesktopThemes,run:()=>(s.local("tab",{value:"themes"}),{opened:"themes",needsUserFile:!0})},{name:"open_wallpaper_settings",effect:"none",description:"Open the active wallpaper’s custom settings dialog, when available.",parameters:I({}),validate:n=>R(n,[]),run:()=>{const n=xe().find(r=>r.id===D().wallpaper);if(!n?.renderConfig)throw new Error("This wallpaper has no settings dialog.");return Sr(n),{opened:n.id}}},{name:"set_snow_settings",description:"Configure Snow wallpaper: wind 0–80, particleCount 100–2000, flakeSize 6–40, background #rrggbb. Does not switch wallpaper.",parameters:I({wind:{type:"number",minimum:0,maximum:80},particleCount:{type:"integer",minimum:100,maximum:2e3},flakeSize:{type:"number",minimum:6,maximum:40},background:{type:"string"}}),allowed:()=>xe().some(n=>n.id==="wp-snow"),validate:n=>R(n,["wind","particleCount","flakeSize","background"])&&Object.entries(ac).every(([r,a])=>typeof n[r]=="number"&&Number.isFinite(n[r])&&n[r]>=a.min&&n[r]<=a.max)&&Number.isInteger(n.particleCount)&&typeof n.background=="string"&&/^#[0-9a-f]{6}$/i.test(n.background),run:async(n,r)=>{const a=n,l=await e({wallpaperSettings:{...D().wallpaperSettings,"wp-snow":a}},r);return rr("wp-snow",a),l}},{name:"open_component_reference",effect:"none",description:"Inspect a kit component’s documentation and interactive example. Administrator only.",parameters:I({tag:{type:"string"}}),allowed:()=>s.data.isAdmin,validate:n=>R(n,["tag"])&&Wi().some(r=>r.tag===n.tag),run:n=>(S(s).components.activeTag=n.tag,s.local("tab",{value:"help"}),s.repaint(),{opened:n.tag})},{name:"list_components",effect:"read",description:"List available component references.",parameters:I({}),validate:n=>R(n,[]),allowed:()=>s.data.isAdmin,run:()=>Wi().map(n=>({tag:n.tag,title:n.title}))},{name:"show_connectors_location",effect:"read",description:"Explain where to connect the AI provider. Credentials must be entered by the user in WordPress Connectors.",parameters:I({}),validate:n=>R(n,[]),run:()=>({url:zs().aiAssistant?.connectorsUrl,instructions:"Open WordPress Settings → Connectors to manage provider credentials."})}]}const Ta=s=>`set_${s.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}`,I=s=>({type:"object",properties:s,required:Object.keys(s),additionalProperties:!1}),R=(s,e)=>Object.keys(s).length===e.length&&e.every(t=>Object.prototype.hasOwnProperty.call(s,t)),qi=s=>typeof s=="string"&&/^#[0-9a-f]{6}$/i.test(s);function tg(s){const e=async(n,r)=>{const a=await or(()=>A(n),r,n);return"developerModeEnabled"in n&&tn(),a},t=io(),o=Object.entries(t).map(([n,r])=>({name:Ta(n),description:`Set Preferences ${n}. Current: ${JSON.stringify(D()[n])}.${n==="desktopLayout"?" unified combines all docks; classic is Split.":""}${n==="desktopTheme"?" Read list_options first to choose from installed themes; this never changes the WordPress frontend theme.":""}`,parameters:I({value:{type:typeof r[0]=="number"?"number":"string",enum:[...new Set(r)]}}),validate:a=>R(a,["value"])&&(io()[n]??[]).includes(a.value),run:(a,l)=>e({[n]:a.value},l)}));for(const n of nc)o.push({name:Ta(n),description:`Set Preferences ${n}. Current: ${D()[n]}.`,parameters:I({value:{type:"boolean"}}),validate:r=>R(r,["value"])&&typeof r.value=="boolean",run:(r,a)=>e({[n]:r.value},a)});return[...o,{name:"list_options",effect:"read",description:"List live themes (including surface colours), wallpapers, accents, effects, navigation and phone pin choices. Read before selecting ids.",parameters:I({}),validate:n=>R(n,[]),run:rc},{name:"read_settings",effect:"read",description:"Read current preferences, active section and capability-gated site options.",parameters:I({}),validate:n=>R(n,[]),run:()=>({settings:D(),section:s.state.tab,extendedOptions:s.data.extendedOptions})},{name:"set_custom_accent",description:"Set a custom six-digit hex accent and activate it.",parameters:I({value:{type:"string",pattern:"^#[0-9a-fA-F]{6}$"}}),validate:n=>R(n,["value"])&&qi(n.value),run:(n,r)=>e({accent:"custom",customAccent:n.value},r)},{name:"set_custom_gradient",description:"Set both gradient colours and its angle, and activate the custom gradient wallpaper.",parameters:I({from:{type:"string"},to:{type:"string"},angle:{type:"number",minimum:0,maximum:360}}),validate:n=>R(n,["from","to","angle"])&&qi(n.from)&&qi(n.to)&&typeof n.angle=="number"&&Number.isFinite(n.angle)&&n.angle>=0&&n.angle<=360,run:(n,r)=>e({wallpaper:"custom-gradient",customGradient:{from:n.from,to:n.to,angle:n.angle}},r)},{name:"set_window_reveal_duration",description:"Set reveal duration: 0 uses each effect’s default; otherwise 80–4000 milliseconds.",parameters:I({value:{type:"number"}}),validate:n=>R(n,["value"])&&typeof n.value=="number"&&(n.value===0||Number.isFinite(n.value)&&n.value>=80&&n.value<=4e3),run:(n,r)=>e({windowRevealDuration:n.value},r)},{name:"set_navigation_placement",description:"Place one available Navigation item on the rail, desktop, both, or hidden. Preserves every other item.",parameters:I({id:{type:"string"},placement:{type:"string",enum:["rail","desktop","both","hidden"]}}),validate:n=>R(n,["id","placement"])&&tr().some(r=>r.id===n.id)&&["rail","desktop","both","hidden"].includes(n.placement),run:(n,r)=>e({navPlacement:{...D().navPlacement,[n.id]:n.placement}},r)},{name:"set_mobile_tabs",description:"Choose up to three available phone pins in order. Empty selects the server defaults; Home and Switcher are reserved.",parameters:I({ids:{type:"array",items:{type:"string"},maxItems:3,uniqueItems:!0}}),validate:n=>R(n,["ids"])&&Array.isArray(n.ids)&&n.ids.length<=3&&new Set(n.ids).size===n.ids.length&&n.ids.every(r=>sr().some(a=>a.id===r)),run:(n,r)=>e({mobileTabs:n.ids},r)},{name:"apply_theme_recommendations",description:"Reapply the active theme’s recommended arrangement. Changes only the settings that theme recommends.",parameters:I({}),validate:n=>R(n,[]),run:async(n,r)=>D().desktopTheme?or(()=>{if(!en(D().desktopTheme))throw new Error("This theme has no applicable recommendations.")},r):{effect:"none",status:"completed",data:{changed:!1,reason:"System default has no recommended layout."}}},...eg(s,e)].map(n=>({effect:"write",...n}))}const sg=Object.entries({index:`# OpenStation Preferences help
2262
2263 Preferences changes the WordPress administration desktop for your account. It does not change the public website's WordPress theme, posts, pages or menus. Changes appear immediately, then save to your account. The browser keeps a local settings cache. MIO waits for the save confirmation before reporting success. If saving fails the existing Preferences store rolls back; MIO must report the failure.
2264
2265 ## Find the right page
2266
2267 - [Appearance](appearance.md): wallpaper, accent colour, dock arrangement, size, placement, behaviour and WordPress admin bar.
2268 - [Desktop themes](themes.md): choose a complete desktop appearance and apply its recommended layout.
2269 - [Windows](windows.md): corners, unfocused effects, opening reveals, links, close-all confirmation.
2270 - [Navigation and mobile](navigation.md): placement of individual launchers and the phone experience.
2271 - [Features](features.md): optional tools, native apps, AI, developer mode and administrator-only site options.
2272 - [Wallpaper images and configuration](wallpaper.md): gradients, existing media, uploads and Snow controls.
2273 - [Components and About](reference.md): component examples, the journal and provider setup.
2274 - [MIO actions and examples](actions.md): private action catalog, chained requests and intentional exclusions.
2275
2276 ## Ask MIO
2277
2278 Use **Ask MIO** in the Preferences window. It appears only when MIO (the shared dock / Features → MIO API switch) and Features → AI assistant are enabled and WordPress has a compatible AI connector. Contextual tips and placement need the MIO API but do not need AI. Show MIO on wallpaper controls only the desktop mascot; turning it off keeps window chat and tips available. MIO belongs to this window while it is focused. A different window can claim MIO only by explicitly registering its own context. An ordinary window cannot take over its prompt or actions. Switching focus cancels unfinished work; already submitted changes may still finish. Closing Preferences discards its conversation. Closing just the chat keeps the in-memory conversation while that window remains open. Reloading discards it.
2279
2280 Your messages, relevant help excerpts and action results are sent to the AI provider configured in WordPress. OpenStation does not save MIO backscroll in WordPress, browser storage or an application log. Provider-side retention is governed by that provider. Do not paste credentials into the conversation.
2281
2282 ## Multiple changes
2283
2284 “Please set rounded corners, unify the docks, and make them dynamic” is three actions: \`set_window_radius\` with \`round\`, \`set_desktop_layout\` with \`unified\`, then \`set_dock_behavior\` with \`dynamic\`. Each action validates its arguments and waits for its own save. A later failure does not undo earlier completed actions. MIO reports partial completion and stops instead of silently retrying writes.
2285
2286 “Make both docks dynamic” in Split mode means set both \`dockBehavior\` and \`sideDockBehavior\` to \`dynamic\`. In Unified there is only one rail and the sidebar setting has no visible effect. See [Appearance](appearance.md).
2287
2288 ## Choosing accurately
2289
2290 Ask MIO to \`list_options\` before choosing a theme, wallpaper, accent or effect. These catalogs are live: plugins can register or remove choices. MIO must use returned ids, not invent them from labels. Theme selection can seed recommended settings once, so apply a theme before making explicit layout overrides in a chain. When a theme visually overrides a setting, explain that fact instead of repeatedly writing the same value.
2291 `,appearance:"# Appearance: colour and desktop layout\n\n[Help index](index.md) · [Themes](themes.md) · [Wallpaper](wallpaper.md) · [Navigation](navigation.md)\n\n## Accent colour\n\nChoose a preset accent from the live swatches (`set_accent`), or supply a six-digit hex colour to `set_custom_accent`. Custom accent both stores the colour and activates the Custom swatch. It colours shell controls and focus treatments. It does not restyle admin documents inside iframe windows. Ask `list_options` for preset ids and their colours; installed extensions can add swatches.\n\n## Unified and Split docks\n\nThe **Unified** layout (`desktopLayout: unified`) combines core administration menus, plugin launchers and system items in one dock. **Split** (`desktopLayout: classic`) uses a left sidebar for core menus and a bottom dock for the other items. The API value `classic` deliberately means the UI label Split.\n\n`set_desktop_layout` changes this arrangement. Individual launcher visibility and location are separate preferences in [Navigation](navigation.md); unifying the dock does not delete those choices.\n\n## Dock placement\n\nIn Unified, `set_dock_placement` accepts `bottom`, `left`, or `right`. Split derives its placement from the layout: left sidebar plus bottom dock. Changing `dockPlacement` while Split is active preserves the choice for Unified but does not move the Split rails.\n\n## Dock size\n\n`set_dock_size` accepts `compact`, `default`, or `large`. These correspond to rail widths of 48, 56 and 72 CSS pixels and icon scales of 18, 20 and 26 pixels. Desktop themes may further shape their appearance.\n\n## Static and dynamic behaviour\n\n`set_dock_behavior` controls the single Unified dock or the bottom Split dock. `static` keeps it visible and reserves its occupied band in the work area. `dynamic` folds the rail into a subtle edge indicator, reveals it when the pointer reaches it or keyboard focus enters it, and reserves no desktop band.\n\n`set_side_dock_behavior` controls only Split's sidebar, independently. Both accept `static` or `dynamic`. “Hide the docks until I need them” means dynamic, not hiding every Navigation item. “Make the docks dynamic” in Split should change both rail behaviours.\n\n## Dock renderer\n\n`set_dock_rail_renderer` selects the rendering style from the live renderer catalog. It changes the presentation of a rail, not which items belong to it. Never guess a renderer id; `list_options` supplies ids and labels.\n\n## WordPress admin bar\n\n`set_admin_bar_mode` accepts `static` (always shown), `dynamic` (auto-hiding peek strip), or `hidden` (not rendered). This affects the bar above the desktop. It is separate from the dock and sidebar behaviours. The shell measures the actual visible bar height when calculating its work area.\n\n## Examples\n\n- “One large dock on the right”: set desktop layout to `unified`, dock size to `large`, dock placement to `right`.\n- “Split layout but let both rails get out of the way”: set layout `classic`, dock behaviour `dynamic`, sidebar behaviour `dynamic`.\n- “Use turquoise”: list available accent colours first, then select the user's intended swatch or ask for a custom colour if the choice is ambiguous.\n",themes:`# Desktop themes
2292
2293 [Help index](index.md) · [Appearance](appearance.md) · [Windows](windows.md)
2294
2295 ## Choose a theme
2296
2297 The Themes page offers **OpenStation**, the system default, and the installed desktop theme library. \`set_desktop_theme\` takes a verified theme slug. The empty string \`""\` selects OpenStation's built-in dark appearance. This is an administration desktop theme, not a WordPress frontend theme.
2298
2299 \`list_options\` loads full theme entries when available and returns names, descriptions, surface colour tokens, and recommended settings. Use actual colour values or a clear description as evidence when the user asks for a darker or lighter theme. A name alone is not evidence of brightness. If the metadata is insufficient, explain the uncertainty or ask which visible theme they mean. Never install or fetch an unrequested theme to satisfy a colour change.
2300
2301 ## Recommendations and order of operations
2302
2303 A desktop theme may recommend an accent, dock layout, dock position, size, renderer, window corner preset or reveal. The first activation seeds its applicable recommendations. That first-use record belongs to the shell; MIO cannot reset it.
2304
2305 Re-selecting a previously used theme respects subsequent choices. **Apply recommended layout and effects** deliberately reapplies the active theme's recommendations; MIO exposes this as \`apply_theme_recommendations\`. It changes only recommended fields. A theme without applicable recommendations reports that fact.
2306
2307 When chaining “use theme X, round the corners and unify the dock”, apply the theme first. Then set the explicitly requested corner and layout values. Otherwise first-use recommendations might override an earlier step.
2308
2309 ## When a saved setting looks unchanged
2310
2311 Themes can override window surface, radius and other CSS tokens. A successfully saved \`windowRadius\` does not necessarily defeat a theme's own radius token. Explain the override. Do not claim to have changed the theme file or silently switch themes unless the user requested that.
2312
2313 The Legacy theme is a frozen snapshot of the earlier WordPress-admin appearance. Changing current defaults never rewrites that snapshot.
2314
2315 ## Theme uploads
2316
2317 Administrators with the theme-management capability can upload a desktop theme ZIP from the Themes page. \`open_theme_upload\` takes the user to the tile. The local file must be selected by the user; MIO cannot access a device's filesystem or invent a ZIP. The existing upload flow validates the package.
2318
2319 Deleting an uploaded theme is destructive and is intentionally absent from MIO's action catalog. Code-registered themes belong to their providing plugin and cannot be deleted from this page. Use \`set_desktop_theme\` to switch away without deleting anything.
2320 `,windows:"# Window appearance and behaviour\n\n[Help index](index.md) · [Themes](themes.md) · [Features](features.md)\n\n## Corners\n\n`set_window_radius` selects `sharp` (0 px), `default` (8 px) or `round` (16 px). “Rounded corners” means `round` unless the user asks for the default rounding. A desktop theme can override the visual radius token; see [Themes](themes.md).\n\n## Unfocused windows\n\n`set_unfocus_effect` chooses how windows look when another window is focused. `none` disables the treatment. The other ids and labels come from `list_options`; the catalog can change when plugins register effects. This controls appearance, not minimization or focus ownership.\n\n## Opening reveals\n\n`set_window_reveal` chooses a content reveal. `none` uses the ordinary opacity fade. `set_window_reveal_duration` accepts `0` for the effect's own timing, or a number from 80 to 4000 milliseconds. Reduced motion is respected by the shell. The duration does not control MIO's ownership transition.\n\n## Window links\n\nRelated windows can carry visual ties. `set_window_link_renderer` chooses a registered renderer, or `none` to disable the visuals. `set_window_link_visibility` accepts `always`, `focus` (visible while a related-group member is focused), or `off`.\n\nThe master **Window links** feature (`set_window_links_enabled`) is on Features. Turning it off disables link visuals and group behaviour but preserves your style choices. Two independent switches are `set_window_link_raise_on_focus` (raise related windows behind the focused member) and `set_window_link_highlight` (outline related windows). None of these actions modifies site content or creates arbitrary relations.\n\n## Confirm closing all windows\n\n`set_confirm_close_all_windows` chooses whether the close-all shortcut asks first. This preference is reversible; MIO can change it. MIO does not expose the close-all operation itself because windows may contain unsaved work.\n\n## MIO inside a window\n\nAn explicitly registered, focused window can host MIO. Inside it, MIO ignores other windows, docks and controls for collision and magnet calculations; only the owning window body's outer boundaries constrain its movement. Closing, minimizing or leaving the owner cancels its active conversation work. A focused eligible window receives MIO through a shrink/move/grow transition, with reduced-motion users receiving an immediate handoff. See [MIO actions](actions.md).\n",navigation:"# Navigation and mobile\n\n[Help index](index.md) · [Appearance](appearance.md) · [Features](features.md)\n\n## Put launchers where you want them\n\nNavigation lists the same live launcher registry the shell uses. Each placeable item can appear on its **rail**, on the **desktop**, on **both**, or be **hidden**. MIO's `set_navigation_placement` takes a returned item `id` and `placement` (`rail`, `desktop`, `both`, `hidden`). It merges just that item into existing preferences, preserving all others.\n\nIn Split, a core menu's rail is the sidebar; other items use the dock. In Unified everything uses the one dock. The API value remains `rail`, so saved placement survives layout changes.\n\nLocked or transient launchers cannot be moved by MIO. Some system tiles are deliberately not placeable; they do not appear in its catalog. Hiding a launcher does not deactivate its plugin or delete its contents. The Mio tile can be hidden independently of whether the companion is enabled.\n\n## Phone layout\n\n`set_mobile_layout` accepts `auto`, `desktop`, or `mobile`. Automatic follows the viewport. Desktop forces the desktop experience, including on a phone. Mobile forces the phone interface, including on a large screen for previewing. Changing modes may alter or hide the current desktop conversation surface; completed settings writes remain in effect.\n\n## Phone tab bar pins\n\nThe phone tab bar reserves slots for Home and the app switcher. Up to three additional launchers can be pinned in order. `list_options` returns `phonePins`; `set_mobile_tabs` accepts a unique list of up to three of those ids. Empty means “use the server defaults,” not “remove every pin.” Unknown or unavailable ids are rejected by the MIO action.\n\nTo change a single pin while retaining others, read current settings and construct the desired complete list. Never replace the user's other pins unless requested. The phone's pin list is distinct from desktop Navigation placement.\n\n## Examples\n\n- “Put Media on the desktop and keep it in the dock”: look up its id and set placement `both`.\n- “Hide the MIO dock icon”: choose the Mio item's placement `hidden`; this does not disable MIO.\n- “Keep Posts, Pages and Media in the phone tabs”: look up their current ids, then set the three-item list in the requested order.\n",features:`# Optional features and site options
2321
2322 [Help index](index.md) · [Windows](windows.md) · [Reference and provider setup](reference.md)
2323
2324 ## Account preferences
2325
2326 The following changes are per user and preserve site content:
2327
2328 | Control | MIO action | Meaning |
2329 |---|---|---|
2330 | MIO API | \`set_mio_api_enabled\` | Master switch shared with the MIO dock button. Defaults off. Disabling hides MIO, suspends window integrations, closes chat and stops the remaining action chain. Tips do not need AI. |
2331 | Show MIO on wallpaper | \`set_mio_show_on_wallpaper\` | Show or hide the desktop mascot, independently of window chat and contextual tips. Defaults on. Also available in Make it yours and the MIO dock context menu. |
2332 | AI assistant | \`set_ai_assistant\` | Enable or disable assistant requests; requires a configured provider that supports function calling. Disabling prevents subsequent MIO requests. |
2333 | WordPress Heartbeat | \`set_heartbeat_rate\` | 15, 30, 45 or 60 seconds. Faster intervals increase server work; 60 is the default. Applies through WordPress Heartbeat settings on page load. |
2334 | Window links | \`set_window_links_enabled\` | Master switch for relation visuals and group behaviour. |
2335 | Raise related windows | \`set_window_link_raise_on_focus\` | Raise a relation group with the focused member. |
2336 | Highlight related windows | \`set_window_link_highlight\` | Outline related windows. |
2337 | Wallpaper click shows desktop | \`set_show_desktop_on_wallpaper_click\` | Clicking empty wallpaper toggles Show Desktop. |
2338 | Post status ribbons | \`set_show_post_status_ribbons\` | Display draft/pending/private/scheduled ribbons in My WordPress. |
2339 | Developer mode | \`set_developer_mode_enabled\` | Expose developer surfaces, including Code Blue and the Starter Widget. A fresh menu payload is requested after the save. |
2340 | Folder sharing | \`set_folders_sharing_enabled\` | Hide or show this user's sharing features. Disabling does not delete sharing records. |
2341
2342 The close-all confirmation and link style settings are described in [Windows](windows.md).
2343
2344 ## Native admin apps
2345
2346 These beta choices change which implementation opens from the corresponding launcher, for this account only. They do not grant permissions the account lacks:
2347
2348 - \`set_station_home_enabled\`: native Station Home instead of the classic Dashboard.
2349 - \`set_native_posts_enabled\`: native Posts table.
2350 - \`set_native_pages_enabled\`: native Pages table.
2351 - \`set_native_users_enabled\`: native Users window, still subject to user-list capabilities.
2352 - \`set_native_plugins_enabled\`: native Plugins window, still subject to plugin-management capabilities.
2353 - \`set_native_comments_enabled\`: native Comments window, still subject to the server's comment capabilities.
2354
2355 Turning a beta off selects the classic admin path on future opens. It does not uninstall anything or rewrite an already open editor.
2356
2357 ## Administrator-only Extended options
2358
2359 These switches affect the whole site and all users. MIO offers them only when Preferences reports \`manage_options\`, and the server action checks that capability again. Use \`enabled: true\` or \`false\`:
2360
2361 | MIO action | Site option |
2362 |---|---|
2363 | \`set_extended_window_prewarm\` | Hover-intent window preloading. |
2364 | \`set_extended_admin_asset_cache\` | Shared administration asset caching. |
2365 | \`set_extended_media_library_enhanced\` | Enhanced Media Library. |
2366 | \`set_extended_games\` | Games module and its registered launchers. |
2367 | \`set_extended_agents\` | Agent features. |
2368 | \`set_extended_network\` | Network features. |
2369
2370 Changes merge over existing options and use the app's \`extended\` action. A separate menu refresh reflects newly enabled registrations. Asset-cache and window-prewarm mirrors apply on shell reload. MIO must not silently reload a page that might hold unsaved work.
2371
2372 ## Welcome introductions
2373
2374 \`show_introductions_again\` makes welcome introductions eligible to display on their next open. It clears only the seen-introduction markers. It does not reset preferences or delete content.
2375
2376 ## Intentionally absent
2377
2378 Reset all preferences, delete folder-sharing data, delete uploaded themes are not available as MIO actions. Destructive actions must remain explicit UI operations. No write action is registered with WordPress's public Abilities registry. See [Actions](actions.md).
2379 `,wallpaper:"# Wallpaper images and custom configuration\n\n[Help index](index.md) · [Appearance](appearance.md) · [Themes](themes.md)\n\n## Select a wallpaper\n\n`list_options` lists currently registered wallpapers. `set_wallpaper` selects one by its exact id. Animated wallpapers may load lazily; the Preferences grid hydrates them for previews and settings controls. A plugin can add or remove wallpaper choices during the session.\n\nA custom image wallpaper requires an existing image selection. Prefer `select_wallpaper_image` for a new media choice; it verifies the attachment and activates the custom-image wallpaper together. A custom gradient can be configured and selected in one `set_custom_gradient` call.\n\n## Custom gradient\n\n`set_custom_gradient` takes `from` and `to` as `#rrggbb` strings and `angle` from 0 through 360 degrees. It preserves unrelated preferences and selects `custom-gradient`. If the user asks to change just one endpoint or the angle, use `read_settings` first to retain the other current values.\n\n## Existing images\n\n`search_wallpaper_images` takes a search `query` (empty lists images) and one-based `page`. It asks the authenticated WordPress Media REST API for up to 12 image attachments, including ids and dimensions. It never scrapes an arbitrary URL. `select_wallpaper_image` takes one attachment id, verifies access and image type against WordPress, then stores the server-returned URL and id.\n\n`set_library_hd_only` toggles the picker’s HD filter. The UI considers at least 1920 × 1080 to be HD. This filter affects library presentation; it is not an upload requirement. Smaller images may look blurry across a large desktop. Search results include dimensions so MIO can explain the tradeoff.\n\n## Upload a local image\n\n`open_image_picker` with `source: upload` opens the upload area if the user has `upload_files`. The user must choose or drop the local file. With `source: library`, it opens existing images. MIO cannot upload an unprovided local file and must not claim that opening the picker uploaded one. The normal WordPress upload permission and validation apply.\n\n## Snow settings\n\nWhen Snow (`wp-snow`) is registered, `set_snow_settings` exposes all four controls:\n\n- `wind`: 0–80; default 22. Controls peak horizontal wind in pixels per second. Zero stops the broad wind sweep, while individual flakes can still sway.\n- `particleCount`: integer 100–2000; default 660. More particles make denser snow and increase graphics work.\n- `flakeSize`: 6–40 CSS pixels; default 16. Maximum flake diameter including the soft halo; smaller flakes preserve depth variation.\n- `background`: a six-digit hex backdrop colour; default `#0c1a36`. The scene derives its night-sky gradient from it.\n\nThe action expects all four values so it cannot silently reset unspecified knobs. Read `wallpaperSettings['wp-snow']` first and merge the defaults above for missing fields when only one knob was requested. Saving Snow settings does not switch the active wallpaper; call `set_wallpaper` separately if requested.\n\n## Other wallpaper settings\n\n`open_wallpaper_settings` opens the active wallpaper's registered custom dialog. Third-party dialogs are arbitrary UI; MIO must not invent their keys or mutate an undocumented configuration bag. An extension should contribute its own validated private actions if it wants direct conversational control of those settings. MIO can open the existing dialog for user interaction in the meantime.\n\nRemoving an image selection and deleting uploaded data are intentionally outside MIO's action set.\n",reference:"# Components, About and AI provider setup\n\n[Help index](index.md) · [Features](features.md) · [Actions](actions.md)\n\n## Open a section or search Preferences\n\n`open_section` accepts a currently available page id. Built-ins are `appearance`, `themes`, `windows`, `navigation`, `mobile`, `features`, `about`, and administrator-only `help` (labelled Components). Plugin-provided tabs can appear in the same page catalog; MIO can open them but their undocumented controls do not become authorized actions automatically.\n\n`search_settings` filters the sidebar by text. Clearing the query restores all rows. It is a local view change, not a saved account preference.\n\n## Components reference\n\nAdministrators can inspect the component kit on Components. `list_components` lists the available tags and titles. `open_component_reference` takes a known tag, opens Components and selects its documentation and interactive example. The examples demonstrate generic controls; operating a sample is not equivalent to modifying real application data. Developer mode can unlock additional demonstration surfaces.\n\n## About\n\nOpen `about` with `open_section` to read the OpenStation version and journal. The page loads the journal when first shown. Journal links and external resources remain ordinary user navigation; MIO does not publish or send messages to those destinations.\n\n## Connect an AI provider\n\nMIO uses the site's existing WordPress AI Client and configured provider. To ask MIO, the personal AI assistant preference must be enabled and a compatible provider must be configured. The client gives a clear error when unavailable; it never pretends to have performed a change.\n\n`show_connectors_location` returns the configured WordPress Connectors destination. Open WordPress **Settings → Connectors** and configure the provider there. Credentials stay in WordPress's connector configuration, not in MIO prompts or help documents. Do not paste keys into chat.\n\n## Private actions\n\nMIO's tools are scoped to a live window registration in the browser. They are neither `wp_register_ability()` registrations nor global slash-commands. WordPress's Abilities discovery and execution routes cannot discover these MIO actions. Server-backed changes still use normal authenticated REST/app actions and their capability checks: private discovery does not bypass authorization.\n",actions:'# Private action catalog and chained examples\n\n[Help index](index.md) · [Appearance](appearance.md) · [Themes](themes.md) · [Windows](windows.md) · [Navigation](navigation.md) · [Features](features.md) · [Wallpaper](wallpaper.md)\n\n## Retrieval and context\n\n`search_help` searches this window\'s Markdown collection. `read_help` reads a known document and returns its valid links. Links never grant filesystem or network access. `read_settings` returns current account preferences, current page and capability-gated site facts. `list_options` returns live choices with labels, theme surface colours and recommendations. Every model round receives a freshly evaluated caller prompt and the current action allowlist.\n\n## Appearance and Windows setters\n\nEach takes `{ "value": ... }`:\n\n`set_accent`, `set_desktop_theme`, `set_wallpaper`, `set_desktop_layout`, `set_dock_placement`, `set_dock_behavior`, `set_side_dock_behavior`, `set_dock_size`, `set_dock_rail_renderer`, `set_admin_bar_mode`, `set_window_radius`, `set_unfocus_effect`, `set_window_reveal`, `set_window_reveal_duration`, `set_window_link_renderer`, `set_window_link_visibility`, `set_mobile_layout`, `set_heartbeat_rate`.\n\nSpecialized value shapes: `set_custom_accent` accepts a hex `value`; `set_custom_gradient` accepts `from`, `to`, `angle`; `set_navigation_placement` accepts `id`, `placement`; `set_mobile_tabs` accepts `ids`; `apply_theme_recommendations` takes no arguments.\n\n## Account switches\n\nEach takes a boolean `value`:\n\n`set_window_links_enabled`, `set_window_link_raise_on_focus`, `set_window_link_highlight`, `set_show_desktop_on_wallpaper_click`, `set_show_post_status_ribbons`, `set_developer_mode_enabled`, `set_folders_sharing_enabled`, `set_station_home_enabled`, `set_native_posts_enabled`, `set_native_pages_enabled`, `set_native_users_enabled`, `set_native_plugins_enabled`, `set_native_comments_enabled`, `set_confirm_close_all_windows`, `set_library_hd_only`.\n\n`set_ai_assistant` takes boolean `enabled`; it is availability/capability-gated. The six `set_extended_*` actions also take boolean `enabled`; see [Features](features.md) for every name and scope.\n\n## Utilities\n\n`open_section`, `search_settings`, `open_image_picker`, `search_wallpaper_images`, `select_wallpaper_image`, `open_theme_upload`, `open_wallpaper_settings`, `set_snow_settings`, `show_introductions_again`, `list_components`, `open_component_reference`, `show_connectors_location`. Some deliberately open a UI for the user\'s file selection rather than claiming direct access to a local file.\n\n## Chain: rounded corners, one dock, dynamic\n\n1. `set_window_radius({ "value": "round" })`.\n2. `set_desktop_layout({ "value": "unified" })`.\n3. `set_dock_behavior({ "value": "dynamic" })`.\n\nThe action loop can receive multiple calls in a round, but executes them sequentially and rechecks context and permission before each. Each save completes before the next write starts. A following model round sees outcomes and can answer accurately.\n\n## Chain: a darker theme and my own layout\n\n1. `list_options({})` and inspect actual theme descriptions and surface colours.\n2. Choose a returned slug that matches the request, or ask the user if unclear.\n3. `set_desktop_theme({ "value": "<returned slug>" })`.\n4. Apply the explicitly requested layout and corner overrides afterwards, so first-use theme recommendations do not supersede them.\n\n## Limits and failures\n\nA turn allows up to eight model rounds and sixteen calls per round. Repeated identical actions stop the loop. Arguments must match the action\'s runtime validator; unknown action names, unknown fields, malformed values and unavailable ids are rejected before a write. An unknown or malformed action does not fall back to a global command.\n\nFocus changes, chat close, window close and Stop cancel pending work. A submitted network write cannot necessarily be recalled; MIO must distinguish cancellation from rollback. Earlier completed actions are preserved if a later action fails. MIO never automatically retries a potentially completed write after a network failure.\n\nThe public WordPress Abilities registry remains unchanged. Destructive resets/deletions, arbitrary URLs, raw settings bags, arbitrary app dispatch and filesystem access are absent. Third-party apps follow the same opt-in pattern with their own help, prompt and validated actions.\n\n`clear_wallpaper_image` takes no arguments. It clears the wallpaper selection and returns an active image wallpaper to the default; the Media Library attachment is preserved. This is reversible by selecting the image again.\n\n## Repair and outcome reporting\n\nMIO may correct invalid arguments twice before a third validation failure ends the user turn. Corrections do not count as saved actions. Read tools can refresh options or settings after a change; a completed or uncertain write must not be replayed. Status summaries distinguish reads, rejected candidates, confirmed writes and unknown write outcomes. Permission failures and cancelled requests are terminal. Read longer help documents using their section IDs or continuation cursor when `truncated` is true.\n'}).map(([s,e])=>({id:`${s}.md`,title:e.split(`
2380 `)[0].replace(/^# /,""),markdown:e}));function og(s){const e=window.wp?.os?.mio?.registerWindow(s.windowId,{host:s.root,title:"OpenStation Preferences",prompt:()=>`You are MIO, the warm, concise companion inside OpenStation Preferences. Help the user understand and customize this admin desktop. Your caller is this window; your scope is its non-destructive controls. Do not change the public website theme. Current section: ${s.state.tab}. Current settings: ${JSON.stringify(D())}. Administrator: ${s.data.isAdmin}. Use help for factual explanations, list_options for live choices, and only offered actions for changes. For "unify docks" choose desktopLayout unified. "Rounded corners" is windowRadius round. For "make both docks dynamic" in Split set both dockBehavior and sideDockBehavior. Apply a desktop theme before requested explicit overrides. Ask when an essential choice is unclear. Read results and report partial completion honestly. Current settings are refreshed AFTER each action; they are not the original state. Use the action result changed and changes (before/after) to describe what happened. Only say already selected when the action result explicitly reports changed:false. Never claim that opening an upload picker uploaded a file. Do not reset preferences, delete themes or purge sharing data.`,documents:sg,abilities:()=>tg(s)});return e?.showCallout({id:"about-blog",target:()=>s.state.tab==="about"?s.root.querySelector(".os-settings__about-journal-head"):null,message:d("Visit our blog!")}),()=>e?.dispose()}const Se=Z("desktop-mode/wallpaper-lazy",()=>({pending:new Map,inflight:new Map}));function ig(s){Se.state.pending.delete(s)}function ng(s){return(window.openStationWallpapers||{})[s]??null}function rg(s){const e=Se.state.inflight.get(s);if(e)return e;const t=Se.state.pending.get(s);if(!t)return Promise.resolve(null);const o=(async()=>{try{await Zs(t.scriptUrl,{translations:t.scriptTranslations,deps:t.scriptDeps,l10n:t.scriptL10n,before:t.scriptBefore,after:t.scriptAfter})}catch(n){return ge(U.SHELL_ERROR,{scope:"wallpaper-script-load",id:t.id,error:n}),null}let i=ng(t.id);if(i&&!i.description&&t.description&&(i={...i,description:t.description}),!i)return ge(U.SHELL_ERROR,{scope:"wallpaper-missing-def",id:t.id,error:new Error(`[openstation] No wallpaper def on window.openStationWallpapers["${t.id}"]. Script loaded but didn't publish a def — check the plugin's enqueue + global assignment.`)}),null;try{Qn(i)}catch(n){return ge(U.SHELL_ERROR,{scope:"wallpaper-register",id:t.id,error:n}),null}return ig(t.id),i})().finally(()=>{Se.state.inflight.delete(s)});return Se.state.inflight.set(s,o),o}async function ag(){const s=Array.from(Se.state.pending.keys());s.length!==0&&await Promise.all(s.map(e=>rg(e)))}let ve=null;function lg(){if(ve)return ve;if(window.openStationWindowLinkVisuals)return ve=Promise.resolve(!0),ve;const e=window.openStationConfig?.windowLinkVisualsBundleUrl;return e?(ve=Zs(e).then(()=>!0).catch(t=>{throw ve=null,t}),ve):Promise.resolve(!1)}const cg=4,Da=24,Pa=4,dg=250,ug="os-settings__wallpaper-live-preview";function hg(s){const e=s.type==="canvas"?s.needs:void 0;if(!e||e.length===0)return Promise.resolve();const t=window.wp?.os;return t?.loadModules?t.loadModules(e):Promise.reject(new Error(`[openstation] Wallpaper "${s.id}" declares needs but wp.os.loadModules is unavailable.`))}function pg(){return window.openStationConfig?.pluginUrl??""}function gg(){return typeof window.matchMedia=="function"&&window.matchMedia("( prefers-reduced-motion: reduce )").matches}function fg(s){const e={...s.previewParams??{}},t=pe(U.WALLPAPER_PREVIEW_PARAMS,e,s.id);return!t||typeof t!="object"?e:t}function bg(s){const e=new Map;let t=!1;const o=()=>{let f=0;return e.forEach(E=>{(E.teardown||E.mounting)&&f++}),f},i=f=>{f.remountTimer!==null&&(clearTimeout(f.remountTimer),f.remountTimer=null)},n=f=>{if(f.generation++,f.mounting=!1,i(f),f.teardown){const E=f.teardown;f.teardown=null;try{E()}catch($){typeof console<"u"&&console.error(`[openstation] Wallpaper "${f.defId}" preview teardown threw:`,$)}}f.overlay.innerHTML=""},r=f=>{t||!f.visible||f.teardown||f.mounting||m&&(f.tile.clientWidth<Da||f.tile.clientHeight<Da)||a(f)},a=f=>{const E=Pe(f.defId);if(!E?.renderPreview||o()>=cg)return;const $=++f.generation;f.mounting=!0,f.mountWidth=f.tile.clientWidth,f.mountHeight=f.tile.clientHeight;const L={id:E.id,pluginUrl:pg(),prefersReducedMotion:gg(),visible:!document.hidden,settings:nr(E.id),params:fg(E),width:f.mountWidth,height:f.mountHeight},Q=O=>{if($!==f.generation||t){try{O()}catch{}return}f.mounting=!1,f.teardown=O,l(f)&&u(f)},X=O=>{$===f.generation&&(f.mounting=!1,f.overlay.innerHTML="",typeof console<"u"&&console.error(`[openstation] Wallpaper "${E.id}" renderPreview failed:`,O))};hg(E).then(()=>{if($!==f.generation||t)return;let O;try{O=E.renderPreview(f.overlay,L)}catch(B){X(B);return}if(ho(O)){O.then(Q,X);return}Q(O)},X)},l=f=>Math.abs(f.tile.clientWidth-f.mountWidth)>Pa||Math.abs(f.tile.clientHeight-f.mountHeight)>Pa,u=f=>{i(f),f.remountTimer=setTimeout(()=>{f.remountTimer=null,!(t||!f.teardown||!l(f))&&(n(f),r(f))},dg)},h=f=>{for(const E of f){const $=e.get(E.target);$&&($.visible=E.isIntersecting,E.isIntersecting?r($):n($))}},p=typeof IntersectionObserver=="function"?new IntersectionObserver(h,{threshold:.1}):null,g=f=>{for(const E of f){const $=e.get(E.target);!$||t||(!$.teardown&&!$.mounting?r($):$.teardown&&l($)&&u($))}},m=typeof ResizeObserver=="function"?new ResizeObserver(g):null,b=f=>{n(f),p?.unobserve(f.tile),m?.unobserve(f.tile),f.overlay.remove(),e.delete(f.tile)},y=()=>{if(t)return;const f=s.querySelectorAll("os-swatch[data-wallpaper-id]"),E=new Set;f.forEach($=>{E.add($);const L=$.dataset.wallpaperId??"",X=!!Pe(L)?.renderPreview&&!!p,O=e.get($);if(O&&(O.defId!==L||!X)&&b(O),!X||e.has($))return;const B=document.createElement("div");B.className=ug,B.setAttribute("aria-hidden","true"),$.appendChild(B),e.set($,{tile:$,overlay:B,defId:L,generation:0,teardown:null,mounting:!1,visible:!1,mountWidth:0,mountHeight:0,remountTimer:null}),p.observe($),m?.observe($)}),e.forEach(($,L)=>{E.has(L)||b($)})},x=()=>{t||(t=!0,e.forEach(f=>n(f)),e.clear(),p?.disconnect(),m?.disconnect(),document.removeEventListener("os-window-closed",k))},k=()=>{s.isConnected||x()};return document.addEventListener("os-window-closed",k),{sync:y,dispose:x}}const mg="appearance";function Na(s,e){if(!e.icon)return c`<span class="os-settings__nav-glyph-blank" aria-hidden="true"></span>`;let t=s.glyphs.get(e.id);return t||(t=e.icon(),s.glyphs.set(e.id,t)),t}function vg(s){const e=D(),t=S(s),o=Ue(s),i=o.some(h=>h.id===s.state.tab)?s.state.tab:mg,{query:n,index:r}=t.search,a=h=>n===""||(r?.get(h.id)??"").includes(n);let l=0;const u=h=>{La(s,h.target.value)};return c`
2381 <div class="os-settings">
2382 <div class="os-settings__search">
2383 <label class="os-settings__search-field">
2384 ${Na(t,{id:"__search",order:0,label:"",icon:()=>P("search",{size:null}),panel:()=>c``})}
2385 <input
2386 type="search"
2387 class="os-settings__search-input"
2388 placeholder=${d("Search settings")}
2389 aria-label=${d("Search settings")}
2390 aria-controls="os-settings-nav"
2391 @input=${u}
2392 />
2393 </label>
2394 </div>
2395 <os-tabs
2396 id="os-settings-nav"
2397 orientation="vertical"
2398 value=${i}
2399 label=${d("Settings sections")}
2400 os-bind="tab"
2401 >
2402 ${o.map((h,p)=>{const g=p>0&&Ca(h.order)!==Ca(o[p-1].order),m=a(h);return m&&l++,c`<os-tab
2403 value=${h.id}
2404 data-group-start=${g?"true":null}
2405 data-search-hidden=${m?null:"true"}
2406 >${Na(t,h)}${h.label}</os-tab>`})}
2407 </os-tabs>
2408 <p class="os-settings__search-empty" ?hidden=${n===""||l>0}>
2409 ${d("No settings match that.")}
2410 </p>
2411 ${""}
2412 <os-select
2413 class="os-settings__page-select"
2414 label=${d("Settings section")}
2415 value=${i}
2416 os-bind="tab"
2417 >
2418 ${o.map(h=>c`<os-option value=${h.id}>${h.label}</os-option>`)}
2419 </os-select>
2420 <os-panel class="os-settings__footer">
2421 <os-button variant="ghost" @click=${Va}>${d("Reset to defaults")}</os-button>
2422 </os-panel>
2423 ${o.map(h=>c`<os-tabpanel for=${h.id}>
2424 <os-panel padding=${h.padding??null}>${h.panel(e,s)}</os-panel>
2425 </os-tabpanel>`)}
2426 </div>
2427 `}const _g=_c(Ms,{local:{tab:(s,e)=>{const t=String(e.value??"");t!==""&&(s.tab=t)}},view:vg,mounted:s=>{const e=S(s);Gc(D,cd),e.previews=bg(s.root),ag(),lg().catch(()=>{});const t=()=>s.repaint(),o=[og(s),Qi(t),tc(t),Ja(t),Yl(t),kl(t),ec(t),Tl(t),xc(t)];return()=>{for(const i of o)i();Er(s),e.previews?.dispose(),e.previews=null}},updated:s=>{ld(s),S(s).previews?.sync(),nd(s),Kp(s,Ue(s)),Np(s),Vp(s),Ir(s),Jp(s)}});return Ts.default=_g,Object.defineProperties(Ts,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),Ts}({});
2428