@creaditor/newsletter-starterkit
Version:
Creaditor Newsletter Editor - Starterkit for creating beautiful email newsletters
661 lines (621 loc) • 52.6 kB
JavaScript
/*! For license information please see 2397.creaditor.bundle.js.LICENSE.txt */
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[2397,6961],{59051:(t,e,s)=>{s.d(e,{$:()=>i});const i=s(8427).iv`
:host {
direction: ltr;
}
.new-folder-form {
max-width: 250px;
}
.add-btn {
background: var(--primary);
color: #fff;
padding: 6px;
}
paper-listbox {
background: transparent;
}
.file-col {
position: relative;
}
vaadin-item,
vaadin-list-box,
lang-text {
direction: ltr;
text-align: left;
}
.moved {
position: absolute;
left: 0;
top: 0;
width: 100%;
background: #fff;
opacity: 0.8;
height: 100%;
z-index: 2;
height: 100%;
}
.onOver {
background: red;
}
paper-item {
cursor: pointer;
font-family: Arial;
font-size: 16px;
}
.icon-btn {
min-width: 50px;
}
.divider-y {
width: 1px;
height: 30px;
background: #cccccc;
}
.list {
background: var(--alpha);
height: 100vh;
max-width: 210px;
}
.search {
--cdtr-input-height: 35px;
width: 200px;
}
.scroll-body {
max-height: calc(100vh - 260px);
overflow: auto;
padding: 5px;
}
.footer {
background: #fff;
width: 100%;
height: 40px;
box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
justify-content: flex-end;
align-items: center;
gap: 0px;
position: absolute;
width: 100%;
top: 100%;
transform: translateY(-100%);
left: 0;
}
.scroll-body::-webkit-scrollbar {
width: 6px;
}
.scroll-body::-webkit-scrollbar-track {
background: #f1f1f1;
}
.scroll-body::-webkit-scrollbar-thumb {
background: #272727;
}
.scroll-body::-webkit-scrollbar-thumb:hover {
background: #555;
}
paper-button.upload,
paper-button.add {
background: var(--primary);
color: var(--primaryText);
display: flex;
gap: 10px;
padding: 5px 22px;
}
paper-button.upload {
border-radius: 20px;
}
.upload-container {
padding: 44px 5px;
/* border:2px dashed grey; */
}
.gallery-container {
padding: 40px 20px;
}
`},62397:(t,e,s)=>{s.r(e),s.d(e,{CreaditorGalleryWrapper:()=>v});var i=s(56666),r=s(8427),o=s(40949),n=s(70235),l=s(9085),a=s(36351),d=s(61828),c=s(59051);function h(t){try{localStorage.setItem("creaditor-gallery-folder",t)}catch(t){console.warn("Could not write to localStorage:",t)}}class p extends r.oi{constructor(){super(),(0,i.Z)(this,"newFolderModalRef",(0,d.V)()),(0,i.Z)(this,"newFolderInputRef",(0,d.V)()),this.drop=this.drop.bind(this),this.controls=!0,this.sendFiles=this.sendFiles.bind(this),this.onSearch=this.onSearch.bind(this),this.coverEl=document.createElement("div"),this.sortItems=[{index:0,text:"fromNewToOld",value:{filter:"date",sortBy:"ASC"},checked:!0},{index:1,text:"fromOldToNew",value:{filter:"date",sortBy:"DESC"},checked:!1},{index:2,text:n.h.get("lang","aToZ"),value:{filter:"name",sortBy:"ASC"},checked:!1},{index:3,text:n.h.get("lang","zToA"),value:{filter:"name",sortBy:"DESC"},checked:!1}],this.filterItems=[{index:0,text:n.h.get("lang","folders"),value:"folders",checked:!0},{index:1,text:n.h.get("lang","images"),value:"images",checked:!0}]}openNewFolderModal(t){const e=this.newFolderModalRef.value;e&&(e.positionTarget=t.target,e.open(),this.newFolderInputRef.value.focus())}sendFiles(){const t={detail:this.files.filter((t=>t.selected)),bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",t))}onLiked(t){const e={detail:t,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("like",e))}onClickFolder(t,e){this.freeImages=!1,this.controls=e;const s={detail:t,bubbles:!1,composed:!1};this.folderName=t.name,this.dispatchEvent(new CustomEvent("folder",s))}onSelectFile(t){const e={detail:t,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",e))}onSelectPexelsImage(t){const e={detail:t,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",e))}onUpload(){const t=(0,o.Z)("input",{hidden:!0,type:"file",accept:"image/*"});t.onchange=t=>{const e=t.target;if(e.files&&e.files[0]){const t=new FileReader,s=e.files[0];t.onload=t=>{const e={detail:s,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("upload",e))},t.readAsDataURL(s)}},t.click()}onCreateNewFolder(){const t=this.newFolderInputRef.value.value;if(t.length<=30){const e={detail:t,bubbles:!1,composed:!1};this.newFolderModalRef.value.close(),this.dispatchEvent(new CustomEvent("newFolder",e)),this.newFolderInputRef.value.value=""}}onClickCategory(){}onReset(){h(null),this.freeImages=!1,this.folderName=n.h.get("lang","myImages"),this.dispatchEvent(new CustomEvent("reset",{}))}onSearch(t,e){h(null),this.freeImages=!1;let s=!1;"object"==typeof e&&e.isLiked&&(s=!0);const i=t.target.value;(0,a.Z)((()=>{const t={detail:{value:i,isLiked:s},bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("search",t))}))}drop(t,e){t.preventDefault();const s=t.dataTransfer.getData("fileId"),i=(t.dataTransfer.getData("folderId"),{detail:{fileId:s,folderId:e},bubbles:!1,composed:!1});this.dispatchEvent(new CustomEvent("moveFile",i))}onFilterMedia(t){const e=t.detail.value,s=e.index,i=[...this.filterItems];i[s].checked=!i[s].checked,this.filterItems=i}onSort(t){const e=t.detail.value,s={detail:e,bubbles:!1,composed:!1},i=e.index,r=[...this.sortItems];r.forEach(((t,e)=>{t.checked=i===e})),this.sortItems=r,this.dispatchEvent(new CustomEvent("filter",s))}onDeleteFile(t){const e={detail:t,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("deleteFile",e))}onDeleteFolder(t){const e={detail:t,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("deleteFolder",e))}dragStart(t,e){t.dataTransfer.setData("fileId",e)}dragOver(t,e){t.dataTransfer.setData("folderId",e),t.preventDefault()}onFreeImages(){this.freeImages=!0,h("freeImages"),s.e(901).then(s.bind(s,20901))}onScroll(t){const e=t.target;if(e.scrollTop+e.offsetHeight>=e.scrollHeight-50){const t={detail:{folderId:this.folderId,page:this.page},bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("loadMore",t))}}connectedCallback(){super.connectedCallback(),s.e(8718).then(s.bind(s,85910));"freeImages"===function(){try{return localStorage.getItem("creaditor-gallery-folder")}catch(t){return console.warn("Could not read from localStorage:",t),null}}()&&(this.freeImages=!0,s.e(901).then(s.bind(s,20901)))}render(){Array.isArray(this.files)||(this.files=[]),Array.isArray(this.folders)||(this.folders=[]);const t=this.folders.filter((t=>"public"!==t.visibility)),e=this.folders.filter((t=>"public"===t.visibility));return r.dy` <cdtr-row dir="rtl">
<cdtr-col class="list" sm="3">
<cdtr-row alignItems="center" class="upload-container">
<paper-button @click=${this.onUpload} class="upload">
<lang-text text="upload"></lang-text
><cdtr-upload-icon width="20"></cdtr-upload-icon>
</paper-button>
</cdtr-row>
<paper-listbox selected="${this.freeImages?"2":"0"}">
<paper-item @click=${this.onReset}
><lang-text text="myImages"></lang-text
></paper-item>
<paper-item @click=${t=>this.onSearch(t,{isLiked:!0})}
><lang-text text="favorites"></lang-text
></paper-item>
<paper-item @click=${this.onFreeImages}> <lang-text text="freeImages"></lang-text> </paper-item>
${Array.isArray(e)?e.map((t=>r.dy`<paper-item
@click=${()=>this.onClickFolder(t,!1)}
><lang-text text="${t.name}"></lang-text
></paper-item>`)):null}
</paper-listbox>
</cdtr-col>
${this.freeImages?r.dy`<cdtr-col>
<cdtr-pexels-gallery
@file=${t=>this.onSelectPexelsImage(t.detail)}
></cdtr-pexels-gallery>
</cdtr-col>`:r.dy`<cdtr-col>
<div class="gallery-container">
<cdtr-row alignItems="center">
<cdtr-input
type="search"
@input=${this.onSearch}
placeholder="${n.h.get("lang","search")}"
class="search"
></cdtr-input>
<div class="divider-y"></div>
<paper-button
@click=${this.openNewFolderModal}
class="icon-btn"
>
<cdtr-tooltip delay="500,0" arrow=${!1} content="newFolder"
><cdtr-new-folder-icon></cdtr-new-folder-icon> </cdtr-tooltip
></paper-button>
</cdtr-row>
<cdtr-row mt="1">
${this.folderName?r.dy`
<cdtr-title style="font-size:14px"
><lang-text text="main"></lang-text
></cdtr-title>
<cdtr-arrow-icon
width="16"
height="16"
to="left"
></cdtr-arrow-icon>
<cdtr-title style="font-size:14px;color:var(--primary);"
>${this.folderName}</cdtr-title
>
`:null}
</cdtr-row>
<cdtr-row mt="2" justify="space-between">
${this.filterItems[0].checked?r.dy` <cdtr-col sm="2">
<cdtr-row
spacing="2px"
class="scroll-body"
justify="space-between"
>
<cdtr-col sm="12">
<cdtr-editor-media-card
@click=${()=>{this.onReset()}}
.controls=${!1}
type="folder"
name=${n.h.get("lang","myImages")}
></cdtr-editor-media-card>
</cdtr-col>
${(0,l.r)(t||[],(t=>t.id),((t,e)=>r.dy`<cdtr-col sm="12">
<cdtr-editor-media-card
@deleteFolder=${()=>this.onDeleteFolder(t)}
@deleteFile=${()=>this.onDeleteFile(t)}
@dragover=${e=>this.dragOver(e,t.id)}
@drop=${e=>this.drop(e,t.id)}
@click=${()=>{this.onClickFolder(t,!0),this.folders.forEach((t=>t.selected=!1)),t.selected=!t.selected,this.folders=[...this.folders]}}
.selected=${t.selected}
.controls=${!0}
type="folder"
name=${t.name||"..."}
subTitle="${parseFloat(t.file_count)||""}"
></cdtr-editor-media-card>
</cdtr-col>`))}
</cdtr-row>
</cdtr-col>`:null}
${this.filterItems[1].checked?r.dy` <cdtr-col sm="10">
<cdtr-row
@scroll=${this.onScroll}
class="scroll-body"
justify="space-evenly"
>
${(0,l.r)(this.files||[],(t=>t.id),((t,e)=>r.dy`<cdtr-col class="file-col" sm="3">
${t.moved?r.dy` <div class="moved"></div> `:null}
<cdtr-editor-media-card
@deleteFile=${()=>this.onDeleteFile(t)}
@deleteFolder=${()=>this.onDeleteFolder(t)}
@like=${()=>this.onLiked(t)}
draggable=${!0}
@dragstart=${e=>this.dragStart(e,t.id)}
@dblclick=${()=>this.onSelectFile(t)}
@click=${e=>{e.shiftKey&&this.multi||this.files.forEach((t=>t.selected=!1)),t.selected=!t.selected,this.files=[...this.files]}}
.selected=${t.selected}
.controls=${this.controls}
.liked=${t.isLiked||t.isFavorite}
src=${t.src}
name=${t.name}
subTitle="${t.size}"
></cdtr-editor-media-card>
</cdtr-col>`))}
</cdtr-row>
</cdtr-col>`:null}
<cdtr-row alignItems="center" justify="flex-end" class="footer">
<paper-button @click=${this.sendFiles} class="add-btn"
><lang-text text="choose"></lang-text
></paper-button>
</cdtr-row>
</cdtr-row>
</div>
</cdtr-col>`}
<paper-dialog
${(0,d.i)(this.newFolderModalRef)}
no-overlap
horizontal-align="left"
vertical-align="top"
>
<form class="new-folder-form">
<cdtr-row spacing="5px">
<cdtr-col sm="10"
><h2><lang-text text="addFolder"></lang-text></h2
></cdtr-col>
<cdtr-col sm="10"
><cdtr-title><lang-text text="folderName"></lang-text></cdtr-title
></cdtr-col>
<cdtr-col sm="10"
><cdtr-input
@submit=${this.onCreateNewFolder}
${(0,d.i)(this.newFolderInputRef)}
autofocus=${!0}
maxLength=${30}
></cdtr-input
></cdtr-col>
<cdtr-col sm="10">
<paper-button @click=${this.onCreateNewFolder} class="add" raised
><lang-text text="yes,Create"></lang-text
></paper-button>
</cdtr-col>
</cdtr-row>
</form>
</paper-dialog>
</cdtr-row>`}}(0,i.Z)(p,"styles",c.$),(0,i.Z)(p,"properties",{folders:{type:Array},files:{type:Array},pageCount:{type:Number},prevUrl:{type:String},nextUrl:{type:String},folderName:{type:String},filterItems:{type:Array},multi:{type:Boolean},controls:{type:Boolean},freeImages:{type:Boolean}}),customElements.define("cdtr-gallery-files",p);class u extends r.oi{constructor(){super(),this.uploads={}}connectedCallback(){super.connectedCallback(),this.addEventListener("upload-start",this.handleUploadStart.bind(this)),this.addEventListener("upload-progress",this.handleUploadProgress.bind(this)),this.addEventListener("upload-complete",this.handleUploadComplete.bind(this)),this.addEventListener("upload-error",this.handleUploadError.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("upload-start",this.handleUploadStart.bind(this)),this.removeEventListener("upload-progress",this.handleUploadProgress.bind(this)),this.removeEventListener("upload-complete",this.handleUploadComplete.bind(this)),this.removeEventListener("upload-error",this.handleUploadError.bind(this))}handleUploadStart(t){const{uploadId:e,fileName:s}=t.detail;this.uploads[e]={fileName:s,status:"uploading",progress:0,error:null},this.requestUpdate()}handleUploadProgress(t){const{uploadId:e,progress:s}=t.detail;this.uploads[e]&&(this.uploads[e].progress=s,this.requestUpdate())}handleUploadComplete(t){const{uploadId:e}=t.detail;this.uploads[e]&&(this.uploads[e].status="completed",this.uploads[e].progress=100,this.requestUpdate(),setTimeout((()=>{this.removeUpload(e)}),3e3))}handleUploadError(t){const{uploadId:e,error:s}=t.detail;this.uploads[e]&&(this.uploads[e].status="error",this.uploads[e].error=s,this.requestUpdate(),setTimeout((()=>{this.removeUpload(e)}),5e3))}removeUpload(t){delete this.uploads[t],this.requestUpdate()}getStatusIcon(t){switch(t){case"uploading":default:return r.dy`<div class="status-icon uploading"></div>`;case"completed":return r.dy`<div class="status-icon completed"></div>`;case"error":return r.dy`<div class="status-icon error"></div>`}}getProgressFillClass(t){switch(t){case"completed":return"progress-fill completed";case"error":return"progress-fill error";default:return"progress-fill"}}render(){const t=Object.entries(this.uploads).map((t=>{let[e,s]=t;return r.dy`
<div class="upload-item">
<div class="upload-header">
<span class="file-name" title="${s.fileName}">${s.fileName}</span>
<div style="display: flex; align-items: center; gap: 8px;">
${this.getStatusIcon(s.status)}
<button
class="close-btn"
@click=${()=>this.removeUpload(e)}
title="Close"
>×</button>
</div>
</div>
<div class="progress-bar">
<div
class="${this.getProgressFillClass(s.status)}"
style="width: ${s.progress}%"
></div>
</div>
<div class="progress-text">
${"uploading"===s.status?`${s.progress}%`:"completed"===s.status?"Upload completed":"error"===s.status?"Upload failed":""}
</div>
${s.error?r.dy`
<div class="error-message">
${s.error.message||s.error}
</div>
`:""}
</div>
`}));return r.dy`
<div>
${t}
</div>
`}}(0,i.Z)(u,"styles",r.iv`
:host {
display: block;
position: fixed;
top: 20px;
right: 20px;
z-index: 9999;
max-width: 300px;
}
.upload-item {
background: white;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 12px;
margin-bottom: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
.upload-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
}
.file-name {
font-size: 14px;
font-weight: 500;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 200px;
}
.status-icon {
width: 16px;
height: 16px;
border-radius: 50%;
}
.status-icon.uploading {
background: #007bff;
animation: pulse 1.5s infinite;
}
.status-icon.completed {
background: #28a745;
}
.status-icon.error {
background: #dc3545;
}
@keyframes pulse {
0% {
opacity: 1;
}
50% {
opacity: 0.5;
}
100% {
opacity: 1;
}
}
.progress-bar {
width: 100%;
height: 4px;
background: #f0f0f0;
border-radius: 2px;
overflow: hidden;
margin-bottom: 4px;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, #007bff, #0056b3);
transition: width 0.3s ease;
border-radius: 2px;
}
.progress-fill.completed {
background: #28a745;
}
.progress-fill.error {
background: #dc3545;
}
.progress-text {
font-size: 12px;
color: #666;
text-align: right;
}
.error-message {
font-size: 12px;
color: #dc3545;
margin-top: 4px;
}
.close-btn {
background: none;
border: none;
color: #999;
cursor: pointer;
font-size: 16px;
padding: 0;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.close-btn:hover {
color: #666;
}
`),(0,i.Z)(u,"properties",{uploads:{type:Object}}),customElements.define("cdtr-upload-loading",u);s(6961);class f extends r.oi{constructor(){super(),this.isVisible=!1,this.fileName="",this.status="uploading",this.progress=0,this.timeElapsed=0,this.pollInterval=null,this.timeoutId=null,this.progressInterval=null,this.startTime=null,this.maxDuration=3e4,this.pollFrequency=7e3}connectedCallback(){super.connectedCallback(),window.addEventListener("cdtr-upload-start",this.handleUploadStart.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.cleanup(),window.removeEventListener("cdtr-upload-start",this.handleUploadStart.bind(this))}handleUploadStart(t){console.log("Upload monitor received event:",t.detail);const{fileName:e,file:s}=t.detail;this.startUploadMonitor(e,s)}startUploadMonitor(t,e){console.log("Starting upload monitor for:",t),this.fileName=t,this.isVisible=!0,this.status="uploading",this.progress=0,this.timeElapsed=0,this.startTime=Date.now(),this.uploadedFile=e,console.log("Component should be visible now, isVisible:",this.isVisible),this.requestUpdate(),this.simulateUploadProgress(),setTimeout((()=>{this.status="checking",this.startPolling(),this.startTimeout()}),this.pollFrequency)}simulateUploadProgress(){let t=0;this.progressInterval=setInterval((()=>{t+=15*Math.random(),t>=90&&(t=90,clearInterval(this.progressInterval),this.progressInterval=null),this.progress=Math.floor(t),this.requestUpdate()}),300)}startPolling(){this.progress=100,this.status="completed",this.requestUpdate(),setTimeout((()=>{this.isVisible=!1,this.requestUpdate()}),5e3)}startTimeout(){this.timeoutId=setTimeout((()=>{"completed"!==this.status&&this.handleTimeout()}),this.maxDuration)}handleUploadSuccess(){this.cleanup(),this.status="completed",this.progress=100,this.requestUpdate(),setTimeout((()=>{this.isVisible=!1,this.requestUpdate()}),2e3)}handleTimeout(){this.cleanup(),this.status="timeout",this.requestUpdate(),setTimeout((()=>{this.isVisible=!1,this.requestUpdate()}),1e4)}cleanup(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null),this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.progressInterval&&(clearInterval(this.progressInterval),this.progressInterval=null)}getCircleProgress(){const t=2*Math.PI*26;return t-this.progress/100*t}renderContent(){switch(this.status){case"uploading":return r.dy`
<div class="progress-circle">
<svg class="progress-ring" width="60" height="60">
<circle class="progress-ring-bg" cx="30" cy="30" r="26"></circle>
<circle
class="progress-ring-progress"
cx="30"
cy="30"
r="26"
style="stroke-dashoffset: ${this.getCircleProgress()}"
></circle>
</svg>
<div class="progress-text">${this.progress}%</div>
</div>
<div class="status-text">
<lang-text text="uploading"></lang-text>
</div>
<div class="file-name" title="${this.fileName}">${this.fileName}</div>
`;case"checking":return r.dy`
<div class="spinner"></div>
<div class="status-text">
<lang-text text="verifying"></lang-text>
</div>
<div class="file-name" title="${this.fileName}">${this.fileName}</div>
`;case"completed":return r.dy`
<div class="success-icon"></div>
<div class="status-text">
<lang-text text="completed"></lang-text>
</div>
<div class="file-name" title="${this.fileName}">${this.fileName}</div>
`;case"timeout":return r.dy`
<div class="error-icon"></div>
<div class="status-text"><lang-text text="timeout"></lang-text></div>
<div class="file-name" title="${this.fileName}">${this.fileName}</div>
<div style="font-size: 10px; color: #666; margin-top: 4px;">
File may be uploaded. Refresh gallery.
</div>
`;default:return r.dy``}}render(){return console.log("Render called - isVisible:",this.isVisible,"status:",this.status,"progress:",this.progress),this.isVisible?r.dy` <div class="upload-card">${this.renderContent()}</div> `:r.dy``}}(0,i.Z)(f,"styles",r.iv`
:host {
display: block;
position: fixed;
bottom: 20px;
left: 20px;
z-index: 10000;
}
.upload-card {
background: white;
border-radius: 12px;
padding: 16px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
text-align: center;
min-width: 200px;
max-width: 250px;
animation: slideInLeft 0.3s ease-out;
}
@keyframes slideInLeft {
from {
transform: translateX(-100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
.progress-circle {
position: relative;
width: 60px;
height: 60px;
margin: 0 auto 12px;
}
.progress-ring {
transform: rotate(-90deg);
}
.progress-ring-circle {
transition: stroke-dashoffset 0.3s ease;
transform-origin: 50% 50%;
}
.progress-ring-bg {
fill: none;
stroke: #f0f0f0;
stroke-width: 6;
}
.progress-ring-progress {
fill: none;
stroke: #007bff;
stroke-width: 6;
stroke-linecap: round;
stroke-dasharray: 163.36; /* 2 * PI * 26 (radius) */
stroke-dashoffset: 163.36;
}
.progress-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 14px;
font-weight: 600;
color: #333;
font-family: var(--font-family);
}
.status-text {
font-size: 13px;
font-weight: 500;
color: #333;
margin-bottom: 6px;
}
.file-name {
font-size: 11px;
color: #666;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 220px;
margin: 0 auto;
}
.spinner {
width: 24px;
height: 24px;
border: 3px solid #f3f3f3;
border-top: 3px solid #007bff;
border-radius: 50%;
animation: spin 1s linear infinite;
margin: 0 auto 12px;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.success-icon {
width: 60px;
height: 60px;
margin: 0 auto 12px;
border-radius: 50%;
background: #28a745;
display: flex;
align-items: center;
justify-content: center;
animation: scaleIn 0.3s ease-out;
}
.success-icon::after {
content: "✓";
font-size: 30px;
color: white;
font-weight: bold;
}
@keyframes scaleIn {
from {
transform: scale(0);
}
to {
transform: scale(1);
}
}
.error-icon {
width: 60px;
height: 60px;
margin: 0 auto 12px;
border-radius: 50%;
background: #dc3545;
display: flex;
align-items: center;
justify-content: center;
animation: scaleIn 0.3s ease-out;
}
.error-icon::after {
content: "✕";
font-size: 30px;
color: white;
font-weight: bold;
}
`),(0,i.Z)(f,"properties",{isVisible:{type:Boolean},fileName:{type:String},status:{type:String},progress:{type:Number},timeElapsed:{type:Number}}),customElements.define("cdtr-upload-progress-monitor",f);var m=s(85517),g=s(30814);class v extends r.oi{constructor(){super(),this.sortBy="ASC",this.files=[],this.folders=[],this.uploadStatus={},this.onSearch=this.onSearch.bind(this),this.close=this.close.bind(this),this.reset=this.reset.bind(this);const t=new m.Z;this.eventEmitter=t;const e=n.h.get("config","editor","configure","mediaGalleryManager");t.files=this.files,t.close=this.close,"function"==typeof e&&(t.render=this.reset,console.log("init mediaGalleryManager"),e(t)),this.reset()}reset(){this.dirId=null,this.eventEmitter.dispatch("load-folders",{resolve:t=>{this.folders=t}}),this.eventEmitter.dispatch("load-files",{resolve:t=>{this.files=[...t]}})}uploadFile(t){this.folders||(this.folders=[]);const e=t.detail,s=this.folders.find((t=>t.selected)),i=`${e.name}-${Date.now()}`;this.uploadStatus[i]={fileName:e.name,status:"uploading",progress:0,error:null},console.log("Dispatching cdtr-upload-start event for:",e.name),this.dispatchEvent(new CustomEvent("cdtr-upload-start",{detail:{uploadId:i,fileName:e.name,file:e},bubbles:!0,composed:!0})),console.log("Event dispatched"),this.eventEmitter.dispatch("upload-file",{file:e,dirId:s?s.id:null,uploadId:i,execCommand:(t,e)=>{n.h.get("editor").store().execCommand(t,e)},options:{},onProgress:t=>{this.uploadStatus[i]&&(this.uploadStatus[i].progress=t,this.requestUpdate("uploadStatus"),this.dispatchEvent(new CustomEvent("upload-progress",{detail:{uploadId:i,fileName:e.name,progress:t},bubbles:!0,composed:!0})))},onComplete:t=>{this.uploadStatus[i]&&(this.uploadStatus[i].status="completed",this.uploadStatus[i].progress=100,this.requestUpdate("uploadStatus"),this.dispatchEvent(new CustomEvent("cdtr-upload-complete",{detail:{uploadId:i,fileName:e.name,result:t},bubbles:!0,composed:!0})),setTimeout((()=>{delete this.uploadStatus[i],this.requestUpdate("uploadStatus")}),3e3))},onError:t=>{this.uploadStatus[i]&&(this.uploadStatus[i].status="error",this.uploadStatus[i].error=t,this.requestUpdate("uploadStatus"),this.dispatchEvent(new CustomEvent("cdtr-upload-error",{detail:{uploadId:i,fileName:e.name,error:t},bubbles:!0,composed:!0})),setTimeout((()=>{delete this.uploadStatus[i],this.requestUpdate("uploadStatus")}),5e3))}}),this.opened=!1}onSearch(t){const{value:e,isLiked:s}=t.detail;s?this.eventEmitter.dispatch("load-files",{isLiked:s,resolve:t=>{Array.isArray(t)?this.files=[...t]:console.error("files is not array",t)}}):e.trim().length>2?this.eventEmitter.dispatch("load-files",{filter:"name",search:e,resolve:t=>{this.files=[...t]}}):0===e.trim().length&&this.reset()}onFilter(t){const e=t.detail;this.eventEmitter.dispatch("load-files",{filter:"name",search:e.value})}onSelectFolder(t){const e=t.detail,s=this.sortBy,i=e.id;this.dirId=i,this.eventEmitter.dispatch("load-files",{filter:"dir",dirId:i,sortBy:s,resolve:t=>{this.files=t}})}oncreateNewFolder(t){const e=t.detail;this.eventEmitter.dispatch("create-folder",{name:e,resolve:t=>{this.folders||(this.folders=[]);const e=[...this.folders];e.forEach((t=>t.selected=!1)),t.selected=!0,e.unshift(t),this.folders=e,this.onSelectFolder({detail:t})}})}onMoveFile(t){const e=t.detail;this.eventEmitter.dispatch("on-move-file",{data:e,resolve:t=>{if(this.folders||(this.folders=[]),this.dirId===e.folderId)return;const s=this.files.findIndex((t=>t.id===e.fileId));if(-1!==s){const t=[...this.files];t[s].moved=!0,this.files=t}const i=this.folders.findIndex((t=>t.id===e.folderId));if(-1!==i){const t=[...this.folders];t[i].file_count+=1,this.folders=t}}})}onLike(t){const e=t.detail;this.eventEmitter.dispatch("on-like",{fileId:e.id,resolve:t=>{const s=this.files.findIndex((t=>t.id===e.id));if(-1!==s){const t=[...this.files];t[s].isLiked=!t[s].isLiked,this.files=t}}})}onselectFile(t){const e={detail:t.detail,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",e))}close(){this.dispatchEvent(new CustomEvent("close",{}))}onDleteFile(t){const e=t.detail;this.eventEmitter.dispatch("delete-file",{id:e.id,type:"image",resolve:t=>{const s=this.files.findIndex((t=>t.id===e.id));if(-1!==s){const t=[...this.files];t.splice(s,1),this.files=t}}})}onLoadMore(){this.eventEmitter.dispatch("lazy-load-files-on-scroll",{resolve:t=>{if(Array.isArray(t)&&t.length>0){const e=[...this.files,...t];this.files=e}}})}onDeleteFolder(t){const e=t.detail;this.eventEmitter.dispatch("delete-folder",{id:e.id,resolve:t=>{this.folders||(this.folders=[]);const s=this.folders.findIndex((t=>t.id===e.id));if(-1!==s){const t=[...this.folders];t.splice(s,1),this.folders=t}}})}connectedCallback(){super.connectedCallback(),g.td.on("on:upload-file","gallery:on:upload-file",(t=>{let{image:e,type:s}=t;if("base64"===s){const t=e.split(",")[1]||e,s=atob(t),i=new Array(s.length);for(let t=0;t<s.length;t++)i[t]=s.charCodeAt(t);const r=new Uint8Array(i),o=new Blob([r],{type:"image/png"}),n=new File([o],"uploaded-image.png",{type:"image/png"});this.uploadFile({detail:n})}}))}render(){return r.dy`
<cdtr-upload-loading></cdtr-upload-loading>
<cdtr-upload-progress-monitor></cdtr-upload-progress-monitor>
<cdtr-drawer
@close=${this.close}
width="50vw"
.opened=${this.opened}
>
<cdtr-gallery-files
@loadMore=${this.onLoadMore}
@deleteFile=${this.onDleteFile}
@deleteFolder=${this.onDeleteFolder}
@like=${this.onLike}
@newFolder=${this.oncreateNewFolder}
@moveFile=${this.onMoveFile}
@file=${this.onselectFile}
@filter=${this.onFilter}
@folder=${this.onSelectFolder}
@search=${this.onSearch}
@reset=${this.reset}
@upload=${this.uploadFile}
.nextUrl=${this.nextUrl}
.prevUrl=${this.prevUrl}
.pageCount=${this.pageCount}
.files=${this.files}
.multi=${this.multi}
.folders=${this.folders}
></cdtr-gallery-files>
</cdtr-drawer>`}}(0,i.Z)(v,"styles",r.iv``),(0,i.Z)(v,"properties",{folders:{type:Array},files:{type:Array},pageCount:{type:Number},prevUrl:{type:String},nextUrl:{type:String},opened:{type:Boolean},multi:{type:Boolean},uploadStatus:{type:Object}}),customElements.define("cdtr-gallery",v)},6961:(t,e,s)=>{s.r(e),s.d(e,{TitleEditor:()=>ft});var i=s(56666);const r=globalThis,o=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),l=new WeakMap;class a{constructor(t,e,s){if(this._$cssResult$=!0,s!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(o&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=l.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&l.set(e,t))}return t}toString(){return this.cssText}}const d=(t,e)=>{if(o)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const s of e){const e=document.createElement("style"),i=r.litNonce;void 0!==i&&e.setAttribute("nonce",i),e.textContent=s.cssText,t.appendChild(e)}},c=o?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new a("string"==typeof t?t:t+"",void 0,n))(e)})(t):t,{is:h,defineProperty:p,getOwnPropertyDescriptor:u,getOwnPropertyNames:f,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,v=globalThis,y=v.trustedTypes,b=y?y.emptyScript:"",$=v.reactiveElementPolyfillSupport,x=(t,e)=>t,w={toAttribute(t,e){switch(e){case Boolean:t=t?b:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},_=(t,e)=>!h(t,e),E={attribute:!0,type:String,converter:w,reflect:!1,useDefault:!1,hasChanged:_};Symbol.metadata??=Symbol("metadata"),v.litPropertyMetadata??=new WeakMap;class A extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=E){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&p(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:r}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const o=i?.call(this);r?.call(this,e),this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??E}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const t=g(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const t=this.properties,e=[...f(t),...m(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(c(t))}else void 0!==t&&e.push(c(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return d(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const r=(void 0!==s.converter?.toAttribute?s.converter:w).toAttribute(e,s.type);this._$Em=t,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:w;this._$Em=i,this[i]=r.fromAttribute(e,t.type)??this._$Ej?.get(i)??null,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const i=this.constructor,r=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??_)(r,e)||s.useDefault&&s.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:r},o){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==r||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,s,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}}A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[x("elementProperties")]=new Map,A[x("finalized")]=new Map,$?.({ReactiveElement:A}),(v.reactiveElementVersions??=[]).push("2.1.0");const S=globalThis,k=S.trustedTypes,C=k?k.createPolicy("lit-html",{createHTML:t=>t}):void 0,I="$lit$",U=`lit$${Math.random().toFixed(9).slice(2)}$`,F="?"+U,N=`<${F}>`,P=document,T=()=>P.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,O=Array.isArray,R=t=>O(t)||"function"==typeof t?.[Symbol.iterator],D="[ \t\n\f\r]",L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,H=/-->/g,z=/>/g,j=RegExp(`>|${D}(?:([^\\s"'>=/]+)(${D}*=${D}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),B=/'/g,q=/"/g,V=/^(?:script|style|textarea|title)$/i,Z=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),W=Z(1),G=(Z(2),Z(3),Symbol.for("lit-noChange")),J=Symbol.for("lit-nothing"),K=new WeakMap,X=P.createTreeWalker(P,129);function Y(t,e){if(!O(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==C?C.createHTML(e):e}const Q=(t,e)=>{const s=t.length-1,i=[];let r,o=2===e?"<svg>":3===e?"<math>":"",n=L;for(let e=0;e<s;e++){const s=t[e];let l,a,d=-1,c=0;for(;c<s.length&&(n.lastIndex=c,a=n.exec(s),null!==a);)c=n.lastIndex,n===L?"!--"===a[1]?n=H:void 0!==a[1]?n=z:void 0!==a[2]?(V.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=j):void 0!==a[3]&&(n=j):n===j?">"===a[0]?(n=r??L,d=-1):void 0===a[1]?d=-2:(d=n.lastIndex-a[2].length,l=a[1],n=void 0===a[3]?j:'"'===a[3]?q:B):n===q||n===B?n=j:n===H||n===z?n=L:(n=j,r=void 0);const h=n===j&&t[e+1].startsWith("/>")?" ":"";o+=n===L?s+N:d>=0?(i.push(l),s.slice(0,d)+I+s.slice(d)+U+h):s+U+(-2===d?e:h)}return[Y(t,o+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class tt{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let r=0,o=0;const n=t.length-1,l=this.parts,[a,d]=Q(t,e);if(this.el=tt.createElement(a,s),X.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=X.nextNode())&&l.length<n;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(I)){const e=d[o++],s=i.getAttribute(t).split(U),n=/([.?@])?(.*)/.exec(e);l.push({type:1,index:r,name:n[2],strings:s,ctor:"."===n[1]?ot:"?"===n[1]?nt:"@"===n[1]?lt:rt}),i.removeAttribute(t)}else t.startsWith(U)&&(l.push({type:6,index:r}),i.removeAttribute(t));if(V.test(i.tagName)){const t=i.textContent.split(U),e=t.length-1;if(e>0){i.textContent=k?k.emptyScript:"";for(let s=0;s<e;s++)i.append(t[s],T()),X.nextNode(),l.push({type:2,index:++r});i.append(t[e],T())}}}else if(8===i.nodeType)if(i.data===F)l.push({type:2,index:r});else{let t=-1;for(;-1!==(t=i.data.indexOf(U,t+1));)l.push({type:7,index:r}),t+=U.length-1}r++}}static createElement(t,e){const s=P.createElement("template");return s.innerHTML=t,s}}function et(t,e,s=t,i){if(e===G)return e;let r=void 0!==i?s._$Co?.[i]:s._$Cl;const o=M(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),void 0===o?r=void 0:(r=new o(t),r._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=r:s._$Cl=r),void 0!==r&&(e=et(t,r._$AS(t,e.values),r,i)),e}class st{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??P).importNode(e,!0);X.currentNode=i;let r=X.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let e;2===l.type?e=new it(r,r.nextSibling,this,t):1===l.type?e=new l.ctor(r,l.name,l.strings,this,t):6===l.type&&(e=new at(r,this,t)),this._$AV.push(e),l=s[++n]}o!==l?.index&&(r=X.nextNode(),o++)}return X.currentNode=P,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class it{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=J,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=et(this,t,e),M(t)?t===J||null==t||""===t?(this._$AH!==J&&this._$AR(),this._$AH=J):t!==this._$AH&&t!==G&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):R(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==J&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=tt.createElement(Y(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new st(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=K.get(t.strings);return void 0===e&&K.set(t.strings,e=new tt(t)),e}k(t){O(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const r of t)i===e.length?e.push(s=new it(this.O(T()),this.O(T()),this,this.options)):s=e[i],s._$AI(r),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class rt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,r){this.type=1,this._$AH=J,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=J}_$AI(t,e=this,s,i){const r=this.strings;let o=!1;if(void 0===r)t=et(this,t,e,0),o=!M(t)||t!==this._$AH&&t!==G,o&&(this._$AH=t);else{const i=t;let n,l;for(t=r[0],n=0;n<r.length-1;n++)l=et(this,i[s+n],e,n),l===G&&(l=this._$AH[n]),o||=!M(l)||l!==this._$AH[n],l===J?t=J:t!==J&&(t+=(l??"")+r[n+1]),this._$AH[n]=l}o&&!i&&this.j(t)}j(t){t===J?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ot extends rt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===J?void 0:t}}class nt extends rt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==J)}}class lt extends rt{constructor(t,e,s,i,r){super(t,e,s,i,r),this.type=5}_$AI(t,e=this){if((t=et(this,t,e,0)??J)===G)return;const s=this._$AH,i=t===J&&s!==J||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==J&&(s===J||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class at{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){et(this,t)}}const dt=S.litHtmlPolyfillSupport;dt?.(tt,it),(S.litHtmlVersions??=[]).push("3.3.0");const ct=globalThis;class ht extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const i=s?.renderBefore??e;let r=i._$litPart$;if(void 0===r){const t=s?.renderBefore??null;i._$litPart$=r=new it(e.insertBefore(T(),t),t,void 0,s??{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return G}}ht._$litElement$=!0,ht.finalized=!0,ct.litElementHydrateSupport?.({LitElement:ht});const pt=ct.litElementPolyfillSupport;pt?.({LitElement:ht});(ct.litElementVersions??=[]).push("4.2.0");var ut=s(70235);class ft extends ht{constructor(){super(),this.text="",this.whiteSpace="pre"}connectedCallback(){super.connectedCallback(),this.style.fontFamily="var(--font-family)",this.bold&&(this.style.fontWeight="bold")}render(){const t=ut.h.get("theme");t&&(this.style.direction=t.direction,this.style.textAlign=this.textAlign||t.textAlign);const e=ut.h.get("lang",this.text);return W`<slot
><span
style="-webkit-font-smoothing: antialiased;
display:inline-block;direction:var(--direction-locale);text-align:var(--text-align-locale);white-space:${this.whiteSpace}"
>${e||this.text}</span
></slot
>`}}(0,i.Z)(ft,"properties",{text:{type:String,reflect:!1},whiteSpace:{type:String},textAlign:{type:String},bold:{type:Boolean}}),customElements.get("lang-text")||customElements.define("lang-text",ft)},30814:(t,e,s)=>{s.d(e,{td:()=>c});const i=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=i,window[i]||(window[i]={});const r=window[i],o=window.__cdtrEvents||{};function n(t){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)).then((t=>Array.from(new Uint8Array(t)).map((t=>t.toString(16).padStart(2,"0"))).join("")))}function l(t){if(t.length%2!=0)throw new Error("Invalid hex string");const e=new Uint8Array(t.length/2);for(let s=0;s<t.length;s+=2)e[s/2]=parseInt(t.substr(s,2),16);return e}async function a(t){const e=await n(t),s=r[e];if(s){const t=await crypto.subtle.importKey("raw",l(e),{name:"AES-GCM"},!1,["encrypt","decrypt"]),i=await async function(t,e,s){const i=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,s);return(new TextDecoder).decode(i)}(t,s.iv,s.encrypted);return JSON.parse(i)}return null}function d(t,e){if(o[t])for(const s in o[t])Object.prototype.ha