@penwin/discord-components-core 4.1.2 → 4.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/custom-elements.json +954 -954
  2. package/dist/bundle/index.mjs +12 -6
  3. package/dist/bundle/index.mjs.map +1 -1
  4. package/dist/components/discord-attachments/DiscordAttachments.js +3 -3
  5. package/dist/components/discord-media-fullscreen-previewer/DiscordMediaFullscreenPreviewer.d.ts.map +1 -1
  6. package/dist/components/discord-media-fullscreen-previewer/DiscordMediaFullscreenPreviewer.js +4 -1
  7. package/dist/components/discord-media-fullscreen-previewer/DiscordMediaFullscreenPreviewer.js.map +1 -1
  8. package/dist/components/discord-media-gallery-item/DiscordMediaGalleryItem.d.ts +26 -0
  9. package/dist/components/discord-media-gallery-item/DiscordMediaGalleryItem.d.ts.map +1 -0
  10. package/dist/components/discord-media-gallery-item/DiscordMediaGalleryItem.js +183 -0
  11. package/dist/components/discord-media-gallery-item/DiscordMediaGalleryItem.js.map +1 -0
  12. package/dist/components/discord-message/DiscordMessage.d.ts.map +1 -1
  13. package/dist/components/discord-message/DiscordMessage.js +5 -0
  14. package/dist/components/discord-message/DiscordMessage.js.map +1 -1
  15. package/dist/components/discord-transcript-header/DiscordTranscriptHeader.d.ts.map +1 -1
  16. package/dist/components/discord-transcript-header/DiscordTranscriptHeader.js +1 -0
  17. package/dist/components/discord-transcript-header/DiscordTranscriptHeader.js.map +1 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/util.js +1 -1
  23. package/dist/util.js.map +1 -1
  24. package/package.json +3 -3
@@ -17,9 +17,9 @@ https://github.com/highlightjs/highlight.js/issues/2277`),j=w,W=B),G===void 0&&(
17
17
  }
18
18
  `,fi=c([M("discord-action-row")],fi);var Si=class extends x{render(){return p`<slot></slot>`}};n(Si,"DiscordAttachments"),Si.styles=I`
19
19
  :host {
20
- display: grid;
21
- grid-auto-flow: row;
22
- grid-row-gap: 0.25rem;
20
+ display: flex;
21
+ flex-direction: column;
22
+ row-gap: 0.25rem;
23
23
  text-indent: 0;
24
24
  min-height: 0;
25
25
  min-width: 0;
@@ -1555,7 +1555,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),j=w,W=B),G===void 0&&(
1555
1555
  margin-right: 0.7em;
1556
1556
  margin-left: -0.7em;
1557
1557
  }
