@creaditor/newsletter-starterkit 1.0.11 → 1.0.13

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.
@@ -1,4 +1,4 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6236],{46236:(e,t,r)=>{r.r(t),r.d(t,{BreadCrumbs:()=>l});var s=r(56666),i=r(40949),n=r(21293),o=(r(58860),r(70235)),c=r(23602),a=r(45607);class l extends n.oi{constructor(){super(),this.crumbs=[],this.cover=function(){const e=document.createElement("div");return e.style.position="fixed",e.style.background="var(--primary)",e.style.zIndex=2,e.style.border="1px dashed black",e.style.opacity=.2,e}(),this.currectCrumb={},this.onSubscribe=()=>{let e;this.crumbs=[];const t=a.Z.components[a.Z.components.length-1];if(!t)return;e=t.element;let r=t.type.getElementType(),s="";t.props.as&&(s=` (${o.h.get("lang",t.props.as)||t.props.as})`),this.currectCrumb={type:r,as:s,name:t.props.name,id:t.id};if(e){let t=e;for(;t&&t.parentElement;)if(t=t.parentElement.closest("[data-type]"),t){const e=o.h.get("components",t.dataset.id);let r=!0;e&&"row"!==e.type&&("col"===e.type&&"block"!==e.parent().type&&(r=!1),r&&this.crumbs.unshift({type:e.type,name:e.props.name,id:e.id,element:e.element,compose:e}))}this.dispatchEvent(new CustomEvent("change",[...this.crumbs]))}},this.onSubscribe=this.onSubscribe.bind(this)}onHover(e){if(e){const t=e.getBoundingClientRect();this.cover.style.left=t.left+"px",this.cover.style.top=t.top+"px",this.cover.style.width=t.width+"px",this.cover.style.height=t.height+"px",document.body.appendChild(this.cover)}}render(){const e=o.h.get("langConfig","direction");return this.crumbs.length>0?n.dy`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6236],{46236:(e,t,r)=>{r.r(t),r.d(t,{BreadCrumbs:()=>l});var s=r(56666),o=r(40949),n=r(21293),i=(r(58860),r(70235)),c=r(23602),a=r(45607);class l extends n.oi{constructor(){super(),this.crumbs=[],this.cover=function(){const e=document.createElement("div");return e.style.position="fixed",e.style.background="var(--primary)",e.style.zIndex=2,e.style.border="1px dashed black",e.style.opacity=.2,e}(),this.currectCrumb={},this.onSubscribe=()=>{let e;this.crumbs=[];const t=a.Z.components[a.Z.components.length-1];if(!t)return;if(e=t.element,!e)return void console.error("selectElement not found","#1ppqmvss6");let r=t.type.getElementType(),s="";t.props.as&&(s=` (${i.h.get("lang",t.props.as)||t.props.as})`),this.currectCrumb={type:r,as:s,name:t.props.name,id:t.id};if(e){let t=e;for(;t&&t.parentElement;)if(t=t.parentElement.closest("[data-type]"),t){const e=i.h.get("components",t.dataset.id);let r=!0;e&&"row"!==e.type&&("col"===e.type&&"block"!==e.parent().type&&(r=!1),r&&this.crumbs.unshift({type:e.type,name:e.props.name,id:e.id,element:e.element,compose:e}))}this.dispatchEvent(new CustomEvent("change",[...this.crumbs]))}},this.onSubscribe=this.onSubscribe.bind(this)}onHover(e){if(e){const t=e.getBoundingClientRect();this.cover.style.left=t.left+"px",this.cover.style.top=t.top+"px",this.cover.style.width=t.width+"px",this.cover.style.height=t.height+"px",document.body.appendChild(this.cover)}}render(){const e=i.h.get("langConfig","direction");return this.crumbs.length>0?n.dy`
2
2
  <!-- <cdtr-tooltip content="breadcrumbs_info" .opened=${!0}></cdtr-tooltip> -->
3
3
  <div>
4
4
  ${this.crumbs.map(((t,r)=>n.dy` <span
@@ -7,7 +7,7 @@
7
7
  @mousedown=${()=>this.clickBread(t)}
8
8
  class="breadcrumb"
9
9
  >${t.name||n.dy`<lang-text text=${t.type}></lang-text>`}</span
10
- >${this.crumbs.length===r?null:(0,i.Z)(c.IT,{style:{transform:`rotate(${"ltr"===e?"180deg":"0"})`},class:"arrow"})}`))}
10
+ >${this.crumbs.length===r?null:(0,o.Z)(c.IT,{style:{transform:`rotate(${"ltr"===e?"180deg":"0"})`},class:"arrow"})}`))}
11
11
  ${this.mainText?n.dy` <div class="currect">
12
12
  ${this.currectCrumb.name||n.dy`<lang-text text=${this.currectCrumb.type}></lang-text
13
13
  >${this.currectCrumb.as}`}
Binary file
@@ -1,6 +1,6 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[7637],{77637:(e,t,r)=>{r.r(t),r.d(t,{default:()=>L});var n=r(9571),s=r(8427);let i={};function a(e){i.selected=e}function c(e){return i.selected}const o=[{type:"youtube",src:"https://panel.sendmsg.co.il/templateContentImages/images/CreaditorGeneral/youtube.png"},{type:"whatsapp",src:"https://panel.sendmsg.co.il/templateContentImages/images/CreaditorGeneral/whatsapp.png"},{type:"snapchat",src:"https://panel.sendmsg.co.il/templateContentImages/images/CreaditorGeneral/snapchat.png"},{type:"instagram",src:"https://render.creaditor.ai/media/social-icons/instagram-black-square.png"},{type:"telegram",src:"https://render.creaditor.ai/media/social-icons/telegram-blue-square.png"},{type:"facebook",src:"https://render.creaditor.ai/media/social-icons/facebook-black-square.png"},{type:"vimeo",src:"https://render.creaditor.ai/media/social-icons/vimeo-blue-square.png"},{type:"email",src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"},{type:"phone",src:"https://render.creaditor.ai/media/social-icons/phone-black-circle.png"},{type:"x",src:"https://render.creaditor.ai/media/social-icons/x-black-circle.png"},{type:"linkedin",src:"https://render.creaditor.ai/media/social-icons/linkedin-black-circle.png"},{type:"tiktok",src:"https://render.creaditor.ai/media/social-icons/tiktok-black-circle.png"},{type:"reddit",src:"https://render.creaditor.ai/media/social-icons/reddit-black-circle.png"},{type:"twitch",src:"https://render.creaditor.ai/media/social-icons/twitch-black-circle.png"}];const l=e=>{{const{component:t,commands:r}=e,n=c();return n?{select:e=>{let{changeTab:t,tab:r}=e;"link"!==r&&t("link")},tabs:e=>{const t=[{text:"image"},{text:"link"},{text:"design"}];return t.forEach((t=>t.selected=t.selected=t.text===e)),t},layout:e=>{let{tab:i,changeTab:a,tabs:c}=e;const l=[{type:"node",node:()=>s.dy`<img
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[7637],{77637:(e,t,s)=>{s.r(t),s.d(t,{default:()=>_});var r=s(9571),i=s(8427);let n={};function a(e){n.selected=e}function c(e){return n.selected}const o=[{type:"youtube",src:"https://panel.sendmsg.co.il/templateContentImages/images/CreaditorGeneral/youtube.png"},{type:"whatsapp",src:"https://panel.sendmsg.co.il/templateContentImages/images/CreaditorGeneral/whatsapp.png"},{type:"snapchat",src:"https://panel.sendmsg.co.il/templateContentImages/images/CreaditorGeneral/snapchat.png"},{type:"instagram",src:"https://render.creaditor.ai/media/social-icons/instagram-black-square.png"},{type:"telegram",src:"https://render.creaditor.ai/media/social-icons/telegram-blue-square.png"},{type:"facebook",src:"https://render.creaditor.ai/media/social-icons/facebook-black-square.png"},{type:"vimeo",src:"https://render.creaditor.ai/media/social-icons/vimeo-blue-square.png"},{type:"email",src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"},{type:"phone",src:"https://render.creaditor.ai/media/social-icons/phone-black-circle.png"},{type:"x",src:"https://render.creaditor.ai/media/social-icons/x-black-circle.png"},{type:"linkedin",src:"https://render.creaditor.ai/media/social-icons/linkedin-black-circle.png"},{type:"tiktok",src:"https://render.creaditor.ai/media/social-icons/tiktok-black-circle.png"},{type:"reddit",src:"https://render.creaditor.ai/media/social-icons/reddit-black-circle.png"},{type:"twitch",src:"https://render.creaditor.ai/media/social-icons/twitch-black-circle.png"}];const l=e=>{{const{component:t,commands:s}=e;let r=c();return r||(r=t.props.items.find((e=>!e.link)),r||(r=t.props.items[0])),{select:e=>{let{changeTab:t,tab:s}=e;"link"!==s&&t("link")},tabs:e=>{const t=[{text:"image"},{text:"link"},{text:"design"}];return t.forEach((t=>t.selected=t.selected=t.text===e)),t},layout:e=>{let{tab:n,changeTab:a,tabs:c}=e;const l=[{type:"node",node:()=>i.dy`<img
2
2
  style="padding:10px;display:block;margin:auto"
3
3
  width="52"
4
4
  height="52"
5
- src=${n?.src}
6
- />`},{type:"button",text:"delete",bgColor:"#df381d",color:"#fff",icon:"deleteBin",active:!0,onClick:e=>{const s=[...t.props.items];if(s.length<2)return;const i=s.findIndex((e=>e.id===n.id));-1!==i&&(s.splice(i,1),r.execCommand("items",s))}},{type:"divider"},{type:"gallery",active:"image"===i.text,src:n?.src,hasPreview:!0,text:"open_gallery",justify:"flex-start",onChange:e=>{let s=e.detail;Array.isArray(s)&&(s=s[0]);const i=t.props,a=JSON.parse(JSON.stringify(i.items)),c=a.findIndex((e=>e.id===n.id));-1!==c&&(a[c].src=s.src,r.execCommand("items",a))}},{type:"linkpicker",href:n.link||n.url,active:()=>"link"===i.text&&!!n,onChange:e=>{const s=e.target.value,i=t.props,a=JSON.parse(JSON.stringify(i.items)),c=a.findIndex((e=>e.id===n.id));if(-1!==c){if(o.find((e=>e.src===a[c].src))){let e=function(e){if("string"!=typeof e)return;const t=document.createElement("a");t.href=e;const r=t.hostname,n=o.find((e=>-1!==r.indexOf(e.type)));return"tel:"===t.protocol?"https://render.creaditor.ai/media/social-icons/phone-black-circle.png":"mailto:"===t.protocol?"https://render.creaditor.ai/media/social-icons/mail-black-circle.png":n?n.src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"}(s.href);e&&(a[c].src=e)}a[c].url=s.href,a[c].link=s,r.execCommand("items",a)}}},{type:"slider",title:"size",active:"design"===i.text,value:parseInt(n?.style?.width),min:10,max:80,onInput:e=>{const n=e.target.value,s=[...t.props.items];s.forEach((e=>{e.style.width=n+"px",e.style.height=n+"px"})),r.execCommand("items",s)}},{type:"divider"},{type:"slider",title:"spacing",active:"design"===i.text,value:parseFloat(t.props.style.gap),min:0,max:80,onInput:e=>{const t=e.target.value;r.execCommand("style",{gap:t+"px"})}}];return l}}:null}};var d=r(46245);const p=()=>({set:(e,t,r)=>{switch(t){case"style":if("object"==typeof r)return e[t]=(0,d.Z)(e[t],r),!0;case"items":if(e[t]=r,Array.isArray(r)){const e=c(),t=r.find((t=>t.id===e.id));if(t)return a(t),!0}case"src":const n=c();if(n){const s=[...e.items],i=s.findIndex((e=>e.id===n.id));if(-1!==i)return s[i].src=r,e[t]=s,!0}}}});var m=r(46062),h=r.n(m),u=r(32877),f=r.n(u),g=r(96793),y=r.n(g),b=r(17892),k=r.n(b),C=r(11173),x=r.n(C),v=r(12089),A={};A.setAttributes=k(),A.insert=y().bind(null,"head"),A.domAPI=f(),A.insertStyleElement=x();h()(v.Z,A);const w=v.Z&&v.Z.locals?v.Z.locals:void 0;var I=r(51921);const L=()=>{const e="social";return{name:e,create:t=>{let{createElement:r,compose:s,helpers:i}=t;const d=document.createElement("div"),m=document.createElement("div");m.classList.add(w.root);new I.ZP(m,{sort:!0,delay:0,delayOnTouchOnly:!1,touchStartThreshold:0,disabled:!1,store:null,animation:150,easing:"cubic-bezier(1, 0, 0, 1)",preventOnFilter:!0,draggable:".item",dataIdAttr:"data-id",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:1,direction:"horizontal",forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,dragoverBubble:!1,removeCloneOnHide:!0,emptyInsertThreshold:5,setData:function(e,t){e.setData("Text",t.textContent)},onChoose:function(e){e.oldIndex},onUnchoose:function(e){},onStart:function(e){e.oldIndex},onEnd:function(e){const t=JSON.parse(JSON.stringify(s.props.items)),{oldIndex:r,newIndex:n}=e,[i]=t.splice(r,1);t.splice(n,0,i),s.editor.store().execCommand("items",t)},onMove:function(e,t){e.dragged,e.draggedRect,e.related,e.relatedRect,e.willInsertAfter,t.clientY},onChange:function(e){e.newIndex}});d.appendChild(m);return r({name:e,id:s.id,template:d,draggable:{group:"element"},droppable:{group:"element"},render:()=>{for(s.props.items.forEach((e=>{if(!e.src){const t=(e=>{if(!e)return;const t=e.toLowerCase();if(t.startsWith("mailto:"))return"email";if(t.startsWith("tel:"))return"phone";try{const r=(t.startsWith("http")?new URL(e):new URL(`https://${e}`)).hostname.replace("www.",""),n=r.split(".")[0];return o.find((e=>{const t=e.type.toLowerCase();return r.includes(t)||t.includes(n)||n.includes(t)}))?.type}catch(e){return o.find((e=>{const r=e.type.toLowerCase();return t.includes(r)||r.includes(t)}))?.type}})(e.url);t&&(e.src=o.find((e=>e.type===t))?.src)}}));m.firstChild;)m.removeChild(m.firstChild);i.mergeDiff(m,{style:s.props.style});const e=c();s.props.items.forEach((t=>{const r=document.createElement("img");e?.id===t.id&&r.classList.add(w.selected),r.addEventListener("click",(()=>{a(t),Array.from(m.children).forEach((e=>{e.classList.remove(w.selected)})),r.classList.add(w.selected)})),r.classList.add("item"),t.id&&r.setAttribute("data-id",t.id),r.src=t.src,i.mergeDiff(r,{style:t.style}),m.append(r)}));const t=document.createElement("paper-button");t.style.minWidth="0",t.style.padding=0,t.innerHTML="<cdtr-icon icon='add'></cdtr-icon>",m.append(t),t.addEventListener("click",(()=>{setTimeout((()=>{const e=s.props.items[s.props.items.length-1],t={id:(0,n.Z)(),fgColor:"",bgColor:"",style:e.style,url:"",src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"},r=[...s.props.items];r.push(t),a(t),s.editor.store().execCommand("items",r)}),200)}))},handleBar:!0,defaultProps:{},validator:p(),schema:s.schema,onSelect:e=>{},onDeselect:e=>{},elementProps:s,remove:()=>{d.remove()},createEditor:l})}}}},12089:(e,t,r)=>{r.d(t,{Z:()=>c});var n=r(40272),s=r.n(n),i=r(82609),a=r.n(i)()(s());a.push([e.id,".kfYL5P8k1NoeIcHkTLa_{\n display: flex;\n}\n.qVA_0R0VNI45kslNcUpm{\n border:1px solid var(--primary);\n}","",{version:3,sources:["webpack://./../social-editor-component-newsletter/lib/style.module.css"],names:[],mappings:"AAAA;IACI,aAAa;AACjB;AACA;IACI,+BAA+B;AACnC",sourcesContent:[".root{\n display: flex;\n}\n.selected{\n border:1px solid var(--primary);\n}"],sourceRoot:""}]),a.locals={root:"kfYL5P8k1NoeIcHkTLa_",selected:"qVA_0R0VNI45kslNcUpm"};const c=a}}]);
5
+ src=${r?.src}
6
+ />`},{type:"button",text:"delete",bgColor:"#df381d",color:"#fff",icon:"deleteBin",active:!0,onClick:e=>{const i=[...t.props.items];if(i.length<2)return;const n=i.findIndex((e=>e.id===r.id));-1!==n&&(i.splice(n,1),s.execCommand("items",i))}},{type:"divider"},{type:"gallery",active:"image"===n.text,src:r?.src,hasPreview:!0,text:"open_gallery",justify:"flex-start",onChange:e=>{let i=e.detail;Array.isArray(i)&&(i=i[0]);const n=t.props,a=JSON.parse(JSON.stringify(n.items)),c=a.findIndex((e=>e.id===r.id));-1!==c&&(a[c].src=i.src,s.execCommand("items",a))}},{type:"linkpicker",href:r.link||r.url,active:()=>"link"===n.text&&!!r,onChange:e=>{const i=e.target.value,n=t.props,a=JSON.parse(JSON.stringify(n.items)),c=a.findIndex((e=>e.id===r.id));if(-1!==c){if(o.find((e=>e.src===a[c].src))){let e=function(e){if("string"!=typeof e)return;const t=document.createElement("a");t.href=e;const s=t.hostname,r=o.find((e=>-1!==s.indexOf(e.type)));return"tel:"===t.protocol?"https://render.creaditor.ai/media/social-icons/phone-black-circle.png":"mailto:"===t.protocol?"https://render.creaditor.ai/media/social-icons/mail-black-circle.png":r?r.src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"}(i.href);e&&(a[c].src=e)}a[c].url=i.href,a[c].link=i,s.execCommand("items",a)}}},{type:"slider",title:"size",active:"design"===n.text,value:parseInt(r?.style?.width),min:10,max:80,onInput:e=>{const r=e.target.value,i=[...t.props.items];i.forEach((e=>{e.style.width=r+"px",e.style.height=r+"px"})),s.execCommand("items",i)}},{type:"divider"},{type:"slider",title:"spacing",active:"design"===n.text,value:parseFloat(t.props.style.gap),min:0,max:80,onInput:e=>{const t=e.target.value;s.execCommand("style",{gap:t+"px"})}}];return l}}}};var d=s(46245);const p=()=>({set:(e,t,s)=>{switch(t){case"style":if("object"==typeof s)return e[t]=(0,d.Z)(e[t],s),!0;case"items":if(e[t]=s,Array.isArray(s)){const e=c(),t=s.find((t=>t.id===e.id));if(t)return a(t),!0}case"src":const r=c();if(r){const i=[...e.items],n=i.findIndex((e=>e.id===r.id));if(-1!==n)return i[n].src=s,e[t]=i,!0}}}});var m=s(46062),h=s.n(m),u=s(32877),f=s.n(u),g=s(96793),y=s.n(g),b=s(17892),k=s.n(b),C=s(11173),x=s.n(C),v=s(12089),w={};w.setAttributes=k(),w.insert=y().bind(null,"head"),w.domAPI=f(),w.insertStyleElement=x();h()(v.Z,w);const A=v.Z&&v.Z.locals?v.Z.locals:void 0;var I=s(51921);const _=()=>{const e="social";return{name:e,create:t=>{let{createElement:s,compose:i,helpers:n}=t;const d=document.createElement("div"),m=document.createElement("div");m.classList.add(A.root);new I.ZP(m,{sort:!0,delay:0,delayOnTouchOnly:!1,touchStartThreshold:0,disabled:!1,store:null,animation:150,easing:"cubic-bezier(1, 0, 0, 1)",preventOnFilter:!0,draggable:".item",dataIdAttr:"data-id",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:1,direction:"horizontal",forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,dragoverBubble:!1,removeCloneOnHide:!0,emptyInsertThreshold:5,setData:function(e,t){e.setData("Text",t.textContent)},onChoose:function(e){e.oldIndex},onUnchoose:function(e){},onStart:function(e){e.oldIndex},onEnd:function(e){const t=JSON.parse(JSON.stringify(i.props.items)),{oldIndex:s,newIndex:r}=e,[n]=t.splice(s,1);t.splice(r,0,n),i.editor.store().execCommand("items",t)},onMove:function(e,t){e.dragged,e.draggedRect,e.related,e.relatedRect,e.willInsertAfter,t.clientY},onChange:function(e){e.newIndex}});d.appendChild(m);return s({name:e,id:i.id,template:d,draggable:{group:"element"},droppable:{group:"element"},render:()=>{for(i.props.items.forEach((e=>{if(!e.src){const t=(e=>{if(!e)return;const t=e.toLowerCase();if(t.startsWith("mailto:"))return"email";if(t.startsWith("tel:"))return"phone";try{const s=(t.startsWith("http")?new URL(e):new URL(`https://${e}`)).hostname.replace("www.",""),r=s.split(".")[0];return o.find((e=>{const t=e.type.toLowerCase();return s.includes(t)||t.includes(r)||r.includes(t)}))?.type}catch(e){return o.find((e=>{const s=e.type.toLowerCase();return t.includes(s)||s.includes(t)}))?.type}})(e.url);t&&(e.src=o.find((e=>e.type===t))?.src)}}));m.firstChild;)m.removeChild(m.firstChild);n.mergeDiff(m,{style:i.props.style});const e=c();i.props.items.forEach((t=>{const s=document.createElement("img");e?.id===t.id&&s.classList.add(A.selected),s.addEventListener("click",(()=>{a(t),Array.from(m.children).forEach((e=>{e.classList.remove(A.selected)})),s.classList.add(A.selected)})),s.classList.add("item"),t.id&&s.setAttribute("data-id",t.id),s.src=t.src,n.mergeDiff(s,{style:t.style}),m.append(s)}));const t=document.createElement("paper-button");t.style.minWidth="0",t.style.padding=0,t.innerHTML="<cdtr-icon icon='add'></cdtr-icon>",m.append(t),t.addEventListener("click",(()=>{setTimeout((()=>{const e=i.props.items[i.props.items.length-1],t={id:(0,r.Z)(),fgColor:"",bgColor:"",style:e.style,url:"",src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"},s=[...i.props.items];s.push(t),a(t),i.editor.store().execCommand("items",s)}),200)}))},handleBar:!0,defaultProps:{},validator:p(),schema:i.schema,onSelect:e=>{const t=c();if(t){const s=document.querySelector(`[data-id="${t.id}"]`);s?(window.___social_cdtr_item=s,s.classList.add("selected_underlined")):d.classList.add(e)}},onDeselect:e=>{c();window.___social_cdtr_item&&window.___social_cdtr_item.classList.remove("selected_underlined"),d?.classList?.remove(e)},elementProps:i,remove:()=>{d.remove()},createEditor:l})}}}},12089:(e,t,s)=>{s.d(t,{Z:()=>c});var r=s(40272),i=s.n(r),n=s(82609),a=s.n(n)()(i());a.push([e.id,".kfYL5P8k1NoeIcHkTLa_{\n display: flex;\n}\n.qVA_0R0VNI45kslNcUpm{\n border:1px solid var(--primary);\n}","",{version:3,sources:["webpack://./../social-editor-component-newsletter/lib/style.module.css"],names:[],mappings:"AAAA;IACI,aAAa;AACjB;AACA;IACI,+BAA+B;AACnC",sourcesContent:[".root{\n display: flex;\n}\n.selected{\n border:1px solid var(--primary);\n}"],sourceRoot:""}]),a.locals={root:"kfYL5P8k1NoeIcHkTLa_",selected:"qVA_0R0VNI45kslNcUpm"};const c=a}}]);
Binary file
@@ -1 +1 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[7946],{7946:(e,t,n)=>{n.r(t),n.d(t,{default:()=>x});n(30814),n(70235);let a=!0;const o=e=>{{const{component:t,commands:n,helpers:o}=e,r=t.parent("col");return{select:e=>{let{changeTab:t,tab:n}=e;n.text||t("image")},tabs:e=>{const t=[{text:"image",selected:!0},{text:"design"},{text:"link"},{text:"ai"},{text:"settings"}];return e?(t.forEach((t=>t.selected=t.selected=t.text===e)),t):t},layout:e=>{const{tab:o,changeTab:s,tabs:i}=e;return[{type:"info",text:"image_micro_copy",active:()=>"image"===o.text},{type:"imagePrompt",active:()=>"ai"===o.text,onChange:e=>{e.target.value}},{type:"gallery",active:()=>"image"===o.text,src:t.props.src,hasPreview:!0,text:"openGalleryImage",justify:"flex-start",onChange:e=>{let t=e.detail;Array.isArray(t)&&(t=t[0]),n.execCommand("src",t.src)}},{type:"input",title:"add_urlAddress_from_media_site",active:()=>"image"===o.text,value:t.props.src||"",onChange:e=>{const t=e.target.value;n.execCommand("src",t)}},{type:"input",title:"altText",active:()=>"image"===o.text,value:t.props.alt||"",onChange:e=>{const t=e.target.value;n.execCommand("alt",t)}},{type:"checkbox",title:"fullWidthOnMobile",checked:!!t.props.isFullWidthOnMobile,active:()=>"image"===o.text,onChange:e=>{const t=e.target.checked;n.execCommand("isFullWidthOnMobile",t)}},{type:"divider",active:()=>"design"===o.text},{type:"checkbox",title:"keep_ratio",checked:!!a,active:()=>"design"===o.text,onChange:e=>{a=!a,s("design")}},{type:"slider",min:10,title:"size",active:()=>"design"===o.text&&a,max:a?1e3:r?.element?.offsetWidth,value:parseInt(t.props.style.width),onInput:e=>{const t=e.target.value;n.execCommand("style",{width:t+"px",height:"auto"})}},{type:"slider",min:10,title:"width",active:()=>"design"===o.text&&!a,max:a?1e3:r?.element?.offsetWidth,value:parseInt(t.props.style.width),onInput:e=>{const a=e.target.value,o=t.atomElement.getBoundingClientRect().height;n.execCommand("style",{width:a+"px",height:o+"px"})}},{type:"slider",min:10,title:"height",active:()=>"design"===o.text&&!a,max:2*r?.element?.offsetWidth,value:parseInt(t.props.style.height),onInput:e=>{const a=e.target.value,o=t.atomElement.getBoundingClientRect().width;n.execCommand("style",{height:a+"px",width:o+"px"})}},{type:"divider",active:()=>"design"===o.text},{type:"linkpicker",href:t.props.onClick?.link,protocol:t.props.onClick?.link?.protocol,target:t.props.onClick?.link?.target,autofocus:!0,active:()=>"link"===o.text,onChange:e=>{const t={link:e.target.value};n.execCommand("onClick",t)}}]}}}};var r=n(46245);const s=()=>({set:(e,t,n)=>{switch(t){case"src":case"isFullWidthOnMobile":case"isOpenWithModal":case"isCircle":case"alt":case"onClick":return e[t]=n,!0;case"style":if("object"==typeof n)return e[t]=(0,r.Z)(e[t],n),!0}}});var i=n(46062),c=n.n(i),l=n(32877),d=n.n(l),p=n(96793),m=n.n(p),u=n(17892),g=n.n(u),y=n(11173),h=n.n(y),f=n(76555),v={};v.setAttributes=g(),v.insert=m().bind(null,"head"),v.domAPI=d(),v.insertStyleElement=h();c()(f.Z,v);const w=f.Z&&f.Z.locals?f.Z.locals:void 0,x=()=>{const e="image";return{name:e,create:t=>{const{createElement:n,compose:a,helpers:r}=t,{arrayToString:i,mergeDiff:c}=r,l=document.createElement("img"),d=document.createElement("div");a.props.style&&!parseInt(a.props.style.height)&&(a.props.style.height="auto"),l.addEventListener("drop",(e=>{e.preventDefault();var t=e.dataTransfer.getData("text/html");const n=document.createElement("div");n.innerHTML=t;const o=n.querySelector("img");o&&o.src&&a.editor.store().updateComponent(a,"src",o.src)})),l.draggable=!0,l.src=a.props.src;const p=i(a.classList);function m(e){"Delete"!==e.key&&"Backspace"!==e.key||u.commands.remove()}l.className=i(p,"editor-image",w.image),d.append(l),l.addEventListener("dblclick",(()=>{const e=document.createElement("cdtr-gallery");e.opened=!0,e.multi=!0,document.body.append(e),e.addEventListener("file",(t=>{let n=t.detail;Array.isArray(n)&&(n=n[0]),a.editor.store().execCommands([{key:"src",value:n.src},{key:"style",value:{height:"auto"}}]),e.opened=!1,setTimeout((()=>{e.remove()}),1500)})),e.addEventListener("close",(()=>{e.remove()}))}));const u=n({name:e,id:a.id,template:d,defaultProps:{style:{height:"auto",width:"200px"}},draggable:{group:"element"},droppable:{group:"element"},render:()=>{c(l,{style:a.props.style}),l.width=a.props.width||a.props.style.width,l.height=a.props.height||a.props.style.height,c(l,{src:a.props.src}),c(l,{alt:a.props.alt})},resizeable:()=>d,handleBar:!0,validator:s({template:d,image:l,helpers:r}),schema:a.schema,onSelect:e=>{l.classList.add(e),document.addEventListener("keyup",m)},onDeselect:e=>{l.classList.remove(e),document.removeEventListener("keyup",m)},elementProps:a,remove:()=>{d.remove()},createEditor:o});let g=0,y=0,h=!1,f=!1,v=!1,x=!1;return l.addEventListener("dragover",(e=>{e.preventDefault()})),l.addEventListener("dragstart",(e=>{g=e.clientX,y=e.clientY,h=!0,f=!1,v=!1,x=!1})),l.addEventListener("drag",(e=>{if(!h)return;const t=l.closest(".block-component")||l.closest("[data-block]")||l.parentElement;if(!t)return;const n=t.getBoundingClientRect(),a=n.width,o=n.left,r=e.clientX-o,s=.3*a,i=.7*a;if(r<s&&!f){f=!0,x=!1,v=!1;const e=u.parent("col");e&&e.commands.execCommand("justify","start")}else if(r>i&&!v){v=!0,x=!1,f=!1;const e=u.parent("col");e&&e.commands.execCommand("justify","end")}else if(r>=s&&r<=i&&!x){x=!0,f=!1,v=!1;const e=u.closest("col");e&&e.commands.execCommand("justify","center")}})),l.addEventListener("dragend",(e=>{h=!1,f=!1,v=!1,x=!1})),u}}}},76555:(e,t,n)=>{n.d(t,{Z:()=>i});var a=n(40272),o=n.n(a),r=n(82609),s=n.n(r)()(o());s.push([e.id,".DYtLgzP53oukeRBVqQDc{\n display: block;\n max-width: 100%;\n}","",{version:3,sources:["webpack://./../image-editor-component/lib/style.module.css"],names:[],mappings:"AAAA;IACI,cAAc;IACd,eAAe;AACnB",sourcesContent:[".image{\n display: block;\n max-width: 100%;\n}"],sourceRoot:""}]),s.locals={image:"DYtLgzP53oukeRBVqQDc"};const i=s},30814:(e,t,n)=>{n.d(t,{td:()=>d});const a=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=a,window[a]||(window[a]={});const o=window[a],r=window.__cdtrEvents||{};function s(e){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)).then((e=>Array.from(new Uint8Array(e)).map((e=>e.toString(16).padStart(2,"0"))).join("")))}function i(e){if(e.length%2!=0)throw new Error("Invalid hex string");const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.substr(n,2),16);return t}async function c(e){const t=await s(e),n=o[t];if(n){const e=await crypto.subtle.importKey("raw",i(t),{name:"AES-GCM"},!1,["encrypt","decrypt"]),a=await async function(e,t,n){const a=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return(new TextDecoder).decode(a)}(e,n.iv,n.encrypted);return JSON.parse(a)}return null}function l(e,t){if(r[e])for(const n in r[e])Object.prototype.hasOwnProperty.call(r[e],n)&&r[e][n].forEach((e=>e(t)));Array.isArray(r["*"])&&r["*"].forEach((e=>e(t)))}window.__cdtrEvents=r;const d={set:async function(e,t){const n=JSON.parse(JSON.stringify(t)),a=await s(e),c=await crypto.subtle.importKey("raw",i(a),{name:"AES-GCM"},!1,["encrypt","decrypt"]),d=await async function(e,t){const n=crypto.getRandomValues(new Uint8Array(12)),a=(new TextEncoder).encode(t),o=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,a);return{iv:n,encrypted:new Uint8Array(o)}}(c,JSON.stringify(n));o[a]=d,r.set&&r.set[a]&&r.set[a].forEach((e=>e(n))),Array.isArray(r["*"])&&r["*"].forEach((e=>e(n))),l(e,n)},get:c,remove:async function(e){const t=await s(e);delete o[t]},on:async function(e,t,n){r[e]||(r[e]={});const a=await s(t);r[e][a]||(r[e][a]=[]),r[e][a].push((e=>{!function(){const e=(new Error).stack;if(e&&e.indexOf(" at <anonymous>:1")>-1)throw console.warn("Function call blocked: Detected console execution."),new Error("Function call blocked: Detected console execution.")}(),n(e)}));const o=await c(t);return o&&n(o),a},off:function(e,t){r[e]&&r[e][t]&&delete r[e][t]},dispatch:l,OPTIONS:{SET:"set"}}}}]);
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[7946],{7946:(e,t,n)=>{n.r(t),n.d(t,{default:()=>x});n(30814),n(70235);let a=!0;const r=e=>{{const{component:t,commands:n,helpers:r}=e,o=t.parent("col");return{select:e=>{let{changeTab:t,tab:n}=e;n.text||t("image")},tabs:e=>{const t=[{text:"image",selected:!0},{text:"design"},{text:"link"},{text:"ai"},{text:"settings"}];return e?(t.forEach((t=>t.selected=t.selected=t.text===e)),t):t},layout:e=>{const{tab:r,changeTab:s,tabs:i}=e;return[{type:"info",text:"image_micro_copy",active:()=>"image"===r.text},{type:"imagePrompt",active:()=>"ai"===r.text,onChange:e=>{e.target.value}},{type:"gallery",active:()=>"image"===r.text,src:t.props.src,hasPreview:!0,text:"openGalleryImage",justify:"flex-start",onChange:e=>{let t=e.detail;Array.isArray(t)&&(t=t[0]),n.execCommand("src",t.src)}},{type:"input",title:"add_urlAddress_from_media_site",active:()=>"image"===r.text,value:t.props.src||"",onChange:e=>{const t=e.target.value;n.execCommand("src",t)}},{type:"input",title:"altText",active:()=>"image"===r.text,value:t.props.alt||"",onChange:e=>{const t=e.target.value;n.execCommand("alt",t)}},{type:"checkbox",title:"fullWidthOnMobile",checked:!!t.props.isFullWidthOnMobile,active:()=>"image"===r.text,onChange:e=>{const t=e.target.checked;n.execCommand("isFullWidthOnMobile",t)}},{type:"divider",active:()=>"design"===r.text},{type:"checkbox",title:"keep_ratio",checked:!!a,active:()=>"design"===r.text,onChange:e=>{a=!a,s("design")}},{type:"slider",min:10,title:"size",active:()=>"design"===r.text&&a,max:a?1e3:o?.element?.offsetWidth,value:parseInt(t.props.style.width),onInput:e=>{const t=e.target.value;n.execCommand("style",{width:t+"px",height:"auto"})}},{type:"slider",min:10,title:"width",active:()=>"design"===r.text&&!a,max:a?1e3:o?.element?.offsetWidth,value:parseInt(t.props.style.width),onInput:e=>{const a=e.target.value,r=t.atomElement.getBoundingClientRect().height;n.execCommand("style",{width:a+"px",height:r+"px"})}},{type:"slider",min:10,title:"height",active:()=>"design"===r.text&&!a,max:2*o?.element?.offsetWidth,value:parseInt(t.props.style.height),onInput:e=>{const a=e.target.value,r=t.atomElement.getBoundingClientRect().width;n.execCommand("style",{height:a+"px",width:r+"px"})}},{type:"divider",active:()=>"design"===r.text},{type:"linkpicker",href:t.props.onClick?.link,protocol:t.props.onClick?.link?.protocol,target:t.props.onClick?.link?.target,autofocus:!0,active:()=>"link"===r.text,onChange:e=>{const t={link:e.target.value};n.execCommand("onClick",t)}}]}}}};var o=n(46245);const s=()=>({set:(e,t,n)=>{switch(t){case"src":case"isFullWidthOnMobile":case"isOpenWithModal":case"isCircle":case"alt":case"onClick":return e[t]=n,!0;case"style":if("object"==typeof n)return e[t]=(0,o.Z)(e[t],n),!0}}});var i=n(46062),c=n.n(i),l=n(32877),d=n.n(l),p=n(96793),m=n.n(p),u=n(17892),g=n.n(u),y=n(11173),h=n.n(y),f=n(76555),v={};v.setAttributes=g(),v.insert=m().bind(null,"head"),v.domAPI=d(),v.insertStyleElement=h();c()(f.Z,v);const w=f.Z&&f.Z.locals?f.Z.locals:void 0,x=()=>{const e="image";return{name:e,create:t=>{const{createElement:n,compose:a,helpers:o}=t,{arrayToString:i,mergeDiff:c}=o,l=document.createElement("img"),d=document.createElement("div");a.props.style&&!parseInt(a.props.style.height)&&(a.props.style.height="auto"),l.addEventListener("drop",(e=>{e.preventDefault();var t=e.dataTransfer.getData("text/html");const n=document.createElement("div");n.innerHTML=t;const r=n.querySelector("img");r&&r.src&&a.editor.store().updateComponent(a,"src",r.src)})),l.draggable=!0,l.src=a.props.src;const p=i(a.classList);function m(e){const t=e.target;t.classList.contains("amazingbar-content-wrapper")&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&("Delete"!==e.key&&"Backspace"!==e.key||u.commands.remove())}l.className=i(p,"editor-image",w.image),d.append(l),l.addEventListener("dblclick",(()=>{const e=document.createElement("cdtr-gallery");e.opened=!0,e.multi=!0,document.body.append(e),e.addEventListener("file",(t=>{let n=t.detail;Array.isArray(n)&&(n=n[0]),a.editor.store().execCommands([{key:"src",value:n.src},{key:"style",value:{height:"auto"}}]),e.opened=!1,setTimeout((()=>{e.remove()}),1500)})),e.addEventListener("close",(()=>{e.remove()}))}));const u=n({name:e,id:a.id,template:d,defaultProps:{style:{height:"auto",width:"200px"}},draggable:{group:"element"},droppable:{group:"element"},render:()=>{c(l,{style:a.props.style}),l.width=a.props.width||a.props.style.width,l.height=a.props.height||a.props.style.height,c(l,{src:a.props.src}),c(l,{alt:a.props.alt})},resizeable:()=>d,handleBar:!0,validator:s({template:d,image:l,helpers:o}),schema:a.schema,onSelect:e=>{l.classList.add(e),document.addEventListener("keyup",m)},onDeselect:e=>{l.classList.remove(e),document.removeEventListener("keyup",m)},elementProps:a,remove:()=>{d.remove()},createEditor:r});let g=0,y=0,h=!1,f=!1,v=!1,x=!1;return l.addEventListener("dragover",(e=>{e.preventDefault()})),l.addEventListener("dragstart",(e=>{g=e.clientX,y=e.clientY,h=!0,f=!1,v=!1,x=!1})),l.addEventListener("drag",(e=>{if(!h)return;const t=l.closest(".block-component")||l.closest("[data-block]")||l.parentElement;if(!t)return;const n=t.getBoundingClientRect(),a=n.width,r=n.left,o=e.clientX-r,s=.3*a,i=.7*a;if(o<s&&!f){f=!0,x=!1,v=!1;const e=u.parent("col");e&&e.commands.execCommand("justify","start")}else if(o>i&&!v){v=!0,x=!1,f=!1;const e=u.parent("col");e&&e.commands.execCommand("justify","end")}else if(o>=s&&o<=i&&!x){x=!0,f=!1,v=!1;const e=u.closest("col");e&&e.commands.execCommand("justify","center")}})),l.addEventListener("dragend",(e=>{h=!1,f=!1,v=!1,x=!1})),u}}}},76555:(e,t,n)=>{n.d(t,{Z:()=>i});var a=n(40272),r=n.n(a),o=n(82609),s=n.n(o)()(r());s.push([e.id,".DYtLgzP53oukeRBVqQDc{\n display: block;\n max-width: 100%;\n}","",{version:3,sources:["webpack://./../image-editor-component/lib/style.module.css"],names:[],mappings:"AAAA;IACI,cAAc;IACd,eAAe;AACnB",sourcesContent:[".image{\n display: block;\n max-width: 100%;\n}"],sourceRoot:""}]),s.locals={image:"DYtLgzP53oukeRBVqQDc"};const i=s},30814:(e,t,n)=>{n.d(t,{td:()=>d});const a=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=a,window[a]||(window[a]={});const r=window[a],o=window.__cdtrEvents||{};function s(e){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)).then((e=>Array.from(new Uint8Array(e)).map((e=>e.toString(16).padStart(2,"0"))).join("")))}function i(e){if(e.length%2!=0)throw new Error("Invalid hex string");const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.substr(n,2),16);return t}async function c(e){const t=await s(e),n=r[t];if(n){const e=await crypto.subtle.importKey("raw",i(t),{name:"AES-GCM"},!1,["encrypt","decrypt"]),a=await async function(e,t,n){const a=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return(new TextDecoder).decode(a)}(e,n.iv,n.encrypted);return JSON.parse(a)}return null}function l(e,t){if(o[e])for(const n in o[e])Object.prototype.hasOwnProperty.call(o[e],n)&&o[e][n].forEach((e=>e(t)));Array.isArray(o["*"])&&o["*"].forEach((e=>e(t)))}window.__cdtrEvents=o;const d={set:async function(e,t){const n=JSON.parse(JSON.stringify(t)),a=await s(e),c=await crypto.subtle.importKey("raw",i(a),{name:"AES-GCM"},!1,["encrypt","decrypt"]),d=await async function(e,t){const n=crypto.getRandomValues(new Uint8Array(12)),a=(new TextEncoder).encode(t),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,a);return{iv:n,encrypted:new Uint8Array(r)}}(c,JSON.stringify(n));r[a]=d,o.set&&o.set[a]&&o.set[a].forEach((e=>e(n))),Array.isArray(o["*"])&&o["*"].forEach((e=>e(n))),l(e,n)},get:c,remove:async function(e){const t=await s(e);delete r[t]},on:async function(e,t,n){o[e]||(o[e]={});const a=await s(t);o[e][a]||(o[e][a]=[]),o[e][a].push((e=>{!function(){const e=(new Error).stack;if(e&&e.indexOf(" at <anonymous>:1")>-1)throw console.warn("Function call blocked: Detected console execution."),new Error("Function call blocked: Detected console execution.")}(),n(e)}));const r=await c(t);return r&&n(r),a},off:function(e,t){o[e]&&o[e][t]&&delete o[e][t]},dispatch:l,OPTIONS:{SET:"set"}}}}]);
Binary file
@@ -1,4 +1,4 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[901],{20901:(e,t,r)=>{r.r(t),r.d(t,{PexelsGallery:()=>n});var o=r(56666),a=r(8427),s=(r(70235),r(9085)),l=(r(36351),r(61828),r(59051));const i="jUU57RHRVmWvXd22MBjQkDhcf9Prkbufc6KXUChhrEIOr6IqNeNvMOUl",c="https://api.pexels.com/v1/search",h=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20;return fetch(`${c}?query=${encodeURIComponent(e)}&page=${t}&per_page=${r}`,{method:"GET",headers:{Authorization:i,"Content-Type":"application/json"}})};class n extends a.oi{constructor(){super(),this.images=[],this.loading=!1,this.searchQuery="",this.page=1,this.hasMore=!0,this.perPage=20,this.multi=!0,this.selectedColor="",this.defaultSearchTerms=["nature","landscape","city","people","technology","food","architecture","travel","business","art"],this.colorOptions=[{name:"Red",value:"red",hex:"#ff0000"},{name:"Orange",value:"orange",hex:"#ff8000"},{name:"Yellow",value:"yellow",hex:"#ffff00"},{name:"Green",value:"green",hex:"#00ff00"},{name:"Blue",value:"blue",hex:"#0000ff"},{name:"Purple",value:"purple",hex:"#8000ff"},{name:"Pink",value:"pink",hex:"#ff0080"},{name:"Brown",value:"brown",hex:"#8b4513"},{name:"Black",value:"black",hex:"#000000"},{name:"White",value:"white",hex:"#ffffff"},{name:"Gray",value:"gray",hex:"#808080"},{name:"Teal",value:"teal",hex:"#008080"},{name:"Navy",value:"navy",hex:"#000080"},{name:"Maroon",value:"maroon",hex:"#800000"},{name:"Olive",value:"olive",hex:"#808000"},{name:"Lime",value:"lime",hex:"#00ff00"},{name:"Aqua",value:"aqua",hex:"#00ffff"},{name:"Silver",value:"silver",hex:"#c0c0c0"},{name:"Fuchsia",value:"fuchsia",hex:"#ff00ff"},{name:"Coral",value:"coral",hex:"#ff7f50"},{name:"Gold",value:"gold",hex:"#ffd700"},{name:"Indigo",value:"indigo",hex:"#4b0082"},{name:"Violet",value:"violet",hex:"#ee82ee"},{name:"Cyan",value:"cyan",hex:"#00ffff"},{name:"Magenta",value:"magenta",hex:"#ff00ff"}],this.cacheKey="pexels-gallery-cache",this.cacheExpiry=864e5,this.isTyping=!1,this.lastSearchQuery="",this.searchTimeout=null}connectedCallback(){super.connectedCallback(),this.loadFromCache()}getCacheData(){try{const e=localStorage.getItem(this.cacheKey);if(!e)return null;const t=JSON.parse(e),r=Date.now();return t.timestamp&&r-t.timestamp>this.cacheExpiry?(localStorage.removeItem(this.cacheKey),null):t}catch(e){return console.error("Error reading cache:",e),null}}saveToCache(){if(!this.isTyping)try{const e={images:this.images,searchQuery:this.searchQuery,selectedColor:this.selectedColor,page:this.page,hasMore:this.hasMore,timestamp:Date.now()};localStorage.setItem(this.cacheKey,JSON.stringify(e))}catch(e){console.error("Error saving to cache:",e)}}loadFromCache(){const e=this.getCacheData();e?(this.images=e.images||[],this.searchQuery=e.searchQuery||"",this.selectedColor=e.selectedColor||"",this.page=e.page||1,this.hasMore=void 0===e.hasMore||e.hasMore,console.log("Gallery state restored from cache"),this.requestUpdate(),this.updateComplete.then((()=>{this.updateSearchInput()}))):this.loadRandomImages()}updateSearchInput(){const e=this.shadowRoot?.querySelector('cdtr-input[type="search"]');e&&(e.value=this.searchQuery)}async loadRandomImages(){this.loading=!0;try{const e=this.defaultSearchTerms[Math.floor(Math.random()*this.defaultSearchTerms.length)],t=await h(e,1,this.perPage);if(t.ok){const e=await t.json();this.images=e.photos||[],this.hasMore=e.photos&&e.photos.length===this.perPage,this.searchQuery="",this.selectedColor="",this.page=1,this.saveToCache()}else console.error("Failed to load images from Pexels"),this.images=[]}catch(e){console.error("Error loading images:",e),this.images=[]}finally{this.loading=!1}}async searchImages(e){if(!e.trim())return this.loadRandomImages();this.loading=!0,this.searchQuery=e,this.page=1;try{const t=await h(e,1,this.perPage);if(t.ok){const e=await t.json();this.images=e.photos||[],this.hasMore=e.photos&&e.photos.length===this.perPage,this.saveToCache()}else console.error("Failed to search images from Pexels"),this.images=[]}catch(e){console.error("Error searching images:",e),this.images=[]}finally{this.loading=!1}}async loadMoreImages(){if(!this.loading&&this.hasMore){this.loading=!0,this.page++;try{let e;if(this.selectedColor&&"all"!==this.selectedColor){let t=this.removeColorFilters(this.searchQuery);e=t.trim()?`${t} ${this.selectedColor}`:this.selectedColor}else{e=this.removeColorFilters(this.searchQuery)||this.defaultSearchTerms[Math.floor(Math.random()*this.defaultSearchTerms.length)]}const t=await h(e,this.page,this.perPage);if(t.ok){const e=(await t.json()).photos||[];this.images=[...this.images,...e],this.hasMore=e.length===this.perPage,this.saveToCache()}}catch(e){console.error("Error loading more images:",e)}finally{this.loading=!1}}}onSearch(e){const t=e.target.value;this.isTyping=!0,t!==this.lastSearchQuery&&(this.lastSearchQuery=t,this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((()=>{this.isTyping=!1,this.searchWithColor(t,this.selectedColor)}),500))}onSelectImage(e){const t=`Photo by ${e.photographer} on Pexels`,r=`Photo by <a href="${e.photographer_url}" target="_blank" rel="noopener noreferrer">${e.photographer}</a> on <a href="${e.url}" target="_blank" rel="noopener noreferrer">Pexels</a>`,o={detail:{id:e.id,src:e.src.medium||e.src.large||e.src.original,name:`Pexels Image ${e.id}`,size:`${e.width}x${e.height}`,photographer:e.photographer,photographerUrl:e.photographer_url,pexelsUrl:e.url,alt:e.alt||`Photo by ${e.photographer} on Pexels`,attributionText:t,attributionHtml:r},bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",o))}sendSelectedImages(){const e={detail:this.images.filter((e=>e.selected)).map((e=>{const t=`Photo by ${e.photographer} on Pexels`,r=`Photo by <a href="${e.photographer_url}" target="_blank" rel="noopener noreferrer">${e.photographer}</a> on <a href="${e.url}" target="_blank" rel="noopener noreferrer">Pexels</a>`;return{id:e.id,src:e.src.medium||e.src.large||e.src.original,name:`Pexels Image ${e.id}`,size:`${e.width}x${e.height}`,photographer:e.photographer,photographerUrl:e.photographer_url,pexelsUrl:e.url,alt:e.alt||`Photo by ${e.photographer} on Pexels`,attributionText:t,attributionHtml:r}})),bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",e))}onScroll(e){const t=e.target;t.scrollTop+t.offsetHeight>=t.scrollHeight-50&&this.loadMoreImages()}clearCache(){localStorage.removeItem(this.cacheKey),console.log("Gallery cache cleared")}onColorChange(e){console.log("Color change event:",e);const t=e.target.value;console.log("Selected color:",t),this.selectedColor="all"===t?"":t;const r=this.searchQuery||"";this.searchWithColor(r,this.selectedColor)}searchWithColor(e,t){if(t&&"all"!==t){let r=this.removeColorFilters(e),o=r.trim()?`${r} ${t}`:t;this.searchImages(o)}else{let t=this.removeColorFilters(e);this.searchImages(t)}}removeColorFilters(e){if(!e)return"";const t=this.colorOptions.map((e=>e.value));return e.split(" ").filter((e=>{const r=e.toLowerCase().trim();return!t.includes(r)})).join(" ").trim()}getSelectedColorName(){if(!this.selectedColor)return"Filter by color";const e=this.colorOptions.find((e=>e.value===this.selectedColor));return e?e.name:"Filter by color"}getSelectedColorHex(){if(!this.selectedColor)return"#666";const e=this.colorOptions.find((e=>e.value===this.selectedColor));return e?e.hex:"#666"}render(){return a.dy`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[901],{20901:(e,t,r)=>{r.r(t),r.d(t,{PexelsGallery:()=>n});var o=r(56666),a=r(8427),s=(r(70235),r(9085)),l=(r(36351),r(61828),r(59051)),i=r(76828);function c(e){e||(e={query:"nature",per_page:1});const t=`${i.W7.agent_url}pexels/search/?query=${e.query||"marketing"}&per_page=${e.per_page||1}`;return fetch(t).then((e=>e.json())).then((e=>{if("success"===e.status&&e.data)return e.data;throw new Error("Invalid response from backend")})).catch((e=>{throw console.error("Error fetching images:",e),e}))}class n extends a.oi{constructor(){super(),this.images=[],this.loading=!1,this.searchQuery="",this.page=1,this.hasMore=!0,this.perPage=20,this.multi=!0,this.selectedColor="",this.defaultSearchTerms=["nature","landscape","city","people","technology","food","architecture","travel","business","art"],this.colorOptions=[{name:"Red",value:"red",hex:"#ff0000"},{name:"Orange",value:"orange",hex:"#ff8000"},{name:"Yellow",value:"yellow",hex:"#ffff00"},{name:"Green",value:"green",hex:"#00ff00"},{name:"Blue",value:"blue",hex:"#0000ff"},{name:"Purple",value:"purple",hex:"#8000ff"},{name:"Pink",value:"pink",hex:"#ff0080"},{name:"Brown",value:"brown",hex:"#8b4513"},{name:"Black",value:"black",hex:"#000000"},{name:"White",value:"white",hex:"#ffffff"},{name:"Gray",value:"gray",hex:"#808080"},{name:"Teal",value:"teal",hex:"#008080"},{name:"Navy",value:"navy",hex:"#000080"},{name:"Maroon",value:"maroon",hex:"#800000"},{name:"Olive",value:"olive",hex:"#808000"},{name:"Lime",value:"lime",hex:"#00ff00"},{name:"Aqua",value:"aqua",hex:"#00ffff"},{name:"Silver",value:"silver",hex:"#c0c0c0"},{name:"Fuchsia",value:"fuchsia",hex:"#ff00ff"},{name:"Coral",value:"coral",hex:"#ff7f50"},{name:"Gold",value:"gold",hex:"#ffd700"},{name:"Indigo",value:"indigo",hex:"#4b0082"},{name:"Violet",value:"violet",hex:"#ee82ee"},{name:"Cyan",value:"cyan",hex:"#00ffff"},{name:"Magenta",value:"magenta",hex:"#ff00ff"}],this.cacheKey="pexels-gallery-cache",this.cacheExpiry=864e5,this.isTyping=!1,this.lastSearchQuery="",this.searchTimeout=null}connectedCallback(){super.connectedCallback(),this.loadFromCache()}getCacheData(){try{const e=localStorage.getItem(this.cacheKey);if(!e)return null;const t=JSON.parse(e),r=Date.now();return t.timestamp&&r-t.timestamp>this.cacheExpiry?(localStorage.removeItem(this.cacheKey),null):t}catch(e){return console.error("Error reading cache:",e),null}}saveToCache(){if(!this.isTyping)try{const e={images:this.images,searchQuery:this.searchQuery,selectedColor:this.selectedColor,page:this.page,hasMore:this.hasMore,timestamp:Date.now()};localStorage.setItem(this.cacheKey,JSON.stringify(e))}catch(e){console.error("Error saving to cache:",e)}}loadFromCache(){const e=this.getCacheData();e?(this.images=e.images||[],this.searchQuery=e.searchQuery||"",this.selectedColor=e.selectedColor||"",this.page=e.page||1,this.hasMore=void 0===e.hasMore||e.hasMore,console.log("Gallery state restored from cache"),this.requestUpdate(),this.updateComplete.then((()=>{this.updateSearchInput()}))):this.loadRandomImages()}updateSearchInput(){const e=this.shadowRoot?.querySelector('cdtr-input[type="search"]');e&&(e.value=this.searchQuery)}async loadRandomImages(){this.loading=!0;try{const e=this.defaultSearchTerms[Math.floor(Math.random()*this.defaultSearchTerms.length)],t=await c(e,this.perPage);if(t.ok){const e=await t.json();this.images=e.photos||[],this.hasMore=e.photos&&e.photos.length===this.perPage,this.searchQuery="",this.selectedColor="",this.page=1,this.saveToCache()}else console.error("Failed to load images from Pexels"),this.images=[]}catch(e){console.error("Error loading images:",e),this.images=[]}finally{this.loading=!1}}async searchImages(e){if(!e.trim())return this.loadRandomImages();this.loading=!0,this.searchQuery=e,this.page=1;try{const t=await c(e,this.perPage);if(t.ok){const e=await t.json();this.images=e.photos||[],this.hasMore=e.photos&&e.photos.length===this.perPage,this.saveToCache()}else console.error("Failed to search images from Pexels"),this.images=[]}catch(e){console.error("Error searching images:",e),this.images=[]}finally{this.loading=!1}}async loadMoreImages(){if(!this.loading&&this.hasMore){this.loading=!0,this.page++;try{let e;if(this.selectedColor&&"all"!==this.selectedColor){let t=this.removeColorFilters(this.searchQuery);e=t.trim()?`${t} ${this.selectedColor}`:this.selectedColor}else{e=this.removeColorFilters(this.searchQuery)||this.defaultSearchTerms[Math.floor(Math.random()*this.defaultSearchTerms.length)]}const t=await c(e,this.page,this.perPage);if(t.ok){const e=(await t.json()).photos||[];this.images=[...this.images,...e],this.hasMore=e.length===this.perPage,this.saveToCache()}}catch(e){console.error("Error loading more images:",e)}finally{this.loading=!1}}}onSearch(e){const t=e.target.value;this.isTyping=!0,t!==this.lastSearchQuery&&(this.lastSearchQuery=t,this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((()=>{this.isTyping=!1,this.searchWithColor(t,this.selectedColor)}),500))}onSelectImage(e){const t=`Photo by ${e.photographer} on Pexels`,r=`Photo by <a href="${e.photographer_url}" target="_blank" rel="noopener noreferrer">${e.photographer}</a> on <a href="${e.url}" target="_blank" rel="noopener noreferrer">Pexels</a>`,o={detail:{id:e.id,src:e.src.medium||e.src.large||e.src.original,name:`Pexels Image ${e.id}`,size:`${e.width}x${e.height}`,photographer:e.photographer,photographerUrl:e.photographer_url,pexelsUrl:e.url,alt:e.alt||`Photo by ${e.photographer} on Pexels`,attributionText:t,attributionHtml:r},bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",o))}sendSelectedImages(){const e={detail:this.images.filter((e=>e.selected)).map((e=>{const t=`Photo by ${e.photographer} on Pexels`,r=`Photo by <a href="${e.photographer_url}" target="_blank" rel="noopener noreferrer">${e.photographer}</a> on <a href="${e.url}" target="_blank" rel="noopener noreferrer">Pexels</a>`;return{id:e.id,src:e.src.medium||e.src.large||e.src.original,name:`Pexels Image ${e.id}`,size:`${e.width}x${e.height}`,photographer:e.photographer,photographerUrl:e.photographer_url,pexelsUrl:e.url,alt:e.alt||`Photo by ${e.photographer} on Pexels`,attributionText:t,attributionHtml:r}})),bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",e))}onScroll(e){const t=e.target;t.scrollTop+t.offsetHeight>=t.scrollHeight-50&&this.loadMoreImages()}clearCache(){localStorage.removeItem(this.cacheKey),console.log("Gallery cache cleared")}onColorChange(e){console.log("Color change event:",e);const t=e.target.value;console.log("Selected color:",t),this.selectedColor="all"===t?"":t;const r=this.searchQuery||"";this.searchWithColor(r,this.selectedColor)}searchWithColor(e,t){if(t&&"all"!==t){let r=this.removeColorFilters(e),o=r.trim()?`${r} ${t}`:t;this.searchImages(o)}else{let t=this.removeColorFilters(e);this.searchImages(t)}}removeColorFilters(e){if(!e)return"";const t=this.colorOptions.map((e=>e.value));return e.split(" ").filter((e=>{const r=e.toLowerCase().trim();return!t.includes(r)})).join(" ").trim()}getSelectedColorName(){if(!this.selectedColor)return"Filter by color";const e=this.colorOptions.find((e=>e.value===this.selectedColor));return e?e.name:"Filter by color"}getSelectedColorHex(){if(!this.selectedColor)return"#666";const e=this.colorOptions.find((e=>e.value===this.selectedColor));return e?e.hex:"#666"}render(){return a.dy`
2
2
  <div class="gallery-container">
3
3
  <cdtr-row alignItems="center">
4
4
  <cdtr-input
Binary file