| @@ -1,22 +1,22 @@ | ||
| 1 | -(function(){"use strict";const Ge="desktop-mode";function ge(){return window.wp?.i18n}function h(o,e=Ge){return ge()?.__(o,e)??o}function G(o,...e){const t=ge()?.sprintf;if(t)return t(o,...e);let s=0;return o.replace(/%(?:(\d+)\$)?[sd]/g,(n,i)=>{const r=i?Number.parseInt(i,10)-1:s++;return String(e[r]??"")})}function v(o,...e){return{__wpdHtml:!0,strings:o,values:e}}function Qe(o){return!!o&&o.__wpdHtml===!0}const Je="$$wpd$$",b=/\$\$wpd\$\$(\d+)\$\$/g;function et(o){let e=o[0];for(let t=1;t<o.length;t++)e+=`${Je}${t-1}$$`+o[t];return e}const ve=new WeakMap;function be(o){const e=ve.get(o);if(e)return e;const t=document.createElement("template");t.innerHTML=et(o);const s=[],n=(l,a)=>{if(l.nodeType===Node.ELEMENT_NODE){const u=l;for(const y of Array.from(u.attributes)){const f=y.name,p=y.value,C=f[0];if(b.test(p))if(b.lastIndex=0,C==="@"){const m=b.exec(p);b.lastIndex=0,s.push({path:a,kind:"event",name:f.slice(1),valueIndex:m?Number(m[1]):0}),u.removeAttribute(f)}else if(C==="."){const m=b.exec(p);b.lastIndex=0,s.push({path:a,kind:"prop",name:f.slice(1),valueIndex:m?Number(m[1]):0}),u.removeAttribute(f)}else if(C==="?"){const m=b.exec(p);b.lastIndex=0,s.push({path:a,kind:"bool",name:f.slice(1),valueIndex:m?Number(m[1]):0}),u.removeAttribute(f)}else{const m=[],x=[];let _=0,A;for(b.lastIndex=0;(A=b.exec(p))!==null;)m.push(p.slice(_,A.index)),x.push(Number(A[1])),_=A.index+A[0].length;m.push(p.slice(_)),s.push({path:a,kind:"attr",name:f,template:m,valueIndices:x}),u.setAttribute(f,"")}}}const c=Array.from(l.childNodes);let d=0;for(let u=0;u<c.length;u++){const y=c[u],f=u+d;if(y.nodeType===Node.TEXT_NODE){const p=y.textContent||"";if(!b.test(p)){b.lastIndex=0;continue}b.lastIndex=0;const C=y.parentNode;let m=0,x;const _=[],A=[];for(b.lastIndex=0;(x=b.exec(p))!==null;){x.index>m&&_.push(document.createTextNode(p.slice(m,x.index)));const me=document.createTextNode("");_.push(me),A.push({path:[...a,f+_.length-1],kind:"node",valueIndex:Number(x[1])}),m=x.index+x[0].length}m<p.length&&_.push(document.createTextNode(p.slice(m)));for(const me of _)C.insertBefore(me,y);C.removeChild(y),d+=_.length-1,s.push(...A)}else n(y,[...a,f])}};n(t.content,[]);const r={template:t,buildParts:l=>{const a=[];for(const c of s){let d=l;for(const u of c.path)d=d.childNodes[u];c.kind==="node"?a.push({kind:"node",valueIndex:c.valueIndex,child:{anchor:d,state:null}}):c.kind==="attr"?a.push({kind:"attr",element:d,name:c.name,template:c.template,valueIndices:c.valueIndices}):c.kind==="event"?a.push({kind:"event",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="prop"?a.push({kind:"prop",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="bool"&&a.push({kind:"bool",valueIndex:c.valueIndex,element:d,name:c.name})}return a}};return ve.set(o,r),r}const ye=new WeakMap;function tt(o,e){for(const t of o.nodes)if(t.parentNode!==e)return!1;return!0}function ot(o,e){const t=ye.get(e);if(t&&t.strings===o.strings&&tt(t,e)){B(t.parts,o.values);return}const s=be(o.strings),n=s.template.content.cloneNode(!0),i=s.buildParts(n),r=Array.from(n.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(n),B(i,o.values),ye.set(e,{strings:o.strings,parts:i,nodes:r})}function B(o,e){for(const t of o)if(t.kind==="node")Q(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let s=t.template[0];for(let n=0;n<t.valueIndices.length;n++)s+=we(e[t.valueIndices[n]]),s+=t.template[n+1];s!==t.last&&(t.last=s,s===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,s))}else if(t.kind==="event"){const s=e[t.valueIndex];s!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),s&&t.element.addEventListener(t.name,s),t.current=s)}else if(t.kind==="prop"){const s=e[t.valueIndex];s!==t.last&&(t.last=s,t.element[t.name]=s)}else if(t.kind==="bool"){const s=!!e[t.valueIndex];s!==t.last&&(t.last=s,s?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function Q(o,e){if(e==null||e===!1){o.state&&(T(o.state),o.state=null);return}if(Array.isArray(e)){rt(o,e);return}if(Qe(e)){it(o,e);return}if(e instanceof Node){st(o,e);return}nt(o,we(e))}function st(o,e){const t=o.state;t?.shape==="node"&&t.node===e||(t&&T(t),U(o,[e]),o.state={shape:"node",node:e})}function nt(o,e){const t=o.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&T(t);const s=document.createTextNode(e);U(o,[s]),o.state={shape:"text",node:s,text:e}}function it(o,e){const t=o.state;if(t?.shape==="template"&&t.strings===e.strings){B(t.parts,e.values);return}t&&T(t);const s=be(e.strings),n=s.template.content.cloneNode(!0),i=s.buildParts(n),r=Array.from(n.childNodes);U(o,[n]),B(i,e.values),o.state={shape:"template",strings:e.strings,parts:i,nodes:r}}function rt(o,e){const t=o.state;if(t?.shape==="array"&&t.entries.length===e.length){for(let n=0;n<e.length;n++)Q(t.entries[n],e[n]);return}t&&T(t);const s=[];for(const n of e){const i=document.createTextNode("");U(o,[i]);const r={anchor:i,state:null};Q(r,n),s.push(r)}o.state={shape:"array",entries:s}}function U(o,e){const t=o.anchor.parentNode;if(t)for(const s of e)t.insertBefore(s,o.anchor)}function T(o){if(o.shape==="text"){o.node.remove();return}if(o.shape==="template"){for(const e of o.parts)e.kind==="node"&&e.child.state&&(T(e.child.state),e.child.state=null);for(const e of o.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(o.shape==="node"){o.node.parentNode&&o.node.parentNode.removeChild(o.node);return}for(const e of o.entries)e.state&&T(e.state),e.anchor.remove()}function we(o){return o==null||o===!1?"":String(o)}const E=class E 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(_e)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,s){if(t===s)return;const n=at(e);this._propValues[n]=s,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const s=(Array.isArray(e)?e:String(e).split(/\s+/)).map(n=>String(n).trim()).filter(n=>n!=="");this.className=s.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 s=_e(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(s),set:n=>{let i;n==null||n===!1?i=null:n===!0?i="":i=String(n),this._propValues[t]=i,i===null?this.removeAttribute(s):this.setAttribute(s,i),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&ot(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(s=>s.sheet).filter(s=>s!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const s of e.styles)if(!s.sheet){const n=document.createElement("style");n.textContent=s.cssText,this.shadowRoot.appendChild(n)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!E._lightStylesAdopted.has(e)){E._lightStylesAdopted.add(e);for(const t of e.styles){const s=document.createElement("style");s.dataset.osUi=this.tagName.toLowerCase(),s.textContent=t.cssText,document.head.appendChild(s)}}}};E.props=[],E.styles=[],E.shadow=!0,E._lightStylesAdopted=new WeakSet;let N=E;function j(o,e){customElements.get(o)||customElements.define(o,e)}function _e(o){return o.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function at(o){return o.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const lt=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function g(o,...e){let t=o[0];for(let s=1;s<o.length;s++){const n=e[s-1];if(typeof n=="string"||typeof n=="number")t+=String(n);else if(n&&n.__wpdCss)t+=n.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof n);t+=o[s]}if(lt){const s=new CSSStyleSheet;return s.replaceSync(t),{__wpdCss:!0,sheet:s,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function ct(o){const e=[],t=[];let s=null,n=o.parentElement;for(;n&&!(n===document.body||n===document.documentElement);){const r=n.id||"";if(r.startsWith("wp-window-")){s=r.slice(10);break}if(n.tagName.toLowerCase()==="os-tabpanel"){const l=n.getAttribute("for");l&&t.unshift(l)}n=n.parentElement}s&&e.push(J(s));for(const r of t)e.push("tab-"+J(r));const i=o.getAttribute("label");return i&&e.push(J(i)),e.length===0?"os-unnamed":"os-"+e.filter(r=>r!=="").join("-")}function J(o){return o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function dt(o){if(o.id)return o.id;const e=ct(o);return o.id=e,e}function ht(o){if(!o)return 214;let e=5381;for(let t=0;t<o.length;t++)e=Math.imul(e,33)+o.charCodeAt(t);return(e%360+360)%360}const ut=g`: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}}`,xe={xs:20,sm:24,md:40,lg:64,xl:96},ke=new Set(["online","inactive","offline"]),D=class D extends N{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,s){super.attributeChangedCallback(e,t,s),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",s=this._attr("alt"),n=s!==null?s:t,i=this._attr("size"),r=this._resolveSize(i),l=this._presenceForRender(),a=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${r}px`);const c=e&&!this._imgFailed?"":this._initialsBg(t),d=e&&!this._imgFailed?v`<img | |
| 1 | +(function(){"use strict";const ut="desktop-mode";function _e(){return window.wp?.i18n}function h(o,e=ut){return _e()?.__(o,e)??o}function z(o,...e){const t=_e()?.sprintf;if(t)return t(o,...e);let s=0;return o.replace(/%(?:(\d+)\$)?[sd]/g,(n,r)=>{const i=r?Number.parseInt(r,10)-1:s++;return String(e[i]??"")})}const xe="X-WP-Nonce";function ht(o,e){const t=pt();if(!t)return e;const s=ft(o);if(!s||!mt(s))return e;const n=e?.headers??(typeof Request<"u"&&o instanceof Request?o.headers:void 0),r=new Headers(n??{});return r.has(xe)?e:(r.set(xe,t),{...e??{},headers:r})}function pt(){if(typeof window>"u")return;const e=window.openStationConfig?.restNonce;return typeof e=="string"&&e.length>0?e:void 0}function ft(o){try{const e=typeof window<"u"&&window.location?window.location.href:void 0;return typeof o=="string"?new URL(o,e):o instanceof URL?o:typeof Request<"u"&&o instanceof Request?new URL(o.url,e):null}catch{return null}}function mt(o){return typeof window>"u"||!window.location||o.origin!==window.location.origin?!1:!!(o.pathname.includes("/wp-json/")||o.searchParams.has("rest_route"))}function gt(o,e,t={}){const s=window.wp?.os?.fetch;if(typeof s=="function")return s(o,e,t);const n=ht(o,e);return fetch(o,n)}class te extends Error{constructor(e,t){super(e||t.serverMessage||`HTTP ${t.status}`),this.name="RestError",this.status=t.status,this.code=t.code,this.data=t.data,this.serverMessage=t.serverMessage??""}}function ke(o){return o instanceof te}function Ee(o){const e=typeof o=="object"&&o!==null?o:void 0;return{code:typeof e?.code=="string"?e.code:void 0,data:e?.data,serverMessage:typeof e?.message=="string"?e.message:""}}function vt(o,e,t=""){return new te(t,{status:o,...Ee(e)})}function Ce(o,e){return new te(e,{status:o,code:"openstation_bad_response"})}function bt(o){const{prefix:e,source:t,conflict:s}=o;return async(n,r={})=>{const i=new Headers(r.headers??{});i.set("X-WP-Nonce",o.nonce()),r.body&&!i.has("Content-Type")&&i.set("Content-Type","application/json");const a=await gt(o.url(n),{...r,headers:i,credentials:"same-origin"},{source:t}),l=await a.text();let c=null,d=null;if(l)try{c=JSON.parse(l)}catch(u){d=u}if(!a.ok){if(a.status===409&&s){const p=s(c);if(p)throw p}const{code:u,serverMessage:m}=Ee(c);throw vt(a.status,c,`${e} ${a.status}: ${u??""} ${m}`.trim())}if(c===null){if(d&&l){const u=l.slice(0,120).replace(/\s+/g," ");throw Ce(a.status,`${e} ${a.status} returned non-JSON body — ${d.message}. First 120 chars: ${u}`)}throw Ce(a.status,`${e} ${a.status}: empty or unparseable body.`)}return c}}const yt="rest_cookie_invalid_nonce",Ae=()=>h("Could not reach the site. Check your connection and try again.","desktop-mode");function Te(o){return typeof navigator<"u"&&navigator.onLine===!1?!0:o instanceof TypeError}function Me(o){return ke(o)?o.code===yt||o.status===401?"session":o.status>=200&&o.status<300?"unreadable":o.status===404?"gone":o.status>=500?"server":o.status>=400?"refused":"unknown":Te(o)?"offline":"unknown"}function wt(o){return ke(o)?o.serverMessage:Te(o)?Ae():o instanceof Error?o.message:""}function Ne(o,e){const{fallback:t,lead:s}=e,n=Me(o),r=n==="offline"||n==="unreadable"?"warning":"error";let i="",a=!0;switch(n){case"offline":i=Ae();break;case"session":i=h("Your session has expired. Reload the page and try again.","desktop-mode");break;case"unreadable":i=h("The site sent an unreadable reply. Reload the page to check whether the change went through.","desktop-mode");break;case"gone":case"refused":case"server":{const c=o;c.serverMessage?i=c.serverMessage:n==="gone"?(i=h("It no longer exists. Reload the page to catch up.","desktop-mode"),a=!1):n==="server"?(i=z(h("The server answered with error %d.","desktop-mode"),c.status),a=!1):(i=z(h("The server refused the request (HTTP %d).","desktop-mode"),c.status),a=!1);break}case"unknown":default:i=wt(o);break}let l;return s?l=i?`${s}: ${i}`:t:i?a?l=i:l=`${t} ${i}`:l=t,{message:l,reason:i,kind:n,type:r}}function H(o,e,t){if(!o)return;const{duration:s,...n}=t,r=Ne(e,n),i={message:r.message,type:r.type};s&&(i.duration=s),o(i)}function b(o,...e){return{__wpdHtml:!0,strings:o,values:e}}function _t(o){return!!o&&o.__wpdHtml===!0}const xt="$$wpd$$",y=/\$\$wpd\$\$(\d+)\$\$/g,kt="$$wpd-node$$",Et=/^\$\$wpd-node\$\$(\d+)\$\$$/,Ct=new Set(["style","script","textarea","title"]);function At(o){let e="",t=!1,s=null,n=!1,r=null,i="",a=!1;for(let l=0;l<o.length;l++){const c=o[l];e+=c;for(let d=0;d<c.length;d++){const u=c[d];if(n){c.startsWith("-->",d)&&(n=!1,d+=2);continue}if(r!==null){u==="<"&&c[d+1]==="/"&&c.slice(d+2,d+2+r.length).toLowerCase()===r&&(d+=1+r.length,r=null,t=!0,a=!1,i="");continue}if(s!==null){u===s&&(s=null);continue}if(t){u==='"'||u==="'"?(s=u,a=!1):u===">"?(t=!1,a=!1,Ct.has(i)&&(r=i),i=""):a&&(/[a-zA-Z0-9-]/.test(u)?i+=u.toLowerCase():a=!1);continue}if(c.startsWith("<!--",d)){n=!0,d+=3;continue}const m=c[d+1]??"";u==="<"&&/[a-zA-Z/!]/.test(m)&&(t=!0,i="",a=/[a-zA-Z]/.test(m))}l<o.length-1&&(e+=t||n||r!==null?`${xt}${l}$$`:`<!--${kt}${l}$$-->`)}return e}const Se=new WeakMap;function Pe(o){const e=Se.get(o);if(e)return e;const t=document.createElement("template");t.innerHTML=At(o);const s=[],n=(a,l)=>{if(a.nodeType===Node.ELEMENT_NODE){const u=a;for(const m of Array.from(u.attributes)){const p=m.name,f=m.value,_=p[0];if(y.test(f))if(y.lastIndex=0,_==="@"){const g=y.exec(f);y.lastIndex=0,s.push({path:l,kind:"event",name:p.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(p)}else if(_==="."){const g=y.exec(f);y.lastIndex=0,s.push({path:l,kind:"prop",name:p.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(p)}else if(_==="?"){const g=y.exec(f);y.lastIndex=0,s.push({path:l,kind:"bool",name:p.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(p)}else{const g=[],E=[];let x=0,M;for(y.lastIndex=0;(M=y.exec(f))!==null;)g.push(f.slice(x,M.index)),E.push(Number(M[1])),x=M.index+M[0].length;g.push(f.slice(x)),s.push({path:l,kind:"attr",name:p,template:g,valueIndices:E}),u.setAttribute(p,"")}}}const c=Array.from(a.childNodes);let d=0;for(let u=0;u<c.length;u++){const m=c[u],p=u+d;if(m.nodeType===Node.COMMENT_NODE){const f=Et.exec(m.data);if(f){const _=document.createTextNode("");m.parentNode.replaceChild(_,m),s.push({path:[...l,p],kind:"node",valueIndex:Number(f[1])})}continue}if(m.nodeType===Node.TEXT_NODE){const f=m.textContent||"";if(!y.test(f)){y.lastIndex=0;continue}y.lastIndex=0;const _=m.parentNode;let g=0,E;const x=[],M=[];for(y.lastIndex=0;(E=y.exec(f))!==null;){E.index>g&&x.push(document.createTextNode(f.slice(g,E.index)));const we=document.createTextNode("");x.push(we),M.push({path:[...l,p+x.length-1],kind:"node",valueIndex:Number(E[1])}),g=E.index+E[0].length}g<f.length&&x.push(document.createTextNode(f.slice(g)));for(const we of x)_.insertBefore(we,m);_.removeChild(m),d+=x.length-1,s.push(...M)}else n(m,[...l,p])}};n(t.content,[]);const i={template:t,buildParts:a=>{const l=[];for(const c of s){let d=a;for(const u of c.path)d=d.childNodes[u];c.kind==="node"?l.push({kind:"node",valueIndex:c.valueIndex,child:{anchor:d,state:null}}):c.kind==="attr"?l.push({kind:"attr",element:d,name:c.name,template:c.template,valueIndices:c.valueIndices}):c.kind==="event"?l.push({kind:"event",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="prop"?l.push({kind:"prop",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="bool"&&l.push({kind:"bool",valueIndex:c.valueIndex,element:d,name:c.name})}return l}};return Se.set(o,i),i}const Le=new WeakMap;function Tt(o,e){for(const t of o.nodes)if(t.parentNode!==e)return!1;return!0}function Mt(o,e){const t=Le.get(e);if(t&&t.strings===o.strings&&Tt(t,e)){Y(t.parts,o.values);return}const s=Pe(o.strings),n=s.template.content.cloneNode(!0),r=s.buildParts(n),i=Array.from(n.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(n),Y(r,o.values),Le.set(e,{strings:o.strings,parts:r,nodes:i})}function Y(o,e){for(const t of o)if(t.kind==="node")q(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let s=t.template[0];for(let n=0;n<t.valueIndices.length;n++)s+=$e(e[t.valueIndices[n]]),s+=t.template[n+1];s!==t.last&&(t.last=s,s===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,s))}else if(t.kind==="event"){const s=e[t.valueIndex];s!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),s&&t.element.addEventListener(t.name,s),t.current=s)}else if(t.kind==="prop"){const s=e[t.valueIndex];s!==t.last&&(t.last=s,t.element[t.name]=s)}else if(t.kind==="bool"){const s=!!e[t.valueIndex];s!==t.last&&(t.last=s,s?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function q(o,e){if(e==null||e===!1){o.state&&(C(o.state),o.state=null);return}if(Array.isArray(e)){Lt(o,e);return}if(_t(e)){Pt(o,e);return}if(e instanceof Node){Nt(o,e);return}St(o,$e(e))}function Nt(o,e){const t=o.state;t?.shape==="node"&&t.node===e||(t&&C(t),O(o,[e]),o.state={shape:"node",node:e})}function St(o,e){const t=o.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&C(t);const s=document.createTextNode(e);O(o,[s]),o.state={shape:"text",node:s,text:e}}function Pt(o,e){const t=o.state;if(t?.shape==="template"&&t.strings===e.strings){Y(t.parts,e.values);return}t&&C(t);const s=Pe(e.strings),n=s.template.content.cloneNode(!0),r=s.buildParts(n),i=Array.from(n.childNodes);O(o,[n]),Y(r,e.values),o.state={shape:"template",strings:e.strings,parts:r,nodes:i}}function Lt(o,e){const t=o.state;if(t?.shape==="array"){const n=Math.min(t.entries.length,e.length);for(let r=0;r<n;r++)q(t.entries[r],e[r]);if(e.length<t.entries.length){for(let r=e.length;r<t.entries.length;r++){const i=t.entries[r];i.state&&C(i.state),i.anchor.remove()}t.entries.length=e.length}else for(let r=t.entries.length;r<e.length;r++){const i=document.createTextNode("");O(o,[i]);const a={anchor:i,state:null};q(a,e[r]),t.entries.push(a)}return}t&&C(t);const s=[];for(const n of e){const r=document.createTextNode("");O(o,[r]);const i={anchor:r,state:null};q(i,n),s.push(i)}o.state={shape:"array",entries:s}}function O(o,e){const t=o.anchor.parentNode;if(t)for(const s of e)t.insertBefore(s,o.anchor)}function C(o){if(o.shape==="text"){o.node.remove();return}if(o.shape==="template"){for(const e of o.parts)e.kind==="node"&&e.child.state&&(C(e.child.state),e.child.state=null);for(const e of o.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(o.shape==="node"){o.node.parentNode&&o.node.parentNode.removeChild(o.node);return}for(const e of o.entries)e.state&&C(e.state),e.anchor.remove()}function $e(o){return o==null||o===!1?"":String(o)}const T=class T 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(Re)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,s){if(t===s)return;const n=$t(e);this._propValues[n]=s,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const s=(Array.isArray(e)?e:String(e).split(/\s+/)).map(n=>String(n).trim()).filter(n=>n!=="");this.className=s.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 s=Re(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(s),set:n=>{let r;n==null||n===!1?r=null:n===!0?r="":r=String(n),this._propValues[t]=r,r===null?this.removeAttribute(s):this.setAttribute(s,r),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&Mt(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(s=>s.sheet).filter(s=>s!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const s of e.styles)if(!s.sheet){const n=document.createElement("style");n.textContent=s.cssText,this.shadowRoot.appendChild(n)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!T._lightStylesAdopted.has(e)){T._lightStylesAdopted.add(e);for(const t of e.styles){const s=document.createElement("style");s.dataset.osUi=this.tagName.toLowerCase(),s.textContent=t.cssText,document.head.appendChild(s)}}}};T.props=[],T.styles=[],T.shadow=!0,T._lightStylesAdopted=new WeakSet;let S=T;function Z(o,e){customElements.get(o)||customElements.define(o,e)}function Re(o){return o.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function $t(o){return o.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const Rt=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function v(o,...e){let t=o[0];for(let s=1;s<o.length;s++){const n=e[s-1];if(typeof n=="string"||typeof n=="number")t+=String(n);else if(n&&n.__wpdCss)t+=n.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof n);t+=o[s]}if(Rt){const s=new CSSStyleSheet;return s.replaceSync(t),{__wpdCss:!0,sheet:s,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function It(o){const e=[],t=[];let s=null,n=o.parentElement;for(;n&&!(n===document.body||n===document.documentElement);){const i=n.id||"";if(i.startsWith("wp-window-")){s=i.slice(10);break}if(n.tagName.toLowerCase()==="os-tabpanel"){const a=n.getAttribute("for");a&&t.unshift(a)}n=n.parentElement}s&&e.push(oe(s));for(const i of t)e.push("tab-"+oe(i));const r=o.getAttribute("label");return r&&e.push(oe(r)),e.length===0?"os-unnamed":"os-"+e.filter(i=>i!=="").join("-")}function oe(o){return o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function zt(o){if(o.id)return o.id;const e=It(o);return o.id=e,e}function Ht(o){if(!o)return 214;let e=5381;for(let t=0;t<o.length;t++)e=Math.imul(e,33)+o.charCodeAt(t);return(e%360+360)%360}const Ot=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}}`,Ie={xs:20,sm:24,md:40,lg:64,xl:96},ze=new Set(["online","inactive","offline"]),U=class U extends S{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,s){super.attributeChangedCallback(e,t,s),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",s=this._attr("alt"),n=s!==null?s:t,r=this._attr("size"),i=this._resolveSize(r),a=this._presenceForRender(),l=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${i}px`);const c=e&&!this._imgFailed?"":this._initialsBg(t),d=e&&!this._imgFailed?b`<img | |
| 2 | 2 | src=${e} |
| 3 | 3 | alt=${n} |
| 4 | 4 | @error=${()=>this._onImgError()} |
| 5 | 5 | loading="lazy" |
| 6 | - />`:this._initials(t),u=l?v`<span | |
| 7 | - class=${`os-avatar__dot os-avatar__dot--${l}`} | |
| 8 | - aria-label=${this._presenceLabel(l)} | |
| 9 | - ></span>`:v``;return a?v` | |
| 6 | + />`:this._initials(t),u=a?b`<span | |
| 7 | + class=${`os-avatar__dot os-avatar__dot--${a}`} | |
| 8 | + aria-label=${this._presenceLabel(a)} | |
| 9 | + ></span>`:b``;return l?b` | |
| 10 | 10 | <button |
| 11 | 11 | type="button" |
| 12 | 12 | class="os-avatar__tile" |
| 13 | 13 | aria-label=${n||"User"} |
| 14 | 14 | style=${c?`background:${c};`:""} |
| 15 | - @click=${y=>this._onClick(y)} | |
| 15 | + @click=${m=>this._onClick(m)} | |
| 16 | 16 | >${d}</button> |
| 17 | 17 | ${u} |
| 18 | - `:v` | |
| 18 | + `:b` | |
| 19 | 19 | <div |
| 20 | 20 | class="os-avatar__tile" |
| 21 | 21 | role="img" |
| 22 | 22 | aria-label=${n||"User"} |
| @@ -22,18 +22,18 @@ | ||
| 22 | 22 | aria-label=${n||"User"} |
| 23 | 23 | style=${c?`background:${c};`:""} |
| 24 | 24 | >${d}</div> |
| 25 | 25 | ${u} |
| 26 | - `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in xe)return xe[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=ht(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&ke.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"),s={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",s)}_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 s=this.getBoundingClientRect();if(s.width===0||s.height===0)return;const n=(t.clientX-s.left)/s.width-.5,i=(t.clientY-s.top)/s.height-.5,r=14;this._pendingTiltY=`${(n*r).toFixed(2)}deg`,this._pendingTiltX=`${(-i*r).toFixed(2)}deg`;const l=Math.max(0,Math.min(100,(n+.5)*100)),a=Math.max(0,Math.min(100,(i+.5)*100));this._pendingGlareX=`${l.toFixed(1)}%`,this._pendingGlareY=`${a.toFixed(1)}%`,this._tiltRaf||(this._tiltRaf=requestAnimationFrame(()=>this._flushTilt()))},this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("pointermove",this._onPointerMove))}_flushTilt(){this._tiltRaf=0,this.style.setProperty("--os-ui-avatar-tilt-x",this._pendingTiltX),this.style.setProperty("--os-ui-avatar-tilt-y",this._pendingTiltY),this.style.setProperty("--os-ui-avatar-glare-x",this._pendingGlareX),this.style.setProperty("--os-ui-avatar-glare-y",this._pendingGlareY)}_detachHoverEffect(){this._onPointerMove&&(this.removeEventListener("pointermove",this._onPointerMove),this._onPointerMove=null),this._onPointerEnter&&(this.removeEventListener("pointerenter",this._onPointerEnter),this._onPointerEnter=null),this._onPointerLeave&&(this.removeEventListener("pointerleave",this._onPointerLeave),this._onPointerLeave=null),this._tiltRaf&&(cancelAnimationFrame(this._tiltRaf),this._tiltRaf=0)}_maybeAttachPresenceListener(){const e=this._attr("user-id"),t=this._attr("presence"),s=!!e&&!t;s&&!this._presenceHandler?(this._presenceHandler=n=>{const i=n.detail;i&&String(i.userId)===String(e)&&i.newStatus&&ke.has(i.newStatus)&&this.setAttribute("presence",i.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!s&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};D.props=["src","alt","name","size","presence","userId","clickable"],D.styles=[ut],D.help=void 0;let ee=D;j("os-avatar",ee);const pt=g`: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%}`,Ee="os-settings-save-lifecycle",ft=2200,mt=6e3,O=class O extends N{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,s){if(super.attributeChangedCallback(e,t,s),(e==="auto"||e==="event")&&(this._removeAutoListener(),this.auto!==null&&this._installAutoListener()),e==="phase"){this._scheduleAutoClear();const n={phase:this.phase??"idle",error:this.error??void 0};this.emit("os-save-status-change",n)}}render(){const e=this.phase??"idle",t=this.mode??"dot",n=(this.error??"")||this._labelForPhase(e);return n?this.setAttribute("title",n):this.removeAttribute("title"),this.setAttribute("aria-live",e==="failed"?"assertive":"polite"),this.setAttribute("role",e==="failed"?"alert":"status"),v` | |
| 26 | + `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in Ie)return Ie[e];const t=Number(e);return Number.isFinite(t)&&t>0?t:32}_initials(e){const t=e.trim();return t?Array.from(t)[0]?.toUpperCase()??"?":"?"}_initialsBg(e){const t=Ht(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&ze.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"),s={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",s)}_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 s=this.getBoundingClientRect();if(s.width===0||s.height===0)return;const n=(t.clientX-s.left)/s.width-.5,r=(t.clientY-s.top)/s.height-.5,i=14;this._pendingTiltY=`${(n*i).toFixed(2)}deg`,this._pendingTiltX=`${(-r*i).toFixed(2)}deg`;const a=Math.max(0,Math.min(100,(n+.5)*100)),l=Math.max(0,Math.min(100,(r+.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"),s=!!e&&!t;s&&!this._presenceHandler?(this._presenceHandler=n=>{const r=n.detail;r&&String(r.userId)===String(e)&&r.newStatus&&ze.has(r.newStatus)&&this.setAttribute("presence",r.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!s&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};U.props=["src","alt","name","size","presence","userId","clickable"],U.styles=[Ot],U.help=void 0;let se=U;Z("os-avatar",se);const Dt=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%}`,He="os-settings-save-lifecycle",Ft=2200,Vt=6e3,W=class W extends S{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,s){if(super.attributeChangedCallback(e,t,s),(e==="auto"||e==="event")&&(this._removeAutoListener(),this.auto!==null&&this._installAutoListener()),e==="phase"){this._scheduleAutoClear();const n={phase:this.phase??"idle",error:this.error??void 0};this.emit("os-save-status-change",n)}}render(){const e=this.phase??"idle",t=this.mode??"dot",n=(this.error??"")||this._labelForPhase(e);return n?this.setAttribute("title",n):this.removeAttribute("title"),this.setAttribute("aria-live",e==="failed"?"assertive":"polite"),this.setAttribute("role",e==="failed"?"alert":"status"),b` | |
| 27 | 27 | <span class="os-save-status"> |
| 28 | 28 | <span class="os-save-status__indicator" aria-hidden="true"> |
| 29 | 29 | <span class="os-save-status__glyph">${this._renderGlyph(e)}</span> |
| 30 | 30 | </span> |
| 31 | - ${t==="pill"?v`<span class="os-save-status__label" | |
| 31 | + ${t==="pill"?b`<span class="os-save-status__label" | |
| 32 | 32 | >${this._labelForPhase(e)}</span |
| 33 | - >`:v``} | |
| 33 | + >`:b``} | |
| 34 | 34 | </span> |
| 35 | - `}_renderGlyph(e){return e==="saved"?gt():e==="failed"?vt():""}_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||Ee;this._docListener=t=>{const s=t.detail;!s||typeof s.phase!="string"||(this.phase=s.phase,s.error?this.error=s.error:s.phase!=="failed"&&this.error&&this.removeAttribute("error"))},document.addEventListener(e,this._docListener)}_removeAutoListener(){if(!this._docListener)return;const e=this.event||Ee;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)||ft}if(e==="failed"){const t=this["auto-clear-failed-ms"];return parseInt(t||"",10)||mt}return 0}};O.props=["phase","mode","variant","animation","auto","event","error","saving-label","saved-label","idle-label","auto-clear-saved-ms","auto-clear-failed-ms"],O.styles=[pt],O.help=void 0;let te=O;j("os-save-status",te);function gt(){return v` | |
| 35 | + `}_renderGlyph(e){return e==="saved"?Bt():e==="failed"?Ut():""}_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||He;this._docListener=t=>{const s=t.detail;!s||typeof s.phase!="string"||(this.phase=s.phase,s.error?this.error=s.error:s.phase!=="failed"&&this.error&&this.removeAttribute("error"))},document.addEventListener(e,this._docListener)}_removeAutoListener(){if(!this._docListener)return;const e=this.event||He;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)||Ft}if(e==="failed"){const t=this["auto-clear-failed-ms"];return parseInt(t||"",10)||Vt}return 0}};W.props=["phase","mode","variant","animation","auto","event","error","saving-label","saved-label","idle-label","auto-clear-saved-ms","auto-clear-failed-ms"],W.styles=[Dt],W.help=void 0;let ne=W;Z("os-save-status",ne);function Bt(){return b` | |
| 36 | 36 | <svg |
| 37 | 37 | viewBox="0 0 12 12" |
| 38 | 38 | aria-hidden="true" |
| 39 | 39 | focusable="false" |
| @@ -44,9 +44,9 @@ | ||
| 44 | 44 | stroke-linejoin="round" |
| 45 | 45 | > |
| 46 | 46 | <path d="M2.5 6 L5 8.5 L9.5 4" /> |
| 47 | 47 | </svg> |
| 48 | - `}function vt(){return v` | |
| 48 | + `}function Ut(){return b` | |
| 49 | 49 | <svg |
| 50 | 50 | viewBox="0 0 12 12" |
| 51 | 51 | aria-hidden="true" |
| 52 | 52 | focusable="false" |
| @@ -55,29 +55,29 @@ | ||
| 55 | 55 | <path |
| 56 | 56 | d="M5 2 H7 V7 H5 z M5 8.5 H7 V10.5 H5 z" |
| 57 | 57 | /> |
| 58 | 58 | </svg> |
| 59 | - `}const Ce=g`: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 ) )}`,bt=g` .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%}}`,yt=g` .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%}}`,wt=g` .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}}`,_t=g` .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}}`,xt=g` .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}}`,kt=g` .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%}}`,Et=g` .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}}`,Ae=g` 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}}`,Ct=g` input[ type='checkbox' ],input[ type='radio' ]{appearance:none;-webkit-appearance:none;position:relative;flex:0 0 auto;box-sizing:border-box;width:16px;height:16px;margin:0;padding:0;border:1px solid var( --_holo-track-edge );border-radius:4px;background-color:var( --_holo-track );background-image:none;background-repeat:no-repeat;cursor:inherit;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='radio' ]{border-radius:50%}input[ type='checkbox' ]:hover:not(:disabled ),input[ type='radio' ]:hover:not(:disabled ){border-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:focus-visible,input[ type='radio' ]:focus-visible{outline:none;box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked,input[ type='checkbox' ]:indeterminate,input[ type='radio' ]:checked{border-color:transparent;background-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:checked:focus-visible,input[ type='radio' ]:checked:focus-visible{box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:46%;width:3.5px;height:7.5px;border:solid var( --os-ui-fg-on-accent,#fff );border-width:0 2px 2px 0;transform:translate( -50%,-50% ) rotate( 45deg );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:indeterminate::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:8px;height:2px;border:0;border-radius:1px;background:var( --os-ui-fg-on-accent,#fff );transform:translate( -50%,-50% )}input[ type='radio' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:6px;height:6px;border-radius:50%;background:var( --os-ui-fg-on-accent,#fff );transform:translate( -50%,-50% );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:disabled,input[ type='radio' ]:disabled{cursor:not-allowed}@keyframes os-holo-tick{from{opacity:0;transform:translate( -50%,-50% ) rotate( 45deg ) scale( 0.4 )}}@media ( prefers-reduced-motion:reduce ){input[ type='checkbox' ]:checked::after,input[ type='radio' ]:checked::after{animation:none}}`,At=g` @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}}`;g` ${Ce} ${bt} ${yt} ${wt} ${_t} ${xt} ${kt} ${Et} ${Ae} ${Ct} ${At} `;const Tt=g` ${Ce} ${Ae}:host{display:flex;flex-direction:column;gap:4px;font-size:13px;color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-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:6px;font:inherit;font-size:13px;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}`,V=class V extends N{constructor(){super(...arguments),this._textareaEl=null}connectedCallback(){super.connectedCallback(),dt(this)}render(){const e=this._attr("label")||"",t=this._attr("value")??"",s=this._attr("placeholder")||"",n=this._boolAttr("disabled"),i=this._boolAttr("readonly"),r=this._attr("aria-label")||e,l=this._attr("name")||"",a=Number(this._attr("rows"))||3,c=this._attr("maxlength"),d=this._attr("minlength"),u=this._boolAttr("invalid"),f=`${this.id||"os-unnamed"}__field`;return v` | |
| 60 | - ${e?v`<label class="os-textarea__label" for=${f}>${e}</label>`:v``} | |
| 59 | + `}const Oe=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 ) )}`,Wt=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%}}`,jt=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%}}`,Xt=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}}`,Yt=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}}`,qt=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}}`,Zt=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%}}`,Kt=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}}`,De=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}}`,Gt=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}}`,Qt=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` ${Oe} ${Wt} ${jt} ${Xt} ${Yt} ${qt} ${Zt} ${Kt} ${De} ${Gt} ${Qt} `;const Jt=v` ${Oe} ${De}: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}`,j=class j extends S{constructor(){super(...arguments),this._textareaEl=null}connectedCallback(){super.connectedCallback(),zt(this)}render(){const e=this._attr("label")||"",t=this._attr("value")??"",s=this._attr("placeholder")||"",n=this._boolAttr("disabled"),r=this._boolAttr("readonly"),i=this._attr("aria-label")||e,a=this._attr("name")||"",l=Number(this._attr("rows"))||3,c=this._attr("maxlength"),d=this._attr("minlength"),u=this._boolAttr("invalid"),p=`${this.id||"os-unnamed"}__field`;return b` | |
| 60 | + ${e?b`<label class="os-textarea__label" for=${p}>${e}</label>`:b``} | |
| 61 | 61 | <textarea |
| 62 | - id=${f} | |
| 62 | + id=${p} | |
| 63 | 63 | part="textarea" |
| 64 | 64 | .value=${t} |
| 65 | 65 | placeholder=${s} |
| 66 | 66 | ?disabled=${n} |
| 67 | - ?readonly=${i} | |
| 68 | - rows=${a} | |
| 67 | + ?readonly=${r} | |
| 68 | + rows=${l} | |
| 69 | 69 | maxlength=${c??""} |
| 70 | 70 | minlength=${d??""} |
| 71 | - name=${l} | |
| 71 | + name=${a} | |
| 72 | 72 | aria-invalid=${u?"true":"false"} |
| 73 | - aria-label=${r||""} | |
| 74 | - @input=${p=>this._onInput(p)} | |
| 75 | - @change=${p=>this._onChange(p)} | |
| 76 | - @keydown=${p=>this._onKeyDown(p)} | |
| 73 | + aria-label=${i||""} | |
| 74 | + @input=${f=>this._onInput(f)} | |
| 75 | + @change=${f=>this._onChange(f)} | |
| 76 | + @keydown=${f=>this._onKeyDown(f)} | |
| 77 | 77 | ></textarea> |
| 78 | - `}_attr(e){return this.getAttribute(e)}_boolAttr(e){return this.getAttribute(e)!==null}_onInput(e){const t=e.target;this._textareaEl=t,this.setAttribute("value",t.value),this.emit("os-input-change",{value:t.value}),this._boolAttr("auto-grow")&&this._autosize(t)}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(this._boolAttr("submit-on-enter")&&e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){e.preventDefault();const t=e.target;this.emit("os-submit",{value:t.value})}}_autosize(e){const t=Number(this._attr("max-rows"))||8,s=window.getComputedStyle(e),n=parseFloat(s.fontSize)||13,i=s.lineHeight,r=i==="normal"?n*1.45:parseFloat(i)||n*1.45,l=parseFloat(s.paddingTop)||0,a=parseFloat(s.paddingBottom)||0,c=r*t+l+a;e.style.height="auto";const d=Math.min(e.scrollHeight,c);e.style.height=`${d}px`}refreshAutosize(){this._textareaEl&&this._boolAttr("auto-grow")&&this._autosize(this._textareaEl)}focusInput(){(this.shadowRoot??this).querySelector("textarea")?.focus()}clear(){this.setAttribute("value","");const t=(this.shadowRoot??this).querySelector("textarea");t&&(t.value="",this._boolAttr("auto-grow")&&this._autosize(t))}};V.props=["label","value","placeholder","disabled","readonly","ariaLabel","name","rows","maxlength","minlength","invalid","autoGrow","maxRows","submitOnEnter"],V.styles=[Tt],V.help=void 0;let oe=V;j("os-textarea",oe);const Mt=g`:host{display:inline-flex}button{display:flex;align-items:center;justify-content:center;width:30px;height:30px;padding:0;border:none;border-radius:var( --os-ui-btn-radius,5px );background-color:var( --os-ui-btn-bg,transparent );background-image:var( --os-ui-btn-bg-image,none );background-repeat:var( --os-ui-btn-bg-image-repeat,no-repeat );background-size:var( --os-ui-btn-bg-image-size,auto );background-position:var( --os-ui-btn-bg-image-position,center );color:var( --os-ui-btn-color,currentColor );cursor:pointer;transition:background-color 0.15s ease,color 0.15s ease,transform 80ms ease}button:active{transform:scale( 0.9 )}@media ( prefers-reduced-motion:reduce ){button:active{transform:none}}button:hover{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) )}button:focus-visible{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );outline:2px solid var( --os-ui-btn-outline,currentColor );outline-offset:1px}:host( [ active ] ) button{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-active,var( --os-ui-hover,rgba( 0,0,0,0.08 ) ) )}:host( [ danger ] ) button:hover{color:var( --os-ui-fg-on-accent,#fff );background-color:var( --os-ui-btn-danger-hover,var( --os-ui-danger,#d63638 ) )}svg{display:block;pointer-events:none;flex-shrink:0}svg:empty{display:none}.themed-icon{display:block;width:14px;height:14px;flex-shrink:0;pointer-events:none;background-color:var( --os-ui-btn-icon-color,currentColor )}::slotted( span ){line-height:1}::slotted( svg ){display:block}`,Nt={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 St(o){const e=(o??"").trim();return e===""||e.length>4096||!/^(https?:\/\/|data:image\/)/i.test(e)||/['"()\\<>\s]/.test(e)?"":e}const F=class F extends N{constructor(){super(...arguments),this._activateWired=!1}static get observedAttributes(){return[...super.observedAttributes,"aria-label"]}render(){const e=St(this["icon-src"]||this.getAttribute("icon-src")||""),t=e?"":this.icon||"",s=Nt[t]||"",n=this.getAttribute("aria-label")||"";return e?v` | |
| 79 | - <button type="button" aria-label="${n}"> | |
| 78 | + `}_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,s=window.getComputedStyle(e),n=parseFloat(s.fontSize)||13,r=s.lineHeight,i=r==="normal"?n*1.45:parseFloat(r)||n*1.45,a=parseFloat(s.paddingTop)||0,l=parseFloat(s.paddingBottom)||0,c=(parseFloat(s.borderTopWidth)||0)+(parseFloat(s.borderBottomWidth)||0),d=i*t+a+l+c;e.style.height="auto",e.style.overflowY="hidden";const u=e.value?e.scrollHeight+c:i*(Number(this._attr("rows"))||3)+a+l+c,m=Math.min(u,d);e.style.height=`${Math.ceil(m)}px`,e.style.overflowY=u>Math.ceil(d)?"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))}};j.props=["label","value","placeholder","disabled","readonly","ariaLabel","name","rows","maxlength","minlength","invalid","autoGrow","maxRows","submitOnEnter"],j.styles=[Jt],j.help=void 0;let re=j;Z("os-textarea",re);const eo=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}`,to={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 oo(o){const e=(o??"").trim();return e===""||e.length>4096||!/^(https?:\/\/|data:image\/)/i.test(e)||/['"()\\<>\s]/.test(e)?"":e}const X=class X extends S{constructor(){super(...arguments),this._activateWired=!1}static get observedAttributes(){return[...super.observedAttributes,"aria-label","aria-pressed"]}render(){const e=oo(this["icon-src"]||this.getAttribute("icon-src")||""),t=e?"":this.icon||"",s=to[t]||"",n=this.getAttribute("aria-label")||"";return e?b` | |
| 79 | + <button type="button" aria-label="${n}" aria-pressed="${this.getAttribute("aria-pressed")||""}" ?disabled="${this.hasAttribute("disabled")}"> | |
| 80 | 80 | <span |
| 81 | 81 | class="themed-icon" |
| 82 | 82 | aria-hidden="true" |
| 83 | 83 | style="-webkit-mask: url('${e}') center / contain no-repeat; mask: url('${e}') center / contain no-repeat;" |
| @@ -83,10 +83,10 @@ | ||
| 83 | 83 | style="-webkit-mask: url('${e}') center / contain no-repeat; mask: url('${e}') center / contain no-repeat;" |
| 84 | 84 | ></span> |
| 85 | 85 | <slot></slot> |
| 86 | 86 | </button> |
| 87 | - `:v` | |
| 88 | - <button type="button" aria-label="${n}"> | |
| 87 | + `:b` | |
| 88 | + <button type="button" aria-label="${n}" aria-pressed="${this.getAttribute("aria-pressed")||""}" ?disabled="${this.hasAttribute("disabled")}"> | |
| 89 | 89 | <svg |
| 90 | 90 | width="14" |
| 91 | 91 | height="14" |
| 92 | 92 | viewBox="0 0 12 12" |
| @@ -95,5 +95,5 @@ | ||
| 95 | 95 | ></svg> |
| 96 | 96 | <slot></slot> |
| 97 | 97 | </button> |
| 98 | 98 | <span data-svg-buffer style="display:none">${s}</span> |
| 99 | - `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg()),queueMicrotask(()=>this._wireActivateEvent())}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("svg"),s=e.querySelector("[data-svg-buffer]");if(t&&s){const n=s.textContent||"";t.innerHTML!==n&&(t.innerHTML=n)}}_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.dispatchEvent(new CustomEvent("os-button-activate",{bubbles:!0,composed:!0,cancelable:!0}))}))}};F.props=["icon","icon-src","active","danger"],F.styles=[Mt],F.help=void 0;let se=F;j("os-window-button",se);let ne=null;function ie(){return!!window.openStationShellOverlays}function Pt(o){return new Promise((e,t)=>{const s=document.querySelector('script[data-os-shell-overlays="1"]'),n=()=>{if(ie()){e();return}t(new Error("[openstation] shell-overlays bundle loaded but did not set `window.openStationShellOverlays`."))};if(s){ie()?n():(s.addEventListener("load",n),s.addEventListener("error",()=>t(new Error("failed to load shell-overlays bundle"))));return}const i=document.createElement("script");i.src=o,i.async=!0,i.dataset.osShellOverlays="1",i.addEventListener("load",n),i.addEventListener("error",()=>t(new Error("failed to load shell-overlays bundle"))),document.head.appendChild(i)})}function Lt(o){return ie()||!o?Promise.resolve():(ne||(ne=Pt(o)),ne)}function $t(){return window.openStationConfig?.shellOverlaysBundleUrl??""}async function Rt(o){return await Lt($t()),new Promise(e=>{const t=document.createElement("os-confirm-dialog");t.setAttribute("open",""),o.title&&t.setAttribute("title",o.title),t.setAttribute("message",o.message),o.confirmLabel&&t.setAttribute("confirm-label",o.confirmLabel),o.cancelLabel&&t.setAttribute("cancel-label",o.cancelLabel),t.setAttribute("danger",""),o.hideCancel&&t.setAttribute("hide-cancel",""),o.dismissable&&t.setAttribute("dismissable","");const s=n=>{t.remove(),e(n)};t.addEventListener("os-confirm",()=>s(!0)),t.addEventListener("os-cancel",()=>s(!1)),document.body.appendChild(t)})}const Te={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 Me(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function It(o){return Object.prototype.hasOwnProperty.call(Te,o)?Te[o]:null}function zt(o,e={}){const t=It(o);if(!t)return"";const{size:s=24,className:n,title:i,rotate:r}=e,l=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];s!=null&&l.push(`width="${s}"`,`height="${s}"`),l.push(t.a),n&&l.push(`class="${Me(n)}"`),i?l.push('role="img"',`aria-label="${Me(i)}"`):l.push('aria-hidden="true"','focusable="false"');const a=r?`<g transform="rotate(${r} 12 12)">${t.b}</g>`:t.b;return`<svg ${l.join(" ")}>${a}</svg>`}const k={START:"os.drag.start",MOVE:"os.drag.move",ENTER:"os.drag.enter",LEAVE:"os.drag.leave"},M=["butter","blush","sky","mint","lilac","peach"];function Ht(o){return M.includes(o)?o:M[0]}function re(o){return o.toLowerCase().replace(/[^a-z0-9_-]/g,"")||M[0]}function Ne(o){const e=M.indexOf(Ht(o));return M[(e+1)%M.length]}const Se="cubic-bezier(0.2, 0.7, 0.2, 1)",Pe="cubic-bezier(0.5, 0, 0.9, 0.4)",Dt="cubic-bezier(0.2, 0.7, 0.3, 1.15)";function S(){return typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function w(o,e,t){return typeof o.animate!="function"?Promise.resolve():o.animate(e,t).finished.then(()=>{}).catch(()=>{})}async function Ot(o){const e=o.restRotation??0;if(S()){Le(o.rippleHost,400);return}const t=o.tempo??1,s=o.fallDistance??30;await w(o.pin,[{opacity:0,transform:`translate(8px, ${-s}px) rotate(${e-16}deg) scale(1.9)`},{opacity:1,offset:.35},{opacity:1,transform:`translate(0, 0) rotate(${e}deg) scale(0.92)`}],{duration:170*t,easing:Pe,fill:"forwards"}),Le(o.rippleHost,420*t);const n=w(o.paper,[{transform:"scale(1) translateY(0) skewX(0)"},{transform:"scale(0.982) translateY(2px) skewX(0)",offset:.08},{transform:"scale(1.01) translateY(0) skewX(0.6deg)",offset:.32},{transform:"scale(0.996) translateY(0) skewX(-0.4deg)",offset:.55},{transform:"scale(1) translateY(0) skewX(0)"}],{duration:370*t,easing:"linear"}),i=w(o.pin,[{transform:`rotate(${e}deg) scale(0.92)`},{transform:`rotate(${e+1.5}deg) scale(1.07)`,offset:.25},{transform:`rotate(${e-1}deg) scale(0.98)`,offset:.5},{transform:`rotate(${e}deg) scale(1)`}],{duration:370*t,easing:Se,fill:"forwards"});await Promise.all([n,i])}function Le(o,e){const t=document.createElement("span");t.className="os-pinned-note__ripple",t.setAttribute("aria-hidden","true"),o.appendChild(t),w(t,[{boxShadow:"0 0 0 0 rgba(0, 0, 0, 0.28)",opacity:.35},{boxShadow:"0 0 0 26px rgba(0, 0, 0, 0)",opacity:0}],{duration:e,easing:"ease-out"}).then(()=>t.remove()),window.setTimeout(()=>t.remove(),e+100)}function Vt(o){if(S())return{onPointerMove:()=>{},setBias:()=>{},stop:()=>{}};const e=14;let t=0,s=0,n=0,i=0,r=null,l=0,a=0,c=0,d=0,u=!0;const y=f=>{if(!u)return;const p=Math.min(.05,d?(f-d)/1e3:.016);d=f,f-l>80&&(a*=.85),n=Math.max(-14,Math.min(14,-a*.055))+i,s+=(-120*(t-n)-e*s)*p,t+=s*p,o.style.transform=`rotate(${t.toFixed(2)}deg)`,c=window.requestAnimationFrame(y)};return c=window.requestAnimationFrame(y),{onPointerMove(f){const p=performance.now();if(r!==null&&p>l){const C=(f-r)/(p-l)*16.7;a=a*.7+C*.3}r=f,l=p},setBias(f){i=f},stop(){u=!1,window.cancelAnimationFrame(c),o.style.transform=""}}}async function Ft(o){if(S()){await w(o.flyback,[{opacity:1},{opacity:0}],{duration:120,easing:"linear",fill:"forwards"});return}const e=o.swing?w(o.swing,[{transform:"rotate(0deg)"},{transform:"rotate(9deg)",offset:.35},{transform:"rotate(-4deg)",offset:.7},{transform:"rotate(0deg)"}],{duration:330,easing:"linear",fill:"forwards"}):Promise.resolve(),t=w(o.flyback,[{left:`${o.flyback.offsetLeft}px`,top:`${o.flyback.offsetTop}px`},{left:`${o.homeX}px`,top:`${o.homeY}px`}],{duration:330,easing:Dt,fill:"forwards"});await Promise.all([t,e])}async function Bt(o){if(S()){await w(o.clone,[{opacity:1},{opacity:0}],{duration:150,easing:"linear",fill:"forwards"});return}o.pin&&w(o.pin,[{transform:"translate(0, 0) rotate(0deg)",opacity:1},{transform:"translate(2px, -16px) rotate(-30deg)",opacity:0}],{duration:200,easing:Se,fill:"forwards"});const e=o.clone.getBoundingClientRect(),t=o.binX-(e.left+e.width/2),s=o.binY-(e.top+e.height/2),n="polygon(4% 8%, 38% 2%, 68% 7%, 96% 3%, 98% 42%, 92% 71%, 97% 94%, 60% 98%, 30% 93%, 3% 97%, 6% 62%, 2% 34%)",i="polygon(10% 14%, 42% 6%, 64% 12%, 90% 8%, 94% 38%, 86% 66%, 92% 88%, 58% 94%, 34% 86%, 10% 92%, 14% 58%, 8% 36%)";await w(o.paper,[{transform:"translate(0, 0) scale(0.88) rotate(0deg)",borderRadius:"2px",opacity:1},{transform:`translate(${t*.3}px, ${s*.3}px) scale(0.6) rotate(12deg)`,clipPath:n,offset:.3},{transform:`translate(${t*.6}px, ${s*.6}px) scale(0.34) rotate(24deg)`,clipPath:i,offset:.6,opacity:1},{transform:`translate(${t}px, ${s}px) scale(0.12) rotate(38deg)`,borderRadius:"50%",clipPath:i,opacity:0}],{duration:400,easing:Pe,delay:60,fill:"forwards"})}function Ut(o){let e=2166136261;for(let s=0;s<o.length;s++)e^=o.charCodeAt(s),e=Math.imul(e,16777619)>>>0;return e>>>1||1}function $e(o){let e=2166136261;const t=`os-note-${o}`;for(let i=0;i<t.length;i++)e^=t.charCodeAt(i),e=Math.imul(e,16777619)>>>0;const s=e>>>3,n=e>>>5;return{rotation:(e%45-22)/10,pinOffsetX:s%21-10,pinRotation:n%17-8}}const jt=.57,Xt=.525,Wt=56,Yt=52;function qt(o){return`${o.replace(/\/$/,"")}/assets/images/pushpin.svg`}function Zt(o){const e=document.createElement("img");return e.src=qt(o),e.alt="",e.width=Wt,e.height=Yt,e.draggable=!1,e.className="os-pinned-note__pin-img",e}const Re="X-WP-Nonce";function Kt(o,e){const t=Gt();if(!t)return e;const s=Qt(o);if(!s||!Jt(s))return e;const n=e?.headers??(typeof Request<"u"&&o instanceof Request?o.headers:void 0),i=new Headers(n??{});return i.has(Re)?e:(i.set(Re,t),{...e??{},headers:i})}function Gt(){if(typeof window>"u")return;const e=window.openStationConfig?.restNonce;return typeof e=="string"&&e.length>0?e:void 0}function Qt(o){try{const e=typeof window<"u"&&window.location?window.location.href:void 0;return typeof o=="string"?new URL(o,e):o instanceof URL?o:typeof Request<"u"&&o instanceof Request?new URL(o.url,e):null}catch{return null}}function Jt(o){return typeof window>"u"||!window.location||o.origin!==window.location.origin?!1:!!(o.pathname.includes("/wp-json/")||o.searchParams.has("rest_route"))}function eo(o,e,t={}){const s=window.wp?.os?.fetch;if(typeof s=="function")return s(o,e,t);const n=Kt(o,e);return fetch(o,n)}const to="http://localhost/";function oo(o,e){const t=typeof window<"u"&&window.location?window.location.href:to,s=new URL(o,t),n=e.replace(/^\/+/,""),i=n.indexOf("?"),r=i===-1?n:n.slice(0,i),l=i===-1?"":n.slice(i+1);if(s.searchParams.has("rest_route")){const a=s.searchParams.get("rest_route")??"/",c=a.endsWith("/")?a:a+"/";s.searchParams.set("rest_route",c+r)}else{const a=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";s.pathname=a+r}return l&&new URLSearchParams(l).forEach((c,d)=>{s.searchParams.append(d,c)}),s.toString()}let ae=null;function so(o){ae=o}function no(){if(!ae)throw new Error("[openstation] notes REST client called before installNotesRestDeps().");return ae}function io(o){const e=window.openStationConfig;return typeof e?.restNonce=="string"&&e.restNonce?e.restNonce:o}class Ie extends Error{constructor(e){super("Note was changed by another session."),this.status=409,this.name="NotesConflictError",this.current=e}}function ro(o){return o instanceof Ie}async function P(o,e){const{baseUrl:t,nonce:s}=no(),n=o?oo(t,o):t,i=new Headers(e.headers??{});i.set("X-WP-Nonce",io(s)),e.body&&!i.has("Content-Type")&&i.set("Content-Type","application/json");const r=await eo(n,{...e,headers:i,credentials:"same-origin"},{source:"desktop-mode/notes"}),l=await r.text();let a=null;if(l)try{a=JSON.parse(l)}catch{a=null}if(!r.ok){if(r.status===409){const d=a?.data?.current;throw new Ie(d??null)}const c=a;throw new Error(`[openstation] notes REST ${r.status}: ${c?.code??""} ${c?.message??""}`.trim())}if(a===null)throw new Error(`[openstation] notes REST ${r.status}: empty or unparseable body.`);return a}function ze(){return P("",{method:"GET"})}function ao(o){return P("",{method:"POST",body:JSON.stringify(o)})}function lo(o,e){return P(`/${o}`,{method:"PATCH",body:JSON.stringify(e)})}function co(o){return P(`/${o}`,{method:"DELETE"})}function He(o){return P(`/${o}/restore`,{method:"POST"})}function ho(o){return P(`/${o}/convert`,{method:"POST"})}const De="__openStationSharedStores";function uo(){const o=window;let e=o[De];return e||(e=new Map,o[De]=e),e}function $(o,e){const t=uo();let s=t.get(o);s||(s={state:e(),listeners:new Set,rebuild:e},t.set(o,s));const n={get state(){return s.state},set state(i){s.state=i},getState(){return s.state},notify(){for(const i of Array.from(s.listeners))try{i(s.state)}catch(r){console.error(`[desktop-mode/shared-store:${o}] subscriber threw:`,r)}},subscribe(i){return s.listeners.add(i),()=>{s.listeners.delete(i)}},setState(i){const r=s.state;if(typeof r!="object"||r===null){console.warn(`[desktop-mode/shared-store:${o}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(r,i),n.notify()},reset(){const i=s.rebuild(),r=s.state;if(typeof r=="object"&&r!==null&&typeof i=="object"&&i!==null){const l=r;for(const a of Object.keys(l))delete l[a];Object.assign(l,i)}else s.state=i;s.listeners.clear()}};return n}const R=$("desktop-mode/heartbeat-bus",()=>({suppliers:new Map,subscribers:new Map,booted:!1})),Oe={contribute(o,e){return R.state.suppliers.set(o,e),()=>{R.state.suppliers.get(o)===e&&R.state.suppliers.delete(o)}},subscribe(o,e){let t=R.state.subscribers.get(o);return t||(t=new Set,R.state.subscribers.set(o,t)),t.add(e),()=>{t.delete(e)}}},po="wpd_note",fo="note-draft",L="note",mo="os-note-created",go="openstation_notes",vo="openstation_notes_subscribe",bo=go;let Ve=!1,le=null;function yo(o){le=o,!Ve&&(Ve=!0,Oe.contribute(vo,()=>le?.getHeartbeatSubscription()),Oe.subscribe(bo,e=>{le?.applyHeartbeatPayload(e)}))}function I(){const o=window.wp?.hooks;if(!o)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 o}function wo(o,e,t,s){I().addFilter(o,e,t,s)}function X(o,e,t,s){I().addAction(o,e,t,s)}function _o(o,e){return I().removeAction(o,e)}function ce(o,e,...t){return I().applyFilters(o,e,...t)}function Fe(o,...e){I().doAction(o,...e)}const W={BROADCAST:"os.broadcast",WINDOW_OPENED:"os.window.opened",WINDOW_CLOSED:"os.window.closed",DOCK_AFTER_RENDER:"os.dock.after-render"},xo="os.activity.";function de(o){return xo+String(o).replace(/[^a-zA-Z0-9_.-]/g,".")}let ko=0;const Eo={publish(o,e){Fe(de(o),e)},subscribe(o,e){const t=`os/activity-sub/${++ko}`,s=de(o);X(s,t,i=>e(i));let n=!1;return()=>{n||(n=!0,_o(s,t))}},filter(o,e,...t){return ce(de(o),e,...t)}},Co="os-broadcast";function Ao(o,e){const t=String(ce("os.broadcast.topic",o,{payload:e})??o),s=ce("os.broadcast.payload",e,{topic:t}),n={topic:t,payload:s};document.dispatchEvent(new CustomEvent(Co,{detail:n})),Fe(W.BROADCAST,n),Eo.publish(t,s)}function To(o,e,t,s=""){const n=(Array.isArray(t)?t:[t]).map(r=>Math.floor(Number(r))).filter(r=>Number.isFinite(r)&&r>0),i=String(o).trim();i===""||n.length===0||Ao(`os.${i}.changed`,{source:s,action:e,ids:n})}function Y(o,e){To(po,o,e,"desktop-mode/notes")}function Be(){const o=window.wp?.os;return o&&typeof o.showToast=="function"?o:null}async function Mo(o,e){e.onEvict(o.id);try{await co(o.id),Y("trashed",[o.id]),Be()?.showToast?.({message:h("Note moved to Trash","desktop-mode"),duration:6e3,action:{label:h("Undo","desktop-mode"),onClick:()=>{He(o.id).then(t=>{Y("untrashed",[o.id]),e.onRestore(t)}).catch(t=>{console.error("[openstation] notes: restore failed:",t)})}}})}catch(t){console.error("[openstation] notes: trash failed:",t),e.onRestore(o),Be()?.showToast?.({message:h("Could not move the note to the Trash.","desktop-mode"),duration:5e3})}}function q(){return window.wp?.os??null}function No(o){const e=q();if(!e?.windowManager?.open||!e.deriveWindowId)return window.location.href=o,null;const t=e.deriveWindowId(o);return e.windowManager.open({id:t,baseId:t,url:o,title:h("Edit draft","desktop-mode"),icon:"dashicons-admin-post"}),t}async function So(o,e){e.onEvict(o.id);try{const t=await ho(o.id);Y("trashed",[o.id]);const s=No(t.editUrl);q()?.showToast?.({message:h("Note converted to a draft post","desktop-mode"),duration:6e3,action:{label:h("Undo","desktop-mode"),onClick:()=>{s&&q()?.windowManager?.getById?.(s)?.close?.(),He(o.id).then(n=>{Y("untrashed",[o.id]),e.onRestore(n)}).catch(n=>{console.error("[openstation] notes: convert undo failed:",n)})}}})}catch(t){console.error("[openstation] notes: convert failed:",t),e.onRestore(o),q()?.showToast?.({message:h("Could not convert the note to a post.","desktop-mode"),duration:5e3})}}const Po=Object.freeze({top:0,right:0,bottom:0,left:0});function Lo(o,e,t){return{x:t.left,y:t.top,width:Math.max(0,o-t.left-t.right),height:Math.max(0,e-t.top-t.bottom)}}const $o="os/work-area";function Ro(){return{insets:{...Po},rect:{x:0,y:0,width:0,height:0},viewport:{x:0,y:0,width:0,height:0},area:{width:0,height:0}}}const he=$($o,()=>({snapshot:Ro(),installed:!1,areaEl:null}));function Io(o){const e=o??he.state.areaEl;if(!e)return{...he.state.snapshot.rect};const t=e.clientWidth||e.getBoundingClientRect().width,s=e.clientHeight||e.getBoundingClientRect().height;return Lo(t,s,he.state.snapshot.insets)}const zo=208,Ho=1e3,Do=800,Oo=10,Vo=1;function Fo(){return window.wp?.os?.dragManager??null}function Z(o){return o.seed||Math.abs(o.id)||1}const Bo='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true" focusable="false"><path d="m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" /></svg>',Uo=zt("trash",{size:20});class jo{constructor(e){this.root=null,this.liveRegion=null,this.controllers=new Map,this.zCounter=1,this.highWaterMs=0,this.tempIdCounter=0,this.host=e.host,this.pluginUrl=e.pluginUrl,this.canCreatePosts=e.canCreatePosts??!1,this.onError=e.onError}async boot(){try{const{notes:e}=await ze();e.forEach(t=>{this.bumpHighWater(t.updatedAtMs),this.upsertNote(t,{animate:"none"})}),yo(this)}catch(e){e instanceof Error&&console.debug("[openstation] Pinned notes unavailable:",e.message)}}upsertNote(e,t={animate:"none"}){this.ensureRoot(),this.zCounter=Math.max(this.zCounter,e.z);const s=this.controllers.get(e.id);if(s)return s.replace(e),s;const n=new Xo({layer:this,note:e});return this.controllers.set(e.id,n),this.root?.appendChild(n.element),t.animate!=="none"&&n.playInsertion(t.animate==="thunk"?1:.7),n}removeNote(e){const t=this.controllers.get(e);t&&(this.controllers.delete(e),t.dispose(),t.element.remove())}rekeyNote(e,t){this.controllers.delete(e),this.controllers.set(t.note.id,t)}has(e){return this.controllers.has(e)}get(e){return this.controllers.get(e)}nextTempId(){return this.tempIdCounter-=1,this.tempIdCounter}bringToFront(e){this.zCounter+=1,e.setZ(this.zCounter)}bumpHighWater(e){Number.isFinite(e)&&e>this.highWaterMs&&(this.highWaterMs=e)}hostSize(){return{width:Math.max(1,this.host.clientWidth),height:Math.max(1,this.host.clientHeight)}}clampPosition(e,t){const{width:s,height:n}=this.hostSize(),i=Io(this.host),r=i.x/s,l=i.y/n,a=Math.max(r,(i.x+i.width-zo)/s),c=Math.max(l,(i.y+i.height-120)/n);return{x:Math.min(a,Math.max(r,e)),y:Math.min(c,Math.max(l,t))}}normalizedFromClient(e,t){const s=this.host.getBoundingClientRect(),{width:n,height:i}=this.hostSize();return this.clampPosition((e-s.left)/n,(t-s.top)/i)}createNoteAt(e){const t=e.text??"",s=re(e.color??M[0]),n=e.isPublic===!0,{x:i,y:r}=this.clampPosition(e.x,e.y),l=Ut(t||`${i},${r}`),a=this.nextTempId(),c=this.upsertNote({id:a,text:t,color:s,x:i,y:r,z:1,public:n,seed:l,ownerId:0,ownerName:"",ownerAvatar:"",canEdit:!0,updatedAtMs:0},{animate:"thunk"});return this.bringToFront(c),e.focus&&c.focusEditor(),ao({text:t,color:s,x:i,y:r,public:n,seed:l}).then(d=>{this.bumpHighWater(d.updatedAtMs),c.replace(d),this.rekeyNote(a,c),c.flushPendingEdits()}).catch(d=>{this.removeNote(a),this.notifyError(h("Could not pin the note. Please try again.","desktop-mode")),console.error("[openstation] notes: create failed:",d)}),c}announce(e){this.ensureRoot(),this.liveRegion&&(this.liveRegion.textContent=e)}notifyError(e){this.onError?.(e)}trashNote(e){Mo(e,{onEvict:t=>this.removeNote(t),onRestore:t=>{this.bumpHighWater(t.updatedAtMs),this.upsertNote(t,{animate:"move"})}})}convertNote(e){!this.canCreatePosts||!e.canEdit||So(e,{onEvict:t=>this.removeNote(t),onRestore:t=>{this.bumpHighWater(t.updatedAtMs),this.upsertNote(t,{animate:"move"})}})}getHeartbeatSubscription(){return{knownIds:Array.from(this.controllers.keys()).filter(e=>e>0),sinceMs:this.highWaterMs}}applyHeartbeatPayload(e){for(const t of e.notes??[]){this.bumpHighWater(t.updatedAtMs);const s=this.controllers.get(t.id);s?s.shouldReplaceFromRemote(t)&&s.replace(t):this.upsertNote(t,{animate:"move"})}for(const t of e.removed??[])this.removeNote(t);typeof e.serverTimeMs=="number"&&Number.isFinite(e.serverTimeMs)&&this.bumpHighWater(e.serverTimeMs),e.truncated&&this.reloadFromServer()}async reloadFromServer(){try{const{notes:e}=await ze(),t=new Set;for(const s of e){t.add(s.id),this.bumpHighWater(s.updatedAtMs);const n=this.controllers.get(s.id);n?n.shouldReplaceFromRemote(s)&&n.replace(s):this.upsertNote(s,{animate:"move"})}for(const s of Array.from(this.controllers.keys()))s>0&&!t.has(s)&&this.removeNote(s)}catch{}}ensureRoot(){if(this.root)return this.root;const e=document.createElement("section");e.className="os-notes",e.setAttribute("aria-label",h("Pinned notes","desktop-mode"));const t=document.createElement("div");return t.className="os-notes__live screen-reader-text",t.setAttribute("aria-live","polite"),e.appendChild(t),this.host.appendChild(e),this.root=e,this.liveRegion=t,e}}class Xo{constructor(e){this.editor=null,this.statusEl=null,this.colorDot=null,this.visibilityBtn=null,this.saveTimer=null,this.zTimer=null,this.patchChain=Promise.resolve(),this.pendingText=null,this.disposed=!1,this.moveMode=!1,this.moveOrigin=null,this.dragCleanup=null,this.lastPointer=null,this.layer=e.layer,this.note=e.note,this.jitter=$e(Z(e.note)),this.element=document.createElement("article"),this.paperEl=document.createElement("div"),this.pinEl=document.createElement(this.note.canEdit?"button":"span"),this.paint(),this.applyPosition(),this.setZ(this.note.z),this.element.addEventListener("pointerdown",()=>this.layer.bringToFront(this),{capture:!0})}paint(){const e=this.note;this.element.className="os-pinned-note",this.element.dataset.noteId=String(e.id),this.element.dataset.noteColor=re(e.color),this.element.dataset.owner=e.canEdit?"me":"other",this.element.setAttribute("role",e.canEdit?"group":"note"),this.element.setAttribute("aria-label",e.canEdit?h("Pinned note","desktop-mode"):G(h("Note by %s","desktop-mode"),e.ownerName)),this.element.style.setProperty("--dm-note-rot",`${this.jitter.rotation}deg`),this.element.style.setProperty("--dm-pin-dx",`${this.jitter.pinOffsetX}px`),this.element.style.setProperty("--dm-pin-rot",`${this.jitter.pinRotation}deg`),this.pinEl.className="os-pinned-note__pin",this.pinEl.appendChild(Zt(this.layer.pluginUrl)),e.canEdit?(this.pinEl.setAttribute("type","button"),this.pinEl.setAttribute("aria-pressed","false"),this.pinEl.setAttribute("aria-label",h("Move note. Drag the pin, or press Enter then use the arrow keys.","desktop-mode")),this.pinEl.addEventListener("pointerdown",t=>this.startDrag(t)),this.pinEl.addEventListener("click",t=>{t.detail===0&&!this.moveMode&&this.toggleMoveMode()}),this.pinEl.addEventListener("keydown",t=>this.onPinKeydown(t)),this.pinEl.addEventListener("blur",()=>this.exitMoveMode(!1))):this.pinEl.setAttribute("aria-hidden","true"),this.paperEl.className="os-pinned-note__paper",e.canEdit?this.paintOwnerPaper():this.paintViewerPaper(),this.element.append(this.pinEl,this.paperEl)}paintOwnerPaper(){const e=document.createElement("div");e.className="os-pinned-note__meta";const t=document.createElement("os-save-status");t.setAttribute("mode","icon"),t.setAttribute("phase","idle"),t.className="os-pinned-note__status",this.statusEl=t;const s=document.createElement("button");s.type="button",s.className="os-pinned-note__color-dot",this.colorDot=s,this.refreshColorDot(),s.addEventListener("click",()=>this.cycleColor()),e.append(t,s);const n=document.createElement("div");n.className="os-pinned-note__actions";const i=document.createElement("os-window-button");if(i.className="os-pinned-note__visibility",this.visibilityBtn=i,this.refreshVisibility(),i.addEventListener("os-button-activate",()=>this.togglePublic()),n.appendChild(i),this.layer.canCreatePosts){const d=document.createElement("os-window-button");d.className="os-pinned-note__convert",d.innerHTML=Bo;const u=h("Convert to a draft post","desktop-mode");d.setAttribute("title",u),d.setAttribute("aria-label",u),d.addEventListener("os-button-activate",()=>this.layer.convertNote(this.note)),n.appendChild(d)}const r=document.createElement("os-window-button");r.className="os-pinned-note__trash",r.innerHTML=Uo;const l=h("Move to Trash","desktop-mode");r.setAttribute("title",l),r.setAttribute("aria-label",l),r.addEventListener("os-button-activate",()=>this.confirmTrash()),n.appendChild(r);const a=document.createElement("os-textarea");a.className="os-pinned-note__editor",a.setAttribute("aria-label",h("Note text","desktop-mode")),a.setAttribute("rows","5"),a.setAttribute("auto-grow",""),a.setAttribute("max-rows","10"),a.setAttribute("value",this.note.text),["keydown","keypress","keyup"].forEach(d=>{a.addEventListener(d,u=>u.stopPropagation())}),a.addEventListener("os-input-change",d=>{const u=d.detail;this.pendingText=u.value,this.setPhase("pending"),this.scheduleSave()}),a.addEventListener("os-input-commit",()=>this.flushSave()),this.editor=a;const c=document.createElement("div");c.className="os-pinned-note__footer",c.appendChild(n),this.paperEl.append(e,a,c)}paintViewerPaper(){const e=document.createElement("div");e.className="os-pinned-note__body",e.textContent=this.note.text;const t=document.createElement("div");t.className="os-pinned-note__attribution",t.title=G(h("Pinned by %s","desktop-mode"),this.note.ownerName);const s=document.createElement("os-avatar");s.setAttribute("size","20"),s.setAttribute("name",this.note.ownerName),this.note.ownerAvatar&&s.setAttribute("src",this.note.ownerAvatar);const n=document.createElement("span");n.className="os-pinned-note__attribution-name",n.textContent=this.note.ownerName,t.append(s,n),this.paperEl.append(e,t)}refreshColorDot(){if(!this.colorDot)return;const e=Ne(this.note.color);this.colorDot.style.setProperty("--dm-note-next-paper",`var(--dm-note-${e})`),this.colorDot.setAttribute("aria-label",G(h("Change paper color (next: %s)","desktop-mode"),e))}refreshVisibility(){if(!this.visibilityBtn)return;const e=this.note.public;this.visibilityBtn.innerHTML="";const t=document.createElement("span");t.className=`dashicons ${e?"dashicons-admin-site-alt3":"dashicons-lock"}`,t.setAttribute("aria-hidden","true"),this.visibilityBtn.appendChild(t),this.visibilityBtn.setAttribute("title",h(e?"Public note — everyone can see it. Click to make private.":"Private note. Click to share with every desktop user.","desktop-mode")),this.visibilityBtn.classList.toggle("is-public",e)}replace(e){const t=e.id!==this.note.id,s=Z(e)!==Z(this.note),n=e.color!==this.note.color,i=e.x!==this.note.x||e.y!==this.note.y,r=e.z!==this.note.z;if(this.note=e,r&&(this.element.style.zIndex=String(e.z)),t&&(this.element.dataset.noteId=String(e.id)),s&&(this.jitter=$e(Z(e)),this.element.style.setProperty("--dm-note-rot",`${this.jitter.rotation}deg`),this.element.style.setProperty("--dm-pin-dx",`${this.jitter.pinOffsetX}px`),this.element.style.setProperty("--dm-pin-rot",`${this.jitter.pinRotation}deg`)),n&&(this.element.dataset.noteColor=re(e.color),this.refreshColorDot()),i&&this.applyPosition(),this.note.canEdit)this.pendingText===null&&this.editor?.setAttribute("value",e.text),this.refreshVisibility();else{const l=this.paperEl.querySelector(".os-pinned-note__body");l&&(l.textContent=e.text)}}shouldReplaceFromRemote(e){return this.pendingText!==null||this.saveTimer!==null?!1:e.updatedAtMs>=this.note.updatedAtMs}setZ(e){this.element.style.zIndex=String(e),!(e===this.note.z||!this.note.canEdit)&&(this.note={...this.note,z:e},!(this.note.id<=0)&&(this.zTimer!==null&&window.clearTimeout(this.zTimer),this.zTimer=window.setTimeout(()=>{this.zTimer=null,this.queuePatch({z:this.note.z})},Do)))}applyPosition(){this.element.style.left=`${(this.note.x*100).toFixed(3)}%`,this.element.style.top=`${(this.note.y*100).toFixed(3)}%`}moveTo(e,t){const s=this.layer.clampPosition(e,t);this.note={...this.note,x:s.x,y:s.y},this.applyPosition(),this.note.id>0&&this.queuePatch({x:s.x,y:s.y})}playInsertion(e=1){return Ot({pin:this.pinEl,paper:this.paperEl,rippleHost:this.element,restRotation:this.jitter.pinRotation,fallDistance:e>=1?30:12,tempo:e})}focusEditor(){window.setTimeout(()=>this.editor?.focusInput?.(),0)}dispose(){this.disposed=!0,this.saveTimer!==null&&(window.clearTimeout(this.saveTimer),this.saveTimer=null),this.zTimer!==null&&(window.clearTimeout(this.zTimer),this.zTimer=null),this.dragCleanup?.(),this.dragCleanup=null}setPhase(e){this.statusEl?.setAttribute("phase",e)}scheduleSave(){this.saveTimer!==null&&window.clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>{this.saveTimer=null,this.flushSave()},Ho)}flushPendingEdits(){this.flushSave()}flushSave(){if(this.saveTimer!==null&&(window.clearTimeout(this.saveTimer),this.saveTimer=null),this.pendingText===null||this.note.id<=0)return;const e=this.pendingText;this.pendingText=null,this.note={...this.note,text:e},this.setPhase("saving"),this.queuePatch({text:e})}cycleColor(){const e=Ne(this.note.color);this.note={...this.note,color:e},this.element.dataset.noteColor=e,this.refreshColorDot(),this.note.id>0&&this.queuePatch({color:e})}togglePublic(){const e=!this.note.public;this.note={...this.note,public:e},this.refreshVisibility(),e&&!S()&&this.visibilityBtn&&this.visibilityBtn.animate?.([{transform:"scale(1)"},{transform:"scale(1.25)"},{transform:"scale(1)"}],{duration:300,easing:"ease-out"}),this.layer.announce(h(e?"Note is now public.":"Note is now private.","desktop-mode")),this.note.id>0&&this.queuePatch({public:e})}confirmTrash(){Rt({title:h("Move note to the Trash?","desktop-mode"),message:h("You can restore it from the Trash later.","desktop-mode"),confirmLabel:h("Move to Trash","desktop-mode")}).then(e=>{e&&this.layer.trashNote(this.note)})}queuePatch(e){this.patchChain=this.patchChain.then(async()=>{if(!(this.disposed||this.note.id<=0))try{const t=await lo(this.note.id,{...e,updatedAtMs:this.note.updatedAtMs});if(this.disposed)return;const s=t.public!==this.note.public;this.note={...this.note,updatedAtMs:t.updatedAtMs,public:t.public},s&&this.refreshVisibility(),this.setPhase("saved")}catch(t){if(this.disposed)return;if(ro(t)&&t.current){this.pendingText=null,this.replace(t.current),this.setPhase("idle"),this.layer.notifyError(h("This note was changed in another session — showing the latest version.","desktop-mode"));return}this.setPhase("failed"),console.error("[openstation] notes: save failed:",t)}})}startDrag(e){if(!this.note.canEdit||this.note.id<=0)return;const t=Fo();if(!t)return;e.preventDefault(),this.element.ownerDocument.defaultView?.getSelection()?.removeAllRanges();const s=this.buildGhost(),n=this.element.getBoundingClientRect(),i={noteId:this.note.id,canEdit:this.note.canEdit,updatedAtMs:this.note.updatedAtMs};t.start({payload:{type:L,source:this.element,data:i,ghost:{element:s.root,offsetX:s.tipX,offsetY:s.tipY,hint:{neutral:h("Drop on the desktop to pin","desktop-mode"),accept:h("Pin here","desktop-mode"),reject:h("Can’t pin here","desktop-mode")}}},origin:e,onClickOnly:()=>{this.teardownDragListeners(),this.toggleMoveMode()},onCancel:()=>{this.teardownDragListeners(),this.snapBack(n)},onCommit:()=>{this.teardownDragListeners(),this.layer.has(this.note.id)&&this.playInsertion(.7)}})&&this.installDragListeners(s)}buildGhost(){const e=this.element.getBoundingClientRect(),s=(this.pinEl.querySelector("img")??this.pinEl).getBoundingClientRect(),n=s.left-e.left+s.width*jt,i=s.top-e.top+s.height*Xt,r=document.createElement("div");r.className="os-pinned-note-ghost",r.style.width=`${e.width}px`,r.style.height=`${e.height}px`;const l=document.createElement("div");l.className="os-pinned-note-ghost__swing",l.style.transformOrigin=`${n}px ${i}px`;const a=this.pinEl.cloneNode(!0);a.removeAttribute("aria-pressed"),a.setAttribute("aria-hidden","true");const c=this.paperEl.cloneNode(!0);return c.classList.add("os-pinned-note-ghost__paper"),l.dataset.noteColor=this.element.dataset.noteColor??"",l.append(a,c),r.appendChild(l),{root:r,swing:l,pin:a,paper:c,tipX:n,tipY:i}}installDragListeners(e){this.teardownDragListeners();let t=null;const s=l=>{l.detail?.payload?.data?.noteId===this.note.id&&(t=Vt(e.swing))},n=l=>{const a=l.detail;this.lastPointer={x:a.clientX,y:a.clientY},t?.onPointerMove(a.clientX)},i=l=>{l.detail?.targetId?.startsWith("recycle-bin")&&(e.root.classList.add("os-pinned-note-ghost--doom"),t?.setBias(6))},r=l=>{l.detail?.targetId?.startsWith("recycle-bin")&&(e.root.classList.remove("os-pinned-note-ghost--doom"),t?.setBias(0))};document.addEventListener(k.START,s),document.addEventListener(k.MOVE,n),document.addEventListener(k.ENTER,i),document.addEventListener(k.LEAVE,r),this.dragCleanup=()=>{t?.stop(),t=null,document.removeEventListener(k.START,s),document.removeEventListener(k.MOVE,n),document.removeEventListener(k.ENTER,i),document.removeEventListener(k.LEAVE,r)}}teardownDragListeners(){this.dragCleanup?.(),this.dragCleanup=null}async snapBack(e){if(!this.lastPointer||S()){this.playInsertion(.63);return}const t=this.buildGhost();t.root.classList.add("os-pinned-note-ghost--flyback"),t.root.style.position="fixed",t.root.style.left=`${this.lastPointer.x-t.tipX}px`,t.root.style.top=`${this.lastPointer.y-t.tipY}px`,t.root.style.zIndex="2147483647",t.root.style.pointerEvents="none",document.body.appendChild(t.root);try{await Ft({flyback:t.root,swing:t.swing,homeX:e.left,homeY:e.top})}finally{t.root.remove()}this.playInsertion(.63)}async playCrumpleAt(e,t){const s=this.buildGhost();s.root.classList.add("os-pinned-note-ghost--flyback"),s.root.style.position="fixed",s.root.style.left=`${e-s.tipX}px`,s.root.style.top=`${t-s.tipY}px`,s.root.style.zIndex="2147483647",s.root.style.pointerEvents="none",document.body.appendChild(s.root);try{await Bt({clone:s.root,pin:s.pin,paper:s.paper,binX:e,binY:t+24})}finally{s.root.remove()}}toggleMoveMode(){this.moveMode?this.exitMoveMode(!0):this.enterMoveMode()}enterMoveMode(){this.note.canEdit&&(this.moveMode=!0,this.moveOrigin={x:this.note.x,y:this.note.y},this.element.classList.add("os-pinned-note--move-mode"),this.pinEl.setAttribute("aria-pressed","true"),this.layer.announce(h("Moving note. Arrow keys to move, Enter to place, Escape to cancel, Delete to move to the Trash.","desktop-mode")))}exitMoveMode(e){this.moveMode&&(this.moveMode=!1,this.element.classList.remove("os-pinned-note--move-mode"),this.pinEl.setAttribute("aria-pressed","false"),e?(this.moveTo(this.note.x,this.note.y),this.layer.announce(h("Note placed.","desktop-mode")),this.playInsertion(.7)):this.moveOrigin&&(this.note={...this.note,...this.moveOrigin},this.applyPosition()),this.moveOrigin=null)}onPinKeydown(e){if(!this.moveMode)return;const{width:t,height:s}=this.layer.hostSize(),n=e.shiftKey?Vo:Oo,i=n/t,r=n/s;switch(e.key){case"ArrowLeft":this.nudge(-i,0);break;case"ArrowRight":this.nudge(i,0);break;case"ArrowUp":this.nudge(0,-r);break;case"ArrowDown":this.nudge(0,r);break;case"Enter":case" ":this.exitMoveMode(!0);break;case"Escape":this.exitMoveMode(!1),this.layer.announce(h("Move cancelled.","desktop-mode"));break;case"Delete":case"Backspace":this.exitMoveMode(!1),this.confirmTrash();break;default:return}e.preventDefault(),e.stopPropagation()}nudge(e,t){const s=this.layer.clampPosition(this.note.x+e,this.note.y+t);this.note={...this.note,...s},this.applyPosition()}}const Wo=$("desktop-mode/canvas-payload-handlers",()=>({handlers:new Map}));function ue(){return Wo.state.handlers}function Ue(o,e){return ue().set(o,e),()=>{ue().get(o)===e&&ue().delete(o)}}const Yo=$("desktop-mode/recycle-bin-payload-handlers",()=>({handlers:new Map}));function pe(){return Yo.state.handlers}function qo(o,e){return pe().set(o,e),()=>{pe().get(o)===e&&pe().delete(o)}}function je(o,e,t){const s=o.host.getBoundingClientRect(),n=e.payload.ghost?.offsetX??0,i=e.payload.ghost?.offsetY??0,{width:r,height:l}=o.hostSize();return o.clampPosition((t.clientX-n-s.left)/r,(t.clientY-i-s.top)/l)}function Zo(o,e,t){const s=e.payload.data,n=String(s.text??"");if(!n.trim())return;const{x:i,y:r}=je(o,e,t);o.createNoteAt({x:i,y:r,text:n,color:String(s.color??""),isPublic:s.isPublic===!0})}function Ko(o,e,t){const s=e.payload.data,n=o.get(s.noteId);if(!n)return;const{x:i,y:r}=je(o,e,t);n.moveTo(i,r)}function Go(o){const e=[],t=s=>s.folderId===0;return e.push(Ue(fo,{accept:(s,n)=>t(n)&&!!String(s.text??"").trim(),onDrop:(s,n)=>Zo(o,s,n)})),e.push(Ue(L,{accept:(s,n)=>t(n)&&s.canEdit===!0,onDrop:(s,n)=>Ko(o,s,n)})),e.push(qo(L,{accept:s=>s.canEdit===!0,onDrop:(s,n)=>{const i=s.payload.data,r=o.get(i.noteId);if(!r)return;const l=r.note;r.playCrumpleAt(n.clientX,n.clientY),o.trashNote(l)}})),()=>{e.forEach(s=>s())}}const Qo=$("desktop-mode/tile-payload-handlers",()=>({handlers:new Map}));function K(){return Qo.state.handlers}function Jo(o,e){const t=K().get(o);return t?t.push(e):K().set(o,[e]),()=>{const s=K().get(o);if(!s)return;const n=s.indexOf(e);n!==-1&&s.splice(n,1),s.length===0&&K().delete(o)}}const fe="data-os-posts-drop-active",Xe="desktop-mode-posts",es='.os-dock__item[data-menu-slug="menu-posts"],.os-dock__item[data-menu-slug="editphp"]',ts="[data-os-posts-root]";function os(){return window.wp?.os?.dragManager??null}function ss(o){return o.type!==L?!1:o.data.canEdit===!0}function ns(o){if(!o)return!1;let e=o,t="";try{const i=new URL(o,window.location.origin);e=i.pathname,t=i.search}catch{}if(!(/(?:^|\/)(?:edit\.php|post-new\.php)$/.test(e)||!e.includes("/")&&(e==="edit.php"||e==="post-new.php")))return!1;const n=new URLSearchParams(t).get("post_type");return!n||n==="post"}function is(o){const e=o.placement.file;if(!e||e.type!=="shortcut")return!1;const t=typeof e.shortcutUrl=="string"?e.shortcutUrl:"";return ns(t)}function We(o,e){if(e.payload.type!==L)return;const t=e.payload.data;if(typeof t.noteId!="number")return;const s=o.get(t.noteId);s&&o.convertNote(s.note)}let Ye=!1,z=null,H=null,qe=null;function Ze(o,e,t,s){return o.registerDropTarget({id:t,element:s,acceptLabel:h("Convert to post","desktop-mode"),accept:n=>ss(n),onEnter:()=>{s.setAttribute(fe,"")},onLeave:()=>{s.removeAttribute(fe)},onDrop:n=>{s.removeAttribute(fe),We(e,n)}})}function rs(o,e){const t=o.debug().listTargets().find(s=>s.id===e);return t?t.element:null}function as(o){if(Ye||!o.canCreatePosts)return;const e=os();if(!e)return;Ye=!0,Jo(L,{appliesTo:s=>is(s),acceptLabel:h("Convert to post","desktop-mode"),accept:s=>s.canEdit===!0,onDrop:s=>We(o,s)});const t=()=>{const s=document.querySelector(es);if(!(s instanceof HTMLElement)){z?.(),z=null;return}z&&rs(e,"notes-convert-dock")===s||(z?.(),z=Ze(e,o,"notes-convert-dock",s))};t(),X(W.DOCK_AFTER_RENDER,"desktop-mode/notes/convert-dock-target",t),typeof MutationObserver<"u"&&(qe=new MutationObserver(()=>{t()}),qe.observe(document.body,{childList:!0,subtree:!0})),X(W.WINDOW_OPENED,"desktop-mode/notes/convert-window-target",s=>{if(s.windowId!==Xe)return;H?.(),H=null;const n=document.querySelector(ts);n instanceof HTMLElement&&(H=Ze(e,o,"notes-convert-window",n))}),X(W.WINDOW_CLOSED,"desktop-mode/notes/convert-window-cleanup",s=>{s.windowId===Xe&&(H?.(),H=null)})}const Ke="new-note";function ls(o){wo("os.wallpaper-context-menu","desktop-mode/notes",(e,t)=>{if(!Array.isArray(e)||e.some(i=>i.id===Ke))return e;const{x:s,y:n}=t??{x:0,y:0};return[...e,{id:Ke,label:h("New note","desktop-mode"),icon:"dashicons-edit-page",sort:14,onClick:()=>{const i=o.normalizedFromClient(s,n);o.createNoteAt({...i,focus:!0})}}]})}function cs(o){const e=o.config.notesUrl;if(typeof e!="string"||!e)return null;so({baseUrl:e,nonce:o.config.restNonce??""});const t=new jo({host:o.host,pluginUrl:o.config.pluginUrl??"",canCreatePosts:o.config.canCreatePosts??!1,onError:o.onError});return Go(t),as(t),ls(t),document.addEventListener(mo,s=>{const n=s.detail?.note;if(n&&typeof n.id=="number"){t.bumpHighWater(n.updatedAtMs);const i=t.upsertNote(n,{animate:"thunk"});t.bringToFront(i),i.focusEditor()}}),t.boot(),t}window.openStationNotes={boot:cs}})(); | |
| 99 | + `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg()),queueMicrotask(()=>this._wireActivateEvent())}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("svg"),s=e.querySelector("[data-svg-buffer]");if(t&&s){const n=s.textContent||"";t.innerHTML!==n&&(t.innerHTML=n)}}_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}))}))}};X.props=["icon","icon-src","active","danger","disabled"],X.styles=[eo],X.help=void 0;let ie=X;Z("os-window-button",ie);let ae=null;function le(){return!!window.openStationShellOverlays}function so(o){return new Promise((e,t)=>{const s=document.querySelector('script[data-os-shell-overlays="1"]'),n=()=>{if(le()){e();return}t(new Error("[openstation] shell-overlays bundle loaded but did not set `window.openStationShellOverlays`."))};if(s){le()?n():(s.addEventListener("load",n),s.addEventListener("error",()=>t(new Error("failed to load shell-overlays bundle"))));return}const r=document.createElement("script");r.src=o,r.async=!0,r.dataset.osShellOverlays="1",r.addEventListener("load",n),r.addEventListener("error",()=>t(new Error("failed to load shell-overlays bundle"))),document.head.appendChild(r)})}function no(o){return le()||!o?Promise.resolve():(ae||(ae=so(o)),ae)}function ro(){return window.openStationConfig?.shellOverlaysBundleUrl??""}async function io(o){return await no(ro()),new Promise(e=>{const t=document.createElement("os-confirm-dialog");t.setAttribute("open",""),o.title&&t.setAttribute("title",o.title),t.setAttribute("message",o.message),o.confirmLabel&&t.setAttribute("confirm-label",o.confirmLabel),o.cancelLabel&&t.setAttribute("cancel-label",o.cancelLabel),o.danger&&t.setAttribute("danger",""),o.hideCancel&&t.setAttribute("hide-cancel",""),o.dismissable&&t.setAttribute("dismissable",""),o.rememberLabel&&t.setAttribute("remember-label",o.rememberLabel);const s=n=>{t.remove(),e(n)};t.addEventListener("os-confirm",n=>{o.onRemember?.(n.detail?.remember===!0),s(!0)}),t.addEventListener("os-cancel",()=>s(!1)),document.body.appendChild(t)})}const Fe={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 Ve(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function ao(o){return Object.prototype.hasOwnProperty.call(Fe,o)?Fe[o]:null}function lo(o,e={}){const t=ao(o);if(!t)return"";const{size:s=24,className:n,title:r,rotate:i}=e,a=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];s!=null&&a.push(`width="${s}"`,`height="${s}"`),a.push(t.a),n&&a.push(`class="${Ve(n)}"`),r?a.push('role="img"',`aria-label="${Ve(r)}"`):a.push('aria-hidden="true"','focusable="false"');const l=i?`<g transform="rotate(${i} 12 12)">${t.b}</g>`:t.b;return`<svg ${a.join(" ")}>${l}</svg>`}const A={START:"os.drag.start",MOVE:"os.drag.move",ENTER:"os.drag.enter",LEAVE:"os.drag.leave"},N=["butter","blush","sky","mint","lilac","peach"];function co(o){return N.includes(o)?o:N[0]}function ce(o){return o.toLowerCase().replace(/[^a-z0-9_-]/g,"")||N[0]}function Be(o){const e=N.indexOf(co(o));return N[(e+1)%N.length]}const Ue="cubic-bezier(0.2, 0.7, 0.2, 1)",We="cubic-bezier(0.5, 0, 0.9, 0.4)",uo="cubic-bezier(0.2, 0.7, 0.3, 1.15)";function P(){return typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function w(o,e,t){return typeof o.animate!="function"?Promise.resolve():o.animate(e,t).finished.then(()=>{}).catch(()=>{})}async function ho(o){const e=o.restRotation??0;if(P()){je(o.rippleHost,400);return}const t=o.tempo??1,s=o.fallDistance??30;await w(o.pin,[{opacity:0,transform:`translate(8px, ${-s}px) rotate(${e-16}deg) scale(1.9)`},{opacity:1,offset:.35},{opacity:1,transform:`translate(0, 0) rotate(${e}deg) scale(0.92)`}],{duration:170*t,easing:We,fill:"forwards"}),je(o.rippleHost,420*t);const n=w(o.paper,[{transform:"scale(1) translateY(0) skewX(0)"},{transform:"scale(0.982) translateY(2px) skewX(0)",offset:.08},{transform:"scale(1.01) translateY(0) skewX(0.6deg)",offset:.32},{transform:"scale(0.996) translateY(0) skewX(-0.4deg)",offset:.55},{transform:"scale(1) translateY(0) skewX(0)"}],{duration:370*t,easing:"linear"}),r=w(o.pin,[{transform:`rotate(${e}deg) scale(0.92)`},{transform:`rotate(${e+1.5}deg) scale(1.07)`,offset:.25},{transform:`rotate(${e-1}deg) scale(0.98)`,offset:.5},{transform:`rotate(${e}deg) scale(1)`}],{duration:370*t,easing:Ue,fill:"forwards"});await Promise.all([n,r])}function je(o,e){const t=document.createElement("span");t.className="os-pinned-note__ripple",t.setAttribute("aria-hidden","true"),o.appendChild(t),w(t,[{boxShadow:"0 0 0 0 rgba(0, 0, 0, 0.28)",opacity:.35},{boxShadow:"0 0 0 26px rgba(0, 0, 0, 0)",opacity:0}],{duration:e,easing:"ease-out"}).then(()=>t.remove()),window.setTimeout(()=>t.remove(),e+100)}function po(o){if(P())return{onPointerMove:()=>{},setBias:()=>{},stop:()=>{}};const e=14;let t=0,s=0,n=0,r=0,i=null,a=0,l=0,c=0,d=0,u=!0;const m=p=>{if(!u)return;const f=Math.min(.05,d?(p-d)/1e3:.016);d=p,p-a>80&&(l*=.85),n=Math.max(-14,Math.min(14,-l*.055))+r,s+=(-120*(t-n)-e*s)*f,t+=s*f,o.style.transform=`rotate(${t.toFixed(2)}deg)`,c=window.requestAnimationFrame(m)};return c=window.requestAnimationFrame(m),{onPointerMove(p){const f=performance.now();if(i!==null&&f>a){const _=(p-i)/(f-a)*16.7;l=l*.7+_*.3}i=p,a=f},setBias(p){r=p},stop(){u=!1,window.cancelAnimationFrame(c),o.style.transform=""}}}async function fo(o){if(P()){await w(o.flyback,[{opacity:1},{opacity:0}],{duration:120,easing:"linear",fill:"forwards"});return}const e=o.swing?w(o.swing,[{transform:"rotate(0deg)"},{transform:"rotate(9deg)",offset:.35},{transform:"rotate(-4deg)",offset:.7},{transform:"rotate(0deg)"}],{duration:330,easing:"linear",fill:"forwards"}):Promise.resolve(),t=w(o.flyback,[{left:`${o.flyback.offsetLeft}px`,top:`${o.flyback.offsetTop}px`},{left:`${o.homeX}px`,top:`${o.homeY}px`}],{duration:330,easing:uo,fill:"forwards"});await Promise.all([t,e])}async function mo(o){if(P()){await w(o.clone,[{opacity:1},{opacity:0}],{duration:150,easing:"linear",fill:"forwards"});return}o.pin&&w(o.pin,[{transform:"translate(0, 0) rotate(0deg)",opacity:1},{transform:"translate(2px, -16px) rotate(-30deg)",opacity:0}],{duration:200,easing:Ue,fill:"forwards"});const e=o.clone.getBoundingClientRect(),t=o.binX-(e.left+e.width/2),s=o.binY-(e.top+e.height/2),n="polygon(4% 8%, 38% 2%, 68% 7%, 96% 3%, 98% 42%, 92% 71%, 97% 94%, 60% 98%, 30% 93%, 3% 97%, 6% 62%, 2% 34%)",r="polygon(10% 14%, 42% 6%, 64% 12%, 90% 8%, 94% 38%, 86% 66%, 92% 88%, 58% 94%, 34% 86%, 10% 92%, 14% 58%, 8% 36%)";await w(o.paper,[{transform:"translate(0, 0) scale(0.88) rotate(0deg)",borderRadius:"2px",opacity:1},{transform:`translate(${t*.3}px, ${s*.3}px) scale(0.6) rotate(12deg)`,clipPath:n,offset:.3},{transform:`translate(${t*.6}px, ${s*.6}px) scale(0.34) rotate(24deg)`,clipPath:r,offset:.6,opacity:1},{transform:`translate(${t}px, ${s}px) scale(0.12) rotate(38deg)`,borderRadius:"50%",clipPath:r,opacity:0}],{duration:400,easing:We,delay:60,fill:"forwards"})}function go(o){let e=2166136261;for(let s=0;s<o.length;s++)e^=o.charCodeAt(s),e=Math.imul(e,16777619)>>>0;return e>>>1||1}function Xe(o){let e=2166136261;const t=`os-note-${o}`;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e=Math.imul(e,16777619)>>>0;const s=e>>>3,n=e>>>5;return{rotation:(e%45-22)/10,pinOffsetX:s%21-10,pinRotation:n%17-8}}const vo=.57,bo=.525,yo=56,wo=52;function _o(o){return`${o.replace(/\/$/,"")}/assets/images/pushpin.svg`}function xo(o){const e=document.createElement("img");return e.src=_o(o),e.alt="",e.width=yo,e.height=wo,e.draggable=!1,e.className="os-pinned-note__pin-img",e}const ko="http://localhost/";function Eo(o,e){const t=typeof window<"u"&&window.location?window.location.href:ko,s=new URL(o,t),n=e.replace(/^\/+/,""),r=n.indexOf("?"),i=r===-1?n:n.slice(0,r),a=r===-1?"":n.slice(r+1);if(s.searchParams.has("rest_route")){const l=s.searchParams.get("rest_route")??"/",c=l.endsWith("/")?l:l+"/";s.searchParams.set("rest_route",c+i)}else{const l=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";s.pathname=l+i}return a&&new URLSearchParams(a).forEach((c,d)=>{s.searchParams.append(d,c)}),s.toString()}let de=null;function Co(o){de=o}function Ye(){if(!de)throw new Error("[openstation] notes REST client called before installNotesRestDeps().");return de}function Ao(o){const e=window.openStationConfig;return typeof e?.restNonce=="string"&&e.restNonce?e.restNonce:o}class qe extends Error{constructor(e){super("Note was changed by another session."),this.status=409,this.name="NotesConflictError",this.current=e}}function To(o){return o instanceof qe}const L=bt({prefix:"[openstation] notes REST",source:"desktop-mode/notes",url:o=>{const{baseUrl:e}=Ye();return o?Eo(e,o):e},nonce:()=>Ao(Ye().nonce),conflict:o=>{const e=o?.data?.current;return new qe(e??null)}});function Ze(){return L("",{method:"GET"})}function Mo(o){return L("",{method:"POST",body:JSON.stringify(o)})}function No(o,e){return L(`/${o}`,{method:"PATCH",body:JSON.stringify(e)})}function So(o){return L(`/${o}`,{method:"DELETE"})}function Ke(o){return L(`/${o}/restore`,{method:"POST"})}function Po(o){return L(`/${o}/convert`,{method:"POST"})}const Ge="__openStationSharedStores";function Lo(){const o=window;let e=o[Ge];return e||(e=new Map,o[Ge]=e),e}function $(o,e){const t=Lo();let s=t.get(o);s||(s={state:e(),listeners:new Set,rebuild:e},t.set(o,s));const n={get state(){return s.state},set state(r){s.state=r},getState(){return s.state},notify(){for(const r of Array.from(s.listeners))try{r(s.state)}catch(i){console.error(`[desktop-mode/shared-store:${o}] subscriber threw:`,i)}},subscribe(r){return s.listeners.add(r),()=>{s.listeners.delete(r)}},setState(r){const i=s.state;if(typeof i!="object"||i===null){console.warn(`[desktop-mode/shared-store:${o}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(i,r),n.notify()},reset(){const r=s.rebuild(),i=s.state;if(typeof i=="object"&&i!==null&&typeof r=="object"&&r!==null){const a=i;for(const l of Object.keys(a))delete a[l];Object.assign(a,r)}else s.state=r;s.listeners.clear()}};return n}const D=$("desktop-mode/heartbeat-bus",()=>({suppliers:new Map,subscribers:new Map,booted:!1})),Qe={contribute(o,e){return D.state.suppliers.set(o,e),()=>{D.state.suppliers.get(o)===e&&D.state.suppliers.delete(o)}},subscribe(o,e){let t=D.state.subscribers.get(o);return t||(t=new Set,D.state.subscribers.set(o,t)),t.add(e),()=>{t.delete(e)}}},ue="wpd_note",$o="note-draft",R="note",Ro="os-note-created",Io="openstation_notes",zo="openstation_notes_subscribe",Ho=Io;let Je=!1,he=null;function Oo(o){he=o,!Je&&(Je=!0,Qe.contribute(zo,()=>he?.getHeartbeatSubscription()),Qe.subscribe(Ho,e=>{he?.applyHeartbeatPayload(e)}))}const k=$("openstation/trash-optimistic",()=>({changes:new Map,reconcile:new Set})),Do=o=>`${o.type}:${o.id}`;function et(o){return{subtitle:"",mime:"",preview:"",icon:"",deleted_at:new Date().toISOString(),deleted_by:"",deleted_by_id:0,can_restore:!1,can_purge:!1,edit_link:"",...o}}function tt(o,e="in"){const t=Do(o);if(k.state.changes.get(t)?.pending)return null;const s={item:o,direction:e,pending:!0};return k.state.changes.set(t,s),k.notify(),{async finish(n){k.state.changes.get(t)!==s||!s.pending||(s.pending=!1,n&&(k.notify(),await Promise.allSettled(Array.from(k.state.reconcile,async r=>r()))),k.state.changes.get(t)===s&&(k.state.changes.delete(t),k.notify()))}}}function I(o){const e=window.wp?.os;return typeof e?.showToast!="function"?()=>{}:e.showToast(o)??(()=>{})}function F(){const o=window.wp?.hooks;if(!o)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 o}function Fo(o,e,t,s){F().addFilter(o,e,t,s)}function K(o,e,t,s){F().addAction(o,e,t,s)}function Vo(o,e){return F().removeAction(o,e)}function pe(o,e,...t){return F().applyFilters(o,e,...t)}function ot(o,...e){F().doAction(o,...e)}const G={BROADCAST:"os.broadcast",WINDOW_OPENED:"os.window.opened",WINDOW_CLOSED:"os.window.closed",DOCK_AFTER_RENDER:"os.dock.after-render"},Bo="os.activity.";function fe(o){return Bo+String(o).replace(/[^a-zA-Z0-9_.-]/g,".")}let Uo=0;const Wo={publish(o,e){ot(fe(o),e)},subscribe(o,e){const t=`os/activity-sub/${++Uo}`,s=fe(o);K(s,t,r=>e(r));let n=!1;return()=>{n||(n=!0,Vo(s,t))}},filter(o,e,...t){return pe(fe(o),e,...t)}},jo="os-broadcast";function Xo(o,e){const t=String(pe("os.broadcast.topic",o,{payload:e})??o),s=pe("os.broadcast.payload",e,{topic:t}),n={topic:t,payload:s};document.dispatchEvent(new CustomEvent(jo,{detail:n})),ot(G.BROADCAST,n),Wo.publish(t,s)}function Yo(o,e,t,s=""){const n=(Array.isArray(t)?t:[t]).map(i=>Math.floor(Number(i))).filter(i=>Number.isFinite(i)&&i>0),r=String(o).trim();r===""||n.length===0||Xo(`os.${r}.changed`,{source:s,action:e,ids:n})}function Q(o,e){Yo(ue,o,e,"desktop-mode/notes")}async function qo(o,e){const t=tt(et({id:o.id,type:ue,title:o.text}));if(t){e.onEvict(o.id);try{await So(o.id),Q("trashed",[o.id]),t.finish(!0),I({message:h("Note moved to Trash","desktop-mode"),duration:6e3,action:{label:h("Undo","desktop-mode"),onClick:()=>{const s=tt(et({id:o.id,type:ue,title:o.text}),"out");Ke(o.id).then(n=>{Q("untrashed",[o.id]),e.onRestore(n),s?.finish(!0)}).catch(n=>{s?.finish(!1),console.error("[openstation] notes: restore failed:",n),H(I,n,{fallback:h("Could not restore the note.","desktop-mode"),duration:5e3})})}}})}catch(s){console.error("[openstation] notes: trash failed:",s),t.finish(!1),e.onRestore(o),H(I,s,{fallback:h("Could not move the note to the Trash.","desktop-mode"),duration:5e3})}}}function me(){return window.wp?.os??null}function Zo(o,e){const t=typeof o.editUrl=="string"?o.editUrl:"";let s=!1;if(t)try{const r=e?new URL(e,window.location.href).origin:window.location.origin;s=new URL(t,window.location.href).origin===r}catch{s=!1}if(s)return t;const n=Math.floor(Number(o.postId));return e&&Number.isFinite(n)&&n>0?`${e.endsWith("/")?e:`${e}/`}post.php?post=${n}&action=edit`:t}function Ko(){const o=me()?.config?.adminUrl;if(typeof o=="string"&&o)return o;const e=window.openStationConfig?.adminUrl;return typeof e=="string"&&e?e:void 0}function Go(o){try{const e=me(),t=Zo(o,Ko());if(!t)throw new Error("the convert route returned no edit URL.");if(!e?.windowManager?.open||!e.deriveWindowId)return window.location.href=t,null;const s=e.deriveWindowId(t);return Promise.resolve(e.windowManager.open({id:s,baseId:s,url:t,title:h("Edit draft","desktop-mode"),icon:"dashicons-admin-post"})).catch(n=>{console.error("[openstation] notes: draft editor failed to open:",n)}),s}catch(e){return console.error("[openstation] notes: draft editor failed to open:",e),null}}function Qo(o){return Me(o)==="unreadable"?h("The site sent an unreadable reply while converting the note. Check Posts → Drafts before trying again.","desktop-mode"):Ne(o,{fallback:h("Could not convert the note to a post.","desktop-mode")}).message}async function Jo(o,e){e.onEvict(o.id);let t;try{t=await Po(o.id)}catch(r){console.error("[openstation] notes: convert failed:",r),e.onRestore(o),I({message:Qo(r),type:"error",duration:5e3});return}Q("trashed",[o.id]);const s=Go(t),n=h(s?"Note converted to a draft post":"Note converted to a draft post. Find it under Posts → Drafts.","desktop-mode");I({message:n,duration:6e3,action:{label:h("Undo","desktop-mode"),onClick:()=>{s&&me()?.windowManager?.getById?.(s)?.close?.(),Ke(o.id).then(r=>{Q("untrashed",[o.id]),e.onRestore(r)}).catch(r=>{console.error("[openstation] notes: convert undo failed:",r),H(I,r,{fallback:h("Could not restore the note.","desktop-mode"),duration:5e3})})}}})}const es=Object.freeze({top:0,right:0,bottom:0,left:0});function ts(o,e,t){return{x:t.left,y:t.top,width:Math.max(0,o-t.left-t.right),height:Math.max(0,e-t.top-t.bottom)}}const os="os/work-area";function ss(){return{insets:{...es},rect:{x:0,y:0,width:0,height:0},viewport:{x:0,y:0,width:0,height:0},area:{width:0,height:0}}}const ge=$(os,()=>({snapshot:ss(),installed:!1,areaEl:null}));function ns(o){const e=o??ge.state.areaEl;if(!e)return{...ge.state.snapshot.rect};const t=e.clientWidth||e.getBoundingClientRect().width,s=e.clientHeight||e.getBoundingClientRect().height;return ts(t,s,ge.state.snapshot.insets)}const rs=208,is=1e3,as=800,ls=10,cs=1;function ds(){return window.wp?.os?.dragManager??null}function J(o){return o.seed||Math.abs(o.id)||1}const us='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true" focusable="false"><path d="m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" /></svg>',hs=lo("trash",{size:20});class ps{constructor(e){this.root=null,this.liveRegion=null,this.controllers=new Map,this.zCounter=1,this.highWaterMs=0,this.tempIdCounter=0,this.host=e.host,this.pluginUrl=e.pluginUrl,this.canCreatePosts=e.canCreatePosts??!1,this.onError=e.onError}async boot(){try{const{notes:e}=await Ze();e.forEach(t=>{this.bumpHighWater(t.updatedAtMs),this.upsertNote(t,{animate:"none"})}),Oo(this)}catch(e){e instanceof Error&&console.debug("[openstation] Pinned notes unavailable:",e.message)}}upsertNote(e,t={animate:"none"}){this.ensureRoot(),this.zCounter=Math.max(this.zCounter,e.z);const s=this.controllers.get(e.id);if(s)return s.replace(e),s;const n=new fs({layer:this,note:e});return this.controllers.set(e.id,n),this.root?.appendChild(n.element),t.animate!=="none"&&n.playInsertion(t.animate==="thunk"?1:.7),n}removeNote(e){const t=this.controllers.get(e);t&&(this.controllers.delete(e),t.dispose(),t.element.remove())}rekeyNote(e,t){this.controllers.delete(e),this.controllers.set(t.note.id,t)}has(e){return this.controllers.has(e)}get(e){return this.controllers.get(e)}nextTempId(){return this.tempIdCounter-=1,this.tempIdCounter}bringToFront(e){this.zCounter+=1,e.setZ(this.zCounter)}bumpHighWater(e){Number.isFinite(e)&&e>this.highWaterMs&&(this.highWaterMs=e)}hostSize(){return{width:Math.max(1,this.host.clientWidth),height:Math.max(1,this.host.clientHeight)}}clampPosition(e,t){const{width:s,height:n}=this.hostSize(),r=ns(this.host),i=r.x/s,a=r.y/n,l=Math.max(i,(r.x+r.width-rs)/s),c=Math.max(a,(r.y+r.height-120)/n);return{x:Math.min(l,Math.max(i,e)),y:Math.min(c,Math.max(a,t))}}normalizedFromClient(e,t){const s=this.host.getBoundingClientRect(),{width:n,height:r}=this.hostSize();return this.clampPosition((e-s.left)/n,(t-s.top)/r)}createNoteAt(e){const t=e.text??"",s=ce(e.color??N[0]),n=e.isPublic===!0,{x:r,y:i}=this.clampPosition(e.x,e.y),a=go(t||`${r},${i}`),l=this.nextTempId(),c=this.upsertNote({id:l,text:t,color:s,x:r,y:i,z:1,public:n,seed:a,ownerId:0,ownerName:"",ownerAvatar:"",canEdit:!0,updatedAtMs:0},{animate:"thunk"});return this.bringToFront(c),e.focus&&c.focusEditor(),Mo({text:t,color:s,x:r,y:i,public:n,seed:a}).then(d=>{this.bumpHighWater(d.updatedAtMs),c.replace(d),this.rekeyNote(l,c),c.flushPendingEdits()}).catch(d=>{this.removeNote(l),H(u=>this.notifyError(u),d,{fallback:h("Could not pin the note. Please try again.","desktop-mode")}),console.error("[openstation] notes: create failed:",d)}),c}announce(e){this.ensureRoot(),this.liveRegion&&(this.liveRegion.textContent=e)}notifyError(e){this.onError?.(e)}trashNote(e){qo(e,{onEvict:t=>this.removeNote(t),onRestore:t=>{this.bumpHighWater(t.updatedAtMs),this.upsertNote(t,{animate:"move"})}})}convertNote(e){!this.canCreatePosts||!e.canEdit||Jo(e,{onEvict:t=>this.removeNote(t),onRestore:t=>{this.bumpHighWater(t.updatedAtMs),this.upsertNote(t,{animate:"move"})}})}getHeartbeatSubscription(){return{knownIds:Array.from(this.controllers.keys()).filter(e=>e>0),sinceMs:this.highWaterMs}}applyHeartbeatPayload(e){for(const t of e.notes??[]){this.bumpHighWater(t.updatedAtMs);const s=this.controllers.get(t.id);s?s.shouldReplaceFromRemote(t)&&s.replace(t):this.upsertNote(t,{animate:"move"})}for(const t of e.removed??[])this.removeNote(t);typeof e.serverTimeMs=="number"&&Number.isFinite(e.serverTimeMs)&&this.bumpHighWater(e.serverTimeMs),e.truncated&&this.reloadFromServer()}async reloadFromServer(){try{const{notes:e}=await Ze(),t=new Set;for(const s of e){t.add(s.id),this.bumpHighWater(s.updatedAtMs);const n=this.controllers.get(s.id);n?n.shouldReplaceFromRemote(s)&&n.replace(s):this.upsertNote(s,{animate:"move"})}for(const s of Array.from(this.controllers.keys()))s>0&&!t.has(s)&&this.removeNote(s)}catch{}}ensureRoot(){if(this.root)return this.root;const e=document.createElement("section");e.className="os-notes",e.setAttribute("aria-label",h("Pinned notes","desktop-mode"));const t=document.createElement("div");return t.className="os-notes__live screen-reader-text",t.setAttribute("aria-live","polite"),e.appendChild(t),this.host.appendChild(e),this.root=e,this.liveRegion=t,e}}class fs{constructor(e){this.editor=null,this.statusEl=null,this.colorDot=null,this.visibilityBtn=null,this.saveTimer=null,this.zTimer=null,this.patchChain=Promise.resolve(),this.pendingText=null,this.disposed=!1,this.saveFailureShown=!1,this.moveMode=!1,this.moveOrigin=null,this.dragCleanup=null,this.lastPointer=null,this.layer=e.layer,this.note=e.note,this.jitter=Xe(J(e.note)),this.element=document.createElement("article"),this.paperEl=document.createElement("div"),this.pinEl=document.createElement(this.note.canEdit?"button":"span"),this.paint(),this.applyPosition(),this.setZ(this.note.z),this.element.addEventListener("pointerdown",()=>this.layer.bringToFront(this),{capture:!0})}paint(){const e=this.note;this.element.className="os-pinned-note",this.element.dataset.noteId=String(e.id),this.element.dataset.noteColor=ce(e.color),this.element.dataset.owner=e.canEdit?"me":"other",this.element.setAttribute("role",e.canEdit?"group":"note"),this.element.setAttribute("aria-label",e.canEdit?h("Pinned note","desktop-mode"):z(h("Note by %s","desktop-mode"),e.ownerName)),this.element.style.setProperty("--dm-note-rot",`${this.jitter.rotation}deg`),this.element.style.setProperty("--dm-pin-dx",`${this.jitter.pinOffsetX}px`),this.element.style.setProperty("--dm-pin-rot",`${this.jitter.pinRotation}deg`),this.pinEl.className="os-pinned-note__pin",this.pinEl.appendChild(xo(this.layer.pluginUrl)),e.canEdit?(this.pinEl.setAttribute("type","button"),this.pinEl.setAttribute("aria-pressed","false"),this.pinEl.setAttribute("aria-label",h("Move note. Drag the pin, or press Enter then use the arrow keys.","desktop-mode")),this.pinEl.addEventListener("pointerdown",t=>this.startDrag(t)),this.pinEl.addEventListener("click",t=>{t.detail===0&&!this.moveMode&&this.toggleMoveMode()}),this.pinEl.addEventListener("keydown",t=>this.onPinKeydown(t)),this.pinEl.addEventListener("blur",()=>this.exitMoveMode(!1))):this.pinEl.setAttribute("aria-hidden","true"),this.paperEl.className="os-pinned-note__paper",e.canEdit?this.paintOwnerPaper():this.paintViewerPaper(),this.element.append(this.pinEl,this.paperEl)}paintOwnerPaper(){const e=document.createElement("div");e.className="os-pinned-note__meta";const t=document.createElement("os-save-status");t.setAttribute("mode","icon"),t.setAttribute("phase","idle"),t.className="os-pinned-note__status",this.statusEl=t;const s=document.createElement("button");s.type="button",s.className="os-pinned-note__color-dot",this.colorDot=s,this.refreshColorDot(),s.addEventListener("click",()=>this.cycleColor()),e.append(t,s);const n=document.createElement("div");n.className="os-pinned-note__actions";const r=document.createElement("os-window-button");if(r.className="os-pinned-note__visibility",this.visibilityBtn=r,this.refreshVisibility(),r.addEventListener("os-button-activate",()=>this.togglePublic()),n.appendChild(r),this.layer.canCreatePosts){const d=document.createElement("os-window-button");d.className="os-pinned-note__convert",d.innerHTML=us;const u=h("Convert to a draft post","desktop-mode");d.setAttribute("title",u),d.setAttribute("aria-label",u),d.addEventListener("os-button-activate",()=>this.layer.convertNote(this.note)),n.appendChild(d)}const i=document.createElement("os-window-button");i.className="os-pinned-note__trash",i.innerHTML=hs;const a=h("Move to Trash","desktop-mode");i.setAttribute("title",a),i.setAttribute("aria-label",a),i.addEventListener("os-button-activate",()=>this.confirmTrash()),n.appendChild(i);const l=document.createElement("os-textarea");l.className="os-pinned-note__editor",l.setAttribute("aria-label",h("Note text","desktop-mode")),l.setAttribute("rows","5"),l.setAttribute("auto-grow",""),l.setAttribute("max-rows","10"),l.setAttribute("value",this.note.text),["keydown","keypress","keyup"].forEach(d=>{l.addEventListener(d,u=>u.stopPropagation())}),l.addEventListener("os-input-change",d=>{const u=d.detail;this.pendingText=u.value,this.setPhase("pending"),this.scheduleSave()}),l.addEventListener("os-input-commit",()=>this.flushSave()),this.editor=l;const c=document.createElement("div");c.className="os-pinned-note__footer",c.appendChild(n),this.paperEl.append(e,l,c)}paintViewerPaper(){const e=document.createElement("div");e.className="os-pinned-note__body",e.textContent=this.note.text;const t=document.createElement("div");t.className="os-pinned-note__attribution",t.title=z(h("Pinned by %s","desktop-mode"),this.note.ownerName);const s=document.createElement("os-avatar");s.setAttribute("size","20"),s.setAttribute("name",this.note.ownerName),this.note.ownerAvatar&&s.setAttribute("src",this.note.ownerAvatar);const n=document.createElement("span");n.className="os-pinned-note__attribution-name",n.textContent=this.note.ownerName,t.append(s,n),this.paperEl.append(e,t)}refreshColorDot(){if(!this.colorDot)return;const e=Be(this.note.color);this.colorDot.style.setProperty("--dm-note-next-paper",`var(--dm-note-${e})`),this.colorDot.setAttribute("aria-label",z(h("Change paper color (next: %s)","desktop-mode"),e))}refreshVisibility(){if(!this.visibilityBtn)return;const e=this.note.public;this.visibilityBtn.innerHTML="";const t=document.createElement("span");t.className=`dashicons ${e?"dashicons-admin-site-alt3":"dashicons-lock"}`,t.setAttribute("aria-hidden","true"),this.visibilityBtn.appendChild(t),this.visibilityBtn.setAttribute("title",h(e?"Public note — everyone can see it. Click to make private.":"Private note. Click to share with every desktop user.","desktop-mode")),this.visibilityBtn.classList.toggle("is-public",e)}replace(e){const t=e.id!==this.note.id,s=J(e)!==J(this.note),n=e.color!==this.note.color,r=e.x!==this.note.x||e.y!==this.note.y,i=e.z!==this.note.z;if(this.note=e,i&&(this.element.style.zIndex=String(e.z)),t&&(this.element.dataset.noteId=String(e.id)),s&&(this.jitter=Xe(J(e)),this.element.style.setProperty("--dm-note-rot",`${this.jitter.rotation}deg`),this.element.style.setProperty("--dm-pin-dx",`${this.jitter.pinOffsetX}px`),this.element.style.setProperty("--dm-pin-rot",`${this.jitter.pinRotation}deg`)),n&&(this.element.dataset.noteColor=ce(e.color),this.refreshColorDot()),r&&this.applyPosition(),this.note.canEdit)this.pendingText===null&&this.editor?.setAttribute("value",e.text),this.refreshVisibility();else{const a=this.paperEl.querySelector(".os-pinned-note__body");a&&(a.textContent=e.text)}}shouldReplaceFromRemote(e){return this.pendingText!==null||this.saveTimer!==null?!1:e.updatedAtMs>=this.note.updatedAtMs}setZ(e){this.element.style.zIndex=String(e),!(e===this.note.z||!this.note.canEdit)&&(this.note={...this.note,z:e},!(this.note.id<=0)&&(this.zTimer!==null&&window.clearTimeout(this.zTimer),this.zTimer=window.setTimeout(()=>{this.zTimer=null,this.queuePatch({z:this.note.z})},as)))}applyPosition(){this.element.style.left=`${(this.note.x*100).toFixed(3)}%`,this.element.style.top=`${(this.note.y*100).toFixed(3)}%`}moveTo(e,t){const s=this.layer.clampPosition(e,t);this.note={...this.note,x:s.x,y:s.y},this.applyPosition(),this.note.id>0&&this.queuePatch({x:s.x,y:s.y})}playInsertion(e=1){return ho({pin:this.pinEl,paper:this.paperEl,rippleHost:this.element,restRotation:this.jitter.pinRotation,fallDistance:e>=1?30:12,tempo:e})}focusEditor(){window.setTimeout(()=>this.editor?.focusInput?.(),0)}dispose(){this.disposed=!0,this.saveTimer!==null&&(window.clearTimeout(this.saveTimer),this.saveTimer=null),this.zTimer!==null&&(window.clearTimeout(this.zTimer),this.zTimer=null),this.dragCleanup?.(),this.dragCleanup=null}setPhase(e){this.statusEl?.setAttribute("phase",e)}scheduleSave(){this.saveTimer!==null&&window.clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>{this.saveTimer=null,this.flushSave()},is)}flushPendingEdits(){this.flushSave()}flushSave(){if(this.saveTimer!==null&&(window.clearTimeout(this.saveTimer),this.saveTimer=null),this.pendingText===null||this.note.id<=0)return;const e=this.pendingText;this.pendingText=null,this.note={...this.note,text:e},this.setPhase("saving"),this.queuePatch({text:e})}cycleColor(){const e=Be(this.note.color);this.note={...this.note,color:e},this.element.dataset.noteColor=e,this.refreshColorDot(),this.note.id>0&&this.queuePatch({color:e})}togglePublic(){const e=!this.note.public;this.note={...this.note,public:e},this.refreshVisibility(),e&&!P()&&this.visibilityBtn&&this.visibilityBtn.animate?.([{transform:"scale(1)"},{transform:"scale(1.25)"},{transform:"scale(1)"}],{duration:300,easing:"ease-out"}),this.layer.announce(h(e?"Note is now public.":"Note is now private.","desktop-mode")),this.note.id>0&&this.queuePatch({public:e})}confirmTrash(){io({title:h("Move note to the Trash?","desktop-mode"),message:h("You can restore it from the Trash later.","desktop-mode"),confirmLabel:h("Move to Trash","desktop-mode"),danger:!0}).then(e=>{e&&this.layer.trashNote(this.note)})}queuePatch(e){this.patchChain=this.patchChain.then(async()=>{if(!(this.disposed||this.note.id<=0))try{const t=await No(this.note.id,{...e,updatedAtMs:this.note.updatedAtMs});if(this.disposed)return;const s=t.public!==this.note.public;this.note={...this.note,updatedAtMs:t.updatedAtMs,public:t.public},s&&this.refreshVisibility(),this.setPhase("saved"),this.saveFailureShown=!1}catch(t){if(this.disposed)return;if(To(t)&&t.current){this.pendingText=null,this.replace(t.current),this.setPhase("idle"),this.layer.notifyError({message:h("This note was changed in another session — showing the latest version.","desktop-mode")});return}this.setPhase("failed"),console.error("[openstation] notes: save failed:",t),this.saveFailureShown||(this.saveFailureShown=!0,H(s=>this.layer.notifyError(s),t,{fallback:h("Could not save the note.","desktop-mode")}))}})}startDrag(e){if(!this.note.canEdit||this.note.id<=0)return;const t=ds();if(!t)return;e.preventDefault(),this.element.ownerDocument.defaultView?.getSelection()?.removeAllRanges();const s=this.buildGhost(),n=this.element.getBoundingClientRect(),r={noteId:this.note.id,canEdit:this.note.canEdit,updatedAtMs:this.note.updatedAtMs};t.start({payload:{type:R,source:this.element,data:r,ghost:{element:s.root,offsetX:s.tipX,offsetY:s.tipY,hint:{neutral:h("Drop on the desktop to pin","desktop-mode"),accept:h("Pin here","desktop-mode"),reject:h("Can’t pin here","desktop-mode")}}},origin:e,onClickOnly:()=>{this.teardownDragListeners(),this.toggleMoveMode()},onCancel:()=>{this.teardownDragListeners(),this.snapBack(n)},onCommit:()=>{this.teardownDragListeners(),this.layer.has(this.note.id)&&this.playInsertion(.7)}})&&this.installDragListeners(s)}buildGhost(){const e=this.element.getBoundingClientRect(),s=(this.pinEl.querySelector("img")??this.pinEl).getBoundingClientRect(),n=s.left-e.left+s.width*vo,r=s.top-e.top+s.height*bo,i=document.createElement("div");i.className="os-pinned-note-ghost",i.style.width=`${e.width}px`,i.style.height=`${e.height}px`;const a=document.createElement("div");a.className="os-pinned-note-ghost__swing",a.style.transformOrigin=`${n}px ${r}px`;const l=this.pinEl.cloneNode(!0);l.removeAttribute("aria-pressed"),l.setAttribute("aria-hidden","true");const c=this.paperEl.cloneNode(!0);return c.classList.add("os-pinned-note-ghost__paper"),a.dataset.noteColor=this.element.dataset.noteColor??"",a.append(l,c),i.appendChild(a),{root:i,swing:a,pin:l,paper:c,tipX:n,tipY:r}}installDragListeners(e){this.teardownDragListeners();let t=null;const s=a=>{a.detail?.payload?.data?.noteId===this.note.id&&(t=po(e.swing))},n=a=>{const l=a.detail;this.lastPointer={x:l.clientX,y:l.clientY},t?.onPointerMove(l.clientX)},r=a=>{a.detail?.targetId?.startsWith("recycle-bin")&&(e.root.classList.add("os-pinned-note-ghost--doom"),t?.setBias(6))},i=a=>{a.detail?.targetId?.startsWith("recycle-bin")&&(e.root.classList.remove("os-pinned-note-ghost--doom"),t?.setBias(0))};document.addEventListener(A.START,s),document.addEventListener(A.MOVE,n),document.addEventListener(A.ENTER,r),document.addEventListener(A.LEAVE,i),this.dragCleanup=()=>{t?.stop(),t=null,document.removeEventListener(A.START,s),document.removeEventListener(A.MOVE,n),document.removeEventListener(A.ENTER,r),document.removeEventListener(A.LEAVE,i)}}teardownDragListeners(){this.dragCleanup?.(),this.dragCleanup=null}async snapBack(e){if(!this.lastPointer||P()){this.playInsertion(.63);return}const t=this.buildGhost();t.root.classList.add("os-pinned-note-ghost--flyback"),t.root.style.position="fixed",t.root.style.left=`${this.lastPointer.x-t.tipX}px`,t.root.style.top=`${this.lastPointer.y-t.tipY}px`,t.root.style.zIndex="2147483647",t.root.style.pointerEvents="none",document.body.appendChild(t.root);try{await fo({flyback:t.root,swing:t.swing,homeX:e.left,homeY:e.top})}finally{t.root.remove()}this.playInsertion(.63)}async playCrumpleAt(e,t){const s=this.buildGhost();s.root.classList.add("os-pinned-note-ghost--flyback"),s.root.style.position="fixed",s.root.style.left=`${e-s.tipX}px`,s.root.style.top=`${t-s.tipY}px`,s.root.style.zIndex="2147483647",s.root.style.pointerEvents="none",document.body.appendChild(s.root);try{await mo({clone:s.root,pin:s.pin,paper:s.paper,binX:e,binY:t+24})}finally{s.root.remove()}}toggleMoveMode(){this.moveMode?this.exitMoveMode(!0):this.enterMoveMode()}enterMoveMode(){this.note.canEdit&&(this.moveMode=!0,this.moveOrigin={x:this.note.x,y:this.note.y},this.element.classList.add("os-pinned-note--move-mode"),this.pinEl.setAttribute("aria-pressed","true"),this.layer.announce(h("Moving note. Arrow keys to move, Enter to place, Escape to cancel, Delete to move to the Trash.","desktop-mode")))}exitMoveMode(e){this.moveMode&&(this.moveMode=!1,this.element.classList.remove("os-pinned-note--move-mode"),this.pinEl.setAttribute("aria-pressed","false"),e?(this.moveTo(this.note.x,this.note.y),this.layer.announce(h("Note placed.","desktop-mode")),this.playInsertion(.7)):this.moveOrigin&&(this.note={...this.note,...this.moveOrigin},this.applyPosition()),this.moveOrigin=null)}onPinKeydown(e){if(!this.moveMode)return;const{width:t,height:s}=this.layer.hostSize(),n=e.shiftKey?cs:ls,r=n/t,i=n/s;switch(e.key){case"ArrowLeft":this.nudge(-r,0);break;case"ArrowRight":this.nudge(r,0);break;case"ArrowUp":this.nudge(0,-i);break;case"ArrowDown":this.nudge(0,i);break;case"Enter":case" ":this.exitMoveMode(!0);break;case"Escape":this.exitMoveMode(!1),this.layer.announce(h("Move cancelled.","desktop-mode"));break;case"Delete":case"Backspace":this.exitMoveMode(!1),this.confirmTrash();break;default:return}e.preventDefault(),e.stopPropagation()}nudge(e,t){const s=this.layer.clampPosition(this.note.x+e,this.note.y+t);this.note={...this.note,...s},this.applyPosition()}}const ms=$("desktop-mode/canvas-payload-handlers",()=>({handlers:new Map}));function ve(){return ms.state.handlers}function st(o,e){return ve().set(o,e),()=>{ve().get(o)===e&&ve().delete(o)}}const gs=$("desktop-mode/recycle-bin-payload-handlers",()=>({handlers:new Map}));function be(){return gs.state.handlers}function vs(o,e){return be().set(o,e),()=>{be().get(o)===e&&be().delete(o)}}function nt(o,e,t){const s=o.host.getBoundingClientRect(),n=e.payload.ghost?.offsetX??0,r=e.payload.ghost?.offsetY??0,{width:i,height:a}=o.hostSize();return o.clampPosition((t.clientX-n-s.left)/i,(t.clientY-r-s.top)/a)}function bs(o,e,t){const s=e.payload.data,n=String(s.text??"");if(!n.trim())return;const{x:r,y:i}=nt(o,e,t);o.createNoteAt({x:r,y:i,text:n,color:String(s.color??""),isPublic:s.isPublic===!0})}function ys(o,e,t){const s=e.payload.data,n=o.get(s.noteId);if(!n)return;const{x:r,y:i}=nt(o,e,t);n.moveTo(r,i)}function ws(o){const e=[],t=s=>s.folderId===0;return e.push(st($o,{accept:(s,n)=>t(n)&&!!String(s.text??"").trim(),onDrop:(s,n)=>bs(o,s,n)})),e.push(st(R,{accept:(s,n)=>t(n)&&s.canEdit===!0,onDrop:(s,n)=>ys(o,s,n)})),e.push(vs(R,{accept:s=>s.canEdit===!0,onDrop:(s,n)=>{const r=s.payload.data,i=o.get(r.noteId);if(!i)return;const a=i.note;i.playCrumpleAt(n.clientX,n.clientY),o.trashNote(a)}})),()=>{e.forEach(s=>s())}}const _s=$("desktop-mode/tile-payload-handlers",()=>({handlers:new Map}));function ee(){return _s.state.handlers}function xs(o,e){const t=ee().get(o);return t?t.push(e):ee().set(o,[e]),()=>{const s=ee().get(o);if(!s)return;const n=s.indexOf(e);n!==-1&&s.splice(n,1),s.length===0&&ee().delete(o)}}const ye="data-os-posts-drop-active",rt="desktop-mode-posts",ks='.os-dock__item[data-menu-slug="menu-posts"],.os-dock__item[data-menu-slug="editphp"]',Es="[data-os-posts-root]";function Cs(){return window.wp?.os?.dragManager??null}function As(o){return o.type!==R?!1:o.data.canEdit===!0}function Ts(o){if(!o)return!1;let e=o,t="";try{const r=new URL(o,window.location.origin);e=r.pathname,t=r.search}catch{}if(!(/(?:^|\/)(?:edit\.php|post-new\.php)$/.test(e)||!e.includes("/")&&(e==="edit.php"||e==="post-new.php")))return!1;const n=new URLSearchParams(t).get("post_type");return!n||n==="post"}function Ms(o){const e=o.placement.file;if(!e||e.type!=="shortcut")return!1;const t=typeof e.shortcutUrl=="string"?e.shortcutUrl:"";return Ts(t)}function it(o,e){if(e.payload.type!==R)return;const t=e.payload.data;if(typeof t.noteId!="number")return;const s=o.get(t.noteId);s&&o.convertNote(s.note)}let at=!1,V=null,B=null,lt=null;function ct(o,e,t,s){return o.registerDropTarget({id:t,element:s,acceptLabel:h("Convert to post","desktop-mode"),accept:n=>As(n),onEnter:()=>{s.setAttribute(ye,"")},onLeave:()=>{s.removeAttribute(ye)},onDrop:n=>{s.removeAttribute(ye),it(e,n)}})}function Ns(o,e){const t=o.debug().listTargets().find(s=>s.id===e);return t?t.element:null}function Ss(o){if(at||!o.canCreatePosts)return;const e=Cs();if(!e)return;at=!0,xs(R,{appliesTo:s=>Ms(s),acceptLabel:h("Convert to post","desktop-mode"),accept:s=>s.canEdit===!0,onDrop:s=>it(o,s)});const t=()=>{const s=document.querySelector(ks);if(!(s instanceof HTMLElement)){V?.(),V=null;return}V&&Ns(e,"notes-convert-dock")===s||(V?.(),V=ct(e,o,"notes-convert-dock",s))};t(),K(G.DOCK_AFTER_RENDER,"desktop-mode/notes/convert-dock-target",t),typeof MutationObserver<"u"&&(lt=new MutationObserver(()=>{t()}),lt.observe(document.body,{childList:!0,subtree:!0})),K(G.WINDOW_OPENED,"desktop-mode/notes/convert-window-target",s=>{if(s.windowId!==rt)return;B?.(),B=null;const n=document.querySelector(Es);n instanceof HTMLElement&&(B=ct(e,o,"notes-convert-window",n))}),K(G.WINDOW_CLOSED,"desktop-mode/notes/convert-window-cleanup",s=>{s.windowId===rt&&(B?.(),B=null)})}const dt="new-note";function Ps(o){Fo("os.wallpaper-context-menu","desktop-mode/notes",(e,t)=>{if(!Array.isArray(e)||e.some(r=>r.id===dt))return e;const{x:s,y:n}=t??{x:0,y:0};return[...e,{id:dt,label:h("New note","desktop-mode"),icon:"dashicons-edit-page",sort:14,onClick:()=>{const r=o.normalizedFromClient(s,n);o.createNoteAt({...r,focus:!0})}}]})}function Ls(o){const e=o.config.notesUrl;if(typeof e!="string"||!e)return null;Co({baseUrl:e,nonce:o.config.restNonce??""});const t=new ps({host:o.host,pluginUrl:o.config.pluginUrl??"",canCreatePosts:o.config.canCreatePosts??!1,onError:o.onError});return ws(t),Ss(t),Ps(t),document.addEventListener(Ro,s=>{const n=s.detail?.note;if(n&&typeof n.id=="number"){t.bumpHighWater(n.updatedAtMs);const r=t.upsertNote(n,{animate:"thunk"});t.bringToFront(r),r.focusEditor()}}),t.boot(),t}window.openStationNotes={boot:Ls}})(); | |