1558
- `,c([u({type:Boolean})],Vt.prototype,"verified",2),c([U({context:et}),u({type:Boolean,reflect:!0,attribute:"compact-mode"})],Vt.prototype,"compactMode",2),Vt=c([M("discord-verified-author-tag")],Vt);var Ts="important",pE=" !"+Ts,Ye=ct(class extends St{constructor(e){if(super(e),e.type!==vi.ATTRIBUTE||e.name!=="style"||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,i)=>{let r=e[i];return r==null?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(e,[t]){let{style:i}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?i.removeProperty(r):i[r]=null);for(let r in t){let a=t[r];if(a!=null){this.ft.add(r);let o=typeof a=="string"&&a.endsWith(pE);r.includes("-")||o?i.setProperty(r,o?a.slice(0,-11):a,o?Ts:""):i[r]=a}}return lt}});var xe=class extends Error{static{n(this,"DiscordComponentsError")}constructor(t){super(t),this.name="DiscordComponentsError"}},mE=new Intl.DateTimeFormat("en-US",{day:"2-digit",month:"2-digit",year:"numeric"}),_E=new Intl.DateTimeFormat("en-US",{hour12:!0,hour:"2-digit",minute:"2-digit"}),uE=new Intl.DateTimeFormat("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),gE=n(e=>e instanceof Date?mE.format(e):e,"formatDate"),hE=n((e,t=!1)=>e instanceof Date?t?uE.format(e):_E.format(e):e,"formatTime");function qt(e,t=!1,i=!1){if(!(e instanceof Date)&&typeof e!="string")throw new TypeError("Timestamp prop must be a Date object or a string.");return t?hE(e,i):gE(e)}n(qt,"handleTimestamp");var Cs=/\.(?<ext>bmp|jpe?g|png|gif|webp|tiff)$/i;function Rs(e){if(!Cs.test(e))throw new xe(`The url of an image for discord-image-attachment should match the regex ${Cs}`)}n(Rs,"validateImageExtension");var EE=/(?:<(?<animated>a)?:(?<name>\w{2,32}):)?(?<id>\d{17,21})>?/;function gr(e){let t=Ti().emojis?.[e];if(t)return t;let i=EE.exec(e);if(i?.groups){let{name:r,id:a,animated:o}=i.groups;return{name:r,url:`https://cdn.discordapp.com/emojis/${a}.${o?"gif":"png"}`}}}n(gr,"getGlobalEmojiUrl");function Yn(e){if(e)return fs.get(e)??e}n(Yn,"getClanIcon");var ye=class extends x{constructor(){super(...arguments);this.author=void 0;this.bot=!1;this.server=!1;this.officialApp=!1;this.op=!1;this.roleColor=void 0;this.roleIcon=void 0;this.roleName=void 0;this.clanIcon=void 0;this.clanTag=void 0;this.verified=!1;this.compactMode=!1;this.lightTheme=!1}render(){let i=Yn(this.clanIcon),r=this.clanTag?.slice(0,4);return p`${C(this.compactMode,()=>null,()=>p`<span class="discord-author-username" style="${Ye({color:this.roleColor??void 0})}">${this.author}</span>`)}
1558
+ `,c([u({type:Boolean})],Vt.prototype,"verified",2),c([U({context:et}),u({type:Boolean,reflect:!0,attribute:"compact-mode"})],Vt.prototype,"compactMode",2),Vt=c([M("discord-verified-author-tag")],Vt);var Ts="important",pE=" !"+Ts,Ye=ct(class extends St{constructor(e){if(super(e),e.type!==vi.ATTRIBUTE||e.name!=="style"||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,i)=>{let r=e[i];return r==null?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(e,[t]){let{style:i}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?i.removeProperty(r):i[r]=null);for(let r in t){let a=t[r];if(a!=null){this.ft.add(r);let o=typeof a=="string"&&a.endsWith(pE);r.includes("-")||o?i.setProperty(r,o?a.slice(0,-11):a,o?Ts:""):i[r]=a}}return lt}});var xe=class extends Error{static{n(this,"DiscordComponentsError")}constructor(t){super(t),this.name="DiscordComponentsError"}},mE=new Intl.DateTimeFormat("en-US",{day:"2-digit",month:"2-digit",year:"numeric"}),_E=new Intl.DateTimeFormat("en-US",{hour12:!0,hour:"2-digit",minute:"2-digit"}),uE=new Intl.DateTimeFormat("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),gE=n(e=>e instanceof Date?mE.format(e):e,"formatDate"),hE=n((e,t=!1)=>e instanceof Date?t?uE.format(e):_E.format(e):e,"formatTime");function qt(e,t=!1,i=!1){if(!(e instanceof Date)&&typeof e!="string")throw new TypeError("Timestamp prop must be a Date object or a string.");return t?hE(new Date(e),i):gE(new Date(e))}n(qt,"handleTimestamp");var Cs=/\.(?<ext>bmp|jpe?g|png|gif|webp|tiff)$/i;function Rs(e){if(!Cs.test(e))throw new xe(`The url of an image for discord-image-attachment should match the regex ${Cs}`)}n(Rs,"validateImageExtension");var EE=/(?:<(?<animated>a)?:(?<name>\w{2,32}):)?(?<id>\d{17,21})>?/;function gr(e){let t=Ti().emojis?.[e];if(t)return t;let i=EE.exec(e);if(i?.groups){let{name:r,id:a,animated:o}=i.groups;return{name:r,url:`https://cdn.discordapp.com/emojis/${a}.${o?"gif":"png"}`}}}n(gr,"getGlobalEmojiUrl");function Yn(e){if(e)return fs.get(e)??e}n(Yn,"getClanIcon");var ye=class extends x{constructor(){super(...arguments);this.author=void 0;this.bot=!1;this.server=!1;this.officialApp=!1;this.op=!1;this.roleColor=void 0;this.roleIcon=void 0;this.roleName=void 0;this.clanIcon=void 0;this.clanTag=void 0;this.verified=!1;this.compactMode=!1;this.lightTheme=!1}render(){let i=Yn(this.clanIcon),r=this.clanTag?.slice(0,4);return p`${C(this.compactMode,()=>null,()=>p`<span class="discord-author-username" style="${Ye({color:this.roleColor??void 0})}">${this.author}</span>`)}
1559
1559
  ${C(this.roleIcon&&!this.compactMode,()=>p`<img
1560
1560
  class="discord-author-role-icon"
1561
1561
  src=${k(this.roleIcon)}
@@ -3984,7 +3984,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),j=w,W=B),G===void 0&&(
3984
3984
  .open-in-fullscreen-container {
3985
3985
  display: grid;
3986
3986
  }
3987
- `,c([u({type:Number,attribute:!1})],Tt.prototype,"size",2),c([ve({context:Xr})],Tt.prototype,"mediaItems",2),c([ee()],Tt.prototype,"currentSlot",2),c([ee()],Tt.prototype,"isOpen",2),Tt=c([M("discord-media-gallery")],Tt);var Ce=class extends x{constructor(){super(...arguments);this.spoiler=!1}static isVideo(i,r){if(r&&Ce.discordSupportedVideoMimeTypes.has(r))return!0;let a=i.split(".").pop();return Ce.discordSupportedVideoExtensions.has(a)}openInFullScreen(){let i=this.getAttribute("slot");if(!i)return;let r=i.split("-")[1];if(!r)return;let a=Number(r);if(Number.isNaN(a))return;let o=new CustomEvent("open-in-full-screen",{detail:{slot:a-1},bubbles:!0});this.dispatchEvent(o)}render(){let i=Ce.isVideo(this.media);return this.mediaItems.length===1&&i?p`<discord-video-attachment
3987
+ `,c([u({type:Number,attribute:!1})],Tt.prototype,"size",2),c([ve({context:Xr})],Tt.prototype,"mediaItems",2),c([ee()],Tt.prototype,"currentSlot",2),c([ee()],Tt.prototype,"isOpen",2),Tt=c([M("discord-media-gallery")],Tt);var Ce=class extends x{constructor(){super(...arguments);this.spoiler=!1}static isVideo(i,r){if(r&&Ce.discordSupportedVideoMimeTypes.has(r))return!0;let a=i.split(".").pop();return Ce.discordSupportedVideoExtensions.has(a)}openInFullScreen(){let i=this.getAttribute("slot");if(!i)return;let r=i.split("-")[1];if(!r)return;let a=Number(r);if(Number.isNaN(a))return;let o=new CustomEvent("open-in-full-screen",{detail:{slot:a-1},bubbles:!0});this.dispatchEvent(o)}render(){let i=Ce.isVideo(this.media,this.mimeType);return this.mediaItems.length===1&&i?p`<discord-video-attachment
3988
3988
  href=${this.media}
3989
3989
  spoiler=${this.spoiler}
3990
3990
  description=${this.description}
@@ -4336,6 +4336,11 @@ https://github.com/highlightjs/highlight.js/issues/2277`),j=w,W=B),G===void 0&&(
4336
4336
  padding-left: 10px;
4337
4337
  }
4338
4338
 
4339
+ .discord-message-compact-indent {
4340
+ display: grid;
4341
+ grid-template-columns: 1fr;
4342
+ }
4343
+
4339
4344
  :host .discord-message-markup {
4340
4345
  font-size: 1rem;
4341
4346
  line-height: 1.375rem;
@@ -4394,7 +4399,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),j=w,W=B),G===void 0&&(
4394
4399
  margin-right: 4px;
4395
4400
  vertical-align: text-bottom;
4396
4401
  }
4397
- `,c([u()],ne.prototype,"profile",2),c([u()],ne.prototype,"author",2),c([u()],ne.prototype,"avatar",2),c([u({type:Boolean})],ne.prototype,"bot",2),c([u({type:Boolean})],ne.prototype,"server",2),c([u({type:Boolean,attribute:"official-app"})],ne.prototype,"officialApp",2),c([u({type:Boolean})],ne.prototype,"verified",2),c([u({type:Boolean})],ne.prototype,"op",2),c([u({type:Boolean})],ne.prototype,"edited",2),c([u({attribute:"role-color"})],ne.prototype,"roleColor",2),c([u({attribute:"role-icon"})],ne.prototype,"roleIcon",2),c([u({attribute:"role-name"})],ne.prototype,"roleName",2),c([u({attribute:"clan-icon"})],ne.prototype,"clanIcon",2),c([u({attribute:"clan-tag"})],ne.prototype,"clanTag",2),c([u({type:Boolean,reflect:!0})],ne.prototype,"highlight",2),c([u({type:Boolean,reflect:!0})],ne.prototype,"ephemeral",2),c([ve({context:Ja}),u({type:String,converter:n(i=>qt(i,!1,!1),"converter"),attribute:!0})],ne.prototype,"timestamp",2),c([u({type:Boolean,attribute:"twenty-four"})],ne.prototype,"twentyFour",2),c([u({type:Boolean,attribute:"message-body-only"})],ne.prototype,"messageBodyOnly",2),c([U({context:Y}),u({type:Boolean,reflect:!0,attribute:"light-theme"})],ne.prototype,"lightTheme",2),c([U({context:et}),u({type:Boolean,reflect:!0,attribute:"compact-mode"})],ne.prototype,"compactMode",2),c([U({context:Aa}),u({type:Boolean,reflect:!0,attribute:"no-background"})],ne.prototype,"noBackground",2),c([u({type:Boolean,reflect:!0,attribute:"has-thread"})],ne.prototype,"hasThread",2),c([u({reflect:!1,attribute:"dismiss-message-clicked"})],ne.prototype,"dismissMessageClicked",2),c([ve({context:ja})],ne.prototype,"resolvedProfile",2),ne=c([M("discord-message")],ne);var ia=n((e,t,i)=>Math.max(t,Math.min(i,e)),"clamp"),sC=n((e,t)=>Math.round(e/t)*t,"roundBySteps"),lC=new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"numeric",year:"2-digit",hour:"numeric",minute:"2-digit",hourCycle:"h23"}),Xe=class extends x{constructor(){super();this.isInMediaFullScreenPreviewer=!0;this.isZoomed=!1;this.__currentXTranslatePercent=0;this.__currentYTranslatePercent=0;this.__draggCurrentXTranslatePercent=0;this.__draggCurrentYTranslatePercent=0;this.__didDrag=!1;this.__scale=1;this.imageRef=Ge();this.__canBeXDraggable=!1;this.__canBeYDraggable=!1;this.__maxXTranslatePercent=0;this.__maxYTranslatePercent=0;this.lightTheme=!1;this.currentSlot=0;this.isOpen=!1;this.containerRef=Ge();this.isCurrentlyClosing=!1;this.handleWindowResize=this.handleWindowResize.bind(this)}clampXTranslatePercentPosition(i){return ia(i,-this.__maxXTranslatePercent,this.__maxXTranslatePercent)}clampYTranslatePercentPosition(i){return ia(i,-this.__maxYTranslatePercent,this.__maxYTranslatePercent)}calcScale(){if(!this.imageRef.value)return 1;let i=this.imageRef.value.getBoundingClientRect(),r=window.innerWidth,a=window.innerHeight,o=r*a,l=i.width*i.height/o,d=ia(sC(l*8,2),2,4);return this.__scale=d,this.__scale}get __canBeDraggable(){return this.__canBeXDraggable||this.__canBeYDraggable}calcCanBeDraggable(i=!1){if(!i&&!this.isZoomed||!this.imageRef.value)return;let r=this.imageRef.value;this.__canBeXDraggable=r.clientWidth*this.__scale>window.innerWidth,this.__canBeYDraggable=r.clientHeight*this.__scale>window.innerHeight;let a=r.clientWidth*this.__scale,o=r.clientHeight*this.__scale,s=(a-window.innerWidth)/2,l=(o-window.innerHeight)/2;this.__maxXTranslatePercent=s/r.clientWidth*100,this.__maxYTranslatePercent=l/r.clientHeight*100,this.__currentXTranslatePercent=this.__canBeXDraggable?this.clampXTranslatePercentPosition(this.__currentXTranslatePercent):0,this.__currentYTranslatePercent=this.__canBeYDraggable?this.clampYTranslatePercentPosition(this.__currentYTranslatePercent):0,this.__draggCurrentXTranslatePercent=this.__currentXTranslatePercent,this.__draggCurrentYTranslatePercent=this.__currentYTranslatePercent,r.parentElement?.style.setProperty("--x",`${this.__currentXTranslatePercent}%`),r.parentElement?.style.setProperty("--y",`${this.__currentYTranslatePercent}%`),this.__canBeXDraggable?r.parentElement?.classList.add("can-be-x-draggable"):r.parentElement?.classList.remove("can-be-x-draggable"),this.__canBeYDraggable?r.parentElement?.classList.add("can-be-y-draggable"):r.parentElement?.classList.remove("can-be-y-draggable")}zoomIn(){if(this.isZoomed||!this.imageRef.value)return;this.calcScale(),this.calcCanBeDraggable();let i=this.imageRef.value,r=i.clientWidth,a=i.clientHeight;i.parentElement?.style.setProperty("--img-width",`${r}px`),i.parentElement?.style.setProperty("--img-height",`${a}px`),i.parentElement?.style.setProperty("--scale",`${this.__scale}`),i.parentElement?.style.setProperty("--x","0%"),i.parentElement?.style.setProperty("--y","0%"),this.__currentXTranslatePercent=0,this.__currentYTranslatePercent=0,this.__draggCurrentXTranslatePercent=0,this.__draggCurrentYTranslatePercent=0,this.isZoomed=!0}handleWindowResize(){this.calcCanBeDraggable()}handleImageClick(i){if(i.preventDefault(),i.stopPropagation(),this.isZoomed){if(this.__didDrag){this.__didDrag=!1;return}window.removeEventListener("resize",this.handleWindowResize),this.isZoomed=!1;return}let r=i.target,a=i.offsetX/r.clientWidth*100,o=i.offsetY/r.clientHeight*100,s=r.clientWidth,l=r.clientHeight;this.calcScale();let d=this.__canBeXDraggable?this.clampXTranslatePercentPosition((50-a)*this.__scale):0,m=this.__canBeYDraggable?this.clampYTranslatePercentPosition((50-o)*this.__scale):0;this.__currentXTranslatePercent=d,this.__currentYTranslatePercent=m,this.__draggCurrentXTranslatePercent=d,this.__draggCurrentYTranslatePercent=m,r.parentElement?.style.setProperty("--x",`${d}%`),r.parentElement?.style.setProperty("--y",`${m}%`),r.parentElement?.style.setProperty("--scale",`${this.__scale}`),r.parentElement?.style.setProperty("--img-width",`${s}px`),r.parentElement?.style.setProperty("--img-height",`${l}px`),this.isZoomed=!0,this.calcCanBeDraggable(!0),window.addEventListener("resize",this.handleWindowResize)}handleImageMouseMove(i){if(i.stopPropagation(),i.preventDefault(),!this.downEvent||i.buttons!==1||!this.__canBeDraggable)return;this.__didDrag=!0;let r=i.screenX-this.downEvent.screenX,a=i.screenY-this.downEvent.screenY,o=i.target,s=o.getBoundingClientRect(),l=r/s.width*100*this.__scale,d=a/s.height*100*this.__scale,m=this.__canBeXDraggable?this.clampXTranslatePercentPosition(this.__currentXTranslatePercent+l):0,_=this.__canBeYDraggable?this.clampYTranslatePercentPosition(this.__currentYTranslatePercent+d):0;this.__draggCurrentXTranslatePercent=m,this.__draggCurrentYTranslatePercent=_,o.parentElement?.style.setProperty("--x",`${m}%`),o.parentElement?.style.setProperty("--y",`${_}%`)}handleImageMouseDown(i){i.buttons===1&&(this.__currentXTranslatePercent=this.__draggCurrentXTranslatePercent,this.__currentYTranslatePercent=this.__draggCurrentYTranslatePercent,this.downEvent=this.isZoomed?i:void 0)}handleImageMouseUp(i){i.stopPropagation(),i.preventDefault(),this.__currentXTranslatePercent=this.__draggCurrentXTranslatePercent,this.__currentYTranslatePercent=this.__draggCurrentYTranslatePercent,this.downEvent=void 0}handleImageWheel(i){if(i.stopPropagation(),i.preventDefault(),!this.isZoomed||!this.__canBeDraggable)return;let r=i.deltaX===0,a=i.deltaY/10*-1,o=i.deltaX/10*-1,s=r&&i.shiftKey,l=this.__canBeYDraggable?this.clampYTranslatePercentPosition(this.__currentYTranslatePercent+(s?0:a)):0,d=this.__canBeYDraggable?this.clampXTranslatePercentPosition(this.__currentXTranslatePercent+(s?a:o)):0;this.__draggCurrentYTranslatePercent=l,this.__currentYTranslatePercent=l,this.__draggCurrentXTranslatePercent=d,this.__currentXTranslatePercent=d;let m=i.target;m.parentElement?.style.setProperty("--y",`${l}%`),m.parentElement?.style.setProperty("--x",`${d}%`)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.handleWindowResize),window.clearTimeout(this.__closeTimeout)}nextSlot(){let i=this.currentSlot+1;if(i>this.mediaItems.length-1){this.currentSlot=0;return}this.currentSlot=i,this.isZoomed=!1}prevSlot(){let i=this.currentSlot-1;if(i<0){this.currentSlot=this.mediaItems.length-1;return}this.currentSlot=i,this.isZoomed=!1}setCurrentSlot(i){this.currentSlot=i}handleContainerKeyUp(i){i.key==="ArrowLeft"?this.prevSlot():i.key==="ArrowRight"&&this.nextSlot()}close(){if(!this.isOpen||this.isCurrentlyClosing)return;this.isCurrentlyClosing=!0,this.containerRef.value?.classList.add("closing"),this.__closeTimeout=window.setTimeout(()=>{this.isOpen=!1,this.isZoomed=!1;let r=new CustomEvent("close-full-screen",{detail:{closed:!0}});this.dispatchEvent(r),this.isCurrentlyClosing=!1},250)}handleContainerClick(i){let r=this.containerRef.value;!r||i.target!==r||this.close()}render(){if(!this.isOpen)return null;let i=this.mediaItems[ia(this.currentSlot,0,this.mediaItems.length-1)],r=Ce.isVideo(i.href),a=this.mediaItems.length===1;return p`
4402
+ `,c([u()],ne.prototype,"profile",2),c([u()],ne.prototype,"author",2),c([u()],ne.prototype,"avatar",2),c([u({type:Boolean})],ne.prototype,"bot",2),c([u({type:Boolean})],ne.prototype,"server",2),c([u({type:Boolean,attribute:"official-app"})],ne.prototype,"officialApp",2),c([u({type:Boolean})],ne.prototype,"verified",2),c([u({type:Boolean})],ne.prototype,"op",2),c([u({type:Boolean})],ne.prototype,"edited",2),c([u({attribute:"role-color"})],ne.prototype,"roleColor",2),c([u({attribute:"role-icon"})],ne.prototype,"roleIcon",2),c([u({attribute:"role-name"})],ne.prototype,"roleName",2),c([u({attribute:"clan-icon"})],ne.prototype,"clanIcon",2),c([u({attribute:"clan-tag"})],ne.prototype,"clanTag",2),c([u({type:Boolean,reflect:!0})],ne.prototype,"highlight",2),c([u({type:Boolean,reflect:!0})],ne.prototype,"ephemeral",2),c([ve({context:Ja}),u({type:String,converter:n(i=>qt(i,!1,!1),"converter"),attribute:!0})],ne.prototype,"timestamp",2),c([u({type:Boolean,attribute:"twenty-four"})],ne.prototype,"twentyFour",2),c([u({type:Boolean,attribute:"message-body-only"})],ne.prototype,"messageBodyOnly",2),c([U({context:Y}),u({type:Boolean,reflect:!0,attribute:"light-theme"})],ne.prototype,"lightTheme",2),c([U({context:et}),u({type:Boolean,reflect:!0,attribute:"compact-mode"})],ne.prototype,"compactMode",2),c([U({context:Aa}),u({type:Boolean,reflect:!0,attribute:"no-background"})],ne.prototype,"noBackground",2),c([u({type:Boolean,reflect:!0,attribute:"has-thread"})],ne.prototype,"hasThread",2),c([u({reflect:!1,attribute:"dismiss-message-clicked"})],ne.prototype,"dismissMessageClicked",2),c([ve({context:ja})],ne.prototype,"resolvedProfile",2),ne=c([M("discord-message")],ne);var ia=n((e,t,i)=>Math.max(t,Math.min(i,e)),"clamp"),sC=n((e,t)=>Math.round(e/t)*t,"roundBySteps"),lC=new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"numeric",year:"2-digit",hour:"numeric",minute:"2-digit",hourCycle:"h23"}),Xe=class extends x{constructor(){super();this.isInMediaFullScreenPreviewer=!0;this.isZoomed=!1;this.__currentXTranslatePercent=0;this.__currentYTranslatePercent=0;this.__draggCurrentXTranslatePercent=0;this.__draggCurrentYTranslatePercent=0;this.__didDrag=!1;this.__scale=1;this.imageRef=Ge();this.__canBeXDraggable=!1;this.__canBeYDraggable=!1;this.__maxXTranslatePercent=0;this.__maxYTranslatePercent=0;this.lightTheme=!1;this.currentSlot=0;this.isOpen=!1;this.containerRef=Ge();this.isCurrentlyClosing=!1;this.handleWindowResize=this.handleWindowResize.bind(this)}clampXTranslatePercentPosition(i){return ia(i,-this.__maxXTranslatePercent,this.__maxXTranslatePercent)}clampYTranslatePercentPosition(i){return ia(i,-this.__maxYTranslatePercent,this.__maxYTranslatePercent)}calcScale(){if(!this.imageRef.value)return 1;let i=this.imageRef.value.getBoundingClientRect(),r=window.innerWidth,a=window.innerHeight,o=r*a,l=i.width*i.height/o,d=ia(sC(l*8,2),2,4);return this.__scale=d,this.__scale}get __canBeDraggable(){return this.__canBeXDraggable||this.__canBeYDraggable}calcCanBeDraggable(i=!1){if(!i&&!this.isZoomed||!this.imageRef.value)return;let r=this.imageRef.value;this.__canBeXDraggable=r.clientWidth*this.__scale>window.innerWidth,this.__canBeYDraggable=r.clientHeight*this.__scale>window.innerHeight;let a=r.clientWidth*this.__scale,o=r.clientHeight*this.__scale,s=(a-window.innerWidth)/2,l=(o-window.innerHeight)/2;this.__maxXTranslatePercent=s/r.clientWidth*100,this.__maxYTranslatePercent=l/r.clientHeight*100,this.__currentXTranslatePercent=this.__canBeXDraggable?this.clampXTranslatePercentPosition(this.__currentXTranslatePercent):0,this.__currentYTranslatePercent=this.__canBeYDraggable?this.clampYTranslatePercentPosition(this.__currentYTranslatePercent):0,this.__draggCurrentXTranslatePercent=this.__currentXTranslatePercent,this.__draggCurrentYTranslatePercent=this.__currentYTranslatePercent,r.parentElement?.style.setProperty("--x",`${this.__currentXTranslatePercent}%`),r.parentElement?.style.setProperty("--y",`${this.__currentYTranslatePercent}%`),this.__canBeXDraggable?r.parentElement?.classList.add("can-be-x-draggable"):r.parentElement?.classList.remove("can-be-x-draggable"),this.__canBeYDraggable?r.parentElement?.classList.add("can-be-y-draggable"):r.parentElement?.classList.remove("can-be-y-draggable")}zoomIn(){if(this.isZoomed||!this.imageRef.value)return;this.calcScale(),this.calcCanBeDraggable();let i=this.imageRef.value,r=i.clientWidth,a=i.clientHeight;i.parentElement?.style.setProperty("--img-width",`${r}px`),i.parentElement?.style.setProperty("--img-height",`${a}px`),i.parentElement?.style.setProperty("--scale",`${this.__scale}`),i.parentElement?.style.setProperty("--x","0%"),i.parentElement?.style.setProperty("--y","0%"),this.__currentXTranslatePercent=0,this.__currentYTranslatePercent=0,this.__draggCurrentXTranslatePercent=0,this.__draggCurrentYTranslatePercent=0,this.isZoomed=!0}handleWindowResize(){this.calcCanBeDraggable()}handleImageClick(i){if(i.preventDefault(),i.stopPropagation(),this.isZoomed){if(this.__didDrag){this.__didDrag=!1;return}window.removeEventListener("resize",this.handleWindowResize),this.isZoomed=!1;return}let r=i.target,a=i.offsetX/r.clientWidth*100,o=i.offsetY/r.clientHeight*100,s=r.clientWidth,l=r.clientHeight;this.calcScale();let d=this.__canBeXDraggable?this.clampXTranslatePercentPosition((50-a)*this.__scale):0,m=this.__canBeYDraggable?this.clampYTranslatePercentPosition((50-o)*this.__scale):0;this.__currentXTranslatePercent=d,this.__currentYTranslatePercent=m,this.__draggCurrentXTranslatePercent=d,this.__draggCurrentYTranslatePercent=m,r.parentElement?.style.setProperty("--x",`${d}%`),r.parentElement?.style.setProperty("--y",`${m}%`),r.parentElement?.style.setProperty("--scale",`${this.__scale}`),r.parentElement?.style.setProperty("--img-width",`${s}px`),r.parentElement?.style.setProperty("--img-height",`${l}px`),this.isZoomed=!0,this.calcCanBeDraggable(!0),window.addEventListener("resize",this.handleWindowResize)}handleImageMouseMove(i){if(i.stopPropagation(),i.preventDefault(),!this.downEvent||i.buttons!==1||!this.__canBeDraggable)return;this.__didDrag=!0;let r=i.screenX-this.downEvent.screenX,a=i.screenY-this.downEvent.screenY,o=i.target,s=o.getBoundingClientRect(),l=r/s.width*100*this.__scale,d=a/s.height*100*this.__scale,m=this.__canBeXDraggable?this.clampXTranslatePercentPosition(this.__currentXTranslatePercent+l):0,_=this.__canBeYDraggable?this.clampYTranslatePercentPosition(this.__currentYTranslatePercent+d):0;this.__draggCurrentXTranslatePercent=m,this.__draggCurrentYTranslatePercent=_,o.parentElement?.style.setProperty("--x",`${m}%`),o.parentElement?.style.setProperty("--y",`${_}%`)}handleImageMouseDown(i){i.buttons===1&&(this.__currentXTranslatePercent=this.__draggCurrentXTranslatePercent,this.__currentYTranslatePercent=this.__draggCurrentYTranslatePercent,this.downEvent=this.isZoomed?i:void 0)}handleImageMouseUp(i){i.stopPropagation(),i.preventDefault(),this.__currentXTranslatePercent=this.__draggCurrentXTranslatePercent,this.__currentYTranslatePercent=this.__draggCurrentYTranslatePercent,this.downEvent=void 0}handleImageWheel(i){if(i.stopPropagation(),i.preventDefault(),!this.isZoomed||!this.__canBeDraggable)return;let r=i.deltaX===0,a=i.deltaY/10*-1,o=i.deltaX/10*-1,s=r&&i.shiftKey,l=this.__canBeYDraggable?this.clampYTranslatePercentPosition(this.__currentYTranslatePercent+(s?0:a)):0,d=this.__canBeYDraggable?this.clampXTranslatePercentPosition(this.__currentXTranslatePercent+(s?a:o)):0;this.__draggCurrentYTranslatePercent=l,this.__currentYTranslatePercent=l,this.__draggCurrentXTranslatePercent=d,this.__currentXTranslatePercent=d;let m=i.target;m.parentElement?.style.setProperty("--y",`${l}%`),m.parentElement?.style.setProperty("--x",`${d}%`)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.handleWindowResize),window.clearTimeout(this.__closeTimeout)}nextSlot(){let i=this.currentSlot+1;if(i>this.mediaItems.length-1){this.currentSlot=0;return}this.currentSlot=i,this.isZoomed=!1}prevSlot(){let i=this.currentSlot-1;if(i<0){this.currentSlot=this.mediaItems.length-1;return}this.currentSlot=i,this.isZoomed=!1}setCurrentSlot(i){this.currentSlot=i}handleContainerKeyUp(i){i.key==="ArrowLeft"?this.prevSlot():i.key==="ArrowRight"?this.nextSlot():i.key==="Escape"&&this.close()}close(){if(!this.isOpen||this.isCurrentlyClosing)return;this.isCurrentlyClosing=!0,this.containerRef.value?.classList.add("closing"),this.__closeTimeout=window.setTimeout(()=>{this.isOpen=!1,this.isZoomed=!1;let r=new CustomEvent("close-full-screen",{detail:{closed:!0}});this.dispatchEvent(r),this.isCurrentlyClosing=!1},250)}handleContainerClick(i){let r=this.containerRef.value;!r||i.target!==r||this.close()}render(){if(!this.isOpen)return null;let i=this.mediaItems[ia(this.currentSlot,0,this.mediaItems.length-1)],r=Ce.isVideo(i.href),a=this.mediaItems.length===1;return p`
4398
4403
  <div
4399
4404
  class=${Q({"media-fullscreen-previewer":!0,zoomed:this.isZoomed,isOnlyOne:a})}
4400
4405
  ${Ee(this.containerRef)}
@@ -6763,6 +6768,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),j=w,W=B),G===void 0&&(
6763
6768
  padding: 0.5rem;
6764
6769
  gap: 0.5rem;
6765
6770
  border-bottom: 1px solid rgba(79, 84, 92, 0.48);
6771
+ padding-bottom: 1rem !important;
6766
6772
  }
6767
6773
 
6768
6774
  .discord-header-icon {