UNPKG

@creaditor/newsletter-starterkit

Version:

Creaditor Newsletter Editor - Starterkit for creating beautiful email newsletters

289 lines (272 loc) 31.4 kB
/*! For license information please see 5349.creaditor.bundle.js.LICENSE.txt */ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5349],{65349:(t,e,i)=>{i.r(e),i.d(e,{MakeNewsletterAsEventPlugin:()=>Pt});const s=globalThis,n=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),r=new WeakMap;class a{constructor(t,e,i){if(this._$cssResult$=!0,i!==o)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(n&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=r.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&r.set(e,t))}return t}toString(){return this.cssText}}const h=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new a("string"==typeof t?t:t+"",void 0,o))(e)})(t):t,{is:l,defineProperty:c,getOwnPropertyDescriptor:p,getOwnPropertyNames:d,getOwnPropertySymbols:u,getPrototypeOf:$}=Object,f=globalThis,g=f.trustedTypes,m=g?g.emptyScript:"",y=f.reactiveElementPolyfillSupport,v=(t,e)=>t,_={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},b=(t,e)=>!l(t,e),A={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:b};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class S 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=A){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 i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&c(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:n}=p(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const o=s?.call(this);n?.call(this,e),this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??A}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=$(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...d(t),...u(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(h(t))}else void 0!==t&&e.push(h(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"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 i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(n)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),n=s.litNonce;void 0!==n&&e.setAttribute("nonce",n),e.textContent=i.cssText,t.appendChild(e)}})(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,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const n=(void 0!==i.converter?.toAttribute?i.converter:_).toAttribute(e,i.type);this._$Em=t,null==n?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:_;this._$Em=s;const o=n.fromAttribute(e,t.type);this[s]=o??this._$Ej?.get(s)??o,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const s=this.constructor,n=this[t];if(i??=s.getPropertyOptions(t),!((i.hasChanged??b)(n,e)||i.useDefault&&i.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:n},o){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==n||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&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,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}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){}}S.elementStyles=[],S.shadowRootOptions={mode:"open"},S[v("elementProperties")]=new Map,S[v("finalized")]=new Map,y?.({ReactiveElement:S}),(f.reactiveElementVersions??=[]).push("2.1.1");const T=globalThis,C=T.trustedTypes,E=C?C.createPolicy("lit-html",{createHTML:t=>t}):void 0,x="$lit$",w=`lit$${Math.random().toFixed(9).slice(2)}$`,k="?"+w,D=`<${k}>`,P=document,H=()=>P.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,U=Array.isArray,O=t=>U(t)||"function"==typeof t?.[Symbol.iterator],L="[ \t\n\f\r]",N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,V=/>/g,z=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,B=/"/g,I=/^(?:script|style|textarea|title)$/i,G=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),W=G(1),q=(G(2),G(3),Symbol.for("lit-noChange")),Z=Symbol.for("lit-nothing"),F=new WeakMap,J=P.createTreeWalker(P,129);function K(t,e){if(!U(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(e):e}const Q=(t,e)=>{const i=t.length-1,s=[];let n,o=2===e?"<svg>":3===e?"<math>":"",r=N;for(let e=0;e<i;e++){const i=t[e];let a,h,l=-1,c=0;for(;c<i.length&&(r.lastIndex=c,h=r.exec(i),null!==h);)c=r.lastIndex,r===N?"!--"===h[1]?r=R:void 0!==h[1]?r=V:void 0!==h[2]?(I.test(h[2])&&(n=RegExp("</"+h[2],"g")),r=z):void 0!==h[3]&&(r=z):r===z?">"===h[0]?(r=n??N,l=-1):void 0===h[1]?l=-2:(l=r.lastIndex-h[2].length,a=h[1],r=void 0===h[3]?z:'"'===h[3]?B:j):r===B||r===j?r=z:r===R||r===V?r=N:(r=z,n=void 0);const p=r===z&&t[e+1].startsWith("/>")?" ":"";o+=r===N?i+D:l>=0?(s.push(a),i.slice(0,l)+x+i.slice(l)+w+p):i+w+(-2===l?e:p)}return[K(t,o+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class X{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const r=t.length-1,a=this.parts,[h,l]=Q(t,e);if(this.el=X.createElement(h,i),J.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=J.nextNode())&&a.length<r;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(x)){const e=l[o++],i=s.getAttribute(t).split(w),r=/([.?@])?(.*)/.exec(e);a.push({type:1,index:n,name:r[2],strings:i,ctor:"."===r[1]?st:"?"===r[1]?nt:"@"===r[1]?ot:it}),s.removeAttribute(t)}else t.startsWith(w)&&(a.push({type:6,index:n}),s.removeAttribute(t));if(I.test(s.tagName)){const t=s.textContent.split(w),e=t.length-1;if(e>0){s.textContent=C?C.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],H()),J.nextNode(),a.push({type:2,index:++n});s.append(t[e],H())}}}else if(8===s.nodeType)if(s.data===k)a.push({type:2,index:n});else{let t=-1;for(;-1!==(t=s.data.indexOf(w,t+1));)a.push({type:7,index:n}),t+=w.length-1}n++}}static createElement(t,e){const i=P.createElement("template");return i.innerHTML=t,i}}function Y(t,e,i=t,s){if(e===q)return e;let n=void 0!==s?i._$Co?.[s]:i._$Cl;const o=M(e)?void 0:e._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),void 0===o?n=void 0:(n=new o(t),n._$AT(t,i,s)),void 0!==s?(i._$Co??=[])[s]=n:i._$Cl=n),void 0!==n&&(e=Y(t,n._$AS(t,e.values),n,s)),e}class tt{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:i}=this._$AD,s=(t?.creationScope??P).importNode(e,!0);J.currentNode=s;let n=J.nextNode(),o=0,r=0,a=i[0];for(;void 0!==a;){if(o===a.index){let e;2===a.type?e=new et(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new rt(n,this,t)),this._$AV.push(e),a=i[++r]}o!==a?.index&&(n=J.nextNode(),o++)}return J.currentNode=P,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class et{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=Z,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.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=Y(this,t,e),M(t)?t===Z||null==t||""===t?(this._$AH!==Z&&this._$AR(),this._$AH=Z):t!==this._$AH&&t!==q&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):O(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!==Z&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=X.createElement(K(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new tt(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=F.get(t.strings);return void 0===e&&F.set(t.strings,e=new X(t)),e}k(t){U(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new et(this.O(H()),this.O(H()),this,this.options)):i=e[s],i._$AI(n),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class it{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,n){this.type=1,this._$AH=Z,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Z}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=Y(this,t,e,0),o=!M(t)||t!==this._$AH&&t!==q,o&&(this._$AH=t);else{const s=t;let r,a;for(t=n[0],r=0;r<n.length-1;r++)a=Y(this,s[i+r],e,r),a===q&&(a=this._$AH[r]),o||=!M(a)||a!==this._$AH[r],a===Z?t=Z:t!==Z&&(t+=(a??"")+n[r+1]),this._$AH[r]=a}o&&!s&&this.j(t)}j(t){t===Z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class st extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Z?void 0:t}}class nt extends it{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Z)}}class ot extends it{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){if((t=Y(this,t,e,0)??Z)===q)return;const i=this._$AH,s=t===Z&&i!==Z||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==Z&&(i===Z||s);s&&this.element.removeEventListener(this.name,this,i),n&&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 rt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Y(this,t)}}const at={M:x,P:w,A:k,C:1,L:Q,R:tt,D:O,V:Y,I:et,H:it,N:nt,U:ot,B:st,F:rt},ht=T.litHtmlPolyfillSupport;ht?.(X,et),(T.litHtmlVersions??=[]).push("3.3.1");const lt=globalThis;class ct extends S{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,i)=>{const s=i?.renderBefore??e;let n=s._$litPart$;if(void 0===n){const t=i?.renderBefore??null;s._$litPart$=n=new et(e.insertBefore(H(),t),t,void 0,i??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return q}}ct._$litElement$=!0,ct.finalized=!0,lt.litElementHydrateSupport?.({LitElement:ct});const pt=lt.litElementPolyfillSupport;pt?.({LitElement:ct});(lt.litElementVersions??=[]).push("4.2.1");const dt={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:b},ut=(t=dt,e,i)=>{const{kind:s,metadata:n}=i;let o=globalThis.litPropertyMetadata.get(n);if(void 0===o&&globalThis.litPropertyMetadata.set(n,o=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),o.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const n=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,n,t)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=i;return function(i){const n=this[s];e.call(this,i),this.requestUpdate(s,n,t)}}throw Error("Unsupported decorator location: "+s)};function $t(t){return(e,i)=>"object"==typeof i?ut(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}const{I:ft}=at,gt=2;class mt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const yt=(t,e)=>{const i=t._$AN;if(void 0===i)return!1;for(const t of i)t._$AO?.(e,!1),yt(t,e);return!0},vt=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===i?.size)},_t=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),St(e)}};function bt(t){void 0!==this._$AN?(vt(this),this._$AM=t,_t(this)):this._$AM=t}function At(t,e=!1,i=0){const s=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(e)if(Array.isArray(s))for(let t=i;t<s.length;t++)yt(s[t],!1),vt(s[t]);else null!=s&&(yt(s,!1),vt(s));else yt(this,t)}const St=t=>{t.type==gt&&(t._$AP??=At,t._$AQ??=bt)};class Tt extends mt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),_t(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(yt(this,t),vt(this))}setValue(t){if((t=>void 0===t.strings)(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class Ct{}const Et=new WeakMap,xt=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends Tt{render(t){return Z}update(t,[e]){const i=e!==this.G;return i&&void 0!==this.G&&this.rt(void 0),(i||this.lt!==this.ct)&&(this.G=e,this.ht=t.options?.host,this.rt(this.ct=t.element)),Z}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.G){const e=this.ht??globalThis;let i=Et.get(e);void 0===i&&(i=new WeakMap,Et.set(e,i)),void 0!==i.get(this.G)&&this.G.call(this.ht,void 0),i.set(this.G,t),void 0!==t&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){return"function"==typeof this.G?Et.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var wt=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,Dt=(t,e,i,s)=>{for(var n,o=s>1?void 0:s?kt(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(o=(s?n(e,i,o):n(o))||o);return s&&o&&wt(e,i,o),o};let Pt=class extends ct{constructor(){super(...arguments),this.lang="en",this.primaryColor="#000000",this.primaryTextColor="#ffffff",this.buttonText="#ffffff",this.iconColor="#ffffff",this.buttonTextContent="",this.headerText="Create Event",this.startLabel="Start Date & Time",this.endLabel="End Date & Time",this.locationLabel="Location",this.linkLabel="Link (Optional)",this.saveButtonText="Save Event",this.cancelEventText="Cancel Event",this.confirmCancelText="Are you sure you want to cancel?",this.creatingEventText="Creating Event...",this.eventCreatedText="Event Created!",this.errorMessage="End date/time must be after start date/time",this.locationPlaceholder="Enter event location",this.linkPlaceholder="Enter event link",this.initialStartDate="",this.initialStartTime="",this.initialEndDate="",this.initialEndTime="",this.initialLocation="",this.initialLink="",this.startDate="",this.startTime="",this.endDate="",this.endTime="",this.location="",this.link="",this.error="",this.isSaving=!1,this.isSaved=!1,this.isConfirmingCancel=!1,this.popoverRef=new Ct,this.cancelTimeout=null}get buttonDisplayText(){return this.isSaved?this.eventCreatedText:this.isSaving?this.creatingEventText:this.startDate&&this.startTime?new Date(`${this.startDate}T${this.startTime}`).toLocaleDateString(this.lang,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):this.buttonTextContent}connectedCallback(){super.connectedCallback(),this.initialStartDate&&this.initialStartTime&&(this.startDate=this.initialStartDate,this.startTime=this.initialStartTime),this.initialEndDate&&this.initialEndTime&&(this.endDate=this.initialEndDate,this.endTime=this.initialEndTime),this.initialLocation&&(this.location=this.initialLocation),this.initialLink&&(this.link=this.initialLink)}handleStartDateTimeChange(t){const e=t.target,[i,s]=e.value.split("T");if(this.startDate=i,this.startTime=s,!this.endDate&&!this.endTime){const t=new Date(new Date(`${i}T${s}`).getTime()+36e5);this.endDate=t.toISOString().split("T")[0],this.endTime=t.toTimeString().slice(0,5)}this.validateDates()}handleEndDateTimeChange(t){const e=t.target,[i,s]=e.value.split("T");this.endDate=i,this.endTime=s,this.validateDates()}validateDates(){if(this.startDate&&this.startTime&&this.endDate&&this.endTime){const t=new Date(`${this.startDate}T${this.startTime}`);new Date(`${this.endDate}T${this.endTime}`)<=t?this.error=this.errorMessage:this.error=""}}async handleSave(){var t;if(this.error)return;this.isSaving=!0,this.isSaved=!1;const e=new CustomEvent("event-created",{detail:{startDate:this.startDate,startTime:this.startTime,endDate:this.endDate,endTime:this.endTime,location:this.location,link:this.link},bubbles:!0,composed:!0});this.dispatchEvent(e),null==(t=this.popoverRef.value)||t.close(),await new Promise((t=>setTimeout(t,1500))),this.isSaving=!1,this.isSaved=!0,setTimeout((()=>{this.isSaved=!1}),2e3)}handleCancelEvent(){var t;if(this.isConfirmingCancel){this.cancelTimeout&&(clearTimeout(this.cancelTimeout),this.cancelTimeout=null),this.startDate="",this.startTime="",this.endDate="",this.endTime="",this.location="",this.link="",this.error="",this.isConfirmingCancel=!1;const e=new CustomEvent("event-cancelled",{detail:{startDate:this.startDate,startTime:this.startTime,endDate:this.endDate,endTime:this.endTime,location:this.location,link:this.link},bubbles:!0,composed:!0});this.dispatchEvent(e),null==(t=this.popoverRef.value)||t.close()}else this.isConfirmingCancel=!0,this.cancelTimeout=window.setTimeout((()=>{this.isConfirmingCancel=!1}),3e3)}disconnectedCallback(){super.disconnectedCallback(),this.cancelTimeout&&clearTimeout(this.cancelTimeout)}render(){return W` <cdtr-popover ${xt(this.popoverRef)}> <paper-button color="primary" slot="trigger" dir="auto" ?disabled=${this.isSaving} > <div style="color:${this.iconColor}" class="button-content ${this.isSaved?"hidden":""}" > <svg width="20" height="20" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="${this.iconColor||"currentColor"}" > <path d="M9 1V3H15V1H17V3H21C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3H7V1H9ZM20 11H4V19H20V11ZM11 13V17H6V13H11ZM7 5H4V9H20V5H17V7H15V5H9V7H7V5Z" ></path> </svg> ${this.buttonDisplayText} </div> <div class="button-border ${this.isSaving?"loading":""} ${this.isSaved?"success":""}" ></div> <svg class="checkmark ${this.isSaved?"visible":""}" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" > <path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z" fill="${"currentColor"}" /> </svg> </paper-button> <div slot="content" class="popover-content" dir="auto"> <div class="popover-header"> <h3 dir="auto">${this.headerText}</h3> </div> <div class="input-group"> <label dir="auto">${this.startLabel}</label> <input type="datetime-local" .value=${`${this.startDate}T${this.startTime}`} @change=${this.handleStartDateTimeChange} dir="auto" /> </div> <div class="input-group"> <label dir="auto">${this.endLabel}</label> <input type="datetime-local" .value=${`${this.endDate}T${this.endTime}`} @change=${this.handleEndDateTimeChange} dir="auto" /> </div> <div class="input-group"> <label dir="auto">${this.locationLabel}</label> <input type="text" .value=${this.location} @input=${t=>this.location=t.target.value} placeholder=${this.locationPlaceholder} dir="auto" /> </div> <div class="input-group"> <label dir="auto">${this.linkLabel}</label> <input name="link" type="url" .value=${this.link} @input=${t=>this.link=t.target.value} placeholder=${this.linkPlaceholder} dir="auto" /> </div> ${this.error?W`<div class="error" dir="auto">${this.error}</div>`:""} <div class="button-group"> ${this.startDate||this.endDate?W` <paper-button style=${`background: #ff0000;color:${this.primaryTextColor}`} class="cancel-event ${this.isConfirmingCancel?"confirming":""}" @click=${this.handleCancelEvent} ?disabled=${this.isSaving} dir="auto" > ${this.isConfirmingCancel?this.confirmCancelText:this.cancelEventText} </paper-button> `:""} <paper-button @click=${this.handleSave} ?disabled=${!!this.error||this.isSaving} style=${`background: ${this.primaryColor};color:${this.primaryTextColor};width:100%;`} dir="auto" > ${this.saveButtonText} </paper-button> </div> </div> </cdtr-popover> `}};Pt.styles=((t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new a(i,t,o)})` :host { display: block; } * { font-family: Arial, Helvetica, sans-serif; box-sizing: border-box; } .popover-content { padding: 16px; min-width: 300px; } .popover-header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid #e0e0e0; } .popover-header h3 { margin: 0; font-size: 16px; font-weight: 600; color: #333; } .popover-header svg { width: 20px; height: 20px; color: #666; } .input-group { margin-bottom: 16px; } .input-group label { display: block; margin-bottom: 4px; font-size: 14px; color: #333; } .input-group input { padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px; width: 100%; font-size: 14px; transition: border-color 0.2s; } .input-group input:focus { border-color: #666; outline: none; } .datetime-container { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .error { color: #ff0000; font-size: 12px; margin-bottom: 8px; } .button-content { display: flex; align-items: center; gap: 8px; position: relative; z-index: 1; transition: opacity 0.3s ease; } .button-content.hidden { opacity: 0; } .button-border { position: absolute; top: 0; left: 0; right: 0; bottom: 0; border: 2px solid transparent; border-radius: 4px; pointer-events: none; } .button-border.loading { border-color: #ffffff; animation: borderRotate 1.5s linear infinite; } .button-border.success { border-color: #4caf50; animation: borderSuccess 0.5s ease-out forwards; } paper-button { min-width: 10px; max-height:40px; } .checkmark { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0); width: 24px; height: 24px; opacity: 0; transition: opacity 0.3s ease; } .checkmark.visible { opacity: 1; transform: translate(-50%, -50%) scale(1); } @keyframes borderRotate { 0% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); } 25% { clip-path: polygon(0 0, 100% 0, 100% 0, 0 0); } 50% { clip-path: polygon(100% 0, 100% 100%, 100% 100%, 100% 0); } 75% { clip-path: polygon(100% 100%, 0 100%, 0 100%, 100% 100%); } 100% { clip-path: polygon(0 100%, 0 0, 0 0, 0 100%); } } @keyframes borderSuccess { 0% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); } 100% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); } } @keyframes checkmarkSuccess { 0% { transform: translate(-50%, -50%) scale(0); opacity: 0; } 50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } } .button-group { display: flex; gap: 8px; margin-top: 16px; } @keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } } `,Dt([$t({type:String})],Pt.prototype,"lang",2),Dt([$t({type:String})],Pt.prototype,"primaryColor",2),Dt([$t({type:String})],Pt.prototype,"primaryTextColor",2),Dt([$t({type:String})],Pt.prototype,"buttonText",2),Dt([$t({type:String})],Pt.prototype,"iconColor",2),Dt([$t({type:String})],Pt.prototype,"buttonTextContent",2),Dt([$t({type:String})],Pt.prototype,"headerText",2),Dt([$t({type:String})],Pt.prototype,"startLabel",2),Dt([$t({type:String})],Pt.prototype,"endLabel",2),Dt([$t({type:String})],Pt.prototype,"locationLabel",2),Dt([$t({type:String})],Pt.prototype,"linkLabel",2),Dt([$t({type:String})],Pt.prototype,"saveButtonText",2),Dt([$t({type:String})],Pt.prototype,"cancelEventText",2),Dt([$t({type:String})],Pt.prototype,"confirmCancelText",2),Dt([$t({type:String})],Pt.prototype,"creatingEventText",2),Dt([$t({type:String})],Pt.prototype,"eventCreatedText",2),Dt([$t({type:String})],Pt.prototype,"errorMessage",2),Dt([$t({type:String})],Pt.prototype,"locationPlaceholder",2),Dt([$t({type:String})],Pt.prototype,"linkPlaceholder",2),Dt([$t({type:String})],Pt.prototype,"initialStartDate",2),Dt([$t({type:String})],Pt.prototype,"initialStartTime",2),Dt([$t({type:String})],Pt.prototype,"initialEndDate",2),Dt([$t({type:String})],Pt.prototype,"initialEndTime",2),Dt([$t({type:String})],Pt.prototype,"initialLocation",2),Dt([$t({type:String})],Pt.prototype,"initialLink",2),Dt([$t()],Pt.prototype,"startDate",2),Dt([$t()],Pt.prototype,"startTime",2),Dt([$t()],Pt.prototype,"endDate",2),Dt([$t()],Pt.prototype,"endTime",2),Dt([$t()],Pt.prototype,"location",2),Dt([$t()],Pt.prototype,"link",2),Dt([$t()],Pt.prototype,"error",2),Dt([$t()],Pt.prototype,"isSaving",2),Dt([$t()],Pt.prototype,"isSaved",2),Dt([$t()],Pt.prototype,"isConfirmingCancel",2),Pt=Dt([(t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)})("cdtr-make-newsletter-as-event-plugin")],Pt)}}]);