PageSourceSearch

https://faector.nl/apps/framework/build/web-component/g2ui-posted-message-mGANrOaz.js

js faector.nl collected 2026-10-03 21:39:39 UTC 14,795 bytes, 1 lines download raw bytes

1import{p as Ie,I as ce,E as Ae}from"../base-Ci7vLHE_.js";import{a as de,w as Re}from"../events-DNd9BXmE.js";import Be from"./g2ui-avatar-buYzc9-t.js";import je from"./g2ui-lightbox-BlkDBrpN.js";import"../preload-helper-BVLnHgTN.js";var Te=Object.defineProperty,pe=h=>{throw TypeError(h)},$e=(h,e,t)=>e in h?Te(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t,Ne=(h,e,t)=>$e(h,e+"",t),ie=(h,e,t)=>e.has(h)||pe("Cannot "+t),s=(h,e,t)=>(ie(h,e,"read from private field"),t?t.call(h):e.get(h)),c=(h,e,t)=>e.has(h)?pe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,t),r=(h,e,t,n)=>(ie(h,e,"write to private field"),e.set(h,t),t),y=(h,e,t)=>(ie(h,e,"access private method"),t),V,G,Y,z,J,K;class ue{constructor(e,t,n,o,i,a){c(this,V),c(this,G),c(this,Y),c(this,z),c(this,J),c(this,K),r(this,V,e||null),r(this,G,t),r(this,Y,n),r(this,z,o),r(this,J,i),r(this,K,a)}get id(){return s(this,V)}get title(){return s(this,G)}get type(){return s(this,Y)}get url(){return s(this,z)}get image(){return s(this,J)}get description(){return s(this,K)}}V=new WeakMap,G=new WeakMap,Y=new WeakMap,z=new WeakMap,J=new WeakMap,K=new WeakMap;var Q,X;class U{constructor(e,t){c(this,Q),c(this,X),r(this,Q,e),r(this,X,t?parseInt(t):null)}get userId(){return s(this,X)}get name(){return s(this,Q)}}Q=new WeakMap,X=new WeakMap;var A,$,N,F;const Fe=class ge{constructor(e,t,n,o){c(this,A),c(this,$),c(this,N),c(this,F),r(this,A,e),r(this,$,t),r(this,N,n),r(this,F,o)}get author(){return s(this,A)}get time(){return s(this,$)}get avatar(){return s(this,N)}get recipients(){return s(this,F)}withValues(e,t,n,o){const i=e.id===s(this,A).id&&e.name===s(this,A).name,a=t.getTime()===s(this,$).getTime(),l=n===s(this,N),d=o.map(u=>u.id).sort().toString()===s(this,F).map(u=>u.id).sort().toString();return i&&a&&l&&d?this:new ge(e,t,n,o)}};A=new WeakMap,$=new WeakMap,N=new WeakMap,F=new WeakMap;let me=Fe;var g,k,R,q,D,Z,p,C,M,B,L,b,_,j,T,H,W,te,w,se,ne,S;class He{constructor(e){c(this,w),c(this,g),c(this,k,null),c(this,R,null),c(this,q,null),c(this,D,null),c(this,Z,null),c(this,p,null),c(this,C,null),c(this,M,null),c(this,B,null),c(this,L,[]),c(this,b,null),c(this,_,!1),c(this,j),c(this,T),c(this,H,[]),c(this,W,!1),c(this,te,!1),r(this,g,e),r(this,j,new Map),r(this,T,new ce)}get type(){return"message"}get element(){return s(this,g)}set id(e){r(this,k,e||null),s(this,g).setAttribute("message-id",s(this,k)||"")}get id(){return s(this,k)}set feedId(e){r(this,R,e||null),s(this,g).setAttribute("feed-id",s(this,R)||"")}get feedId(){return s(this,R)}set feedName(e){if(e===s(this,q))return;r(this,q,e||null);const t=y(this,w,S).call(this),n=t.querySelector(".feed-name")||t.ownerDocument.createElement("div");n.classList.add("feed-name"),n.textContent=s(this,q)||"",t.insertBefore(n,t.querySelector("header"))}get feedName(){return s(this,q)}set pinned(e){if(e===s(this,W))return;r(this,W,e);const t=s(this,g).querySelector("button.pin-status");t&&t.classList.toggle("disabled",!s(this,W))}get pinned(){return s(this,W)}get authorUserId(){return s(this,p).author.userId}set sortId(e){e!==s(this,D)&&(r(this,D,e),y(this,w,S).call(this).dataset.sortId=s(this,D))}get sortId(){return s(this,D)}set inReplyTo(e){r(this,Z,e)}get inReplyTo(){return s(this,Z)}get header(){return s(this,p)}set header(e){var t;if(e===s(this,p))return;r(this,p,e);const n=y(this,w,S).call(this);let o=n.querySelector("header")||n.ownerDocument.createElement("header");n.insertBefore(o,((t=n.querySelector(".feed-name"))==null?void 0:t.nextElementSibling)||n.firstElementChild);let i=n.querySelector(".engagers")||n.ownerDocument.createElement("div");i.classList.add("engagers"),o.insertBefore(i,o.firstElementChild);let a=n.querySelector(".author")||n.ownerDocument.createElement("span");a.classList.add("author"),a.dataset.userId=s(this,p).author.userId,a.textContent=s(this,p).author.name,i.insertBefore(a,i.firstElementChild);let l=i.querySelector(".recipients")||n.ownerDocument.createElement("div");l.classList.add("recipients"),l.querySelectorAll(".recipient").forEach(x=>x.remove()),i.appendChild(l);for(const x of s(this,p).recipients){const I=n.ownerDocument.createElement("span");I.classList.add("recipient"),I.textContent=x.name,I.dataset.userId=x.userId,l.appendChild(I)}let d=n.querySelector("g2ui-avatar")||n.ownerDocument.createElement("g2ui-avatar");d.setAttribute("name",s(this,p).author.name),s(this,p).avatar?d.setAttribute("src",s(this,p).avatar):d.removeAttribute("src"),o.insertBefore(d,i.nextElementSibling);let u=n.querySelector("time")||n.ownerDocument.createElement("time");u.classList.add("timestamp"),u.setAttribute("datetime",s(this,p).time.toISOString()),u.textContent=s(this,p).time;const f=n.ownerDocument.documentElement.getAttribute("lang"),E=new Intl.DateTimeFormat(f,{dateStyle:"long",timeStyle:"short"});u.textContent=E.format(s(this,p).time),o.insertBefore(u,d.nextElementSibling)}get subject(){return s(this,C)}set subject(e){var t;if(s(this,C)===e)return;r(this,C,e);const n=y(this,w,S).call(this);if(!s(this,C)){(t=n.querySelector("h1.subject"))==null||t.remove();return}const o=n.querySelector("h1.subject")||n.ownerDocument.createElement("h1");o.classList.add("subject"),o.textContent=s(this,C),n.insertBefore(o,n.querySelector(".body"))}get content(){return s(this,M)}set content(e){if(e===s(this,M))return;r(this,M,e);const t=y(this,w,S).call(this),n=t.querySelector(".body")||t.ownerDocument.createElement("div");n.classList.add("body"),n.innerHTML=s(this,M),n.parentNode||t.insertBefore(n,t.querySelector('slot[name = "actions"]'))}get source(){return s(this,B)}set source(e){if(e===s(this,B))return;r(this,B,e);const t=y(this,w,S).call(this),n=t.querySelector(".body")||t.ownerDocument.createElement("div");n.classList.add("body"),n.dataset.source=e,n.parentNode||t.insertBefore(n,t.querySelector('slot[name = "actions"]'))}get stats(){return s(this,b)}set stats(e){if(e===s(this,b))return;r(this,b,e);const t=s(this,g).querySelector("button.likes");t&&(t.classList.toggle("actioned",s(this,b).liked),t.textContent=s(this,b).likes.toString());const n=s(this,g).querySelector("button.replies");n&&(n.textContent=s(this,b).replies.toString());const o=s(this,g).querySelector("button.unread");o&&(o.classList.toggle("disabled",!this.stats.hasBadge),o.textContent=s(this,b).badgeContent)}get conversation(){return!0}get reply(){return s(this,_)}addReply(e){s(this,j).set(e.id,e)}removeReply(e){s(this,j).delete(e.id)}get replies(){return s(this,j)}set meta(e){if(e.map(a=>a.id).sort().toString()===s(this,L).map(a=>a.id).sort().toString()||(r(this,L,e),s(this,L).length===0))return;const t=y(this,w,S).call(this);t.querySelectorAll(".meta:not(.attachment)").forEach(a=>a.remove());const n=s(this,L)[0],o=t.ownerDocument.createElement("aside");o.classList.add("meta"),o.dataset.type=n.type;const i=t.ownerDocument.createElement("h3");if(n.url){const a=t.ownerDocument.createElement("a");a.href=n.url,a.textContent=n.title,i.appendChild(a)}else i.textContent=n.title;if(o.appendChild(i),n.description){const a=t.ownerDocument.createElement("p");a.textContent=n.description,o.appendChild(a)}if(n.image){const a=t.ownerDocument.createElement("img");if(a.src=n.image,n.url){const l=t.ownerDocument.createElement("a");l.href=n.url,l.appendChild(a),o.appendChild(l)}else o.appendChild(a)}t.insertBefore(o,t.querySelector("slot"))}set attachments(e){if(s(this,T).hasSameFiles(e))return;r(this,T,e);const t=y(this,w,S).call(this);t.querySelectorAll(".meta g2ui-lightbox").forEach(i=>
1i.close()),t.querySelectorAll(".meta.attachment").forEach(i=>i.remove());const n=e.images,o=e.files;if(n.length===1){const i=y(this,w,ne).call(this),a=t.ownerDocument.createElement("aside");a.classList.add("meta"),a.classList.add("attachment"),a.dataset.type="image";const l=t.ownerDocument.createElement("a"),d=t.ownerDocument.createElement("img");l.href=n[0].url,l.setAttribute("slot","slot"),d.src=n[0].thumb,l.appendChild(d),i.appendChild(l),a.appendChild(i),t.insertBefore(a,t.querySelector("slot"))}if(n.length>1){const i=t.ownerDocument.createElement("aside");i.classList.add("meta"),i.classList.add("attachment"),i.dataset.type="images";const a=y(this,w,ne).call(this),l=t.ownerDocument.createElement("ul");l.classList.add("thumbnails");for(const d of n){const u=t.ownerDocument.createElement("li"),f=t.ownerDocument.createElement("a"),E=t.ownerDocument.createElement("img");E.src=d.thumb,f.href=E.src,f.appendChild(E),u.appendChild(f),l.appendChild(u)}a.shadowRoot.appendChild(l),i.appendChild(a),t.insertBefore(i,t.querySelector("slot"))}if(o.length>0){const i=t.ownerDocument.createElement("aside");i.classList.add("meta"),i.classList.add("attachment"),i.dataset.type="attachments";const a=t.ownerDocument.createElement("ul");a.classList.add("attachments");for(const l of o){const d=t.ownerDocument.createElement("li"),u=t.ownerDocument.createElement("a"),f=t.ownerDocument.createElement("span");u.href=l.url,u.download="download",f.textContent=l.name,u.appendChild(f),d.appendChild(u),a.appendChild(d)}i.appendChild(a),t.insertBefore(i,t.querySelector("slot"))}}get attachments(){return s(this,T)}set features(e){r(this,H,e),this.element.setAttribute("features",e.join(" "))}get features(){return s(this,H)}updateWithServerData(e){const t=new U(e.sender.entry.name,e.sender.entry.id),n=new Date(e.time),o=(e.recipients||[]).map(i=>{var a;return new U(i.entry.name,((a=i.entry)==null?void 0:a.id)||null)});this.header?this.header=this.header.withValues(t,n,e.avatar,o):this.header=new me(t,n,e.avatar,o),this.id=e.id,this.feedId=e.feedId,this.feedName=e.feedName,this.pinned=e.pinned,this.features=e.features,this.sortId=e.sortId,this.source=e.source,this.content=e.content,this.meta=(e.meta||[]).map(i=>new ue(i.id,i.title,i.type,i.url,i.image,i.description)),this.attachments=new ce((e.attachments||[]).map(i=>new Ae(i.src,i.name,i.mime,i.thumb))),this.subject=e.subject}get feed(){var e;return((e=s(this,g).feed)==null?void 0:e.value)||null}parse(){var e,t,n,o,i,a;const l=s(this,g),d=l.shadowRoot.querySelector(".wrapper");if(!d)return null;const u=l.querySelector("button.likes"),f=l.querySelector("button.unread"),E=l.querySelector("button.pin-status"),x=((e=d.querySelector(".body"))==null?void 0:e.innerHTML)||"",I=((t=d.querySelector(".body"))==null?void 0:t.dataset.source)||"",ye=parseInt((u==null?void 0:u.textContent)||0),ve=u&&u.classList.contains("actioned"),be=parseInt((f==null?void 0:f.textContent)||0),Se=E&&!E.classList.contains("disabled"),Ee=f&&f.classList.contains("notified"),Ce=parseInt(((n=l.querySelector(".replies"))==null?void 0:n.textContent)||0),ke=((o=d.querySelector("h1"))==null?void 0:o.textContent)||null,qe=[...d.querySelectorAll(".recipient")].map(m=>new U(m.textContent.trim(),m.dataset.userId)),P=d.querySelector(".author"),De=new U((P==null?void 0:P.textContent)||"",(P==null?void 0:P.dataset.userId)||null),re=(i=d.querySelector("time"))==null?void 0:i.getAttribute("datetime"),Me=new Date(re),Le=((a=d.querySelector("g2ui-avatar"))==null?void 0:a.getAttribute("src"))||null,We=[...d.querySelectorAll(".meta")].map(m=>{var ae,oe,le,he;return new ue(m.dataset.id,((ae=m.querySelector("h3"))==null?void 0:ae.textContent)||"",m.dataset.type,((oe=m.querySelector("a"))==null?void 0:oe.href)||null,((le=m.querySelector("img"))==null?void 0:le.src)||null,((he=m.querySelector("p"))==null?void 0:he.textContent)||null)}),xe=new me(De,Me,Le,qe);if(r(this,k,l.hasAttribute("message-id")?l.getAttribute("message-id"):null),r(this,R,l.hasAttribute("feed-id")?l.getAttribute("feed-id"):null),r(this,q,l.hasAttribute("feed-name")?l.getAttribute("feed-name"):null),r(this,W,Se),r(this,H,(l.hasAttribute("features")?l.getAttribute("features"):"").split(" ").map(m=>m.trim()).filter(m=>!!m)),r(this,_,(l.getAttribute("role")||"").includes("comment")),r(this,p,xe),r(this,M,x),r(this,B,I),r(this,C,ke),r(this,b,new Re(ye,Ce,ve,Ee,be)),r(this,L,We),r(this,D,d.dataset.sortId||`000-${re}-${s(this,k)}`),!s(this,te)){const m=l.shadowRoot.querySelector("g2ui-lightbox");m&&y(this,w,se).call(this,m)}}}g=new WeakMap,k=new WeakMap,R=new WeakMap,q=new WeakMap,D=new WeakMap,Z=new WeakMap,p=new WeakMap,C=new WeakMap,M=new WeakMap,B=new WeakMap,L=new WeakMap,b=new WeakMap,_=new WeakMap,j=new WeakMap,T=new WeakMap,H=new WeakMap,W=new WeakMap,te=new WeakMap,w=new WeakSet,se=function(h){h.addEventListener("share",({detail
1:e})=>this.element.dispatchEvent(new CustomEvent("lightbox:share",{detail:e}))),r(this,te,!0)},ne=function(){const h=this.element.ownerDocument.createElement("g2ui-lightbox");return h.setAttribute("part","lightbox"),y(this,w,se).call(this,h),h},S=function(){let h=s(this,g).shadowRoot.querySelector(".wrapper")||s(this,g).shadowRoot.ownerDocument.createElement("div");return h.classList.add("wrapper"),h.parentNode||s(this,g).shadowRoot.insertBefore(h,s(this,g).shadowRoot.firstElementChild.nextElementSibling),h};var O,ee,v;const we=class fe extends Ie{constructor(){super(),c(this,O,!0),c(this,ee,null),c(this,v),r(this,O,this.isDeclarativeShadowDom);let e=this.shadowRoot.querySelector(".wrapper");if(!e){e=this.ownerDocument.createElement("div"),e.classList.add("wrapper");const t=this.ownerDocument.createElement("slot");t.name="actions",this.shadowRoot.appendChild(e),e.appendChild(t)}r(this,v,new He(this))}connectedCallback(){s(this,O)&&(s(this,v).parse(),r(this,O,!1)),this.shadowRoot.querySelector(".wrapper").addEventListener("click",this,!1)}disconnectedCallback(){this.shadowRoot.querySelector(".wrapper").removeEventListener("click",this,!1)}handleEvent(e){const t=e.target;if(e.type==="click"){const n=this.classList.contains("link-engager");if(n&&t.classList.contains("author")){const i=s(this,v).header.author;this.dispatchEvent(new CustomEvent("engager:click",{detail:{message:s(this,v),engager:i}}));return}if(n&&t.classList.contains("recipient")){const i=s(this,v).header.recipients.filter(a=>a.userId===parseInt(t.dataset.userId))[0];this.dispatchEvent(new CustomEvent("engager:click",{detail:{message:s(this,v),engager:i}}));return}const o=t.closest("a");if(o&&!o.closest("g2ui-lightbox")){e.preventDefault();const i=new de("message:link:click",s(this,v),{cancelable:!0});o.dispatchEvent(i),i.defaultPrevented||window.open(o.href,"_blank");return}if(!this.shadowRoot.contains(t))return;t.closest("aside.meta")||this.dispatchEvent(new de("message:click",s(this,v)))}}set feed(e){r(this,ee,e)}get feed(){return s(this,ee)}get value(){return s(this,v)}static register(){Be.register(),je.register(),customElements.get("g2ui-posted-message")||customElements.define("g2ui-posted-message",fe)}};O=new WeakMap,ee=new WeakMap,v=new WeakMap,Ne(we,"adopt",[new URL("/apps/framework/build/css/g2ui-posted-message-CjsGg8YB.css",import.meta.url)]);let Ye=we;export{U as Engager,me as Header,ue as Meta,Ye as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.