@creaditor/newsletter-starterkit 1.0.29 → 1.0.31

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([[1626],{21626:(e,t,s)=>{s.r(t),s.d(t,{default:()=>R});var i=s(9571),r=s(8427);let n={};function o(e){n.selected=e}function c(e){return n.selected}const l="https://img.creaditor.ai",a=[{type:"youtube",src:`${l}/icons/serve/Logos/youtube-line.png?width=34&height=34`},{type:"whatsapp",src:`${l}/icons/serve/Logos/whatsapp-line.png?width=34&height=34`},{type:"snapchat",src:`${l}/icons/serve/Logos/snapchat-line.png?width=34&height=34`},{type:"instagram",src:`${l}/icons/serve/Logos/instagram-line.png?width=34&height=34`},{type:"telegram",src:`${l}/icons/serve/Logos/telegram-line.png?width=34&height=34`},{type:"facebook",src:`${l}/icons/serve/Logos/facebook-line.png?width=34&height=34`},{type:"vimeo",src:`${l}/icons/serve/Logos/vimeo-line.png?width=34&height=34`},{type:"x",src:`${l}/icons/serve/Logos/twitter-x-line.png?width=34&height=34`},{type:"linkedin",src:`${l}/icons/serve/Logos/linkedin-box-line.png?width=34&height=34`},{type:"tiktok",src:`${l}/icons/serve/Logos/tiktok-line.png?width=34&height=34`},{type:"reddit",src:`${l}/icons/serve/Logos/reddit-line.png?width=34&height=34`},{type:"twitch",src:`${l}/icons/serve/Logos/twitch-line.png?width=34&height=34`},{type:"messenger",src:`${l}/icons/serve/Logos/messenger-line.png?width=34&height=34`},{type:"pinterest",src:`${l}/icons/serve/Logos/pinterest-line.png?width=34&height=34`},{type:"discord",src:`${l}/icons/serve/Logos/discord-line.png?width=34&height=34`},{type:"skype",src:`${l}/icons/serve/Logos/skype-line.png?width=34&height=34`},{type:"wechat",src:`${l}/icons/serve/Logos/wechat-2-line.png?width=34&height=34`},{type:"email",src:`${l}/icons/serve/Business/mail-line.png?width=34&height=34`},{type:"phone",src:`${l}/icons/serve/Device/phone-line.png?width=34&height=34`},{type:"home",src:`${l}/icons/serve/Buildings/home-line.png?width=34&height=34`},{type:"website",src:`${l}/icons/serve/Map/globe-line.png?width=34&height=34`},{type:"link",src:`${l}/icons/serve/Editor/link.png?width=34&height=34`},{type:"contact",src:`${l}/icons/serve/Business/customer-service-2-line.png?width=34&height=34`},{type:"address",src:`${l}/icons/serve/Map/map-pin-line.png?width=34&height=34`},{type:"send",src:`${l}/icons/serve/Business/send-plane-line.png?width=34&height=34`}],d="https://img.creaditor.ai",p={twitter:"x","t.co":"x","x.com":"x",youtu:"youtube","youtu.be":"youtube","fb.com":"facebook","fb.me":"facebook","m.me":"messenger","wa.me":"whatsapp","t.me":"telegram","ig.me":"instagram","lnkd.in":"linkedin"};function h(e,t){if(!t||"string"!=typeof t)return;const s=t.toLowerCase().trim();if(s.startsWith("mailto:"))return"email";if(s.startsWith("tel:"))return"phone";try{const i=(s.startsWith("http")?new URL(t):new URL(`https://${t}`)).hostname.replace("www.",""),r=i.split(".")[0];for(const[e,t]of Object.entries(p))if(i.includes(e)||e===i)return t;const n=e.find((e=>{const t=e.type.toLowerCase();return i.includes(t)||t.includes(r)||r.includes(t)}));return n?n.type:e.find((e=>s.includes(e.type.toLowerCase())))?.type}catch(t){return e.find((e=>s.includes(e.type.toLowerCase())))?.type}}function g(e,t){if(!e||!e.includes(d))return e;const s=function(e){let t=(e||"000000").toString().trim();return t.startsWith("#")&&(t=t.slice(1)),8===t.length&&/^[0-9a-fA-F]+$/.test(t)&&(t=t.slice(0,6)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length?t:"000000"}(t);try{const t=new URL(e);return t.searchParams.set("color",s),t.toString()}catch(t){const i=e.includes("?")?"&":"?";return`${e}${i}color=${s}`}}var m=s(56666);const u="https://img.creaditor.ai";function f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=t.width??24,i=t.height??24;let r=t.color??"000000";r.startsWith("#")&&(r=r.slice(1));return g(`${u}/icons/serve/${encodeURIComponent(e.category)}/${encodeURIComponent(e.name)}.png?width=${s}&height=${i}`,r)}class y extends r.oi{constructor(){super(),this.searchQuery="",this.iconColor="000000",this.iconSize=34,this.selectedSrc="",this._icons=[],this._loading=!1,this._error=""}willUpdate(e){e.has("searchQuery")&&this.searchQuery?this._fetchIcons():e.has("searchQuery")&&!this.searchQuery&&(this._icons=[],this._error="")}async _fetchIcons(){const e=(this.searchQuery||"").trim();if(e){this._loading=!0,this._error="";try{const t=new URLSearchParams({q:e,limit:"20"}),s=await fetch(`${u}/icons/search?${t.toString()}`);if(!s.ok)throw new Error(s.statusText);const i=await s.json();this._icons=i.icons||[]}catch(e){this._icons=[],this._error=e.message||"Failed to load icons"}finally{this._loading=!1}}else this._icons=[]}_onSelect(e){const t=(this.iconColor||"000000").replace(/^#/,""),s=Number(this.iconSize)||34,i=f(e,{width:s,height:s,color:t});this.dispatchEvent(new CustomEvent("icon-selected",{detail:{src:i,icon:e},bubbles:!0,composed:!0}))}render(){if(!this.searchQuery?.trim())return r.dy``;if(this._loading)return r.dy`<div class="loading"><cdtr-loader></cdtr-loader></div>`;if(this._error)return r.dy`<div class="error">${this._error}</div>`;if(!this._icons.length)return r.dy``;const e=(this.iconColor||"000000").replace(/^#/,"");return r.dy`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[1626],{21626:(e,t,s)=>{s.r(t),s.d(t,{default:()=>Z});var i=s(9571),r=s(8427);let n={};function o(e){n.selected=e}function c(e){return n.selected}const l="https://img.creaditor.ai",a=[{type:"youtube",src:`${l}/icons/serve/Logos/youtube-line.png?width=34&height=34`},{type:"whatsapp",src:`${l}/icons/serve/Logos/whatsapp-line.png?width=34&height=34`},{type:"snapchat",src:`${l}/icons/serve/Logos/snapchat-line.png?width=34&height=34`},{type:"instagram",src:`${l}/icons/serve/Logos/instagram-line.png?width=34&height=34`},{type:"telegram",src:`${l}/icons/serve/Logos/telegram-line.png?width=34&height=34`},{type:"facebook",src:`${l}/icons/serve/Logos/facebook-line.png?width=34&height=34`},{type:"vimeo",src:`${l}/icons/serve/Logos/vimeo-line.png?width=34&height=34`},{type:"x",src:`${l}/icons/serve/Logos/twitter-x-line.png?width=34&height=34`},{type:"linkedin",src:`${l}/icons/serve/Logos/linkedin-box-line.png?width=34&height=34`},{type:"tiktok",src:`${l}/icons/serve/Logos/tiktok-line.png?width=34&height=34`},{type:"reddit",src:`${l}/icons/serve/Logos/reddit-line.png?width=34&height=34`},{type:"twitch",src:`${l}/icons/serve/Logos/twitch-line.png?width=34&height=34`},{type:"messenger",src:`${l}/icons/serve/Logos/messenger-line.png?width=34&height=34`},{type:"pinterest",src:`${l}/icons/serve/Logos/pinterest-line.png?width=34&height=34`},{type:"discord",src:`${l}/icons/serve/Logos/discord-line.png?width=34&height=34`},{type:"skype",src:`${l}/icons/serve/Logos/skype-line.png?width=34&height=34`},{type:"wechat",src:`${l}/icons/serve/Logos/wechat-2-line.png?width=34&height=34`},{type:"email",src:`${l}/icons/serve/Business/mail-line.png?width=34&height=34`},{type:"phone",src:`${l}/icons/serve/Device/phone-line.png?width=34&height=34`},{type:"home",src:`${l}/icons/serve/Buildings/home-line.png?width=34&height=34`},{type:"website",src:`${l}/icons/serve/Map/globe-line.png?width=34&height=34`},{type:"link",src:`${l}/icons/serve/Editor/link.png?width=34&height=34`},{type:"contact",src:`${l}/icons/serve/Business/customer-service-2-line.png?width=34&height=34`},{type:"address",src:`${l}/icons/serve/Map/map-pin-line.png?width=34&height=34`},{type:"send",src:`${l}/icons/serve/Business/send-plane-line.png?width=34&height=34`}],d="https://img.creaditor.ai",p={twitter:"x","t.co":"x","x.com":"x",youtu:"youtube","youtu.be":"youtube","fb.com":"facebook","fb.me":"facebook","m.me":"messenger","wa.me":"whatsapp","t.me":"telegram","ig.me":"instagram","lnkd.in":"linkedin"};function h(e,t){if(!t||"string"!=typeof t)return;const s=t.toLowerCase().trim();if(s.startsWith("mailto:"))return"email";if(s.startsWith("tel:"))return"phone";try{const i=(s.startsWith("http")?new URL(t):new URL(`https://${t}`)).hostname.replace("www.",""),r=i.split(".")[0];for(const[e,t]of Object.entries(p))if(i.includes(e)||e===i)return t;const n=e.find((e=>{const t=e.type.toLowerCase();return i.includes(t)||t.includes(r)||r.includes(t)}));return n?n.type:e.find((e=>s.includes(e.type.toLowerCase())))?.type}catch(t){return e.find((e=>s.includes(e.type.toLowerCase())))?.type}}function g(e,t){if(!e||!e.includes(d))return e;const s=function(e){let t=(e||"000000").toString().trim();return t.startsWith("#")&&(t=t.slice(1)),8===t.length&&/^[0-9a-fA-F]+$/.test(t)&&(t=t.slice(0,6)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length?t:"000000"}(t);try{const t=new URL(e);return t.searchParams.set("color",s),t.toString()}catch(t){const i=e.includes("?")?"&":"?";return`${e}${i}color=${s}`}}var m=s(56666);const u="https://img.creaditor.ai";function f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=t.width??24,i=t.height??24;let r=t.color??"000000";r.startsWith("#")&&(r=r.slice(1));return g(`${u}/icons/serve/${encodeURIComponent(e.category)}/${encodeURIComponent(e.name)}.png?width=${s}&height=${i}`,r)}class y extends r.oi{constructor(){super(),this.searchQuery="",this.iconColor="000000",this.iconSize=34,this.selectedSrc="",this._icons=[],this._loading=!1,this._error=""}willUpdate(e){e.has("searchQuery")&&this.searchQuery?this._fetchIcons():e.has("searchQuery")&&!this.searchQuery&&(this._icons=[],this._error="")}async _fetchIcons(){const e=(this.searchQuery||"").trim();if(e){this._loading=!0,this._error="";try{const t=new URLSearchParams({q:e,limit:"20"}),s=await fetch(`${u}/icons/search?${t.toString()}`);if(!s.ok)throw new Error(s.statusText);const i=await s.json();this._icons=i.icons||[]}catch(e){this._icons=[],this._error=e.message||"Failed to load icons"}finally{this._loading=!1}}else this._icons=[]}_onSelect(e){const t=(this.iconColor||"000000").replace(/^#/,""),s=Number(this.iconSize)||34,i=f(e,{width:s,height:s,color:t});this.dispatchEvent(new CustomEvent("icon-selected",{detail:{src:i,icon:e},bubbles:!0,composed:!0}))}render(){if(!this.searchQuery?.trim())return r.dy``;if(this._loading)return r.dy`<div class="loading"><cdtr-loader></cdtr-loader></div>`;if(this._error)return r.dy`<div class="error">${this._error}</div>`;if(!this._icons.length)return r.dy``;const e=(this.iconColor||"000000").replace(/^#/,"");return r.dy`
2
2
 
3
3
  <div class="grid">
4
4
  ${this._icons.map((t=>{const s=f(t,{width:24,height:24,color:e}),i=this.selectedSrc&&(this.selectedSrc.includes(t.name)||this.selectedSrc===s);return r.dy`
@@ -60,7 +60,7 @@
60
60
  .error {
61
61
  color: var(--error-color, #c00);
62
62
  }
63
- `),customElements.define("social-icon-suggestions",y);const v=e=>{{const{component:t,commands:s}=e,i=()=>{let e=c();if(e||(e=t.props.items.find((e=>!e.link)),!e&&t.props.items.length>0&&(e=t.props.items[0])),e){!t.props.items.find((t=>t.id===e.id))&&t.props.items.length>0&&(e=t.props.items[0])}return e};return{select:e=>{let{changeTab:t,tab:s}=e;"link"!==s&&t("link")},tabs:e=>{e||(e="link");const t=[{text:"image"},{text:"design"},{text:"link",selected:!0}];return t.forEach((t=>t.selected=t.selected=t.text===e)),t},layout:e=>{let{tab:n,changeTab:o,tabs:c}=e;const l=i(),d=[{type:"node",node:()=>r.dy`<img
63
+ `),customElements.define("social-icon-suggestions",y);var v=s(1547);const w=e=>{{const{component:t,commands:s}=e,i=()=>{let e=c();if(e||(e=t.props.items.find((e=>!e.link)),!e&&t.props.items.length>0&&(e=t.props.items[0])),e){!t.props.items.find((t=>t.id===e.id))&&t.props.items.length>0&&(e=t.props.items[0])}return e};return{select:e=>{let{changeTab:t,tab:s}=e;"link"!==s&&t("link")},tabs:e=>{e||(e="link");const t=[{text:"image"},{text:"design"},{text:"link",selected:!0}];return t.forEach((t=>t.selected=t.selected=t.text===e)),t},layout:e=>{let{tab:n,changeTab:o,tabs:c}=e;const l=i(),d=[{type:"node",node:()=>r.dy`<img
64
64
  style="padding:10px;display:block;margin:auto"
65
65
  width="52"
66
66
  height="52"
@@ -71,4 +71,4 @@
71
71
  .iconSize=${parseInt(l?.style?.width,10)||34}
72
72
  .selectedSrc=${l?.src||""}
73
73
  @icon-selected=${e=>{const r=i();if(!r)return;const n=t.props,o=JSON.parse(JSON.stringify(n.items)),c=o.findIndex((e=>e.id===r.id));-1!==c&&(o[c].src=e.detail.src,s.execCommand("items",o))}}
74
- ></social-icon-suggestions></cdtr-editor-container>`}},{type:"divider"},{type:"linkpicker",href:l?.link||l?.url,active:()=>"link"===n.text&&!!l,onChange:e=>{const r=i();if(!r)return;const n=e.target.value,o=t.props,c=JSON.parse(JSON.stringify(o.items)),l=c.findIndex((e=>e.id===r.id));if(-1!==l){const e=c[l].fgColor||c[l].iconColor,t=function(e,t){const s=h(a,e),i=s?a.find((e=>e.type===s)):null,r=i?i.src:null;return r?g(r,t):null}(n.href,e);t&&(c[l].src=t),c[l].url=n.href,c[l].link=n,s.execCommand("items",c)}}},{type:"slider",title:"size",active:"design"===n.text,value:parseInt(l?.style?.width),min:10,max:80,onInput:e=>{const i=e.target.value,r=[...t.props.items];r.forEach((e=>{e.style.width=i+"px",e.style.height=i+"px"})),s.execCommand("items",r)}},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>"design"===n.text&&!!l,value:l?.fgColor?l.fgColor.startsWith("#")?l.fgColor:"#"+l.fgColor:"#000000",onChange:e=>{const r=i();if(!r)return;let n=e.target.value;n.startsWith("#")&&(n=n.slice(1)),8===n.length&&/^[0-9a-fA-F]+$/.test(n)&&(n=n.slice(0,6));const o=t.props,c=JSON.parse(JSON.stringify(o.items));if(!0===o.applyColorToAll)c.forEach((e=>{e.fgColor=n}));else{const e=c.findIndex((e=>e.id===r.id));-1!==e&&(c[e].fgColor=n)}s.execCommand("items",c)}},{type:"checkbox",title:"color_them_all",checked:!!t.props.applyColorToAll,active:()=>"design"===n.text&&!!l,onChange:e=>{const t=!!e.target.checked;s.execCommand("applyColorToAll",t)}},{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 d}}}};var w=s(46245);const b=()=>({set:(e,t,s)=>{switch(t){case"style":if("object"==typeof s)return e[t]=(0,w.Z)(e[t],s),!0;break;case"items":if(e[t]=s,Array.isArray(s)){const e=c(),t=s.find((t=>t.id===e?.id));t&&o(t)}return!0;case"src":const i=c();if(i&&Array.isArray(e.items)){const t=[...e.items],r=t.findIndex((e=>e.id===i.id));if(-1!==r)return t[r].src=s,e.items=t,!0}break;case"applyColorToAll":return e[t]=s,!0}}});var x=s(46062),C=s.n(x),k=s(32877),$=s.n(k),_=s(96793),L=s.n(_),A=s(17892),S=s.n(A),I=s(11173),E=s.n(I),T=s(12089),N={};N.setAttributes=S(),N.insert=L().bind(null,"head"),N.domAPI=$(),N.insertStyleElement=E();C()(T.Z,N);const O=T.Z&&T.Z.locals?T.Z.locals:void 0;var B=s(51921);const R=()=>{const e="social";return{name:e,create:t=>{let{createElement:s,compose:r,helpers:n}=t;const l=document.createElement("div"),d=document.createElement("div");d.classList.add(O.root);new B.ZP(d,{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(r.props.items)),{oldIndex:s,newIndex:i}=e,[n]=t.splice(s,1);t.splice(i,0,n),r.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}});l.appendChild(d);return s({name:e,id:r.id,template:l,draggable:{group:"element"},droppable:{group:"element"},render:()=>{const e=r.props.items;let t=!1;const s=e.map((e=>{const s=e.url||e.link?.link||"";if(!e.src&&s){const i=h(a,s),r=i?a.find((e=>e.type===i)):null;if(r)return t=!0,{...e,src:r.src}}return e}));t&&setTimeout((()=>r.editor.store().execCommand("items",s)),0);const l=t?s:e;for(;d.firstChild;)d.removeChild(d.firstChild);n.mergeDiff(d,{style:r.props.style});const p=c();l.forEach((e=>{const t=document.createElement("img");p?.id===e.id&&t.classList.add(O.selected),t.addEventListener("click",(()=>{o(e),Array.from(d.children).forEach((e=>{e.classList.remove(O.selected)})),t.classList.add(O.selected)})),t.classList.add("item"),e.id&&t.setAttribute("data-id",e.id);const s=e.fgColor||e.iconColor;t.src=g(e.src,s),n.mergeDiff(t,{style:e.style}),d.append(t)}));const m=document.createElement("paper-button");m.style.minWidth="0",m.style.padding=0,m.innerHTML="<cdtr-icon icon='add'></cdtr-icon>",d.append(m),m.addEventListener("click",(()=>{setTimeout((()=>{const e=r.props.items[r.props.items.length-1],t={id:(0,i.Z)(),fgColor:"",bgColor:"",style:e.style,url:"",src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"},s=[...r.props.items];s.push(t),o(t),r.editor.store().execCommand("items",s)}),200)}))},handleBar:!0,defaultProps:{},validator:b(),schema:r.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")):l.classList.add(e)}},onDeselect:e=>{c();window.___social_cdtr_item&&window.___social_cdtr_item.classList.remove("selected_underlined"),l?.classList?.remove(e)},elementProps:r,remove:()=>{l.remove()},createEditor:v})}}}},12089:(e,t,s)=>{s.d(t,{Z:()=>c});var i=s(40272),r=s.n(i),n=s(82609),o=s.n(n)()(r());o.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:""}]),o.locals={root:"kfYL5P8k1NoeIcHkTLa_",selected:"qVA_0R0VNI45kslNcUpm"};const c=o}}]);
74
+ ></social-icon-suggestions></cdtr-editor-container>`}},{type:"divider"},{type:"linkpicker",href:l?.link||l?.url,active:()=>"link"===n.text&&!!l,onChange:e=>{const r=i();if(!r)return;const n=e.target.value,o=t.props,c=JSON.parse(JSON.stringify(o.items)),l=c.findIndex((e=>e.id===r.id));if(-1!==l){const e=c[l].fgColor||c[l].iconColor,t=function(e,t){const s=h(a,e),i=s?a.find((e=>e.type===s)):null,r=i?i.src:null;return r?g(r,t):null}(n.href,e);t&&(c[l].src=t),c[l].url=n.href,c[l].link=n,s.execCommand("items",c)}}},{type:"slider",title:"size",active:"design"===n.text,value:parseInt(l?.style?.width),min:10,max:80,onInput:e=>{const i=e.target.value,r=[...t.props.items];r.forEach((e=>{e.style.width=i+"px",e.style.height=i+"px"})),s.execCommand("items",r)}},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>"design"===n.text&&!!l,value:l?.fgColor?l.fgColor.startsWith("#")?l.fgColor:"#"+l.fgColor:"#000000",onChange:e=>{const r=i();if(!r)return;let n=e.target.value;n=(0,v.Z)(n).toHex(),n.startsWith("#")&&(n=n.slice(1)),8===n.length&&/^[0-9a-fA-F]+$/.test(n)&&(n=n.slice(0,6));const o=t.props,c=JSON.parse(JSON.stringify(o.items));if(!0===o.applyColorToAll)c.forEach((e=>{e.fgColor=n}));else{const e=c.findIndex((e=>e.id===r.id));-1!==e&&(c[e].fgColor=n)}s.execCommand("items",c)}},{type:"checkbox",title:"color_them_all",checked:!!t.props.applyColorToAll,active:()=>"design"===n.text&&!!l,onChange:e=>{const t=!!e.target.checked;s.execCommand("applyColorToAll",t)}},{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 d}}}};var b=s(46245);const x=()=>({set:(e,t,s)=>{switch(t){case"style":if("object"==typeof s)return e[t]=(0,b.Z)(e[t],s),!0;break;case"items":if(e[t]=s,Array.isArray(s)){const e=c(),t=s.find((t=>t.id===e?.id));t&&o(t)}return!0;case"src":const i=c();if(i&&Array.isArray(e.items)){const t=[...e.items],r=t.findIndex((e=>e.id===i.id));if(-1!==r)return t[r].src=s,e.items=t,!0}break;case"applyColorToAll":return e[t]=s,!0}}});var C=s(46062),k=s.n(C),$=s(32877),_=s.n($),L=s(96793),A=s.n(L),S=s(17892),I=s.n(S),E=s(11173),T=s.n(E),N=s(12089),O={};O.setAttributes=I(),O.insert=A().bind(null,"head"),O.domAPI=_(),O.insertStyleElement=T();k()(N.Z,O);const B=N.Z&&N.Z.locals?N.Z.locals:void 0;var R=s(51921);const Z=()=>{const e="social";return{name:e,create:t=>{let{createElement:s,compose:r,helpers:n}=t;const l=document.createElement("div"),d=document.createElement("div");d.classList.add(B.root);new R.ZP(d,{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(r.props.items)),{oldIndex:s,newIndex:i}=e,[n]=t.splice(s,1);t.splice(i,0,n),r.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}});l.appendChild(d);return s({name:e,id:r.id,template:l,draggable:{group:"element"},droppable:{group:"element"},render:()=>{const e=r.props.items;let t=!1;const s=e.map((e=>{const s=e.url||e.link?.link||"";if(!e.src&&s){const i=h(a,s),r=i?a.find((e=>e.type===i)):null;if(r)return t=!0,{...e,src:r.src}}return e}));t&&setTimeout((()=>r.editor.store().execCommand("items",s)),0);const l=t?s:e;for(;d.firstChild;)d.removeChild(d.firstChild);n.mergeDiff(d,{style:r.props.style});const p=c();l.forEach((e=>{const t=document.createElement("img");p?.id===e.id&&t.classList.add(B.selected),t.addEventListener("click",(()=>{o(e),Array.from(d.children).forEach((e=>{e.classList.remove(B.selected)})),t.classList.add(B.selected)})),t.classList.add("item"),e.id&&t.setAttribute("data-id",e.id);const s=e.fgColor||e.iconColor;t.src=g(e.src,s),n.mergeDiff(t,{style:e.style}),d.append(t)}));const m=document.createElement("paper-button");m.style.minWidth="0",m.style.padding=0,m.innerHTML="<cdtr-icon icon='add'></cdtr-icon>",d.append(m),m.addEventListener("click",(()=>{setTimeout((()=>{const e=r.props.items[r.props.items.length-1],t={id:(0,i.Z)(),fgColor:"",bgColor:"",style:e.style,url:"",src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"},s=[...r.props.items];s.push(t),o(t),r.editor.store().execCommand("items",s)}),200)}))},handleBar:!0,defaultProps:{},validator:x(),schema:r.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")):l.classList.add(e)}},onDeselect:e=>{c();window.___social_cdtr_item&&window.___social_cdtr_item.classList.remove("selected_underlined"),l?.classList?.remove(e)},elementProps:r,remove:()=>{l.remove()},createEditor:w})}}}},12089:(e,t,s)=>{s.d(t,{Z:()=>c});var i=s(40272),r=s.n(i),n=s(82609),o=s.n(n)()(r());o.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:""}]),o.locals={root:"kfYL5P8k1NoeIcHkTLa_",selected:"qVA_0R0VNI45kslNcUpm"};const c=o}}]);
Binary file
@@ -5,7 +5,7 @@
5
5
  height: 100%;
6
6
  }
7
7
  .skeleton-item {
8
- background: #dedee2;
8
+ background: #e8e4f0;
9
9
  border-radius: 4px;
10
10
  position: relative;
11
11
  overflow: hidden;
@@ -19,7 +19,7 @@
19
19
  left: 0;
20
20
  width: 100%;
21
21
  height: 100%;
22
- background: linear-gradient(90deg, #dedee2, #e9e9ec, #dedee2);
22
+ background: linear-gradient(90deg, #e8e4f0, #f0ecf8, #e8e4f0);
23
23
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
24
24
  }
25
25
 
Binary file
@@ -0,0 +1 @@
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[4217],{84217:(e,n,t)=>{t.r(n),t.d(n,{default:()=>w});t(30814),t(70235);let a=!0;const o=e=>{{const{component:n,commands:t,helpers:o}=e,i=n.parent("col");return{select:e=>{let{changeTab:n,tab:t}=e;t.text||n("image")},tabs:e=>{const n=[{text:"image",selected:!0},{text:"design"},{text:"link"},{text:"ai"},{text:"settings"}];return e?(n.forEach((n=>n.selected=n.selected=n.text===e)),n):n},layout:e=>{const{tab:o,changeTab:r,tabs:s}=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:n.props.src,hasPreview:!0,text:"openGalleryImage",justify:"flex-start",onChange:e=>{let n=e.detail;Array.isArray(n)&&(n=n[0]),t.execCommand("src",n.src)}},{type:"input",title:"add_urlAddress_from_media_site",active:()=>"image"===o.text,value:n.props.src||"",onChange:e=>{const n=e.target.value;t.execCommand("src",n)}},{type:"input",title:"altText",active:()=>"image"===o.text,value:n.props.alt||"",onChange:e=>{const n=e.target.value;t.execCommand("alt",n)}},{type:"checkbox",title:"fullWidthOnMobile",checked:!!n.props.isFullWidthOnMobile,active:()=>"image"===o.text,onChange:e=>{const n=e.target.checked;t.execCommand("isFullWidthOnMobile",n)}},{type:"divider",active:()=>"design"===o.text},{type:"checkbox",title:"keep_ratio",checked:!!a,active:()=>"design"===o.text,onChange:e=>{a=!a,r("design")}},{type:"slider",min:10,title:"size",active:()=>"design"===o.text&&a,max:a?1e3:i?.element?.offsetWidth,value:parseInt(n.props.style.width),onInput:e=>{const n=e.target.value;t.execCommand("style",{width:n+"px",height:"auto"})}},{type:"slider",min:10,title:"width",active:()=>"design"===o.text&&!a,max:a?1e3:i?.element?.offsetWidth,value:parseInt(n.props.style.width),onInput:e=>{const a=e.target.value,o=n.atomElement.getBoundingClientRect().height;t.execCommand("style",{width:a+"px",height:o+"px"})}},{type:"slider",min:10,title:"height",active:()=>"design"===o.text&&!a,max:2*i?.element?.offsetWidth,value:parseInt(n.props.style.height),onInput:e=>{const a=e.target.value,o=n.atomElement.getBoundingClientRect().width;t.execCommand("style",{height:a+"px",width:o+"px"})}},{type:"radius",title:"radius",active:()=>"design"===o.text,min:0,max:parseInt(n.props.style.width)/2,value:parseInt(n.props.style.borderRadius),elementId:n.id,borderTopRightRadius:parseInt(n.props.style.borderTopRightRadius),borderTopLeftRadius:parseInt(n.props.style.borderTopLeftRadius),borderBottomRightRadius:parseInt(n.props.style.borderBottomRightRadius),borderBottomLeftRadius:parseInt(n.props.style.borderBottomLeftRadius),onInput:e=>{const n=e.target.json;t.execCommand("style",{borderTopRightRadius:n.borderTopRightRadius+"px",borderTopLeftRadius:n.borderTopLeftRadius+"px",borderBottomRightRadius:n.borderBottomRightRadius+"px",borderBottomLeftRadius:n.borderBottomLeftRadius+"px",borderRadius:null})}},{type:"divider",active:()=>"design"===o.text},{type:"linkpicker",href:n.props.onClick?.link,protocol:n.props.onClick?.link?.protocol,target:n.props.onClick?.link?.target,autofocus:!0,active:()=>"link"===o.text,onChange:e=>{const n={link:e.target.value};t.execCommand("onClick",n)}}]}}}};var i=t(46245);const r=()=>({set:(e,n,t)=>{switch(n){case"src":case"isFullWidthOnMobile":case"isOpenWithModal":case"isCircle":case"alt":case"onClick":return e[n]=t,!0;case"style":if("object"==typeof t)return e[n]=(0,i.Z)(e[n],t),!0}}});var s=t(46062),c=t.n(s),d=t(32877),l=t.n(d),p=t(96793),A=t.n(p),m=t(17892),u=t.n(m),g=t(11173),h=t.n(g),E=t(4257),y={};y.setAttributes=u(),y.insert=A().bind(null,"head"),y.domAPI=l(),y.insertStyleElement=h();c()(E.Z,y);const C=E.Z&&E.Z.locals?E.Z.locals:void 0;function f(e){const n=document.createElement("div");n.className=C.wrapper;const t=document.createElement("div");t.className=C.skeleton;const a=document.createElement("div");a.className=C.shimmer,t.appendChild(a);const o=document.createElement("div");o.className=C.scanline,t.appendChild(o);const i=document.createElement("div");i.className=C.imageContainer,i.appendChild(e);let r=!1;function s(){if(!r)return;r=!1,n.classList.remove(C.loading),n.classList.add(C.revealed),e.classList.remove(C.imageHidden),e.classList.add(C.imageRevealed);const t=()=>{n.classList.remove(C.revealed),e.classList.remove(C.imageRevealed),e.removeEventListener("animationend",t)};e.addEventListener("animationend",t)}return e.addEventListener("load",s),e.addEventListener("error",s),{wrapper:n,showLoader:function(){(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||e.src&&!e.complete)&&(r=!0,n.classList.add(C.loading),e.classList.add(C.imageHidden))},hideLoader:s,wrap:function(e){n.appendChild(t),n.appendChild(i),e.appendChild(n)},skeleton:t}}var v=t(76555),b={};b.setAttributes=u(),b.insert=A().bind(null,"head"),b.domAPI=l(),b.insertStyleElement=h();c()(v.Z,b);const k=v.Z&&v.Z.locals?v.Z.locals:void 0,w=()=>{const e="image";return{name:e,create:n=>{const{createElement:t,compose:a,helpers:i}=n,{arrayToString:s,mergeDiff:c}=i,d=document.createElement("img"),l=document.createElement("div");a.props.style&&!parseInt(a.props.style.height)&&(a.props.style.height="auto"),d.addEventListener("drop",(e=>{e.preventDefault();var n=e.dataTransfer.getData("text/html");const t=document.createElement("div");t.innerHTML=n;const o=t.querySelector("img");o&&o.src&&a.editor.store().updateComponent(a,"src",o.src)})),d.draggable=!0,d.src=a.props.src;const p=s(a.classList);d.className=s(p,"editor-image",k.image),l.append(d);const A=f(d);A.wrap(l);let m=a.props.src;function u(e){const n=e.target;n.classList.contains("amazingbar-content-wrapper")&&"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName&&("Delete"!==e.key&&"Backspace"!==e.key||g.commands.remove())}a.props.src&&A.showLoader(),d.addEventListener("dblclick",(()=>{const e=document.createElement("cdtr-gallery");e.opened=!0,e.multi=!0,document.body.append(e),e.addEventListener("file",(n=>{let t=n.detail;Array.isArray(t)&&(t=t[0]),a.editor.store().execCommands([{key:"src",value:t.src},{key:"style",value:{height:"auto"}}]),e.opened=!1,setTimeout((()=>{e.remove()}),1500)})),e.addEventListener("close",(()=>{e.remove()}))}));const g=t({name:e,id:a.id,template:l,defaultProps:{style:{height:"auto",width:"200px"}},draggable:{group:"element"},droppable:{group:"element"},render:()=>{c(d,{style:a.props.style}),d.width=a.props.width||a.props.style.width,d.height=a.props.height||a.props.style.height,a.props.src&&a.props.src!==m&&(m=a.props.src,A.showLoader(!0)),c(d,{src:a.props.src}),c(d,{alt:a.props.alt})},resizeable:()=>l,handleBar:!0,validator:r({template:l,image:d,helpers:i}),schema:a.schema,onSelect:e=>{d.classList.add(e),document.addEventListener("keyup",u)},onDeselect:e=>{d.classList.remove(e),document.removeEventListener("keyup",u)},elementProps:a,remove:()=>{l.remove()},createEditor:o});let h=0,E=0,y=!1,C=!1,v=!1,b=!1;return d.addEventListener("dragover",(e=>{e.preventDefault()})),d.addEventListener("dragstart",(e=>{h=e.clientX,E=e.clientY,y=!0,C=!1,v=!1,b=!1})),d.addEventListener("drag",(e=>{if(!y)return;const n=d.closest(".block-component")||d.closest("[data-block]")||d.parentElement;if(!n)return;const t=n.getBoundingClientRect(),a=t.width,o=t.left,i=e.clientX-o,r=.3*a,s=.7*a;if(i<r&&!C){C=!0,b=!1,v=!1;const e=g.parent("col");e&&e.commands.execCommand("justify","start")}else if(i>s&&!v){v=!0,b=!1,C=!1;const e=g.parent("col");e&&e.commands.execCommand("justify","end")}else if(i>=r&&i<=s&&!b){b=!0,C=!1,v=!1;const e=g.closest("col");e&&e.commands.execCommand("justify","center")}})),d.addEventListener("dragend",(e=>{y=!1,C=!1,v=!1,b=!1})),g}}}},4257:(e,n,t)=>{t.d(n,{Z:()=>s});var a=t(40272),o=t.n(a),i=t(82609),r=t.n(i)()(o());r.push([e.id,".dvyeXDEWGDwQldC0Fv8X {\n position: relative;\n display: inline-block;\n overflow: hidden;\n}\n\n.Nm0m1lLy5PfrkcLEFbKK {\n position: relative;\n display: block;\n line-height: 0;\n}\n\n.dogylpRtyD7KXQzaAELM {\n opacity: 0;\n transition: opacity 0.15s ease-out;\n}\n\n.G31NNGIMzJODgwFanTWa {\n animation: kVMR3qotZ5zoT096EjqQ 0.4s ease-out forwards;\n}\n\n@keyframes kVMR3qotZ5zoT096EjqQ {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n/* Skeleton overlay - light purple placeholder */\n.a0StLItf00WRhmpEbZgN {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: linear-gradient(\n 110deg,\n #e8e4f0 8%,\n #f0ecf8 18%,\n #e8e4f0 33%\n );\n background-size: 200% 100%;\n animation: Z6Vx9hDUR58e_YIwbFpH 1.5s ease-in-out infinite;\n pointer-events: none;\n}\n\n.dvyeXDEWGDwQldC0Fv8X.Ppaid5QaGvjws84qIQzc .a0StLItf00WRhmpEbZgN {\n opacity: 1;\n z-index: 1;\n}\n\n.dvyeXDEWGDwQldC0Fv8X:not(.Ppaid5QaGvjws84qIQzc) .a0StLItf00WRhmpEbZgN {\n opacity: 0;\n pointer-events: none;\n z-index: -1;\n transition: opacity 0.2s ease-out;\n}\n\n.dvyeXDEWGDwQldC0Fv8X.dpeZ0kyhzQiISwO8GTXa .a0StLItf00WRhmpEbZgN {\n animation: E7r0bceMAcn0gX52ytIX 0.4s ease-out forwards;\n}\n\n@keyframes Z6Vx9hDUR58e_YIwbFpH {\n 0% {\n background-position: 200% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n}\n\n@keyframes E7r0bceMAcn0gX52ytIX {\n to {\n opacity: 0;\n }\n}\n\n/* Shimmer highlight sweep */\n.nYxhEQAmC2ND9Dl5SkoX {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.4) 50%,\n transparent 100%\n );\n background-size: 50% 100%;\n animation: mH_hfMLh7RKw5vWazHwT 2s ease-in-out infinite;\n}\n\n@keyframes mH_hfMLh7RKw5vWazHwT {\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(200%);\n }\n}\n\n/* Print-style scanline */\n.m4vo4fZkraouC_mbmxb0 {\n position: absolute;\n left: 0;\n right: 0;\n height: 2px;\n background: linear-gradient(\n to bottom,\n transparent,\n rgba(255, 255, 255, 0.6),\n transparent\n );\n animation: Tpj4rBpkPWx1OrWANbU0 1.2s ease-in-out infinite;\n box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);\n}\n\n@keyframes Tpj4rBpkPWx1OrWANbU0 {\n 0% {\n top: 0;\n opacity: 1;\n }\n 90% {\n top: 100%;\n opacity: 0.8;\n }\n 100% {\n top: 100%;\n opacity: 0;\n }\n}\n","",{version:3,sources:["webpack://./../image-editor-component/lib/image-loader.module.css"],names:[],mappings:"AAAA;EACE,kBAAkB;EAClB,qBAAqB;EACrB,gBAAgB;AAClB;;AAEA;EACE,kBAAkB;EAClB,cAAc;EACd,cAAc;AAChB;;AAEA;EACE,UAAU;EACV,kCAAkC;AACpC;;AAEA;EACE,sDAA6C;AAC/C;;AAEA;EACE;IACE,UAAU;EACZ;EACA;IACE,UAAU;EACZ;AACF;;AAEA,gDAAgD;AAChD;EACE,kBAAkB;EAClB,MAAQ;EAAR,QAAQ;EAAR,SAAQ;EAAR,OAAQ;EACR;;;;;GAKC;EACD,0BAA0B;EAC1B,yDAAoD;EACpD,oBAAoB;AACtB;;AAEA;EACE,UAAU;EACV,UAAU;AACZ;;AAEA;EACE,UAAU;EACV,oBAAoB;EACpB,WAAW;EACX,iCAAiC;AACnC;;AAEA;EACE,sDAAiD;AACnD;;AAEA;EACE;IACE,2BAA2B;EAC7B;EACA;IACE,4BAA4B;EAC9B;AACF;;AAEA;EACE;IACE,UAAU;EACZ;AACF;;AAEA,4BAA4B;AAC5B;EACE,kBAAkB;EAClB,MAAQ;EAAR,QAAQ;EAAR,SAAQ;EAAR,OAAQ;EACR;;;;;GAKC;EACD,yBAAyB;EACzB,uDAA+C;AACjD;;AAEA;EACE;IACE,4BAA4B;EAC9B;EACA;IACE,2BAA2B;EAC7B;AACF;;AAEA,yBAAyB;AACzB;EACE,kBAAkB;EAClB,OAAO;EACP,QAAQ;EACR,WAAW;EACX;;;;;GAKC;EACD,yDAAiD;EACjD,4CAA4C;AAC9C;;AAEA;EACE;IACE,MAAM;IACN,UAAU;EACZ;EACA;IACE,SAAS;IACT,YAAY;EACd;EACA;IACE,SAAS;IACT,UAAU;EACZ;AACF",sourcesContent:[".wrapper {\n position: relative;\n display: inline-block;\n overflow: hidden;\n}\n\n.imageContainer {\n position: relative;\n display: block;\n line-height: 0;\n}\n\n.imageHidden {\n opacity: 0;\n transition: opacity 0.15s ease-out;\n}\n\n.imageRevealed {\n animation: imageFadeIn 0.4s ease-out forwards;\n}\n\n@keyframes imageFadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n/* Skeleton overlay - light purple placeholder */\n.skeleton {\n position: absolute;\n inset: 0;\n background: linear-gradient(\n 110deg,\n #e8e4f0 8%,\n #f0ecf8 18%,\n #e8e4f0 33%\n );\n background-size: 200% 100%;\n animation: skeletonShimmer 1.5s ease-in-out infinite;\n pointer-events: none;\n}\n\n.wrapper.loading .skeleton {\n opacity: 1;\n z-index: 1;\n}\n\n.wrapper:not(.loading) .skeleton {\n opacity: 0;\n pointer-events: none;\n z-index: -1;\n transition: opacity 0.2s ease-out;\n}\n\n.wrapper.revealed .skeleton {\n animation: skeletonFadeOut 0.4s ease-out forwards;\n}\n\n@keyframes skeletonShimmer {\n 0% {\n background-position: 200% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n}\n\n@keyframes skeletonFadeOut {\n to {\n opacity: 0;\n }\n}\n\n/* Shimmer highlight sweep */\n.shimmer {\n position: absolute;\n inset: 0;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.4) 50%,\n transparent 100%\n );\n background-size: 50% 100%;\n animation: shimmerSweep 2s ease-in-out infinite;\n}\n\n@keyframes shimmerSweep {\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(200%);\n }\n}\n\n/* Print-style scanline */\n.scanline {\n position: absolute;\n left: 0;\n right: 0;\n height: 2px;\n background: linear-gradient(\n to bottom,\n transparent,\n rgba(255, 255, 255, 0.6),\n transparent\n );\n animation: scanlineMove 1.2s ease-in-out infinite;\n box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);\n}\n\n@keyframes scanlineMove {\n 0% {\n top: 0;\n opacity: 1;\n }\n 90% {\n top: 100%;\n opacity: 0.8;\n }\n 100% {\n top: 100%;\n opacity: 0;\n }\n}\n"],sourceRoot:""}]),r.locals={wrapper:"dvyeXDEWGDwQldC0Fv8X",imageContainer:"Nm0m1lLy5PfrkcLEFbKK",imageHidden:"dogylpRtyD7KXQzaAELM",imageRevealed:"G31NNGIMzJODgwFanTWa",imageFadeIn:"kVMR3qotZ5zoT096EjqQ",skeleton:"a0StLItf00WRhmpEbZgN",skeletonShimmer:"Z6Vx9hDUR58e_YIwbFpH",loading:"Ppaid5QaGvjws84qIQzc",revealed:"dpeZ0kyhzQiISwO8GTXa",skeletonFadeOut:"E7r0bceMAcn0gX52ytIX",shimmer:"nYxhEQAmC2ND9Dl5SkoX",shimmerSweep:"mH_hfMLh7RKw5vWazHwT",scanline:"m4vo4fZkraouC_mbmxb0",scanlineMove:"Tpj4rBpkPWx1OrWANbU0"};const s=r},76555:(e,n,t)=>{t.d(n,{Z:()=>s});var a=t(40272),o=t.n(a),i=t(82609),r=t.n(i)()(o());r.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:""}]),r.locals={image:"DYtLgzP53oukeRBVqQDc"};const s=r},30814:(e,n,t)=>{t.d(n,{td:()=>l});const a=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=a,window[a]||(window[a]={});const o=window[a],i=window.__cdtrEvents||{};function r(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 s(e){if(e.length%2!=0)throw new Error("Invalid hex string");const n=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2)n[t/2]=parseInt(e.substr(t,2),16);return n}async function c(e){const n=await r(e),t=o[n];if(t){const e=await crypto.subtle.importKey("raw",s(n),{name:"AES-GCM"},!1,["encrypt","decrypt"]),a=await async function(e,n,t){const a=await crypto.subtle.decrypt({name:"AES-GCM",iv:n},e,t);return(new TextDecoder).decode(a)}(e,t.iv,t.encrypted);return JSON.parse(a)}return null}function d(e,n){if(i[e])for(const t in i[e])Object.prototype.hasOwnProperty.call(i[e],t)&&i[e][t].forEach((e=>e(n)));Array.isArray(i["*"])&&i["*"].forEach((e=>e(n)))}window.__cdtrEvents=i;const l={set:async function(e,n){const t=JSON.parse(JSON.stringify(n)),a=await r(e),c=await crypto.subtle.importKey("raw",s(a),{name:"AES-GCM"},!1,["encrypt","decrypt"]),l=await async function(e,n){const t=crypto.getRandomValues(new Uint8Array(12)),a=(new TextEncoder).encode(n),o=await crypto.subtle.encrypt({name:"AES-GCM",iv:t},e,a);return{iv:t,encrypted:new Uint8Array(o)}}(c,JSON.stringify(t));o[a]=l,i.set&&i.set[a]&&i.set[a].forEach((e=>e(t))),Array.isArray(i["*"])&&i["*"].forEach((e=>e(t))),d(e,t)},get:c,remove:async function(e){const n=await r(e);delete o[n]},on:async function(e,n,t){i[e]||(i[e]={});const a=await r(n);i[e][a]||(i[e][a]=[]),i[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.")}(),t(e)}));const o=await c(n);return o&&t(o),a},off:function(e,n){i[e]&&i[e][n]&&delete i[e][n]},dispatch:d,OPTIONS:{SET:"set"}}}}]);
Binary file
@@ -1 +1 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[7216],{87216:(e,t,o)=>{o.r(t),o.d(t,{default:()=>a});const n=e=>{{const{component:t,commands:o}=e;return{select:e=>{let{changeTab:t,tab:o}=e;o.text||t("icon")},tabs:e=>{const t=[{text:"icon",selected:!0},{text:"design"},{text:"link"},{text:"settings"}];return e?(t.forEach((t=>t.selected=t.text===e)),t):t},layout:e=>{let{tab:n}=e;const r=t.props.src.includes("img.creaditor.ai");return[{type:"icons",active:()=>"icon"===n.text,selectedIcon:t.props.src,useIconsApi:!0,iconColor:t.props.iconColor||"000000",iconSize:parseInt(t.props.style?.width,10)||24,onChange:e=>{const n=e.detail;if(n){const e=n.urlPng||n.src;e&&o.execCommand("src",e),t.props.alt&&"icon"!==t.props.alt||o.execCommand("alt",n.name),n.size?.width&&n.size?.height&&o.execCommand("style",{width:n.size.width+"px",height:n.size.height+"px"}),null!=n.category&&null!=n.name&&(o.execCommand("iconCategory",n.category),o.execCommand("iconName",n.name));const r=(n.color??t.props.iconColor??"000000").toString().replace(/^#/,"");o.execCommand("iconColor",r)}}},{type:"input",title:"altText",active:()=>"icon"===n.text,value:t.props.alt||"",onChange:e=>{const t=e.target.value;o.execCommand("alt",t)}},{type:"slider",title:"size",min:8,max:256,active:()=>"design"===n.text,value:parseInt(t.props.style?.width,10)||24,onInput:e=>{const t=e.target.value;o.execCommand("style",{width:t+"px",height:t+"px"})}},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>"design"===n.text&&r,value:t.props.iconColor?t.props.iconColor.startsWith("#")?t.props.iconColor:"#"+t.props.iconColor:"#000000",onChange:e=>{let t=e.target.value;t.startsWith("#")&&(t=t.slice(1)),o.execCommand("iconColor",t)}},{type:"linkpicker",href:t.props.onClick?.link,protocol:t.props.onClick?.link?.protocol,target:t.props.onClick?.link?.target,autofocus:!0,active:()=>"link"===n.text,onChange:e=>{const t={link:e.target.value};o.execCommand("onClick",t)}}]}}}},r=e=>{let{helpers:t}=e;return{set:(e,o,n)=>{switch(o){case"style":return e[o]=t.deepMerge(e[o],n),!0;case"src":case"alt":case"iconColor":case"iconCategory":case"iconName":return e[o]=n,!0;case"onClick":if(n&&n.link)return e[o]=n,!0}}}},s="https://img.creaditor.ai",c=1,i=512;const a=()=>{const e="icon";return{name:e,create:t=>{const{createElement:o,compose:a,helpers:l}=t,{mergeDiff:p}=l,m=document.createElement("div"),d=document.createElement("img");m.appendChild(d);return o({name:e,id:a.id,template:m,defaultProps:{style:{height:"24px",width:"24px",display:"inline-block"},src:"",alt:"",iconColor:"000000"},draggable:{group:"element"},droppable:{group:"element"},render:()=>{p(d,{style:a.props.style});const e=function(e){const t=e.props.iconCategory,o=e.props.iconName;if(!t||!o)return null;let n=parseInt(e.props.style?.width,10)||24,r=parseInt(e.props.style?.height,10)||24;n=Math.min(i,Math.max(c,n)),r=Math.min(i,Math.max(c,r));const a=function(e){let t=(e||"000000").toString().trim();return t.startsWith("#")&&(t=t.slice(1)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?"000000":t}(e.props.iconColor);return`${s}/icons/serve/${encodeURIComponent(t)}/${encodeURIComponent(o)}.png?${new URLSearchParams({width:String(n),height:String(r),color:a}).toString()}`}(a)||a.props.src;p(d,{src:e,alt:a.props.alt||""})},resizeable:null,handleBar:!0,validator:r({helpers:l}),schema:a.schema,onSelect:e=>{m.classList.add(e)},onDeselect:e=>{m.classList.remove(e)},elementProps:a,remove:()=>{m.remove()},createEditor:n})}}}}}]);
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[7216],{87216:(e,t,o)=>{o.r(t),o.d(t,{default:()=>l});var n=o(1547);const r=e=>{{const{component:t,commands:o}=e;return{select:e=>{let{changeTab:t,tab:o}=e;o.text||t("icon")},tabs:e=>{const t=[{text:"icon",selected:!0},{text:"design"},{text:"link"},{text:"settings"}];return e?(t.forEach((t=>t.selected=t.text===e)),t):t},layout:e=>{let{tab:r}=e;const s=t.props.src.includes("img.creaditor.ai");return[{type:"icons",active:()=>"icon"===r.text,selectedIcon:t.props.src,useIconsApi:!0,iconColor:t.props.iconColor||"000000",iconSize:parseInt(t.props.style?.width,10)||24,onChange:e=>{const n=e.detail;if(n){const e=n.urlPng||n.src;e&&o.execCommand("src",e),t.props.alt&&"icon"!==t.props.alt||o.execCommand("alt",n.name),n.size?.width&&n.size?.height&&o.execCommand("style",{width:n.size.width+"px",height:n.size.height+"px"}),null!=n.category&&null!=n.name&&(o.execCommand("iconCategory",n.category),o.execCommand("iconName",n.name));const r=(n.color??t.props.iconColor??"000000").toString().replace(/^#/,"");o.execCommand("iconColor",r)}}},{type:"input",title:"altText",active:()=>"icon"===r.text,value:t.props.alt||"",onChange:e=>{const t=e.target.value;o.execCommand("alt",t)}},{type:"slider",title:"size",min:8,max:256,active:()=>"design"===r.text,value:parseInt(t.props.style?.width,10)||24,onInput:e=>{const t=e.target.value;o.execCommand("style",{width:t+"px",height:t+"px"})}},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>"design"===r.text&&s,value:t.props.iconColor?t.props.iconColor.startsWith("#")?t.props.iconColor:"#"+t.props.iconColor:"#000000",onChange:e=>{let t=e.target.value;t=(0,n.Z)(t).toHex(),t.startsWith("#")&&(t=t.slice(1)),o.execCommand("iconColor",t)}},{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};o.execCommand("onClick",t)}}]}}}},s=e=>{let{helpers:t}=e;return{set:(e,o,n)=>{switch(o){case"style":return e[o]=t.deepMerge(e[o],n),!0;case"src":case"alt":case"iconColor":case"iconCategory":case"iconName":return e[o]=n,!0;case"onClick":if(n&&n.link)return e[o]=n,!0}}}},c="https://img.creaditor.ai",i=1,a=512;const l=()=>{const e="icon";return{name:e,create:t=>{const{createElement:o,compose:n,helpers:l}=t,{mergeDiff:p}=l,m=document.createElement("div"),d=document.createElement("img");m.appendChild(d);return o({name:e,id:n.id,template:m,defaultProps:{style:{height:"24px",width:"24px",display:"inline-block"},src:"",alt:"",iconColor:"000000"},draggable:{group:"element"},droppable:{group:"element"},render:()=>{p(d,{style:n.props.style});const e=function(e){const t=e.props.iconCategory,o=e.props.iconName;if(!t||!o)return null;let n=parseInt(e.props.style?.width,10)||24,r=parseInt(e.props.style?.height,10)||24;n=Math.min(a,Math.max(i,n)),r=Math.min(a,Math.max(i,r));const s=function(e){let t=(e||"000000").toString().trim();return t.startsWith("#")&&(t=t.slice(1)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?"000000":t}(e.props.iconColor);return`${c}/icons/serve/${encodeURIComponent(t)}/${encodeURIComponent(o)}.png?${new URLSearchParams({width:String(n),height:String(r),color:s}).toString()}`}(n)||n.props.src;p(d,{src:e,alt:n.props.alt||""})},resizeable:null,handleBar:!0,validator:s({helpers:l}),schema:n.schema,onSelect:e=>{m.classList.add(e)},onDeselect:e=>{m.classList.remove(e)},elementProps:n,remove:()=>{m.remove()},createEditor:r})}}}}}]);
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:()=>w});n(30814),n(70235);let o=!0;const r=e=>{{const{component:t,commands:n,helpers:r}=e,a=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:!!o,active:()=>"design"===r.text,onChange:e=>{o=!o,s("design")}},{type:"slider",min:10,title:"size",active:()=>"design"===r.text&&o,max:o?1e3:a?.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&&!o,max:o?1e3:a?.element?.offsetWidth,value:parseInt(t.props.style.width),onInput:e=>{const o=e.target.value,r=t.atomElement.getBoundingClientRect().height;n.execCommand("style",{width:o+"px",height:r+"px"})}},{type:"slider",min:10,title:"height",active:()=>"design"===r.text&&!o,max:2*a?.element?.offsetWidth,value:parseInt(t.props.style.height),onInput:e=>{const o=e.target.value,r=t.atomElement.getBoundingClientRect().width;n.execCommand("style",{height:o+"px",width:r+"px"})}},{type:"radius",title:"radius",active:()=>"design"===r.text,min:0,max:parseInt(t.props.style.width)/2,value:parseInt(t.props.style.borderRadius),elementId:t.id,borderTopRightRadius:parseInt(t.props.style.borderTopRightRadius),borderTopLeftRadius:parseInt(t.props.style.borderTopLeftRadius),borderBottomRightRadius:parseInt(t.props.style.borderBottomRightRadius),borderBottomLeftRadius:parseInt(t.props.style.borderBottomLeftRadius),onInput:e=>{const t=e.target.json;n.execCommand("style",{borderTopRightRadius:t.borderTopRightRadius+"px",borderTopLeftRadius:t.borderTopLeftRadius+"px",borderBottomRightRadius:t.borderBottomRightRadius+"px",borderBottomLeftRadius:t.borderBottomLeftRadius+"px",borderRadius:null})}},{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 a=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,a.Z)(e[t],n),!0}}});var i=n(46062),c=n.n(i),d=n(32877),l=n.n(d),p=n(96793),m=n.n(p),u=n(17892),g=n.n(u),h=n(11173),y=n.n(h),f=n(76555),v={};v.setAttributes=g(),v.insert=m().bind(null,"head"),v.domAPI=l(),v.insertStyleElement=y();c()(f.Z,v);const x=f.Z&&f.Z.locals?f.Z.locals:void 0,w=()=>{const e="image";return{name:e,create:t=>{const{createElement:n,compose:o,helpers:a}=t,{arrayToString:i,mergeDiff:c}=a,d=document.createElement("img"),l=document.createElement("div");o.props.style&&!parseInt(o.props.style.height)&&(o.props.style.height="auto"),d.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&&o.editor.store().updateComponent(o,"src",r.src)})),d.draggable=!0,d.src=o.props.src;const p=i(o.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())}d.className=i(p,"editor-image",x.image),l.append(d),d.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]),o.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:o.id,template:l,defaultProps:{style:{height:"auto",width:"200px"}},draggable:{group:"element"},droppable:{group:"element"},render:()=>{c(d,{style:o.props.style}),d.width=o.props.width||o.props.style.width,d.height=o.props.height||o.props.style.height,c(d,{src:o.props.src}),c(d,{alt:o.props.alt})},resizeable:()=>l,handleBar:!0,validator:s({template:l,image:d,helpers:a}),schema:o.schema,onSelect:e=>{d.classList.add(e),document.addEventListener("keyup",m)},onDeselect:e=>{d.classList.remove(e),document.removeEventListener("keyup",m)},elementProps:o,remove:()=>{l.remove()},createEditor:r});let g=0,h=0,y=!1,f=!1,v=!1,w=!1;return d.addEventListener("dragover",(e=>{e.preventDefault()})),d.addEventListener("dragstart",(e=>{g=e.clientX,h=e.clientY,y=!0,f=!1,v=!1,w=!1})),d.addEventListener("drag",(e=>{if(!y)return;const t=d.closest(".block-component")||d.closest("[data-block]")||d.parentElement;if(!t)return;const n=t.getBoundingClientRect(),o=n.width,r=n.left,a=e.clientX-r,s=.3*o,i=.7*o;if(a<s&&!f){f=!0,w=!1,v=!1;const e=u.parent("col");e&&e.commands.execCommand("justify","start")}else if(a>i&&!v){v=!0,w=!1,f=!1;const e=u.parent("col");e&&e.commands.execCommand("justify","end")}else if(a>=s&&a<=i&&!w){w=!0,f=!1,v=!1;const e=u.closest("col");e&&e.commands.execCommand("justify","center")}})),d.addEventListener("dragend",(e=>{y=!1,f=!1,v=!1,w=!1})),u}}}},76555:(e,t,n)=>{n.d(t,{Z:()=>i});var o=n(40272),r=n.n(o),a=n(82609),s=n.n(a)()(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:()=>l});const o=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=o,window[o]||(window[o]={});const r=window[o],a=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"]),o=await async function(e,t,n){const o=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return(new TextDecoder).decode(o)}(e,n.iv,n.encrypted);return JSON.parse(o)}return null}function d(e,t){if(a[e])for(const n in a[e])Object.prototype.hasOwnProperty.call(a[e],n)&&a[e][n].forEach((e=>e(t)));Array.isArray(a["*"])&&a["*"].forEach((e=>e(t)))}window.__cdtrEvents=a;const l={set:async function(e,t){const n=JSON.parse(JSON.stringify(t)),o=await s(e),c=await crypto.subtle.importKey("raw",i(o),{name:"AES-GCM"},!1,["encrypt","decrypt"]),l=await async function(e,t){const n=crypto.getRandomValues(new Uint8Array(12)),o=(new TextEncoder).encode(t),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,o);return{iv:n,encrypted:new Uint8Array(r)}}(c,JSON.stringify(n));r[o]=l,a.set&&a.set[o]&&a.set[o].forEach((e=>e(n))),Array.isArray(a["*"])&&a["*"].forEach((e=>e(n))),d(e,n)},get:c,remove:async function(e){const t=await s(e);delete r[t]},on:async function(e,t,n){a[e]||(a[e]={});const o=await s(t);a[e][o]||(a[e][o]=[]),a[e][o].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),o},off:function(e,t){a[e]&&a[e][t]&&delete a[e][t]},dispatch:d,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),h=n(11173),y=n.n(h),f=n(76555),v={};v.setAttributes=g(),v.insert=m().bind(null,"head"),v.domAPI=d(),v.insertStyleElement=y();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);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 m=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,l.height=a.props.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)},onDeselect:e=>{l.classList.remove(e)},elementProps:a,remove:()=>{d.remove()},createEditor:r});let u=0,g=0,h=!1,y=!1,f=!1,v=!1;return l.addEventListener("dragover",(e=>{e.preventDefault()})),l.addEventListener("dragstart",(e=>{u=e.clientX,g=e.clientY,h=!0,y=!1,f=!1,v=!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&&!y){y=!0,v=!1,f=!1;const e=m.parent("col");e&&e.commands.execCommand("justify","start")}else if(o>i&&!f){f=!0,v=!1,y=!1;const e=m.parent("col");e&&e.commands.execCommand("justify","end")}else if(o>=s&&o<=i&&!v){v=!0,y=!1,f=!1;const e=m.closest("col");e&&e.commands.execCommand("justify","center")}})),l.addEventListener("dragend",(e=>{h=!1,y=!1,f=!1,v=!1})),m}}}},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