| @@ -1,63 +1,76 @@ | ||
| 1 | -var openStationApp_comments=function(w){"use strict";const le="desktop-mode";function U(){return window.wp?.i18n}function l(t,e=le){return U()?.__(t,e)??t}function P(t,...e){const n=U()?.sprintf;if(n)return n(t,...e);let o=0;return t.replace(/%(?:(\d+)\$)?[sd]/g,(s,i)=>{const r=i?Number.parseInt(i,10)-1:o++;return String(e[r]??"")})}function p(t,...e){return{__wpdHtml:!0,strings:t,values:e}}function ce(t){return!!t&&t.__wpdHtml===!0}const de="$$wpd$$",b=/\$\$wpd\$\$(\d+)\$\$/g,ue="$$wpd-node$$",pe=/^\$\$wpd-node\$\$(\d+)\$\$$/,he=new Set(["style","script","textarea","title"]);function me(t){let e="",n=!1,o=null,s=!1,i=null,r="",c=!1;for(let d=0;d<t.length;d++){const u=t[d];e+=u;for(let m=0;m<u.length;m++){const f=u[m];if(s){u.startsWith("-->",m)&&(s=!1,m+=2);continue}if(i!==null){f==="<"&&u[m+1]==="/"&&u.slice(m+2,m+2+i.length).toLowerCase()===i&&(m+=1+i.length,i=null,n=!0,c=!1,r="");continue}if(o!==null){f===o&&(o=null);continue}if(n){f==='"'||f==="'"?(o=f,c=!1):f===">"?(n=!1,c=!1,he.has(r)&&(i=r),r=""):c&&(/[a-zA-Z0-9-]/.test(f)?r+=f.toLowerCase():c=!1);continue}if(u.startsWith("<!--",m)){s=!0,m+=3;continue}const v=u[m+1]??"";f==="<"&&/[a-zA-Z/!]/.test(v)&&(n=!0,r="",c=/[a-zA-Z]/.test(v))}d<t.length-1&&(e+=n||s||i!==null?`${de}${d}$$`:`<!--${ue}${d}$$-->`)}return e}const F=new WeakMap;function q(t){const e=F.get(t);if(e)return e;const n=document.createElement("template");n.innerHTML=me(t);const o=[],s=(c,d)=>{if(c.nodeType===Node.ELEMENT_NODE){const f=c;for(const v of Array.from(f.attributes)){const _=v.name,h=v.value,g=_[0];if(b.test(h))if(b.lastIndex=0,g==="@"){const $=b.exec(h);b.lastIndex=0,o.push({path:d,kind:"event",name:_.slice(1),valueIndex:$?Number($[1]):0}),f.removeAttribute(_)}else if(g==="."){const $=b.exec(h);b.lastIndex=0,o.push({path:d,kind:"prop",name:_.slice(1),valueIndex:$?Number($[1]):0}),f.removeAttribute(_)}else if(g==="?"){const $=b.exec(h);b.lastIndex=0,o.push({path:d,kind:"bool",name:_.slice(1),valueIndex:$?Number($[1]):0}),f.removeAttribute(_)}else{const $=[],y=[];let k=0,M;for(b.lastIndex=0;(M=b.exec(h))!==null;)$.push(h.slice(k,M.index)),y.push(Number(M[1])),k=M.index+M[0].length;$.push(h.slice(k)),o.push({path:d,kind:"attr",name:_,template:$,valueIndices:y}),f.setAttribute(_,"")}}}const u=Array.from(c.childNodes);let m=0;for(let f=0;f<u.length;f++){const v=u[f],_=f+m;if(v.nodeType===Node.COMMENT_NODE){const h=pe.exec(v.data);if(h){const g=document.createTextNode("");v.parentNode.replaceChild(g,v),o.push({path:[...d,_],kind:"node",valueIndex:Number(h[1])})}continue}if(v.nodeType===Node.TEXT_NODE){const h=v.textContent||"";if(!b.test(h)){b.lastIndex=0;continue}b.lastIndex=0;const g=v.parentNode;let $=0,y;const k=[],M=[];for(b.lastIndex=0;(y=b.exec(h))!==null;){y.index>$&&k.push(document.createTextNode(h.slice($,y.index)));const D=document.createTextNode("");k.push(D),M.push({path:[...d,_+k.length-1],kind:"node",valueIndex:Number(y[1])}),$=y.index+y[0].length}$<h.length&&k.push(document.createTextNode(h.slice($)));for(const D of k)g.insertBefore(D,v);g.removeChild(v),m+=k.length-1,o.push(...M)}else s(v,[...d,_])}};s(n.content,[]);const r={template:n,buildParts:c=>{const d=[];for(const u of o){let m=c;for(const f of u.path)m=m.childNodes[f];u.kind==="node"?d.push({kind:"node",valueIndex:u.valueIndex,child:{anchor:m,state:null}}):u.kind==="attr"?d.push({kind:"attr",element:m,name:u.name,template:u.template,valueIndices:u.valueIndices}):u.kind==="event"?d.push({kind:"event",valueIndex:u.valueIndex,element:m,name:u.name}):u.kind==="prop"?d.push({kind:"prop",valueIndex:u.valueIndex,element:m,name:u.name}):u.kind==="bool"&&d.push({kind:"bool",valueIndex:u.valueIndex,element:m,name:u.name})}return d}};return F.set(t,r),r}const W=new WeakMap;function fe(t,e){for(const n of t.nodes)if(n.parentNode!==e)return!1;return!0}function ve(t,e){const n=W.get(e);if(n&&n.strings===t.strings&&fe(n,e)){N(n.parts,t.values);return}const o=q(t.strings),s=o.template.content.cloneNode(!0),i=o.buildParts(s),r=Array.from(s.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(s),N(i,t.values),W.set(e,{strings:t.strings,parts:i,nodes:r})}function N(t,e){for(const n of t)if(n.kind==="node")S(n.child,e[n.valueIndex]);else if(n.kind==="attr"){let o=n.template[0];for(let s=0;s<n.valueIndices.length;s++)o+=K(e[n.valueIndices[s]]),o+=n.template[s+1];o!==n.last&&(n.last=o,o===""?n.element.removeAttribute(n.name):n.element.setAttribute(n.name,o))}else if(n.kind==="event"){const o=e[n.valueIndex];o!==n.current&&(n.current&&n.element.removeEventListener(n.name,n.current),o&&n.element.addEventListener(n.name,o),n.current=o)}else if(n.kind==="prop"){const o=e[n.valueIndex];o!==n.last&&(n.last=o,n.element[n.name]=o)}else if(n.kind==="bool"){const o=!!e[n.valueIndex];o!==n.last&&(n.last=o,o?n.element.setAttribute(n.name,""):n.element.removeAttribute(n.name))}}function S(t,e){if(e==null||e===!1){t.state&&(C(t.state),t.state=null);return}if(Array.isArray(e)){be(t,e);return}if(ce(e)){_e(t,e);return}if(e instanceof Node){$e(t,e);return}ge(t,K(e))}function $e(t,e){const n=t.state;n?.shape==="node"&&n.node===e||(n&&C(n),x(t,[e]),t.state={shape:"node",node:e})}function ge(t,e){const n=t.state;if(n?.shape==="text"){n.text!==e&&(n.node.textContent=e,n.text=e);return}n&&C(n);const o=document.createTextNode(e);x(t,[o]),t.state={shape:"text",node:o,text:e}}function _e(t,e){const n=t.state;if(n?.shape==="template"&&n.strings===e.strings){N(n.parts,e.values);return}n&&C(n);const o=q(e.strings),s=o.template.content.cloneNode(!0),i=o.buildParts(s),r=Array.from(s.childNodes);x(t,[s]),N(i,e.values),t.state={shape:"template",strings:e.strings,parts:i,nodes:r}}function be(t,e){const n=t.state;if(n?.shape==="array"){const s=Math.min(n.entries.length,e.length);for(let i=0;i<s;i++)S(n.entries[i],e[i]);if(e.length<n.entries.length){for(let i=e.length;i<n.entries.length;i++){const r=n.entries[i];r.state&&C(r.state),r.anchor.remove()}n.entries.length=e.length}else for(let i=n.entries.length;i<e.length;i++){const r=document.createTextNode("");x(t,[r]);const c={anchor:r,state:null};S(c,e[i]),n.entries.push(c)}return}n&&C(n);const o=[];for(const s of e){const i=document.createTextNode("");x(t,[i]);const r={anchor:i,state:null};S(r,s),o.push(r)}t.state={shape:"array",entries:o}}function x(t,e){const n=t.anchor.parentNode;if(n)for(const o of e)n.insertBefore(o,t.anchor)}function C(t){if(t.shape==="text"){t.node.remove();return}if(t.shape==="template"){for(const e of t.parts)e.kind==="node"&&e.child.state&&(C(e.child.state),e.child.state=null);for(const e of t.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(t.shape==="node"){t.node.parentNode&&t.node.parentNode.removeChild(t.node);return}for(const e of t.entries)e.state&&C(e.state),e.anchor.remove()}function K(t){return t==null||t===!1?"":String(t)}function ye(){let t="";const e=new Map;let n=0,o=1,s=0,i=!1,r=!0,c=null,d,u=async()=>{},m=()=>{};const f=()=>{const h=[],g=new Set;for(const $ of Array.from(e.keys()).sort((y,k)=>y-k))for(const y of e.get($)??[])g.has(y.id)||(g.add(y.id),h.push(y));return h},v=()=>o>Math.max(...Array.from(e.keys()),1),_=h=>{!h.some(g=>g.isIntersecting)||i||!r||(r=!1,i=!0,s=Math.max(1,...Array.from(e.keys()))+1,m(),u().finally(()=>{i=!1,s=0,m()}))};return{accumulate(h,g){return g?(t!==h&&(t=h,e.clear()),e.set(g.page,g.items),n=g.total,o=g.pages,f()):(t="",e.clear(),n=0,o=1,[])},items:f,get total(){return n},get pageCount(){return o},get loadingPage(){return s},hasMore:v,ghosts(h){return s===0||e.has(s)||!v()?0:Math.max(1,Math.min(h,n-f().length))},sync(h){u=h.load,m=h.repaint,!d&&typeof IntersectionObserver<"u"&&(d=new IntersectionObserver(_)),d?.disconnect(),h.sentinel&&d?.observe(h.sentinel),h.canvas!==c&&(c=h.canvas,c?.addEventListener("scroll",()=>{r=!0},{passive:!0})),c&&c.scrollHeight<=c.clientHeight+4&&(r=!0)},dispose(){d?.disconnect(),d=void 0}}}function ke(t,e){const n=e.local??{},o={id:t,hasLocal:r=>Object.prototype.hasOwnProperty.call(n,r),runLocal:(r,c,d,u)=>{const m=n[r];if(!m)return c;const f={...c},v=m(f,d,u);return v===void 0?f:v},render:r=>{ve(e.view(r),r.root),e.updated?.(r)},mounted:r=>e.mounted?.(r)},{placeholder:s}=e;s&&(o.placeholder=r=>s(r));const i=window;return(i.openStationApps??(i.openStationApps={}))[t]=o,o}const R=new Map;async function we(t){if(!t)return null;let e;try{e=new URL(t,window.location.href)}catch{return t}if(!/gravatar\.com$/i.test(e.hostname))return t;e.searchParams.delete("d"),e.searchParams.delete("s");const n=e.toString(),o=R.get(n);if(o!==void 0)return o instanceof Promise,o;const s=new URL(t,window.location.href);s.searchParams.set("d","blank");const i=new Promise(r=>{const c=new Image;c.crossOrigin="anonymous",c.onload=()=>{try{const d=document.createElement("canvas");d.width=1,d.height=1;const u=d.getContext("2d",{willReadFrequently:!0});if(!u){r(t);return}u.drawImage(c,0,0,1,1);const m=u.getImageData(0,0,1,1).data;r(m[3]===0?null:t)}catch{r(t)}},c.onerror=()=>r(null),c.src=s.toString()}).then(r=>(R.set(n,r),r));return R.set(n,i),i}function Q(t){return t?.["48"]??t?.["96"]??t?.["24"]??""}function Ce(t,e){e&&we(e).then(n=>{t.isConnected&&(n?t.setAttribute("src",n):t.removeAttribute("src"))})}function Me(){return window.wp?.os?.config?.adminUrl||"/wp-admin/"}function A(t){const e=document.createElement("textarea");return e.innerHTML=t,e.value}const a="os-comments";function E(t){const e=String(t.status);return e==="approve"||e==="approved"||e==="1"?"approved":e==="hold"||e==="0"||e==="unapproved"?"hold":e}function X(t){switch(t){case"approved":return l("Approved");case"hold":return l("Pending");case"spam":return l("Spam");case"trash":return l("Trash");default:return t}}function z(t){switch(t){case"approved":return"success";case"hold":return"warning";case"spam":return"danger";default:return"neutral"}}function G(t,e=!1){const n=X(t);return e?p`<os-badge class="${a}__status" tone=${z(t)} title=${n}> | |
| 2 | - <span class="screen-reader-text">${n}</span> | |
| 3 | - </os-badge>`:p`<os-badge class="${a}__msg-status" tone=${z(t)}>${n}</os-badge>`}function Y(t,e,n=!1){return p`<os-relative-time class=${e} datetime=${t} ?compact=${n}></os-relative-time>`}function Z(t){return typeof t.content?.raw=="string"?t.content.raw:A((t.content?.rendered??"").replace(/<[^>]*>/g," "))}function J(t){return Z(t).replace(/\s+/g," ").trim()}function O(t){return t?.author_name||l("Anonymous")}function ee(t,e){const n=Q(t.author_avatar_urls);return p`<os-avatar | |
| 1 | +var openStationApp_comments=function(w){"use strict";function h(n,...e){return{__wpdHtml:!0,strings:n,values:e}}function be(n){return!!n&&n.__wpdHtml===!0}const $e="$$wpd$$",_=/\$\$wpd\$\$(\d+)\$\$/g,_e="$$wpd-node$$",ye=/^\$\$wpd-node\$\$(\d+)\$\$$/,ke=new Set(["style","script","textarea","title"]);function we(n){let e="",t=!1,s=null,o=!1,i=null,r="",c=!1;for(let d=0;d<n.length;d++){const u=n[d];e+=u;for(let m=0;m<u.length;m++){const f=u[m];if(o){u.startsWith("-->",m)&&(o=!1,m+=2);continue}if(i!==null){f==="<"&&u[m+1]==="/"&&u.slice(m+2,m+2+i.length).toLowerCase()===i&&(m+=1+i.length,i=null,t=!0,c=!1,r="");continue}if(s!==null){f===s&&(s=null);continue}if(t){f==='"'||f==="'"?(s=f,c=!1):f===">"?(t=!1,c=!1,ke.has(r)&&(i=r),r=""):c&&(/[a-zA-Z0-9-]/.test(f)?r+=f.toLowerCase():c=!1);continue}if(u.startsWith("<!--",m)){o=!0,m+=3;continue}const v=u[m+1]??"";f==="<"&&/[a-zA-Z/!]/.test(v)&&(t=!0,r="",c=/[a-zA-Z]/.test(v))}d<n.length-1&&(e+=t||o||i!==null?`${$e}${d}$$`:`<!--${_e}${d}$$-->`)}return e}const X=new WeakMap;function G(n){const e=X.get(n);if(e)return e;const t=document.createElement("template");t.innerHTML=we(n);const s=[],o=(c,d)=>{if(c.nodeType===Node.ELEMENT_NODE){const f=c;for(const v of Array.from(f.attributes)){const $=v.name,p=v.value,b=$[0];if(_.test(p))if(_.lastIndex=0,b==="@"){const g=_.exec(p);_.lastIndex=0,s.push({path:d,kind:"event",name:$.slice(1),valueIndex:g?Number(g[1]):0}),f.removeAttribute($)}else if(b==="."){const g=_.exec(p);_.lastIndex=0,s.push({path:d,kind:"prop",name:$.slice(1),valueIndex:g?Number(g[1]):0}),f.removeAttribute($)}else if(b==="?"){const g=_.exec(p);_.lastIndex=0,s.push({path:d,kind:"bool",name:$.slice(1),valueIndex:g?Number(g[1]):0}),f.removeAttribute($)}else{const g=[],y=[];let k=0,M;for(_.lastIndex=0;(M=_.exec(p))!==null;)g.push(p.slice(k,M.index)),y.push(Number(M[1])),k=M.index+M[0].length;g.push(p.slice(k)),s.push({path:d,kind:"attr",name:$,template:g,valueIndices:y}),f.setAttribute($,"")}}}const u=Array.from(c.childNodes);let m=0;for(let f=0;f<u.length;f++){const v=u[f],$=f+m;if(v.nodeType===Node.COMMENT_NODE){const p=ye.exec(v.data);if(p){const b=document.createTextNode("");v.parentNode.replaceChild(b,v),s.push({path:[...d,$],kind:"node",valueIndex:Number(p[1])})}continue}if(v.nodeType===Node.TEXT_NODE){const p=v.textContent||"";if(!_.test(p)){_.lastIndex=0;continue}_.lastIndex=0;const b=v.parentNode;let g=0,y;const k=[],M=[];for(_.lastIndex=0;(y=_.exec(p))!==null;){y.index>g&&k.push(document.createTextNode(p.slice(g,y.index)));const Q=document.createTextNode("");k.push(Q),M.push({path:[...d,$+k.length-1],kind:"node",valueIndex:Number(y[1])}),g=y.index+y[0].length}g<p.length&&k.push(document.createTextNode(p.slice(g)));for(const Q of k)b.insertBefore(Q,v);b.removeChild(v),m+=k.length-1,s.push(...M)}else o(v,[...d,$])}};o(t.content,[]);const r={template:t,buildParts:c=>{const d=[];for(const u of s){let m=c;for(const f of u.path)m=m.childNodes[f];u.kind==="node"?d.push({kind:"node",valueIndex:u.valueIndex,child:{anchor:m,state:null}}):u.kind==="attr"?d.push({kind:"attr",element:m,name:u.name,template:u.template,valueIndices:u.valueIndices}):u.kind==="event"?d.push({kind:"event",valueIndex:u.valueIndex,element:m,name:u.name}):u.kind==="prop"?d.push({kind:"prop",valueIndex:u.valueIndex,element:m,name:u.name}):u.kind==="bool"&&d.push({kind:"bool",valueIndex:u.valueIndex,element:m,name:u.name})}return d}};return X.set(n,r),r}const Y=new WeakMap;function xe(n,e){for(const t of n.nodes)if(t.parentNode!==e)return!1;return!0}function J(n,e){const t=Y.get(e);if(t&&t.strings===n.strings&&xe(t,e)){I(t.parts,n.values);return}const s=G(n.strings),o=s.template.content.cloneNode(!0),i=s.buildParts(o),r=Array.from(o.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(o),I(i,n.values),Y.set(e,{strings:n.strings,parts:i,nodes:r})}function I(n,e){for(const t of n)if(t.kind==="node")V(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let s=t.template[0];for(let o=0;o<t.valueIndices.length;o++)s+=ee(e[t.valueIndices[o]]),s+=t.template[o+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 V(n,e){if(e==null||e===!1){n.state&&(x(n.state),n.state=null);return}if(Array.isArray(e)){Ae(n,e);return}if(be(e)){Se(n,e);return}if(e instanceof Node){Ce(n,e);return}Me(n,ee(e))}function Ce(n,e){const t=n.state;t?.shape==="node"&&t.node===e||(t&&x(t),S(n,[e]),n.state={shape:"node",node:e})}function Me(n,e){const t=n.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&x(t);const s=document.createTextNode(e);S(n,[s]),n.state={shape:"text",node:s,text:e}}function Se(n,e){const t=n.state;if(t?.shape==="template"&&t.strings===e.strings){I(t.parts,e.values);return}t&&x(t);const s=G(e.strings),o=s.template.content.cloneNode(!0),i=s.buildParts(o),r=Array.from(o.childNodes);S(n,[o]),I(i,e.values),n.state={shape:"template",strings:e.strings,parts:i,nodes:r}}function Ae(n,e){const t=n.state;if(t?.shape==="array"){const o=Math.min(t.entries.length,e.length);for(let i=0;i<o;i++)V(t.entries[i],e[i]);if(e.length<t.entries.length){for(let i=e.length;i<t.entries.length;i++){const r=t.entries[i];r.state&&x(r.state),r.anchor.remove()}t.entries.length=e.length}else for(let i=t.entries.length;i<e.length;i++){const r=document.createTextNode("");S(n,[r]);const c={anchor:r,state:null};V(c,e[i]),t.entries.push(c)}return}t&&x(t);const s=[];for(const o of e){const i=document.createTextNode("");S(n,[i]);const r={anchor:i,state:null};V(r,o),s.push(r)}n.state={shape:"array",entries:s}}function S(n,e){const t=n.anchor.parentNode;if(t)for(const s of e)t.insertBefore(s,n.anchor)}function x(n){if(n.shape==="text"){n.node.remove();return}if(n.shape==="template"){for(const e of n.parts)e.kind==="node"&&e.child.state&&(x(e.child.state),e.child.state=null);for(const e of n.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(n.shape==="node"){n.node.parentNode&&n.node.parentNode.removeChild(n.node);return}for(const e of n.entries)e.state&&x(e.state),e.anchor.remove()}function ee(n){return n==null||n===!1?"":String(n)}const C=class C 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(ne)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,s){if(t===s)return;const o=ze(e);this._propValues[o]=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(o=>String(o).trim()).filter(o=>o!=="");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=ne(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(s),set:o=>{let i;o==null||o===!1?i=null:o===!0?i="":i=String(o),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&&J(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 o=document.createElement("style");o.textContent=s.cssText,this.shadowRoot.appendChild(o)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!C._lightStylesAdopted.has(e)){C._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)}}}};C.props=[],C.styles=[],C.shadow=!0,C._lightStylesAdopted=new WeakSet;let R=C;function te(n,e){customElements.get(n)||customElements.define(n,e)}function ne(n){return n.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function ze(n){return n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const Te=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function se(n,...e){let t=n[0];for(let s=1;s<n.length;s++){const o=e[s-1];if(typeof o=="string"||typeof o=="number")t+=String(o);else if(o&&o.__wpdCss)t+=o.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof o);t+=n[s]}if(Te){const s=new CSSStyleSheet;return s.replaceSync(t),{__wpdCss:!0,sheet:s,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}const Ee=se`:host{display:grid;grid-template-rows:auto auto minmax( 0,1fr ) auto;flex:1 1 auto;min-inline-size:0;min-block-size:0;block-size:100%;overflow:hidden}:host( [ hidden ] ){display:none}.content{min-inline-size:0;min-block-size:0;overflow:auto}:host( [ contained ] ) .content{display:flex;flex-direction:column;overflow:hidden}::slotted( * ){min-inline-size:0}:host( [ contained ] ) slot:not( [ name ] )::slotted( * ){flex:1 1 auto;min-block-size:0}`,E=class E extends R{render(){return h`<div><slot name="header"></slot></div> | |
| 2 | + <div><slot name="toolbar"></slot></div> | |
| 3 | + <div class="content" part="content"><slot></slot></div> | |
| 4 | + <div><slot name="footer"></slot></div>`}};E.props=["contained"],E.styles=[Ee],E.help=void 0;let Z=E;te("os-app-frame",Z);const Ne="desktop-mode";function oe(){return window.wp?.i18n}function l(n,e=Ne){return oe()?.__(n,e)??n}function U(n,...e){const t=oe()?.sprintf;if(t)return t(n,...e);let s=0;return n.replace(/%(?:(\d+)\$)?[sd]/g,(o,i)=>{const r=i?Number.parseInt(i,10)-1:s++;return String(e[r]??"")})}const Ie=se`:host{display:flex;flex:1 1 auto;min-inline-size:0;min-block-size:0;overflow:hidden}:host( [ hidden ] ){display:none}.layout{display:grid;flex:1;min-inline-size:0;min-block-size:0;grid-template-columns:minmax( 0,var( --_split-start,35% ) ) auto minmax( 0,1fr );grid-template-rows:minmax( 0,1fr )}.pane{display:flex;flex-direction:column;min-inline-size:0;min-block-size:0;overflow:auto}::slotted( * ){flex:1 1 auto;min-inline-size:0;min-block-size:0}.divider{inline-size:0;outline:none}.divider.enabled{position:relative;inline-size:8px;cursor:col-resize;touch-action:none;user-select:none}.divider.enabled::before,.divider.enabled::after{content:'';position:absolute;inset-inline:0;margin-inline:auto;inset-block-start:50%;transform:translateY( -50% );pointer-events:none;transition:background-color 120ms ease}.divider.enabled::before{inline-size:1px;block-size:100%;background:var( --os-ui-border,#dcdcde );opacity:0.65}.divider.enabled::after{inline-size:3px;block-size:28px;border-radius:999px;background:var( --os-ui-fg-faint,#787c82 )}.divider.enabled:hover::after,.divider.dragging::after,.divider:focus-visible::after{background:var( --os-ui-accent,#2271b1 )}.divider:focus-visible{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:-2px;border-radius:4px}:host( [ direction='vertical' ] ) .layout{grid-template-columns:minmax( 0,1fr );grid-template-rows:minmax( 0,var( --_split-start,35% ) ) auto minmax( 0,1fr )}:host( [ direction='vertical' ] ) .divider.enabled{inline-size:auto;block-size:8px;cursor:row-resize}:host( [ direction='vertical' ] ) .divider.enabled::before{inline-size:100%;block-size:1px}:host( [ direction='vertical' ] ) .divider.enabled::after{inline-size:28px;block-size:3px}:host .layout.compact{grid-template-columns:minmax( 0,1fr );grid-template-rows:minmax( 0,1fr ) minmax( 0,1fr )}.layout.compact .divider{display:none}:host .layout.compact.start,:host .layout.compact.end{grid-template-rows:minmax( 0,1fr )}.layout.compact.start .end,.layout.compact.end .start{display:none}.shield{position:fixed;inset:0;z-index:2147483647;cursor:col-resize}:host( [ direction='vertical' ] ) .shield{cursor:row-resize}.shield[hidden]{display:none}@media ( prefers-reduced-motion:reduce ){.divider.enabled::before,.divider.enabled::after{transition:none}}`,N=class N extends R{constructor(){super(...arguments),this.observer=null,this.width=0,this.height=0,this.drag=null,this.onDown=e=>{if(!this.enabled()||e.button!==0||this.drag||this.extent()<=0)return;e.preventDefault();const t=e.currentTarget;t.focus(),this.drag={id:e.pointerId,origin:this.coordinate(e),last:this.coordinate(e),position:this.positionValue(),initial:this.positionValue(),target:t},t.setPointerCapture(e.pointerId),this.requestUpdate()},this.onMove=e=>{this.drag?.id===e.pointerId&&(this.drag.last=this.coordinate(e),this.setPosition(this.drag.position+(this.coordinate(e)-this.drag.origin)*this.sign()/Math.max(1,this.extent())*100))},this.cancelDrag=()=>this.finishDrag(!1),this.onCancel=e=>{this.drag?.id===e.pointerId&&this.cancelDrag()},this.onLostCapture=e=>{this.drag?.id===e.pointerId&&this.finishDrag(!0)},this.onUp=e=>{this.drag?.id===e.pointerId&&(this.onMove(e),this.finishDrag(!0))},this.onKey=e=>{if(!this.enabled())return;if(e.key==="Escape"&&this.drag){e.preventDefault(),this.cancelDrag();return}const[t,s]=this.bounds(),o=this.positionValue(),i=e.shiftKey?10:2,r=this.isVertical()?"ArrowDown":"ArrowRight",c=this.isVertical()?"ArrowUp":"ArrowLeft";let d=o;if(e.key==="Home")d=t;else if(e.key==="End")d=s;else if(e.key===r||e.key===c)d+=i*this.sign()*(e.key===r?1:-1);else return;e.preventDefault(),this.setPosition(d),o!==this.positionValue()&&this.emit("os-split-change",{position:this.positionValue()})}}connectedCallback(){super.connectedCallback(),typeof ResizeObserver<"u"&&(this.observer=new ResizeObserver(e=>{const{width:t,height:s}=e[0].contentRect;if(t===this.width&&s===this.height)return;const o=this.positionValue();this.width=t,this.height=s,this.isCompact()?this.cancelDrag():this.drag&&(this.setPosition(o),this.drag.origin=this.drag.last,this.drag.position=this.positionValue()),this.requestUpdate()}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.observer=null,this.cancelDrag()}attributeChangedCallback(e,t,s){t!==s&&e==="direction"&&this.cancelDrag(),super.attributeChangedCallback(e,t,s)}number(e,t){const s=this.getAttribute(e),o=s===null||s.trim()===""?NaN:Number(s);return Number.isFinite(o)&&o>=0?o:t}isVertical(){return this.getAttribute("direction")==="vertical"}isCompact(){const e=this.number("collapse-at",600);return this.hasAttribute("compact")||!this.isVertical()&&e>0&&this.width>0&&this.width<=e}extent(){return Math.max(0,(this.isVertical()?this.height:this.width)-(this.hasAttribute("resizable")?8:0))}bounds(){const e=this.extent();if(e<=0)return[0,100];const t=this.number("min-start",160),s=this.number("min-end",160),o=t+s,i=o>e?e/o:1;return[t*i/e*100,100-s*i/e*100]}positionValue(){const[e,t]=this.bounds();return Math.min(t,Math.max(e,this.number("position",35)))}enabled(){return this.hasAttribute("resizable")&&!this.isCompact()}setPosition(e){const[t,s]=this.bounds();this.setAttribute("position",String(Math.min(s,Math.max(t,e))))}coordinate(e){return this.isVertical()?e.clientY:e.clientX}sign(){return!this.isVertical()&&getComputedStyle(this).direction==="rtl"?-1:1}finishDrag(e){const t=this.drag;t&&(this.drag=null,e||this.setPosition(t.initial),t.target.hasPointerCapture(t.id)&&t.target.releasePointerCapture(t.id),this.requestUpdate(),e&&this.positionValue()!==t.initial&&this.emit("os-split-change",{position:this.positionValue()}))}recoverFocus(e){const t=e==="end"?"start":"end",o=this.getRootNode().activeElement,i=e!=="stack"&&Array.from(this.children).some(c=>c.slot===t&&c.contains(o)),r=this.shadowRoot?.activeElement?.classList.contains("divider");!i&&!r||queueMicrotask(()=>{this.isConnected&&this.shadowRoot?.querySelector(e==="end"?".pane.end":".pane.start")?.focus()})}render(){!this.enabled()&&this.drag&&this.cancelDrag();const e=this.enabled(),t=this.positionValue(),[s,o]=this.bounds(),i=this.getAttribute("narrow"),r=i==="start"||i==="end"?i:"stack";return this.style.setProperty("--_split-start",`calc((100% - ${this.hasAttribute("resizable")?8:0}px) * ${t/100})`),this.isCompact()&&this.recoverFocus(r),h`<div class="layout ${this.isCompact()?"compact "+r:""}"> | |
| 5 | + <div class="pane start" part="start" id="start" tabindex="-1"><slot name="start"></slot></div> | |
| 6 | + <div class="divider ${e?"enabled":""} ${this.drag?"dragging":""}" part="divider" | |
| 7 | + role=${e?"separator":"presentation"} aria-hidden=${e?"false":"true"} tabindex=${e?"0":"-1"} | |
| 8 | + aria-label=${this.getAttribute("label")||l("Resize panes")} | |
| 9 | + aria-controls="start" aria-orientation=${this.isVertical()?"horizontal":"vertical"} | |
| 10 | + aria-valuemin=${String(s)} aria-valuemax=${String(o)} aria-valuenow=${String(t)} | |
| 11 | + @pointerdown=${this.onDown} @pointermove=${this.onMove} @pointerup=${this.onUp} | |
| 12 | + @pointercancel=${this.onCancel} @lostpointercapture=${this.onLostCapture} @keydown=${this.onKey}></div> | |
| 13 | + <div class="pane end" part="end" tabindex="-1"><slot name="end"></slot></div> | |
| 14 | + </div><div class="shield" ?hidden=${!this.drag} aria-hidden="true"></div>`}};N.props=["position","min-start","min-end","resizable","direction","collapse-at","narrow","compact","label"],N.styles=[Ie],N.help=void 0;let j=N;te("os-split",j);function Ve(){let n="";const e=new Map;let t=0,s=1,o=0,i=!1,r=!0,c=null,d,u=async()=>{},m=()=>{};const f=()=>{const p=[],b=new Set;for(const g of Array.from(e.keys()).sort((y,k)=>y-k))for(const y of e.get(g)??[])b.has(y.id)||(b.add(y.id),p.push(y));return p},v=()=>s>Math.max(...Array.from(e.keys()),1),$=p=>{!p.some(b=>b.isIntersecting)||i||!r||(r=!1,i=!0,o=Math.max(1,...Array.from(e.keys()))+1,m(),u().finally(()=>{i=!1,o=0,m()}))};return{accumulate(p,b){return b?(n!==p&&(n=p,e.clear()),e.set(b.page,b.items),t=b.total,s=b.pages,f()):(n="",e.clear(),t=0,s=1,[])},items:f,get total(){return t},get pageCount(){return s},get loadingPage(){return o},hasMore:v,ghosts(p){return o===0||e.has(o)||!v()?0:Math.max(1,Math.min(p,t-f().length))},sync(p){u=p.load,m=p.repaint,!d&&typeof IntersectionObserver<"u"&&(d=new IntersectionObserver($)),d?.disconnect(),p.sentinel&&d?.observe(p.sentinel),p.canvas!==c&&(c=p.canvas,c?.addEventListener("scroll",()=>{r=!0},{passive:!0})),c&&c.scrollHeight<=c.clientHeight+4&&(r=!0)},dispose(){d?.disconnect(),d=void 0}}}function Re(n,e){const t=e.local??{},s={id:n,hasLocal:r=>Object.prototype.hasOwnProperty.call(t,r),runLocal:(r,c,d,u)=>{const m=t[r];if(!m)return c;const f={...c},v=m(f,d,u);return v===void 0?f:v},render:r=>{J(e.view(r),r.root),e.updated?.(r)},mounted:r=>e.mounted?.(r)},{placeholder:o}=e;o&&(s.placeholder=r=>o(r));const i=window;return(i.openStationApps??(i.openStationApps={}))[n]=s,s}const q=new Map;async function Le(n){if(!n)return null;let e;try{e=new URL(n,window.location.href)}catch{return n}if(!/gravatar\.com$/i.test(e.hostname))return n;e.searchParams.delete("d"),e.searchParams.delete("s");const t=e.toString(),s=q.get(t);if(s!==void 0)return s instanceof Promise,s;const o=new URL(n,window.location.href);o.searchParams.set("d","blank");const i=new Promise(r=>{const c=new Image;c.crossOrigin="anonymous",c.onload=()=>{try{const d=document.createElement("canvas");d.width=1,d.height=1;const u=d.getContext("2d",{willReadFrequently:!0});if(!u){r(n);return}u.drawImage(c,0,0,1,1);const m=u.getImageData(0,0,1,1).data;r(m[3]===0?null:n)}catch{r(n)}},c.onerror=()=>r(null),c.src=o.toString()}).then(r=>(q.set(t,r),r));return q.set(t,i),i}function ie(n){return n?.["48"]??n?.["96"]??n?.["24"]??""}function Pe(n,e){e&&Le(e).then(t=>{n.isConnected&&(t?n.setAttribute("src",t):n.removeAttribute("src"))})}function He(){return window.wp?.os?.config?.adminUrl||"/wp-admin/"}function A(n){const e=document.createElement("textarea");return e.innerHTML=n,e.value}const a="os-comments";function L(n){const e=String(n.status);return e==="approve"||e==="approved"||e==="1"?"approved":e==="hold"||e==="0"||e==="unapproved"?"hold":e}function re(n){switch(n){case"approved":return l("Approved");case"hold":return l("Pending");case"spam":return l("Spam");case"trash":return l("Trash");default:return n}}function O(n){switch(n){case"approved":return"success";case"hold":return"warning";case"spam":return"danger";default:return"neutral"}}function ae(n,e=!1){const t=re(n);return e?h`<os-badge class="${a}__status" tone=${O(n)} title=${t}> | |
| 15 | + <span class="screen-reader-text">${t}</span> | |
| 16 | + </os-badge>`:h`<os-badge class="${a}__msg-status" tone=${O(n)}>${t}</os-badge>`}function le(n,e,t=!1){return h`<os-relative-time class=${e} datetime=${n} ?compact=${t}></os-relative-time>`}function B(n){return typeof n.content?.raw=="string"?n.content.raw:A((n.content?.rendered??"").replace(/<[^>]*>/g," "))}function ce(n){return B(n).replace(/\s+/g," ").trim()}function F(n){return n?.author_name||l("Anonymous")}function de(n,e){const t=ie(n.author_avatar_urls);return h`<os-avatar | |
| 4 | 17 | class="${a}__disc" |
| 5 | - name=${t.author_name||"?"} | |
| 18 | + name=${n.author_name||"?"} | |
| 6 | 19 | size=${e} |
| 7 | 20 | alt="" |
| 8 | - data-avatar-src=${n} | |
| 9 | - ></os-avatar>`}function xe(){return p`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" class="${a}__ext-icon"> | |
| 21 | + data-avatar-src=${t} | |
| 22 | + ></os-avatar>`}function De(){return h`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" class="${a}__ext-icon"> | |
| 10 | 23 | <path d="M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Z"></path> |
| 11 | 24 | <path d="M18 18v-5h1.5v5c0 .83-.67 1.5-1.5 1.5H6c-.83 0-1.5-.67-1.5-1.5V6c0-.83.67-1.5 1.5-1.5h5V6H6v12h12Z"></path> |
| 12 | - </svg>`}function V(t,e,n=""){return p`<os-empty-state | |
| 25 | + </svg>`}function P(n,e,t=""){return h`<os-empty-state | |
| 13 | 26 | class="${a}__placeholder" |
| 14 | - icon=${t} | |
| 27 | + icon=${n} | |
| 15 | 28 | heading=${e} |
| 16 | - description=${n} | |
| 17 | - ></os-empty-state>`}const Ae={spam:{title:l("Mark as spam?"),message:l("This comment moves out of the conversation. You can restore it from the Spam tab."),label:l("Mark as spam"),danger:!0},trash:{title:l("Move to trash?"),message:l("This comment moves out of the conversation. You can restore it from the Trash tab."),label:l("Move to trash"),danger:!0}};function Ie(t){switch(t){case"approve":return l("Comment approved.");case"unapprove":return l("Comment unapproved.");case"spam":return l("Comment marked as spam.");case"unspam":return l("Comment restored from spam.");case"trash":return l("Comment moved to trash.");case"untrash":return l("Comment restored from trash.")}}function te(t){const e=new Map;return t.forEach(n=>{const o=Number(n.parent)||0,s=e.get(o)??[];s.push(n),e.set(o,s)}),e}function Te(t,e){return t.tree.rows!==e&&(t.tree={rows:e,byParent:te(e)}),t.tree.byParent}function Ne(t,e){const n=e.content?.rendered??"",o=t.bodies.get(e.id);if(o&&o.html===n)return o.el;const s=document.createElement("div");return s.className=`${a}__msg-text`,s.innerHTML=n,t.bodies.set(e.id,{html:n,el:s}),s}function Se(t,e){const n=new Set(e.map(o=>o.id));for(const o of Array.from(t.bodies.keys()))n.has(o)||t.bodies.delete(o)}const ne=[{value:"pending",label:()=>l("Pending")},{value:"all",label:()=>l("All")},{value:"spam",label:()=>l("Spam")},{value:"trash",label:()=>l("Trash")},{value:"mine",label:()=>l("Mine")}];function oe(t,e){if(!e)return null;switch(t){case"pending":return e.pending;case"all":return e.approved+e.pending;case"spam":return e.spam;case"trash":return e.trash;default:return null}}function Ee(t,e){const{state:n,data:o}=t,s=()=>{e.pane="rail"},i=ne.map(r=>{const c=oe(r.value,o.counts);return{value:r.value,label:c===null?r.label():P(l("%1$s (%2$s)"),r.label(),String(c))}});return p` | |
| 29 | + description=${t} | |
| 30 | + ></os-empty-state>`}const Ze={spam:{title:l("Mark as spam?"),message:l("This comment moves out of the conversation. You can restore it from the Spam tab."),label:l("Mark as spam"),danger:!0},trash:{title:l("Move to trash?"),message:l("This comment moves out of the conversation. You can restore it from the Trash tab."),label:l("Move to trash"),danger:!0}};function Ue(n){switch(n){case"approve":return l("Comment approved.");case"unapprove":return l("Comment unapproved.");case"spam":return l("Comment marked as spam.");case"unspam":return l("Comment restored from spam.");case"trash":return l("Comment moved to trash.");case"untrash":return l("Comment restored from trash.")}}function ue(n){const e=new Map;return n.forEach(t=>{const s=Number(t.parent)||0,o=e.get(s)??[];o.push(t),e.set(s,o)}),e}function je(n,e){return n.tree.rows!==e&&(n.tree={rows:e,byParent:ue(e)}),n.tree.byParent}function qe(n,e){const t=e.content?.rendered??"",s=n.bodies.get(e.id);if(s&&s.html===t)return s.el;const o=document.createElement("div");return o.className=`${a}__msg-text`,o.innerHTML=t,n.bodies.set(e.id,{html:t,el:o}),o}function Oe(n,e){const t=new Set(e.map(s=>s.id));for(const s of Array.from(n.bodies.keys()))t.has(s)||n.bodies.delete(s)}const he=[{value:"pending",label:()=>l("Pending")},{value:"all",label:()=>l("All")},{value:"spam",label:()=>l("Spam")},{value:"trash",label:()=>l("Trash")},{value:"mine",label:()=>l("Mine")}];function pe(n,e){if(!e)return null;switch(n){case"pending":return e.pending;case"all":return e.approved+e.pending;case"spam":return e.spam;case"trash":return e.trash;default:return null}}function Be(n,e){const{state:t,data:s}=n,o=()=>{e.pane="rail"},i=he.map(r=>{const c=pe(r.value,s.counts);return{value:r.value,label:c===null?r.label():U(l("%1$s (%2$s)"),r.label(),String(c))}});return h` | |
| 18 | 31 | <os-tabs |
| 19 | 32 | class="${a}__tabrow" |
| 20 | - value=${n.tab} | |
| 33 | + value=${t.tab} | |
| 21 | 34 | label=${l("Comment status")} |
| 22 | 35 | os-bind="tab" |
| 23 | 36 | os-action="filter" |
| 24 | - @os-tab-change=${s} | |
| 37 | + @os-tab-change=${o} | |
| 25 | 38 | data-os-comments-tabs |
| 26 | - >${ne.map(r=>{const c=oe(r.value,o.counts);return p`<os-tab value=${r.value}>${r.label()}${c===null?"":p`<os-badge class="${a}__tab-count" tone="neutral" no-dot>${c}</os-badge>`}</os-tab>`})}</os-tabs> | |
| 39 | + >${he.map(r=>{const c=pe(r.value,s.counts);return h`<os-tab value=${r.value}>${r.label()}${c===null?"":h`<os-badge class="${a}__tab-count" tone="neutral" no-dot>${c}</os-badge>`}</os-tab>`})}</os-tabs> | |
| 27 | 40 | <os-select |
| 28 | 41 | class="${a}__tabselect" |
| 29 | 42 | aria-label=${l("Comment status")} |
| 30 | - value=${n.tab} | |
| 43 | + value=${t.tab} | |
| 31 | 44 | .items=${i} |
| 32 | 45 | os-bind="tab" |
| 33 | 46 | os-action="filter" |
| 34 | - @os-pick=${s} | |
| 47 | + @os-pick=${o} | |
| 35 | 48 | data-os-comments-tabselect |
| 36 | 49 | ></os-select> |
| 37 | - `}function Ve(t,e,n){const o=n[0]?.openstation_post_title,s=()=>{e.pane="rail",t.dispatch("filter",{post:0})};return p`<div class="${a}__rail-filter"> | |
| 38 | - <span class="${a}__rail-filter-label">${o?P(l("On: %s"),A(o)):l("Comments on this post")}</span> | |
| 39 | - <os-button class="${a}__rail-filter-clear" variant="link" @click=${s}>${l("Show all")}</os-button> | |
| 40 | - </div>`}function He(t,e,n){const o=t.state.selected===n.id,s=()=>{if(e.pane="convo",o&&e.thread){t.repaint();return}t.dispatch("select",{id:n.id})},i=n.openstation_replies_count??0;return p`<div role="listitem" class="${a}__thread-slot"> | |
| 50 | + `}function Fe(n,e,t){const s=t[0]?.openstation_post_title,o=()=>{e.pane="rail",n.dispatch("filter",{post:0})};return h`<div class="${a}__rail-filter"> | |
| 51 | + <span class="${a}__rail-filter-label">${s?U(l("On: %s"),A(s)):l("Comments on this post")}</span> | |
| 52 | + <os-button class="${a}__rail-filter-clear" variant="link" @click=${o}>${l("Show all")}</os-button> | |
| 53 | + </div>`}function Ke(n,e,t){const s=n.state.selected===t.id,o=()=>{if(e.pane="convo",s&&e.thread){n.repaint();return}n.dispatch("select",{id:t.id})},i=t.openstation_replies_count??0;return h`<div role="listitem" class="${a}__thread-slot"> | |
| 41 | 54 | <button |
| 42 | 55 | type="button" |
| 43 | - class="${a}__thread${o?" is-selected":""}${e.busy.startsWith(`${n.id}:`)?" is-busy":""}" | |
| 44 | - data-id=${n.id} | |
| 45 | - aria-current=${o?"true":""} | |
| 46 | - @click=${s} | |
| 56 | + class="${a}__thread${s?" is-selected":""}${e.busy.startsWith(`${t.id}:`)?" is-busy":""}" | |
| 57 | + data-id=${t.id} | |
| 58 | + aria-current=${s?"true":""} | |
| 59 | + @click=${o} | |
| 47 | 60 | > |
| 48 | - ${ee(n,36)} | |
| 61 | + ${de(t,36)} | |
| 49 | 62 | <div class="${a}__thread-main"> |
| 50 | - <div class="${a}__thread-name">${O(n)}${G(E(n),!0)}</div> | |
| 51 | - <div class="${a}__thread-snip">${J(n)}</div> | |
| 52 | - <div class="${a}__thread-post">${A(n.openstation_post_title||"")}</div> | |
| 63 | + <div class="${a}__thread-name">${F(t)}${ae(L(t),!0)}</div> | |
| 64 | + <div class="${a}__thread-snip">${ce(t)}</div> | |
| 65 | + <div class="${a}__thread-post">${A(t.openstation_post_title||"")}</div> | |
| 53 | 66 | </div> |
| 54 | 67 | <div class="${a}__thread-meta"> |
| 55 | - ${Y(n.date_gmt,`${a}__thread-time`,!0)} | |
| 56 | - ${i>0?p`<os-badge class="${a}__reply-count" tone="neutral" no-dot>${i}<span class="screen-reader-text">${P(l("%d replies"),i)}</span></os-badge>`:""} | |
| 68 | + ${le(t.date_gmt,`${a}__thread-time`,!0)} | |
| 69 | + ${i>0?h`<os-badge class="${a}__reply-count" tone="neutral" no-dot>${i}<span class="screen-reader-text">${U(l("%d replies"),i)}</span></os-badge>`:""} | |
| 57 | 70 | </div> |
| 58 | 71 | </button> |
| 59 | - </div>`}const Le=6;function Pe(){return p`<div class="${a}__thread-slot ${a}__thread-slot--ghost" aria-hidden="true"> | |
| 72 | + </div>`}const We=6;function Qe(){return h`<div class="${a}__thread-slot ${a}__thread-slot--ghost" aria-hidden="true"> | |
| 60 | 73 | <div class="${a}__thread"> |
| 61 | 74 | <span class="${a}__ghost ${a}__ghost--disc"></span> |
| 62 | 75 | <div class="${a}__thread-main"> |
| 63 | 76 | <span class="${a}__ghost ${a}__ghost--line"></span> |
| @@ -63,11 +76,11 @@ | ||
| 63 | 76 | <span class="${a}__ghost ${a}__ghost--line"></span> |
| 64 | 77 | <span class="${a}__ghost ${a}__ghost--line ${a}__ghost--short"></span> |
| 65 | 78 | </div> |
| 66 | 79 | </div> |
| 67 | - </div>`}function Re(t,e){const n=()=>{e.loadingMore=!0,t.repaint(),t.dispatch("page",{page:t.state.page+1}).finally(()=>{e.loadingMore=!1,t.repaint()})};return p`<div class="${a}__load-more"> | |
| 68 | - <os-button variant="ghost" ?busy=${e.loadingMore} ?disabled=${e.loadingMore} @click=${n}>${l("Load more")}</os-button> | |
| 69 | - </div>`}function ze(t,e,n,o){const{state:s}=t,i=s.post>0;let r;return o?r=V("warning",l("Could not load comments"),l("Check your connection and try another tab.")):t.loading?r=Array.from({length:Le},Pe):n.length===0?r=i?V("admin-comments",l("Nothing on this post here"),l("This post has no comments in this view — try another tab.")):V("admin-comments",l("No conversations yet"),l("Comments in this view will show up here.")):r=n.map(c=>He(t,e,c)),p`<aside class="${a}__rail" aria-label=${l("Conversations")}> | |
| 80 | + </div>`}function Xe(n,e){const t=()=>{e.loadingMore=!0,n.repaint(),n.dispatch("page",{page:n.state.page+1}).finally(()=>{e.loadingMore=!1,n.repaint()})};return h`<div class="${a}__load-more"> | |
| 81 | + <os-button variant="ghost" ?busy=${e.loadingMore} ?disabled=${e.loadingMore} @click=${t}>${l("Load more")}</os-button> | |
| 82 | + </div>`}function Ge(n,e,t,s){const{state:o}=n,i=o.post>0;let r;return s?r=P("warning",l("Could not load comments"),l("Check your connection and try another tab.")):n.loading?r=Array.from({length:We},Qe):t.length===0?r=i?P("admin-comments",l("Nothing on this post here"),l("This post has no comments in this view — try another tab.")):P("admin-comments",l("No conversations yet"),l("Comments in this view will show up here.")):r=t.map(c=>Ke(n,e,c)),h`<aside slot="start" class="${a}__rail" aria-label=${l("Conversations")}> | |
| 70 | 83 | <div class="${a}__search"> |
| 71 | 84 | <os-text-field |
| 72 | 85 | label=${l("Search comments")} |
| 73 | 86 | hide-label |
| @@ -78,19 +91,19 @@ | ||
| 78 | 91 | data-os-comments-search |
| 79 | 92 | ></os-text-field> |
| 80 | 93 | </div> |
| 81 | 94 | <div class="${a}__list" role="list" aria-label=${l("Conversations")} data-os-comments-list> |
| 82 | - ${i&&!o?Ve(t,e,n):""} | |
| 95 | + ${i&&!s?Fe(n,e,t):""} | |
| 83 | 96 | ${r} |
| 84 | - ${!o&&n.length>0&&e.list.hasMore()?Re(t,e):""} | |
| 97 | + ${!s&&t.length>0&&e.list.hasMore()?Xe(n,e):""} | |
| 85 | 98 | </div> |
| 86 | - </aside>`}const se={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 re(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Ze(t){return Object.prototype.hasOwnProperty.call(se,t)?se[t]:null}function Oe(t,e={}){const n=Ze(t);if(!n)return"";const{size:o=24,className:s,title:i,rotate:r}=e,c=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];o!=null&&c.push(`width="${o}"`,`height="${o}"`),c.push(n.a),s&&c.push(`class="${re(s)}"`),i?c.push('role="img"',`aria-label="${re(i)}"`):c.push('aria-hidden="true"','focusable="false"');const d=r?`<g transform="rotate(${r} 12 12)">${n.b}</g>`:n.b;return`<svg ${c.join(" ")}>${d}</svg>`}function je(t,e={}){const n=Oe(t,e),o=document.createElement("div");o.innerHTML=n;const s=o.firstElementChild;return s instanceof SVGSVGElement?s:document.createElementNS("http://www.w3.org/2000/svg","svg")}function H(t){return t.extra}function j(t,e,n){e.status="",t.repaint(),window.setTimeout(()=>{e.status=n,t.repaint()},0)}function I(t){return String(t.detail?.value??"")}async function B(t,e,n,o){e.busy=`${n}:${o}`,t.repaint();const s=await t.dispatch("moderate",{ids:[n],action:o},{confirm:Ae[o]??null});e.busy="",s?j(t,e,Ie(o)):t.repaint()}function Be(t,e,n){e.replyTo=n.id,t.repaint();const o=t.root.querySelector(`.${a}__composer`);o?.querySelector(`.${a}__reply-input`)?.focusInput?.(),o?.scrollIntoView?.({block:"nearest",behavior:"smooth"})}function De(t,e,n){e.editing!==n.id&&(e.editing=n.id,e.editSeed=Z(n),e.editDraft=e.editSeed,t.repaint()),t.root.querySelector(`.${a}__msg[data-id="${n.id}"] > .${a}__msg-body > .${a}__reply-input`)?.focusInput?.()}async function Ue(t,e,n){const o=e.editDraft.trim();if(!o){t.host.toast?.({message:l("A comment cannot be empty.")});return}e.busy=`edit:${n.id}`,t.repaint();const s=await t.dispatch("edit",{id:n.id,content:o});e.busy="",s?(e.editing=0,j(t,e,l("Comment updated."))):t.repaint()}async function ae(t,e,n){if(e.busy==="reply")return;const o=e.draft.trim();if(!o){t.host.toast?.({message:l("Reply is empty.")});return}e.busy="reply",t.repaint();const s=await t.dispatch("reply",{parent:e.replyTo||n.id,content:o});e.busy="",s?(e.draft="",t.root.querySelector(`.${a}__composer .${a}__reply-input`)?.clear?.(),j(t,e,l("Reply sent."))):t.repaint()}function T(t,e,n,o){return p`<os-button | |
| 99 | + </aside>`}const me={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 fe(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Ye(n){return Object.prototype.hasOwnProperty.call(me,n)?me[n]:null}function Je(n,e={}){const t=Ye(n);if(!t)return"";const{size:s=24,className:o,title:i,rotate:r}=e,c=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];s!=null&&c.push(`width="${s}"`,`height="${s}"`),c.push(t.a),o&&c.push(`class="${fe(o)}"`),i?c.push('role="img"',`aria-label="${fe(i)}"`):c.push('aria-hidden="true"','focusable="false"');const d=r?`<g transform="rotate(${r} 12 12)">${t.b}</g>`:t.b;return`<svg ${c.join(" ")}>${d}</svg>`}function et(n,e={}){const t=Je(n,e),s=document.createElement("div");s.innerHTML=t;const o=s.firstElementChild;return o instanceof SVGSVGElement?o:document.createElementNS("http://www.w3.org/2000/svg","svg")}function H(n){return n.extra}function K(n,e,t){e.status="",n.repaint(),window.setTimeout(()=>{e.status=t,n.repaint()},0)}function z(n){return String(n.detail?.value??"")}async function W(n,e,t,s){e.busy=`${t}:${s}`,n.repaint();const o=await n.dispatch("moderate",{ids:[t],action:s},{confirm:Ze[s]??null});e.busy="",o?K(n,e,Ue(s)):n.repaint()}function tt(n,e,t){e.replyTo=t.id,n.repaint();const s=n.root.querySelector(`.${a}__composer`);s?.querySelector(`.${a}__reply-input`)?.focusInput?.(),s?.scrollIntoView?.({block:"nearest",behavior:"smooth"})}function nt(n,e,t){e.editing!==t.id&&(e.editing=t.id,e.editSeed=B(t),e.editDraft=e.editSeed,n.repaint()),n.root.querySelector(`.${a}__msg[data-id="${t.id}"] > .${a}__msg-body > .${a}__reply-input`)?.focusInput?.()}async function st(n,e,t){const s=e.editDraft.trim();if(!s){n.host.toast?.({message:l("A comment cannot be empty.")});return}e.busy=`edit:${t.id}`,n.repaint();const o=await n.dispatch("edit",{id:t.id,content:s});e.busy="",o?(e.editing=0,K(n,e,l("Comment updated."))):n.repaint()}async function ve(n,e,t){if(e.busy==="reply")return;const s=e.draft.trim();if(!s){n.host.toast?.({message:l("Reply is empty.")});return}e.busy="reply",n.repaint();const o=await n.dispatch("reply",{parent:e.replyTo||t.id,content:s});e.busy="",o?(e.draft="",n.root.querySelector(`.${a}__composer .${a}__reply-input`)?.clear?.(),K(n,e,l("Reply sent."))):n.repaint()}function T(n,e,t,s){return h`<os-button | |
| 87 | 100 | class="${a}__act${e==="danger"?" is-danger":""}" |
| 88 | 101 | variant="link" |
| 89 | - ?busy=${n} | |
| 90 | - ?disabled=${n} | |
| 91 | - @click=${s=>{s.stopPropagation(),o()}} | |
| 92 | - >${t}</os-button>`}function Fe(t,e,n){const o=E(n),s=!!H(t).canModerate,i=!!H(t).canEditComments,r=d=>e.busy===`${n.id}:${d}`,c=[];if(s){const d=o==="approved"?"unapprove":"approve";c.push(T(l(o==="approved"?"Unapprove":"Approve"),"default",r(d),()=>void B(t,e,n.id,d)))}return i&&c.push(T(l("Reply"),"default",!1,()=>Be(t,e,n))),n.openstation_can_edit&&c.push(T(l("Edit"),"default",!1,()=>De(t,e,n))),s&&(o!=="spam"&&c.push(T(l("Spam"),"danger",r("spam"),()=>void B(t,e,n.id,"spam"))),o!=="trash"&&c.push(T(l("Trash"),"danger",r("trash"),()=>void B(t,e,n.id,"trash")))),p`<div class="${a}__msg-actions" ?hidden=${e.editing===n.id}>${c.map((d,u)=>u>0?p`<span class="${a}__act-sep" aria-hidden="true">|</span>${d}`:d)}</div>`}function qe(t,e,n){const o=e.busy===`edit:${n.id}`,s=()=>{e.editing=0,t.repaint()};return p`<os-textarea | |
| 102 | + ?busy=${t} | |
| 103 | + ?disabled=${t} | |
| 104 | + @click=${o=>{o.stopPropagation(),s()}} | |
| 105 | + >${n}</os-button>`}function ot(n,e,t){const s=L(t),o=!!H(n).canModerate,i=!!H(n).canEditComments,r=d=>e.busy===`${t.id}:${d}`,c=[];if(o){const d=s==="approved"?"unapprove":"approve";c.push(T(l(s==="approved"?"Unapprove":"Approve"),"default",r(d),()=>void W(n,e,t.id,d)))}return i&&c.push(T(l("Reply"),"default",!1,()=>tt(n,e,t))),t.openstation_can_edit&&c.push(T(l("Edit"),"default",!1,()=>nt(n,e,t))),o&&(s!=="spam"&&c.push(T(l("Spam"),"danger",r("spam"),()=>void W(n,e,t.id,"spam"))),s!=="trash"&&c.push(T(l("Trash"),"danger",r("trash"),()=>void W(n,e,t.id,"trash")))),h`<div class="${a}__msg-actions" ?hidden=${e.editing===t.id}>${c.map((d,u)=>u>0?h`<span class="${a}__act-sep" aria-hidden="true">|</span>${d}`:d)}</div>`}function it(n,e,t){const s=e.busy===`edit:${t.id}`,o=()=>{e.editing=0,n.repaint()};return h`<os-textarea | |
| 93 | 106 | class="${a}__reply-input" |
| 94 | 107 | placeholder=${l("Edit comment…")} |
| 95 | 108 | aria-label=${l("Comment text")} |
| 96 | 109 | rows="4" |
| @@ -96,53 +109,53 @@ | ||
| 96 | 109 | rows="4" |
| 97 | 110 | auto-grow |
| 98 | 111 | max-rows="10" |
| 99 | 112 | value=${e.editSeed} |
| 100 | - ?disabled=${o} | |
| 101 | - @os-input-change=${i=>{e.editDraft=I(i)}} | |
| 102 | - @os-input-commit=${i=>{e.editDraft=I(i)}} | |
| 113 | + ?disabled=${s} | |
| 114 | + @os-input-change=${i=>{e.editDraft=z(i)}} | |
| 115 | + @os-input-commit=${i=>{e.editDraft=z(i)}} | |
| 103 | 116 | ></os-textarea> |
| 104 | 117 | <div class="${a}__composer-row ${a}__edit-bar"> |
| 105 | - <os-button variant="ghost" @click=${s}>${l("Cancel")}</os-button> | |
| 106 | - <os-button variant="primary" ?busy=${o} ?disabled=${o} @click=${()=>void Ue(t,e,n)}>${l("Save")}</os-button> | |
| 107 | - </div>`}function ie(t,e,n,o){const s=o.get(n.id)??[],i=E(n),r=e.editing===n.id,c=Ne(e,n);return c.hidden=r,p`<div class="${a}__msg" data-id=${n.id} data-status=${i}> | |
| 118 | + <os-button variant="ghost" @click=${o}>${l("Cancel")}</os-button> | |
| 119 | + <os-button variant="primary" ?busy=${s} ?disabled=${s} @click=${()=>void st(n,e,t)}>${l("Save")}</os-button> | |
| 120 | + </div>`}function ge(n,e,t,s){const o=s.get(t.id)??[],i=L(t),r=e.editing===t.id,c=qe(e,t);return c.hidden=r,h`<div class="${a}__msg" data-id=${t.id} data-status=${i}> | |
| 108 | 121 | <div class="${a}__msg-rail"> |
| 109 | - ${ee(n,34)} | |
| 110 | - ${s.length>0?p`<div class="${a}__msg-line"></div>`:""} | |
| 122 | + ${de(t,34)} | |
| 123 | + ${o.length>0?h`<div class="${a}__msg-line"></div>`:""} | |
| 111 | 124 | </div> |
| 112 | 125 | <div class="${a}__msg-body"> |
| 113 | 126 | <div class="${a}__msg-head"> |
| 114 | - <span class="${a}__msg-name">${O(n)}</span> | |
| 115 | - ${n.author>0&&n.author===H(t).currentUserId?p`<os-badge class="${a}__msg-you" tone="info" no-dot>${l("You")}</os-badge>`:""} | |
| 116 | - ${Y(n.date_gmt,`${a}__msg-time`)} | |
| 117 | - ${i!=="approved"?G(i):""} | |
| 127 | + <span class="${a}__msg-name">${F(t)}</span> | |
| 128 | + ${t.author>0&&t.author===H(n).currentUserId?h`<os-badge class="${a}__msg-you" tone="info" no-dot>${l("You")}</os-badge>`:""} | |
| 129 | + ${le(t.date_gmt,`${a}__msg-time`)} | |
| 130 | + ${i!=="approved"?ae(i):""} | |
| 118 | 131 | </div> |
| 119 | 132 | ${c} |
| 120 | - ${Fe(t,e,n)} | |
| 121 | - ${r?qe(t,e,n):""} | |
| 122 | - ${s.length>0?p`<div class="${a}__nested">${s.map(d=>ie(t,e,d,o))}</div>`:""} | |
| 133 | + ${ot(n,e,t)} | |
| 134 | + ${r?it(n,e,t):""} | |
| 135 | + ${o.length>0?h`<div class="${a}__nested">${o.map(d=>ge(n,e,d,s))}</div>`:""} | |
| 123 | 136 | </div> |
| 124 | - </div>`}function We(t,e,n){const o=A(n.openstation_post_title||l("(no title)")),s=()=>{e.pane="rail",t.repaint()},i=n.post>0?p`<a | |
| 137 | + </div>`}function rt(n,e,t){const s=A(t.openstation_post_title||l("(no title)")),o=()=>{e.pane="rail",n.repaint()},i=t.post>0?h`<a | |
| 125 | 138 | class="${a}__convo-post ${a}__convo-post--editable" |
| 126 | - href="${Me()}post.php?post=${n.post}&action=edit" | |
| 139 | + href="${He()}post.php?post=${t.post}&action=edit" | |
| 127 | 140 | title=${l("Edit this post")} |
| 128 | - >${o}<os-icon class="${a}__convo-post-pencil" name="edit" size="15"></os-icon><span class="screen-reader-text">${l("Edit this post")}</span></a>`:p`<div class="${a}__convo-post">${o}</div>`;return p`<div class="${a}__convo-head"> | |
| 141 | + >${s}<os-icon class="${a}__convo-post-pencil" name="edit" size="15"></os-icon><span class="screen-reader-text">${l("Edit this post")}</span></a>`:h`<div class="${a}__convo-post">${s}</div>`;return h`<div class="${a}__convo-head"> | |
| 129 | 142 | <os-button |
| 130 | 143 | class="${a}__convo-back" |
| 131 | 144 | variant="ghost" |
| 132 | 145 | aria-label=${l("Back to conversations")} |
| 133 | 146 | title=${l("Back to conversations")} |
| 134 | - @click=${s} | |
| 135 | - >${je("chevron-right",{size:18,rotate:180})}</os-button> | |
| 147 | + @click=${o} | |
| 148 | + >${et("chevron-right",{size:18,rotate:180})}</os-button> | |
| 136 | 149 | <div class="${a}__convo-context"> |
| 137 | 150 | <div class="${a}__convo-kicker">${l("In response to")}</div> |
| 138 | 151 | ${i} |
| 139 | 152 | </div> |
| 140 | 153 | <div class="${a}__convo-head-actions"> |
| 141 | - ${n.openstation_post_link?p`<a class="${a}__convo-link" href=${n.openstation_post_link} target="_blank" rel="noopener">${l("View post")}${xe()}<span class="screen-reader-text">${l("(opens in a new tab)")}</span></a>`:""} | |
| 154 | + ${t.openstation_post_link?h`<a class="${a}__convo-link" href=${t.openstation_post_link} target="_blank" rel="noopener">${l("View post")}${De()}<span class="screen-reader-text">${l("(opens in a new tab)")}</span></a>`:""} | |
| 142 | 155 | </div> |
| 143 | - </div>`}function Ke(t,e,n,o){if(!H(t).canEditComments)return p`<div class="${a}__composer is-empty" data-target=${n.id}></div>`;const s=o.find(r=>r.id===e.replyTo)??n,i=e.busy==="reply";return p`<div class="${a}__composer" data-target=${s.id}> | |
| 144 | - <div class="${a}__composer-to">${l("Replying to")} <b>${O(s)}</b></div> | |
| 156 | + </div>`}function at(n,e,t,s){if(!H(n).canEditComments)return h`<div class="${a}__composer is-empty" data-target=${t.id}></div>`;const o=s.find(r=>r.id===e.replyTo)??t,i=e.busy==="reply";return h`<div class="${a}__composer" data-target=${o.id}> | |
| 157 | + <div class="${a}__composer-to">${l("Replying to")} <b>${F(o)}</b></div> | |
| 145 | 158 | <os-textarea |
| 146 | 159 | class="${a}__reply-input" |
| 147 | 160 | placeholder=${l("Write a reply…")} |
| 148 | 161 | aria-label=${l("Reply")} |
| @@ -150,29 +163,32 @@ | ||
| 150 | 163 | auto-grow |
| 151 | 164 | max-rows="10" |
| 152 | 165 | submit-on-enter |
| 153 | 166 | ?disabled=${i} |
| 154 | - @os-input-change=${r=>{e.draft=I(r)}} | |
| 155 | - @os-input-commit=${r=>{e.draft=I(r)}} | |
| 156 | - @os-submit=${r=>{e.draft=I(r),ae(t,e,n)}} | |
| 167 | + @os-input-change=${r=>{e.draft=z(r)}} | |
| 168 | + @os-input-commit=${r=>{e.draft=z(r)}} | |
| 169 | + @os-submit=${r=>{e.draft=z(r),ve(n,e,t)}} | |
| 157 | 170 | ></os-textarea> |
| 158 | 171 | <div class="${a}__composer-row"> |
| 159 | 172 | <span class="${a}__composer-hint">${l("Enter to send · Shift+Enter for a new line")}</span> |
| 160 | - <os-button variant="primary" ?busy=${i} ?disabled=${i} @click=${()=>void ae(t,e,n)}>${l("Send reply")}</os-button> | |
| 173 | + <os-button variant="primary" ?busy=${i} ?disabled=${i} @click=${()=>void ve(n,e,t)}>${l("Send reply")}</os-button> | |
| 161 | 174 | </div> |
| 162 | - </div>`}function Qe(t,e,n){if(!n)return p`<section class="${a}__convo" data-os-comments-convo>${V("format-chat",l("No conversation selected"),l("Pick one from the list to read and reply."))}</section>`;const o=e.thread?.rows??[n],s=Te(e,o),i=o.find(r=>r.id===n.id)??n;return p`<section class="${a}__convo" data-os-comments-convo> | |
| 163 | - ${We(t,e,i)} | |
| 175 | + </div>`}function lt(n,e,t){if(!t)return h`<section slot="end" class="${a}__convo" data-os-comments-convo>${P("format-chat",l("No conversation selected"),l("Pick one from the list to read and reply."))}</section>`;const s=e.thread?.rows??[t],o=je(e,s),i=s.find(r=>r.id===t.id)??t;return h`<section slot="end" class="${a}__convo" data-os-comments-convo> | |
| 176 | + ${rt(n,e,i)} | |
| 164 | 177 | <div class="${a}__thread-scroll"> |
| 165 | - ${ie(t,e,i,s)} | |
| 166 | - ${e.thread?.truncated?p`<os-notice class="${a}__truncated" tone="info">${l("This conversation is longer than shown; open the post to read the rest.")}</os-notice>`:""} | |
| 178 | + ${ge(n,e,i,o)} | |
| 179 | + ${e.thread?.truncated?h`<os-notice class="${a}__truncated" tone="info">${l("This conversation is longer than shown; open the post to read the rest.")}</os-notice>`:""} | |
| 167 | 180 | </div> |
| 168 | - ${Ke(t,e,i,o)} | |
| 169 | - </section>`}const Xe="desktop-mode-comments",L=()=>({pane:"rail",status:"",draft:"",replyTo:0,editing:0,editSeed:"",editDraft:"",busy:"",loadingMore:!1,list:ye(),thread:null,tree:{rows:null,byParent:new Map},announcedPost:-1,draftFor:-1,bodies:new Map});function Ge(t,e,n){const o=window.wp?.os?.relations;if(!o?.set)return;const s=e>0?{type:"comment",id:e,root:{type:"post",id:e},label:n?A(n):void 0}:null;try{o.set(t.windowId,s)}catch{}}const Ye=ke(Xe,{placeholder:()=>({}),view:t=>{const{state:e,data:n}=t,o=t.ui(L),s=n.rail&&n.railKey!==void 0?o.list.accumulate(n.railKey,n.rail):o.list.items();n.thread!==void 0&&(o.thread=n.thread);const i=s.find(c=>c.id===e.selected);o.draftFor!==e.selected&&(o.draftFor=e.selected,o.draft="",o.replyTo=0,o.editing=0);const r=i?o.pane:"rail";return p` | |
| 170 | - <div class="${a} ${a}--conversation" data-os-comments-root data-os-comments-pane=${r}> | |
| 171 | - ${Ee(t,o)} | |
| 172 | - <div class="${a}__split"> | |
| 173 | - ${ze(t,o,s,n.rail?.error??"")} | |
| 174 | - ${Qe(t,o,i)} | |
| 175 | - </div> | |
| 176 | - <div class="${a}__live screen-reader-text" role="status" aria-live="polite" data-os-comments-status>${o.status}</div> | |
| 177 | - </div> | |
| 178 | - `},mounted:t=>{const e=()=>t.repaint();return document.addEventListener("os-mode-changed",e),()=>{document.removeEventListener("os-mode-changed",e),t.ui(L).list.dispose()}},updated:t=>{const e=t.ui(L);t.root.querySelectorAll("os-avatar[data-avatar-src]").forEach(s=>{const i=s.getAttribute("data-avatar-src")??"";s.getAttribute("data-avatar-applied")!==i&&(s.setAttribute("data-avatar-applied",i),i?Ce(s,i):s.removeAttribute("src"))});const n=t.root.querySelector(`.${a}__composer[data-target]`);n&&n.getAttribute("data-composer-for")!==String(e.draftFor)&&(n.setAttribute("data-composer-for",String(e.draftFor)),n.querySelector(`.${a}__reply-input`)?.clear?.()),Se(e,e.thread?.rows??[]);const o=t.state.post;o!==e.announcedPost&&(e.announcedPost=o,Ge(t,o,e.list.items()[0]?.openstation_post_title))}});return w.buildTree=te,w.default=Ye,w.freshUi=L,w.normalizeStatus=E,w.pickAvatarUrl=Q,w.plainText=Z,w.snippet=J,w.statusLabel=X,w.statusTone=z,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),w}({}); | |
| 181 | + ${at(n,e,i,s)} | |
| 182 | + </section>`}const ct="desktop-mode-comments",D=()=>({pane:"rail",status:"",draft:"",replyTo:0,editing:0,editSeed:"",editDraft:"",busy:"",loadingMore:!1,list:Ve(),thread:null,tree:{rows:null,byParent:new Map},announcedPost:-1,draftFor:-1,bodies:new Map});function dt(n,e,t){const s=window.wp?.os?.relations;if(!s?.set)return;const o=e>0?{type:"comment",id:e,root:{type:"post",id:e},label:t?A(t):void 0}:null;try{s.set(n.windowId,o)}catch{}}const ut=Re(ct,{placeholder:()=>({}),view:n=>{const{state:e,data:t}=n,s=n.ui(D),o=t.rail&&t.railKey!==void 0?s.list.accumulate(t.railKey,t.rail):s.list.items();t.thread!==void 0&&(s.thread=t.thread);const i=o.find(c=>c.id===e.selected);s.draftFor!==e.selected&&(s.draftFor=e.selected,s.draft="",s.replyTo=0,s.editing=0);const r=i?s.pane:"rail";return h` | |
| 183 | + <os-app-frame contained class="${a} ${a}--conversation" data-os-comments-root data-os-comments-pane=${r}> | |
| 184 | + <div slot="header">${Be(n,s)}</div> | |
| 185 | + <os-split class="${a}__split" resizable label=${l("Resize conversations")} | |
| 186 | + collapse-at="720" min-start="240" min-end="300" | |
| 187 | + narrow=${r==="convo"?"end":"start"} | |
| 188 | + ?compact=${document.documentElement.dataset.osMode==="mobile"}> | |
| 189 | + ${Ge(n,s,o,t.rail?.error??"")} | |
| 190 | + ${lt(n,s,i)} | |
| 191 | + </os-split> | |
| 192 | + <div slot="footer" class="${a}__live screen-reader-text" role="status" aria-live="polite" data-os-comments-status>${s.status}</div> | |
| 193 | + </os-app-frame> | |
| 194 | + `},mounted:n=>{const e=()=>n.repaint();return document.addEventListener("os-mode-changed",e),()=>{document.removeEventListener("os-mode-changed",e),n.ui(D).list.dispose()}},updated:n=>{const e=n.ui(D);n.root.querySelectorAll("os-avatar[data-avatar-src]").forEach(o=>{const i=o.getAttribute("data-avatar-src")??"";o.getAttribute("data-avatar-applied")!==i&&(o.setAttribute("data-avatar-applied",i),i?Pe(o,i):o.removeAttribute("src"))});const t=n.root.querySelector(`.${a}__composer[data-target]`);t&&t.getAttribute("data-composer-for")!==String(e.draftFor)&&(t.setAttribute("data-composer-for",String(e.draftFor)),t.querySelector(`.${a}__reply-input`)?.clear?.()),Oe(e,e.thread?.rows??[]);const s=n.state.post;s!==e.announcedPost&&(e.announcedPost=s,dt(n,s,e.list.items()[0]?.openstation_post_title))}});return w.buildTree=ue,w.default=ut,w.freshUi=D,w.normalizeStatus=L,w.pickAvatarUrl=ie,w.plainText=B,w.snippet=ce,w.statusLabel=re,w.statusTone=O,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),w}({}); | |