@creaditor/newsletter-starterkit 1.0.58 → 1.0.60

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 +1 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[2765],{12765(e,t,o){o.d(t,{default:()=>s});var n=o(61919);const r=e=>{{const{component:t,commands:o}=e;return{select:e=>{let{changeTab:t,tab:o}=e;o.text||t("style")},tabs:e=>{const t=[{text:"style",selected:!0},{text:"interactions"},{text:"settings"}];return e?(t.forEach(t=>t.selected=t.text===e),t):t},layout:e=>{let{tab:r}=e;const i=t.props.src.includes("img.creaditor.ai"),s=()=>"style"===r.text;return[{type:"heading",level:6,text:"icon",active:s},{type:"icons",active:s,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:s,value:t.props.alt||"",onChange:e=>{const t=e.target.value;o.execCommand("alt",t)}},{type:"heading",level:6,text:"size",active:s},{type:"slider",title:"size",min:8,max:256,active:s,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:"heading",level:6,text:"colors",active:()=>s()&&i},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>s()&&i,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.A)(t).toHex(),t.startsWith("#")&&(t=t.slice(1)),o.execCommand("iconColor",t)}},{type:"heading",level:6,text:"link",active:()=>"interactions"===r.text},{type:"linkpicker",href:t.props.onClick?.link,protocol:t.props.onClick?.link?.protocol,target:t.props.onClick?.link?.target,autofocus:!0,active:()=>"interactions"===r.text,onChange:e=>{const t={link:e.target.value};o.execCommand("onClick",t)}}]}}}},i=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}}}};const s=()=>{const e="icon";return{name:e,create:t=>{const{createElement:o,compose:n,helpers:s}=t,{mergeDiff:a}=s,c=document.createElement("div"),l=document.createElement("img");c.appendChild(l);return o({name:e,id:n.id,template:c,defaultProps:{style:{height:"24px",width:"24px",display:"inline-block"},src:"",alt:"",iconColor:"000000"},draggable:{group:"element"},droppable:{group:"element"},render:()=>{a(l,{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(512,Math.max(1,n)),r=Math.min(512,Math.max(1,r));const i=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`https://img.creaditor.ai/icons/serve/${encodeURIComponent(t)}/${encodeURIComponent(o)}.png?${new URLSearchParams({width:String(n),height:String(r),color:i}).toString()}`}(n)||n.props.src;a(l,{src:e,alt:n.props.alt||""})},resizeable:null,handleBar:!0,validator:i({helpers:s}),schema:n.schema,onSelect:e=>{c.classList.add(e)},onDeselect:e=>{c.classList.remove(e)},elementProps:n,remove:()=>{c.remove()},createEditor:r})}}}}}]);
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[2765],{12765(e,t,o){o.d(t,{default:()=>s});var n=o(61919);const r=e=>{{const{component:t,commands:o}=e;return{select:e=>{let{changeTab:t,tab:o}=e;o.text||t("style")},tabs:e=>{const t=[{text:"style",selected:!0},{text:"interactions"},{text:"settings"}];return e?(t.forEach(t=>t.selected=t.text===e),t):t},layout:e=>{let{tab:r}=e;const i=t.props.src.includes("img.creaditor.ai"),s=()=>"style"===r.text;return[{type:"heading",level:6,text:"icon",active:s},{type:"icons",active:s,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:s,value:t.props.alt||"",onChange:e=>{const t=e.target.value;o.execCommand("alt",t)}},{type:"heading",level:6,text:"size",active:s},{type:"slider",title:"size",min:8,max:256,active:s,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:"heading",level:6,text:"colors",active:()=>s()&&i},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>s()&&i,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.A)(t).toHex(),t.startsWith("#")&&(t=t.slice(1)),o.execCommand("iconColor",t)}},{type:"heading",level:6,text:"link",active:()=>"interactions"===r.text},{type:"linkpicker",href:t.props.onClick?.link,protocol:t.props.onClick?.link?.protocol,target:t.props.onClick?.link?.target,autofocus:!0,active:()=>"interactions"===r.text,onChange:e=>{const t={link:e.target.value};o.execCommand("onClick",t)}}]}}}},i=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}}}};const s=()=>{const e="icon";return{name:e,create:t=>{const{createElement:o,compose:n,helpers:s}=t,{mergeDiff:a}=s,c=document.createElement("div"),l=document.createElement("img");c.appendChild(l);return o({name:e,id:n.id,template:c,defaultProps:{style:{height:"24px",width:"24px",display:"inline-block"},src:"",alt:"",iconColor:"000000"},draggable:{group:"element"},droppable:{group:"element"},render:()=>{a(l,{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(512,Math.max(1,n)),r=Math.min(512,Math.max(1,r));const i=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`https://img.creaditor.ai/icons/serve/${encodeURIComponent(t)}/${encodeURIComponent(o)}.png?${new URLSearchParams({width:String(n),height:String(r),color:i}).toString()}`}(n)||n.props.src;a(l,{src:e,alt:n.props.alt||""})},resizeable:()=>c,handleBar:!0,validator:i({helpers:s}),schema:n.schema,onSelect:e=>{c.classList.add(e)},onDeselect:e=>{c.classList.remove(e)},elementProps:n,remove:()=>{c.remove()},createEditor:r})}}}}}]);
Binary file
@@ -0,0 +1 @@
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[3503],{43503(e,t,n){function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"string"==typeof e.url&&e.url?e.url:"string"==typeof e.src&&e.src?e.src:""}function i(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(const e of t){if("string"==typeof e&&e.includes("%"))continue;const t=parseInt(e,10);if(!isNaN(t)&&t>0)return t}return null}n.d(t,{default:()=>k});const s=e=>{{const{component:t,commands:n,helpers:i}=e,s=t.parent("col");return{select:e=>{let{changeTab:t,tab:n}=e},tabs:e=>{const t=[{text:"video"},{text:"design"},{text:"settings"}];return t.forEach(t=>t.selected=t.selected=t.text===e),t},layout:e=>{let{tab:i,changeTab:r,tabs:l}=e;return[{type:"input",title:"add_urlAddress_from_media_site",active:()=>"video"===i.text,value:o(t.props),onChange:e=>{let o=e.target.value;if(-1!==o.indexOf("youtube.com/shorts/")){const e=o.split("/");e.length>0&&(o=`https://youtu.be/${e[e.length-1]}`)}n.execCommand("url",o),"string"==typeof t.props.src&&n.execCommand("src",o)}},{type:"divider",active:()=>"video"===i.text},{type:"input",title:"altText",active:()=>"video"===i.text,value:t.props.alt||"",onChange:e=>{const t=e.target.value;n.execCommand("alt",t)}},{type:"divider",active:()=>"video"===i.text},{type:"checkbox",title:"fullWidthOnMobile",checked:!!t.props.isFullWidthOnMobile,active:()=>"video"===i.text,onChange:e=>{const t=e.target.checked;n.execCommand("isFullWidthOnMobile",t)}},{type:"slider",min:10,title:"size",active:()=>"design"===i.text,max:s?.element?.offsetWidth,value:parseInt(t.props.style.width),onInput:e=>{const t=e.target.value;n.execCommand("style",{width:t+"px"})}},{type:"divider"},{type:"justifyContent",value:s?.props.justify,active:()=>"design"===i.text,onChange:e=>{const t=e.target.value;n.execCommand("justify",t,{find:"col"})}},{type:"justifyContent",title:"alignItems",active:()=>"design"===i.text,value:s?.props.alignItems,onChange:e=>{const t=e.target.value;n.execCommand("alignItems",t,{find:"col"})}},{type:"divider",active:()=>"design"===i.text}]}}}};var r=n(52144);const l=()=>({set:(e,t,n)=>{switch(t){case"url":case"alt":case"fullWidthOnMobile":return e[t]=n,!0;case"style":if("object"==typeof n)return e[t]=(0,r.A)(e[t],n),n.height&&(e[t].height=n.height),n.width&&(e[t].width=n.width),!0}}});var a=n(72591),c=n.n(a),d=n(88639),u=n.n(d),p=n(88128),h=n.n(p),m=n(30855),v=n.n(m),g=n(93051),y=n.n(g),f=n(54292),A={};A.setAttributes=v(),A.insert=h().bind(null,"head"),A.domAPI=u(),A.insertStyleElement=y();c()(f.A,A);const b=f.A&&f.A.locals?f.A.locals:void 0;n(15284);var w=n(91597);const C="video";function x(){const e=(0,w.S)(),t="https://api.creaditor.com",n="https://multimedia.sendmsg.co.il/ShowYouTube.aspx?";return{name:C,create:r=>{function a(e,o,i){return o=parseInt(o),i=parseInt(i),new Promise((s,r)=>{if("string"!=typeof e||!e)return console.warn("video link is empty.."),void s(null);-1!==e.indexOf("youtu.be")&&(e=e.replace("youtu.be/","youtube.com/watch?v=")),-1!==e.indexOf("youtube")?s(function(e,o,i){const s=function(e){if(-1!==e.indexOf("youtube.com/shorts/")){const t=e.split("/");t.length>0&&(e=`https://youtu.be/${t[t.length-1]}`)}const t=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return t&&11===t[2].length?t[2]:null}(e);if(!s)throw Error();const r=`//www.youtube.com/embed/${s}`,l=r.match(/youtube\.com.*(\?v=|\/embed\/)(.{11})/).pop();return 11!==l.length?(console.error("youtube link is not valid"),null):{img:`${t}/images/video/?code=${l}&width=${o}&height=${i}&type=youtube`,href:`${n}youtube=${s}`,embeded:r,source:e}}(e,o,i)):e.indexOf("vimeo")>-1?function(e,o,i){const s=e;return new Promise((r,l)=>{e=e.substr(e.lastIndexOf("/")+1).replace(/\?.*/g,""),r({img:`${t}/images/video/?code=${e}&width=${o}&height=${i}&type=vimeo`,href:`${n}vimeo=${e}`,source:s})})}(e,o,i).then(e=>{s(e)}):(console.warn("video link is not a youtube or vimeo link..",e),s(null))})}const{createElement:c,compose:d,helpers:u}=r,{arrayToString:p,mergeDiff:h}=u,m=document.createElement("div");m.classList.add(b.root);const v=document.createElement("div");v.classList.add(b.cover);const g=document.createElement("img");return m.append(g,v),c({name:C,id:d.id,template:m,defaultProps:{height:"300px",width:"400px",url:"https://www.youtube.com/watch?v=04Or_U9OexU",style:{width:"400px",height:"300px",playing:!1,loop:!1,light:!1,controls:!0,autoPlay:!1,muted:!1}},draggable:{group:"element"},droppable:{group:"element"},render:t=>{e.run(()=>{const e=g.getBoundingClientRect(),t=i(d.props.style.height,d.props.height,e.height)||300,n=i(d.props.style.width,d.props.width,e.width)||400,s=o(d.props);a(s,n,t).then(e=>{e&&(g.src=e.img)}).catch(()=>{console.warn("could not resolve video link",s)})});const n={...d.props.style};delete n.height,h(g,{style:n});const s=i(d.props.style.width);s?g.width=s:g.removeAttribute("width"),g.style.height="auto",g.height="auto",g.style.maxWidth="100%"},atomElement:g,resizeable:()=>m,handleBar:!0,validator:l(),schema:d.schema,onSelect:e=>{g.classList.add(e)},onDeselect:e=>{g.classList.remove(e)},elementProps:d,remove:()=>{m.remove()},createEditor:s})}}}const k=()=>x()},54292(e,t,n){n.d(t,{A:()=>l});var o=n(82001),i=n.n(o),s=n(40935),r=n.n(s)()(i());r.push([e.id,".erXmYCCmdWL8v5GDxnjP {\n position: relative;\n max-width: 100%;\n}\n.tPZLaQk8gBr1YTwcypDQ {\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n opacity: 0.6;\n}\n\n.erXmYCCmdWL8v5GDxnjP:hover .tPZLaQk8gBr1YTwcypDQ {\n display: block;\n background-color: var(--primary);\n}\n","",{version:3,sources:["webpack://./../newsletter-editors/video-editor-component-newsletter/lib/style.module.css"],names:[],mappings:"AAAA;EACE,kBAAkB;EAClB,eAAe;AACjB;AACA;EACE,WAAW;EACX,YAAY;EACZ,OAAO;EACP,MAAM;EACN,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,cAAc;EACd,gCAAgC;AAClC",sourcesContent:[".root {\n position: relative;\n max-width: 100%;\n}\n.cover {\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n opacity: 0.6;\n}\n\n.root:hover .cover {\n display: block;\n background-color: var(--primary);\n}\n"],sourceRoot:""}]),r.locals={root:"erXmYCCmdWL8v5GDxnjP",cover:"tPZLaQk8gBr1YTwcypDQ"};const l=r}}]);
Binary file
@@ -1,7 +1,7 @@
1
1
  "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[3521],{83521(t,e,i){i.r(e),i.d(e,{DesignFactory:()=>l});var o=i(5441),n=i(59929),r=i(15604),s=i(18057),d=i(86319);i.e(8315).then(i.bind(i,68315));class l extends n.WF{constructor(){super(),this.lastEditor=null,this._selectedComponentId=null,this._injectedForId=null,d.M.set({injectEditor:t=>{this.injected=!0,this._injectedForId=this._selectedComponentId,this.lastEditor=this.editor,this.backToEditor=this.editor,this.editor=t}}),this.editor=n.qy`<cdtr-ilustration-preference
2
2
  width="200px"
3
3
  height="200px"
4
- ></cdtr-ilustration-preference>`,this.delayer=new s.A,this.connect=this.connect.bind(this),this.editors={block:{selector:"block-editor",load:()=>i.e(1260).then(i.bind(i,91260)),component:null},no_editor:{selector:"cdtr-no-component",load:()=>i.e(8854).then(i.bind(i,68854)),component:null,attrs:{style:"margin:auto;display:block;max-width:150px;margin-top:30px;"}}},this.type=null,r.Ay.on("select",this.connect)}connect(t){let{editor:e,component:i}=t;if(!e)return;let n=e.type;if("string"!=typeof n)return;const r=i?.id??null;if(this.injected){if(null==r||r===this._injectedForId)return;this.injected=!1,this._injectedForId=null}if(this._selectedComponentId=r,this.editor?.type===n)return;if(!this.editors[n]){const t=d.M.get("config","editor","configure","plugins");if(Array.isArray(t)){const e=t.find(t=>t.name===n);if(e&&"function"==typeof e.createEditor){this.editor=document.createElement("cdtr-editor-builder"),this.editor.type=n;const t=e.createEditor();return void(t&&(this.editor.editors=t.layout,t!==this.backToEditor&&this.lastEditor&&(this.lastEditor=null)))}}n="no_editor"}this.type=n;const s=(0,o.A)("div",null,(0,o.A)("cdtr-block-loader",null),(0,o.A)("cdtr-title",{style:"text-align:center;"},(0,o.A)("lang-text",{text:"please_wait_downloading_new_version"})));this.editors[n]&&!this.editors[n].component&&(this.editors[n].load().then(()=>{if(s.remove(),this.editors[n].attrs)for(const t in this.editors[n].attrs)if(Object.hasOwnProperty.call(this.editors[n].attrs,t)){const e=this.editors[n].attrs[t];this.editors[n].component[t]=e}}),this.editors[n].component=document.createElement(this.editors[n].selector),this.editors[n].component.appendChild(s)),this.editors[n].component&&(this.editor=this.editors[n].component)}goBack(){this.lastEditor&&(this.editor=this.lastEditor,this.lastEditor=null,this.injected=!1,this._injectedForId=null)}createRenderRoot(){return this}render(){return n.qy` ${this.lastEditor?n.qy`<div style="display:flex;justify-content:flex-start;padding:12px 16px 4px;direction:var(--direction-locale);">
4
+ ></cdtr-ilustration-preference>`,this.delayer=new s.A,this.connect=this.connect.bind(this),this.editors={block:{selector:"block-editor",load:()=>i.e(8299).then(i.bind(i,68299)),component:null},no_editor:{selector:"cdtr-no-component",load:()=>i.e(8854).then(i.bind(i,68854)),component:null,attrs:{style:"margin:auto;display:block;max-width:150px;margin-top:30px;"}}},this.type=null,r.Ay.on("select",this.connect)}connect(t){let{editor:e,component:i}=t;if(!e)return;let n=e.type;if("string"!=typeof n)return;const r=i?.id??null;if(this.injected){if(null==r||r===this._injectedForId)return;this.injected=!1,this._injectedForId=null}if(this._selectedComponentId=r,this.editor?.type===n)return;if(!this.editors[n]){const t=d.M.get("config","editor","configure","plugins");if(Array.isArray(t)){const e=t.find(t=>t.name===n);if(e&&"function"==typeof e.createEditor){this.editor=document.createElement("cdtr-editor-builder"),this.editor.type=n;const t=e.createEditor();return void(t&&(this.editor.editors=t.layout,t!==this.backToEditor&&this.lastEditor&&(this.lastEditor=null)))}}n="no_editor"}this.type=n;const s=(0,o.A)("div",null,(0,o.A)("cdtr-block-loader",null),(0,o.A)("cdtr-title",{style:"text-align:center;"},(0,o.A)("lang-text",{text:"please_wait_downloading_new_version"})));this.editors[n]&&!this.editors[n].component&&(this.editors[n].load().then(()=>{if(s.remove(),this.editors[n].attrs)for(const t in this.editors[n].attrs)if(Object.hasOwnProperty.call(this.editors[n].attrs,t)){const e=this.editors[n].attrs[t];this.editors[n].component[t]=e}}),this.editors[n].component=document.createElement(this.editors[n].selector),this.editors[n].component.appendChild(s)),this.editors[n].component&&(this.editor=this.editors[n].component)}goBack(){this.lastEditor&&(this.editor=this.lastEditor,this.lastEditor=null,this.injected=!1,this._injectedForId=null)}createRenderRoot(){return this}render(){return n.qy` ${this.lastEditor?n.qy`<div style="display:flex;justify-content:flex-start;padding:12px 16px 4px;direction:var(--direction-locale);">
5
5
  <span
6
6
  @click=${this.goBack}
7
7
  style="display:inline-flex;align-items:center;gap:3px;font-size:12px;color:#555;cursor:pointer;font-family:inherit;"
Binary file
@@ -1,5 +1,5 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[380],{70380(t,e,s){s.r(e),s.d(e,{default:()=>h});var i=s(59929),n=s(21421),a=s(91597);const o="֑-߿יִ-﷽ﹰ-ﻼ",l="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",c=new RegExp("^[^"+l+"]*["+o+"]"),u=new RegExp("^[^"+o+"]*["+l+"]");var r=s(86319);const p=(0,a.S)();class h extends i.WF{constructor(){super(),this.inputRef=(0,n._)(),this.min=0,this.max=100,this.step=1,this.autofocus=!1,this.type="text",this.value="number"===this.type?"0":"",this.placeholder="",this.oldValue=this.value,this.successActive=!1,this._successTimeout=null}onSubmit(t){t.preventDefault();const e=new UIEvent("submit",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),this.oldValue=this.value}focus(){const t=this.inputRef.value;t.focus(),t.setSelectionRange(t.value.length,t.value.length)}onFocus(){const t=new UIEvent("focus",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}onBlur(){const t=new UIEvent("blur",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t),this.oldValue=this.value}render(){this.fullWidth&&(this.style.width="100%"),this.value||"text"!==this.type||(this.value=""),this.icon&&"string"!=typeof this.inputStyle&&(this.inputStyle="");const t=r.M.get("lang",this.placeholder)||this.placeholder||"";t&&("string"!=typeof this.inputStyle&&(this.inputStyle=""),-1===this.inputStyle.indexOf("text-align")&&(this.inputStyle+=";text-align:"+("rtl"===function(t){const e=String(t||"");return c.test(e)?"rtl":u.test(e)?"ltr":"neutral"}(t)?"right":"")));const e=this.multiline?i.qy` <textarea
2
- row=${this.row||4}
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[380],{70380(t,e,s){s.r(e),s.d(e,{default:()=>p});var i=s(59929),n=s(21421),a=s(91597);const o="֑-߿יִ-﷽ﹰ-ﻼ",l="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",c=new RegExp("^[^"+l+"]*["+o+"]"),r=new RegExp("^[^"+o+"]*["+l+"]");var u=s(86319);const h=(0,a.S)();class p extends i.WF{constructor(){super(),this.inputRef=(0,n._)(),this.min=0,this.max=100,this.step=1,this.autofocus=!1,this.type="text",this.value="number"===this.type?"0":"",this.placeholder="",this.oldValue=this.value,this.successActive=!1,this._successTimeout=null}onSubmit(t){t.preventDefault();const e=new UIEvent("submit",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),this.oldValue=this.value}focus(){const t=this.inputRef.value;t.focus(),t.setSelectionRange(t.value.length,t.value.length)}onFocus(){const t=new UIEvent("focus",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}onBlur(){const t=new UIEvent("blur",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t),this.oldValue=this.value}render(){this.fullWidth&&(this.style.width="100%"),this.value||"text"!==this.type||(this.value=""),this.icon&&"string"!=typeof this.inputStyle&&(this.inputStyle="");const t=u.M.get("lang",this.placeholder)||this.placeholder||"";t&&("string"!=typeof this.inputStyle&&(this.inputStyle=""),-1===this.inputStyle.indexOf("text-align")&&(this.inputStyle+=";text-align:"+("rtl"===function(t){const e=String(t||"");return c.test(e)?"rtl":r.test(e)?"ltr":"neutral"}(t)?"right":"")));const e=this.multiline?i.qy` <textarea
2
+ rows=${this.row||4}
3
3
  .disabled=${this.disabled}
4
4
  dir="auto"
5
5
  ${(0,n.K)(this.inputRef)}
@@ -49,7 +49,7 @@
49
49
  ${"text"===this.type&&this.maxLength?i.qy`<span class="counter"
50
50
  >${this.value.length}/${this.maxLength}</span
51
51
  > `:null}
52
- </form>`}firstUpdated(){this.autofocus&&setTimeout(()=>{this.inputRef.value&&this.inputRef.value.focus()},500),void 0===this.value&&(this.value="")}focus(){super.focus(),this.inputRef.value.focus()}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null)}setValue(t){if(this.selectionStart=this.inputRef.value.selectionStart,!this.inputRef.value)return;const e=this.inputRef.value;if("text"===this.type&&this.max&&e.value.length>this.max)return e.value=this.value,void this.inputRef.value.focus();this.value=e.value;const s=new UIEvent(t.type,{view:window,bubbles:!0,cancelable:!0});if(this.dispatchEvent(s),"input"===t.type){const t=()=>{const t=new UIEvent("debounce",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)};p.run(t,500)}}success(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null),this.successActive=!0;const e=Number(t);!Number.isFinite(e)||e<=0||(this._successTimeout=setTimeout(()=>{this.successActive=!1,this._successTimeout=null},e))}patch(t){this.value=t}}h.styles=i.AH`
52
+ </form>`}firstUpdated(){this.autofocus&&setTimeout(()=>{this.inputRef.value&&this.inputRef.value.focus()},500),void 0===this.value&&(this.value="")}focus(){super.focus(),this.inputRef.value.focus()}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null)}setValue(t){if(this.selectionStart=this.inputRef.value.selectionStart,!this.inputRef.value)return;const e=this.inputRef.value;if("text"===this.type&&this.max&&e.value.length>this.max)return e.value=this.value,void this.inputRef.value.focus();this.value=e.value;const s=new UIEvent(t.type,{view:window,bubbles:!0,cancelable:!0});if(this.dispatchEvent(s),"input"===t.type){const t=()=>{const t=new UIEvent("debounce",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)};h.run(t,500)}}success(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null),this.successActive=!0;const e=Number(t);!Number.isFinite(e)||e<=0||(this._successTimeout=setTimeout(()=>{this.successActive=!1,this._successTimeout=null},e))}patch(t){this.value=t}}p.styles=i.AH`
53
53
  :host {
54
54
  display: inline-block;
55
55
  --cdtr-input-height: 30px;
@@ -88,7 +88,9 @@
88
88
  }
89
89
  textarea {
90
90
  height: auto;
91
- resize: none;
91
+ /* Vertical only — horizontal resizing would break out of the sidebar. */
92
+ resize: vertical;
93
+ min-height: 80px;
92
94
  }
93
95
  input:disabled,
94
96
  textrea:disabled,
@@ -183,4 +185,4 @@
183
185
  box-shadow: 0 0 10px rgba(79, 192, 111, 0.2);
184
186
  }
185
187
  }
186
- `,h.properties={value:{type:String,reflect:!0},step:{type:Number,reflect:!0},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},type:{type:String,reflect:!0},inputDir:{type:String},icon:{type:String,reflect:!0},placeholder:{type:String,reflect:!0},autofocus:{type:Boolean,reflect:!0},fullWidth:{type:Boolean,reflect:!0},selectionStart:{type:Number},inputStyle:{type:String,reflect:!0},maxLength:{type:Number},couchOnEmpty:{type:Boolean},disabled:{type:Boolean},multiline:{type:Boolean},row:{type:Number},successActive:{type:Boolean}},customElements.get("cdtr-input")||customElements.define("cdtr-input",h)}}]);
188
+ `,p.properties={value:{type:String,reflect:!0},step:{type:Number,reflect:!0},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},type:{type:String,reflect:!0},inputDir:{type:String},icon:{type:String,reflect:!0},placeholder:{type:String,reflect:!0},autofocus:{type:Boolean,reflect:!0},fullWidth:{type:Boolean,reflect:!0},selectionStart:{type:Number},inputStyle:{type:String,reflect:!0},maxLength:{type:Number},couchOnEmpty:{type:Boolean},disabled:{type:Boolean},multiline:{type:Boolean},row:{type:Number},successActive:{type:Boolean}},customElements.get("cdtr-input")||customElements.define("cdtr-input",p)}}]);
Binary file
@@ -1,5 +1,5 @@
1
1
  "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[380,3847],{70380(t,e,i){i.r(e),i.d(e,{default:()=>p});var s=i(59929),o=i(21421),r=i(91597);const n="֑-߿יִ-﷽ﹰ-ﻼ",a="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",l=new RegExp("^[^"+a+"]*["+n+"]"),c=new RegExp("^[^"+n+"]*["+a+"]");var h=i(86319);const d=(0,r.S)();class p extends s.WF{constructor(){super(),this.inputRef=(0,o._)(),this.min=0,this.max=100,this.step=1,this.autofocus=!1,this.type="text",this.value="number"===this.type?"0":"",this.placeholder="",this.oldValue=this.value,this.successActive=!1,this._successTimeout=null}onSubmit(t){t.preventDefault();const e=new UIEvent("submit",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),this.oldValue=this.value}focus(){const t=this.inputRef.value;t.focus(),t.setSelectionRange(t.value.length,t.value.length)}onFocus(){const t=new UIEvent("focus",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}onBlur(){const t=new UIEvent("blur",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t),this.oldValue=this.value}render(){this.fullWidth&&(this.style.width="100%"),this.value||"text"!==this.type||(this.value=""),this.icon&&"string"!=typeof this.inputStyle&&(this.inputStyle="");const t=h.M.get("lang",this.placeholder)||this.placeholder||"";t&&("string"!=typeof this.inputStyle&&(this.inputStyle=""),-1===this.inputStyle.indexOf("text-align")&&(this.inputStyle+=";text-align:"+("rtl"===function(t){const e=String(t||"");return l.test(e)?"rtl":c.test(e)?"ltr":"neutral"}(t)?"right":"")));const e=this.multiline?s.qy` <textarea
2
- row=${this.row||4}
2
+ rows=${this.row||4}
3
3
  .disabled=${this.disabled}
4
4
  dir="auto"
5
5
  ${(0,o.K)(this.inputRef)}
@@ -88,7 +88,9 @@
88
88
  }
89
89
  textarea {
90
90
  height: auto;
91
- resize: none;
91
+ /* Vertical only — horizontal resizing would break out of the sidebar. */
92
+ resize: vertical;
93
+ min-height: 80px;
92
94
  }
93
95
  input:disabled,
94
96
  textrea:disabled,
@@ -191,6 +193,13 @@
191
193
  .anchor-dd {
192
194
  width: 100%;
193
195
  }
196
+ /* The picked anchor's name — a document value, so never text-transformed. */
197
+ .anchor-dd-value {
198
+ font-size: 13px;
199
+ text-transform: none;
200
+ direction: ltr;
201
+ unicode-bidi: isolate;
202
+ }
194
203
  .anchor-create {
195
204
  width: 100%;
196
205
  margin-top: 10px;
@@ -379,13 +388,13 @@
379
388
  margin-top: 0.75rem;
380
389
  padding-left: 1rem;
381
390
  }
382
- `;var a=i(21421);i(73095),i(70380);const l="260px",c=[{type:"https:",text:"link"},{type:"http:",text:"link"},{type:"mailto:",text:"sendEmail"},{type:"tel:",text:"tel"},{type:"sms:",text:"sendSms"},{type:"whatsapp:",text:"sendWhatsapp"},{type:"anchor:",text:"anchor"}],h="cdtrAdd",d="cdtrRemove",p="cdtrAutomation",u=[h,d,p];function m(t,e){t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}const g="anchor",f="linkpicker:anchor";function b(){const t=o.M.get("components");return Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t).filter(t=>t&&"object"==typeof t):[]}let y=null,v=null;const x=[0,60,150,400,800];function w(t,e){let i=null;const s=()=>{document.removeEventListener("mouseup",s,!0);let o=0;const r=()=>{if(function(t){return b().find(e=>e.type===g&&e.props&&e.props.name===t)||null}(t))return v=null,void e(t);o++,o<x.length?i=setTimeout(r,x[o]):v=null};i=setTimeout(r,x[0])};return document.addEventListener("mouseup",s,!0),()=>{document.removeEventListener("mouseup",s,!0),i&&clearTimeout(i)}}function $(){let{onCreated:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};A();const e=function(){const t=new Set(b().filter(t=>t.type===g&&t.props&&t.props.name).map(t=>String(t.props.name)));let e=1;for(;t.has(`${g}-${e}`);)e++;return`${g}-${e}`}(),i={id:f,name:g,group:"elements",body:{type:g,props:{mode:"inline",name:e,color:"#6b7280"}}},s=document.createElement("div");return s.setAttribute("data-id",f),s.setAttribute("data-group","elements"),s.setAttribute("data-placement",""),s.setAttribute("draggable-element","create:element"),s.setAttribute("draggable-direction","top,bottom,left,right"),s.classList.add("draggable-element-handle"),s.__template=i,window.__dragoned_selected_element=s,y=s,"function"==typeof t&&(v=w(e,t)),s}function A(){y&&window.__dragoned_selected_element===y&&delete window.__dragoned_selected_element,y=null,v&&(v(),v=null)}function k(t){let{onRequest:e,onChangeLink:i,onBlur:r}=t;return function(){const t=o.M.get("config","editor","configure","plugins");return!!Array.isArray(t)&&t.some(t=>t&&t.name===g)}()?s.qy`
391
+ `;var a=i(21421);i(73095),i(70380);const l="260px",c=[{type:"https:",text:"link"},{type:"http:",text:"link"},{type:"mailto:",text:"sendEmail"},{type:"tel:",text:"tel"},{type:"sms:",text:"sendSms"},{type:"whatsapp:",text:"sendWhatsapp"},{type:"anchor:",text:"anchor"}],h="cdtrAdd",d="cdtrRemove",p="cdtrAutomation",u=[h,d,p];function m(t,e){t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}const f="anchor",g="linkpicker:anchor";function b(){const t=new Set;return function(){const t=o.M.get("components");return Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t).filter(t=>t&&"object"==typeof t):[]}().forEach(e=>{const i=e&&e.props;i&&(i.anchor&&i.anchor.name&&t.add(String(i.anchor.name)),e.type===f&&i.name&&t.add(String(i.name)))}),t}let y=null,v=null;const x="cdtr:anchor-attached";function w(){let{onCreated:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};$();const e=function(){const t=b();let e=1;for(;t.has(`${f}-${e}`);)e++;return`${f}-${e}`}(),i={id:g,name:f,group:"elements",body:{type:f,props:{name:e,color:"#6b7280"}}},s=document.createElement("div");return s.setAttribute("data-id",g),s.setAttribute("data-group","elements"),s.setAttribute("data-placement",""),s.setAttribute("draggable-element","create:element"),s.setAttribute("draggable-direction","top,bottom,left,right"),s.classList.add("draggable-element-handle"),s.__template=i,window.__dragoned_selected_element=s,y=s,"function"==typeof t&&(v=function(t){let e=!1;const i=i=>{const s=i&&i.detail&&i.detail.name;!e&&s&&(e=!0,o(),v=null,t(s))},s=()=>{setTimeout(()=>{e||(o(),v=null)},0)};function o(){window.removeEventListener(x,i),document.removeEventListener("mouseup",s,!0)}return window.addEventListener(x,i),document.addEventListener("mouseup",s,!0),o}(t)),s}function $(){y&&window.__dragoned_selected_element===y&&delete window.__dragoned_selected_element,y=null,v&&(v(),v=null)}function A(t){let{onRequest:e,onChangeLink:i,onBlur:r}=t;return function(){const t=o.M.get("config","editor","configure","plugins");return!!Array.isArray(t)&&t.some(t=>t&&t.name===f)}()?s.qy`
383
392
  <div class="anchor-create">
384
393
  <div
385
394
  class="anchor-drag draggable-element-handle"
386
395
  role="button"
387
- @mousedown=${()=>$({onCreated:t=>{i({target:{value:`#${t}`},anchor:!0}),r()}})}
388
- @mouseup=${()=>{A(),"function"==typeof e&&e("anchor")}}
396
+ @mousedown=${()=>w({onCreated:t=>{i({target:{value:`#${t}`},anchor:!0}),r()}})}
397
+ @mouseup=${()=>{$(),"function"==typeof e&&e("anchor")}}
389
398
  >
390
399
  <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
391
400
  <path d="${"M2.05 11H7v2H4.062A8.004 8.004 0 0 0 11 19.938V9.874A4.002 4.002 0 0 1 12 2a4 4 0 0 1 1 7.874v10.064A8.004 8.004 0 0 0 19.938 13H17v-2h4.95c.033.329.05.663.05 1 0 5.523-4.477 10-10 10S2 17.523 2 12c0-.337.017-.671.05-1zM12 8a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"}"></path>
@@ -401,27 +410,34 @@
401
410
  ></lang-text>
402
411
  </span>
403
412
  </div>
404
- `:null}function _(t,e){switch(t){case"anchor:":return function(t){const{url:e,anchors:i,href:o,protocol:r,onChangeLink:n,onBlur:a,onRequest:l}=t;return s.qy`
413
+ `:null}function k(t,e){switch(t){case"anchor:":return function(t){const{url:e,anchors:i,protocol:o,onChangeLink:r,onBlur:n,onRequest:a}=t,l=e.isAnchor?String(e.href||"").replace(/^#/,""):"";return s.qy`
405
414
  <cdtr-row alignItems="center" spacing="5">
406
415
  <cdtr-dropdown
407
- @change=${t=>{n({target:{value:"#"+t.target.value},anchor:!0}),a()}}
408
- .opened=${i.length>0&&"anchor:"===r&&!o}
416
+ @change=${t=>{r({target:{value:"#"+t.target.value},anchor:!0}),n()}}
417
+ .opened=${i.length>0&&"anchor:"===o&&!l}
409
418
  class="anchor-dd"
410
419
  >
411
420
  <cdtr-dropdown-button
412
421
  minWidth=${100}
413
422
  class=" dropdown-button"
414
423
  slot="trigger"
415
- ><lang-text .text=${e.isAnchor?o:""}></lang-text>
424
+ >
425
+ ${l?s.qy`<span class="anchor-dd-value"
426
+ >${(t=>{const e=i.find(e=>e.name===t);return e&&e.label||t})(l)}</span
427
+ >`:s.qy`<lang-text
428
+ text=${i.length?"select_anchor":"no_anchors_yet"}
429
+ ></lang-text>`}
416
430
  </cdtr-dropdown-button>
417
431
  <div style="min-width:150px" slot="content">
418
432
  ${i.map(t=>s.qy`<cdtr-dropdown-item
419
- value="${t.props.name||t.props.element_ID}"
420
- >${t.props.name||t.props.element_ID}
433
+ value="${t.name}"
434
+ .selected=${t.name===l}
435
+ .focused=${t.name===l}
436
+ >${t.label||t.name}
421
437
  </cdtr-dropdown-item>`)}
422
438
  </div>
423
439
  </cdtr-dropdown>
424
- ${k({onRequest:l,onChangeLink:n,onBlur:a})}
440
+ ${A({onRequest:a,onChangeLink:r,onBlur:n})}
425
441
  </cdtr-row>
426
442
  `}(e);case"mailto:":return function(t){const{href:e,body:i,subject:o,onBlur:r,updateBody:n,updateSubject:a}=t,c="string"==typeof e?m("body",e):i||e.params.body,h="string"==typeof e?m("subject",e):o||e.params.subject;return s.qy`
427
443
  <cdtr-row spacing="5">
@@ -468,7 +484,7 @@
468
484
  @change=${t=>{let{target:e}=t;r(e.value),o()}}
469
485
  ></cdtr-input>
470
486
  </cdtr-row>
471
- `}(e);default:return""}}function S(t,e,i,s,o,n){if(!t)return null;const a="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,s,o){const n="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t),a=(n.params&&(n.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(n.fullHref))||m("phone",n.href||"")||n.url||"").replace(/\D+/g,"");if(!a)return null;const l=s||n.params&&(n.params.text||n.params.body)||"",c=l?encodeURIComponent(l):"";let h=`https://wa.me/${a}`;c&&(h+=`?text=${c}`);const d=new r.A(h);return d.target=o||d.target||"_blank",{url:d,params:d.params,protocol:"whatsapp:"}}(t,e,i,s,n):(a.isEmail?function(t,e,i){let s=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,s=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,s=!0),s&&(t.href=t.getUrlWithParams())}(a,o,s):s?a.addParam("body",s):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=n||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function R(t,e,i){if(!t)return{href:{},protocol:null,body:"",subject:""};if(t.startsWith("http")&&!t.startsWith("http://")&&!t.startsWith("https://"))return null;const s=r.A.getProtocol(t);let o=e;s&&(o=s+":");const n=new r.A({href:t,protocol:o||null});console.log("output",n);const a=(i instanceof r.A?i:new r.A(i)).url!==n.url;return{href:n,protocol:n.protocol,shouldBlur:n.isValid,clearParams:a}}function L(t){const{value:e="",inputRef:i,autofocus:o=!1,onChange:r,onBlur:n,onFocus:c,onKeyDown:h,placeholder:d="",inputStyle:p="",style:u="width:260px;",width:m=l}=t,g=t=>{r&&r(t),n&&n()},f=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return s.qy`
487
+ `}(e);default:return""}}function _(t,e,i,s,o,n){if(!t)return null;const a="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,s,o){const n="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t),a=(n.params&&(n.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(n.fullHref))||m("phone",n.href||"")||n.url||"").replace(/\D+/g,"");if(!a)return null;const l=s||n.params&&(n.params.text||n.params.body)||"",c=l?encodeURIComponent(l):"";let h=`https://wa.me/${a}`;c&&(h+=`?text=${c}`);const d=new r.A(h);return d.target=o||d.target||"_blank",{url:d,params:d.params,protocol:"whatsapp:"}}(t,e,i,s,n):(a.isEmail?function(t,e,i){let s=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,s=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,s=!0),s&&(t.href=t.getUrlWithParams())}(a,o,s):s?a.addParam("body",s):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=n||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function S(t,e,i){if(!t)return{href:{},protocol:null,body:"",subject:""};if(t.startsWith("http")&&!t.startsWith("http://")&&!t.startsWith("https://"))return null;const s=r.A.getProtocol(t);let o=e;s&&(o=s+":");const n=new r.A({href:t,protocol:o||null});console.log("output",n);const a=(i instanceof r.A?i:new r.A(i)).url!==n.url;return{href:n,protocol:n.protocol,shouldBlur:n.isValid,clearParams:a}}function R(){const t=o.M.get("components"),e=Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t):[],i=function(t){const e=new Map;t.forEach(t=>{const i=t&&(t.id||t._id);i&&e.set(i,t)});const i=t.find(t=>t&&"root"===t.type),s=i&&(i.id||i._id);if(!s)return null;const o=new Set,r=t=>{if(!t||o.has(t))return;o.add(t);const i=e.get(t);i&&[].concat(Array.isArray(i.children)?i.children:[]).concat(Array.isArray(i.elements)?i.elements:[]).forEach(t=>r((t=>t?"string"==typeof t?t:t.id||t.dataset&&t.dataset.id||null:null)(t)))};return r(s),o}(e),s=i?e.filter(t=>t&&i.has(t.id||t._id)):e,r=new Set,n=[],a=(t,e,i)=>{e&&!r.has(e)&&(r.add(e),n.push({id:t,name:e,label:i||e}))};return s.forEach(t=>{const e=t&&t.props;e&&(e.anchor&&e.anchor.name?a(t.id,e.anchor.name,e.anchor.label):"anchor"===t.type&&e.name?a(t.id,e.name):e.element_ID&&a(t.id,e.element_ID))}),n}function L(t){const{value:e="",inputRef:i,autofocus:o=!1,onChange:r,onBlur:n,onFocus:c,onKeyDown:h,placeholder:d="",inputStyle:p="",style:u="width:260px;",width:m=l}=t,f=t=>{r&&r(t),n&&n()},g=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return s.qy`
472
488
  <cdtr-row style="position:relative;" spacing="5">
473
489
  <span style="display:none;" aria-hidden="true">${e}</span>
474
490
  <cdtr-input
@@ -481,10 +497,10 @@
481
497
  width="${m}"
482
498
  placeholder="${d}"
483
499
  @input=${t=>{if(t.target.selectionStart!==t.target.value.length)return;const e=t.target.value.trim();/^[^a-zA-Z0-9]+$/.test(e)||r&&r(t)}}
484
- @change=${g}
500
+ @change=${f}
485
501
  @focus=${c}
486
- @submit=${h||g}
487
- .value="${f}"
502
+ @submit=${h||f}
503
+ .value="${g}"
488
504
  ></cdtr-input>
489
505
  </cdtr-row>
490
506
  `}function U(t){return class extends t{initAutomations(){this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.activeTab="add",this.baseUrl="",this.showSaveSuccess=!1;const t=o.M.get("config","editor","configure","editorProps","mailingLists","items");this.mailingLists=t||[];const e=o.M.get("config","editor","configure","editorProps","automations")||{};this.automations=[],e.addAndRemoveFromMailingList&&this.automations.push({id:"addAndRemoveFromMailingList",name:"moving_from_mailing_list"})}onAutomationsClick(){if(this.showAutomations=!0,this.protocol="automation:",this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.href&&this.href.href){const t=this.href.href;if("string"==typeof t&&t.match(/^\[\[([^\]]+)\]\]\?/))this.parseAutomationLink(this.href);else{const t=new r.A(this.href);t.params&&t.params[p]?(this.baseUrl=this.extractBaseUrl(t),this.parseAutomationLink(t)):this.baseUrl=t.href||""}}else this.baseUrl="";this.requestUpdate()}extractBaseUrl(t){const e=[];t.protocol&&e.push(t.protocol),t.host&&(e.push("//"),e.push(t.host)),t.pathname&&e.push(t.pathname);const i=u,s=[];t.params&&Object.keys(t.params).forEach(e=>{if(!i.includes(e)){const i=t.params[e];s.push(`${e}=${encodeURIComponent(i)}`)}});let o=e.join("");return s.length>0&&(o+=`?${s.join("&")}`),t.href}onBackClick(){if(this.selectedAutomation)this.selectedAutomation=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null;else if(this.showAutomations=!1,this.activeAutomationId=null,"automation:"===this.protocol)if(this.baseUrl){const t=new r.A(this.baseUrl);this.href=t,this.protocol=t.protocol}else this.protocol=null,this.href={};this.requestUpdate()}onAutomationClick(t){this.selectedAutomation=t,this.activeAutomationId=t.id,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.requestUpdate()}onActionSelect(t){this.automationAction===t?this.automationAction=null:this.automationAction=t,this.requestUpdate()}onTabChange(t){this.activeTab=t,this.requestUpdate()}onMailingListToggle(t,e){("add"===e?this.selectedMailingListsForAdd:this.selectedMailingListsForRemove).indexOf(t)>-1?"add"===e?this.selectedMailingListsForAdd=this.selectedMailingListsForAdd.filter(e=>e!==t):this.selectedMailingListsForRemove=this.selectedMailingListsForRemove.filter(e=>e!==t):"add"===e?this.selectedMailingListsForAdd=[...this.selectedMailingListsForAdd,t]:this.selectedMailingListsForRemove=[...this.selectedMailingListsForRemove,t],this.requestUpdate()}createAutomationLink(){if(!this.selectedAutomation)return null;const t=[];if(this.selectedMailingListsForAdd.length>0&&t.push(`${h}=${this.selectedMailingListsForAdd.join(",")}`),this.selectedMailingListsForRemove.length>0&&t.push(`${d}=${this.selectedMailingListsForRemove.join(",")}`),0===t.length)return null;const e=this.selectedAutomation.name||this.selectedAutomation.id;if(this.baseUrl&&this.baseUrl.trim()){let e=this.baseUrl.trim();e.match(/^https?:\/\//i)||e.includes("://")||!e.includes(".")&&e.match(/^[a-zA-Z]+:/)||(e=`https://${e}`),t.push(`url=${encodeURIComponent(e)}`)}return`[[${e}]]?${t.join("&")}`}onSaveAutomation(){const t=this.createAutomationLink();if(!t)return;console.log("Saving automation link:",t);const e=t.match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(!e)return void console.error("Invalid automation link format:",t);const i=e[1],s=e[2],o={};s.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(o[decodeURIComponent(e)]=decodeURIComponent(i))});const n=o.url;let a;if(delete o.url,a=n?new r.A(n):new r.A("https://example.com"),a.params||(a.params={}),o[h]&&(a.params[h]=o[h]),o[d]&&(a.params[d]=o[d]),a.params[p]=i,a.href=t,a.url=n||"",this.href=a,this.protocol=null,this.value=a,this.link=a,this.lastUrl=a,console.log("Set href to:",this.href),console.log("Set href.href to:",this.href?.href),this.onDispatch(),console.log("After dispatch, href:",this.href),console.log("After dispatch, href.href:",this.href?.href),console.log("After dispatch, href.params:",this.href?.params),this.href&&(!this.href.params||!this.href.params[p])){console.log("Restoring automation params after dispatch");const t=this.href.href||this.href,e=String(t).match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(e){const i=e[2],s={};i.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(s[decodeURIComponent(e)]=decodeURIComponent(i))});const o=s.url,n=o?new r.A(o):new r.A("https://example.com");n.params||(n.params={}),s[h]&&(n.params[h]=s[h]),s[d]&&(n.params[d]=s[d]),n.params[p]=e[1],n.href=t,n.url=o||"",this.href=n,this.value=n,this.link=n,this.lastUrl=n,console.log("Restored href:",this.href?.href),console.log("Restored params:",this.href?.params)}}this.showSaveSuccess=!0,this.requestUpdate(),setTimeout(()=>{this.showSaveSuccess=!1,this.requestUpdate()},2e3)}parseAutomationLink(t){if(!t)return;let e=null,i=!1,s=t.href||t;if("string"==typeof s&&s.match(/^\[\[([^\]]+)\]\]\?/)){i=!0;e=s.match(/^\[\[([^\]]+)\]\]\?/)[1]}else t.params&&(e=t.params[p],i=e&&""!==e&&"string"==typeof e&&""!==e.trim());if(i){if("string"==typeof s&&s.match(/^\[\[([^\]]+)\]\]\?(.+)$/)){const t=s.match(/^\[\[([^\]]+)\]\]\?(.+)$/)[2],e={};if(t.split("&").forEach(t=>{const[i,s]=t.split("=");i&&s&&(e[decodeURIComponent(i)]=decodeURIComponent(s))}),e.url?this.baseUrl=e.url:this.baseUrl="",e[h]){const t="string"==typeof e[h]?e[h].split(",").filter(t=>t.trim()):Array.isArray(e[h])?e[h]:[];this.selectedMailingListsForAdd=t}if(e[d]){const t="string"==typeof e[d]?e[d].split(",").filter(t=>t.trim()):Array.isArray(e[d])?e[d]:[];this.selectedMailingListsForRemove=t}}else if(t.params){const e=this.extractBaseUrl(t);if(this.baseUrl=e,t.params[h]){const e="string"==typeof t.params[h]?t.params[h].split(",").filter(t=>t.trim()):Array.isArray(t.params[h])?t.params[h]:[];this.selectedMailingListsForAdd=e}if(t.params[d]){const e="string"==typeof t.params[d]?t.params[d].split(",").filter(t=>t.trim()):Array.isArray(t.params[d])?t.params[d]:[];this.selectedMailingListsForRemove=e}}if((this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0)&&(this.showAutomations=!0,this.automations&&this.automations.length>0)){const t=String(e).trim(),i=this.automations.find(e=>e.name&&String(e.name).trim()===t||e.id&&String(e.id).trim()===t)||this.automations[0];this.selectedAutomation=i,this.activeAutomationId=i.id}}}renderAutomationsView(){return this.selectedAutomation?this.renderAutomationDetails():s.qy`
@@ -685,7 +701,7 @@
685
701
  >
686
702
  <lang-text text="url"></lang-text> (Optional)
687
703
  </cdtr-title>
688
- ${L({value:this.baseUrl||"",onChange:t=>{const e=t.target.value||"",i=R(e,null,this.baseUrl?new r.A(this.baseUrl):{});null===i?this.baseUrl=e:i.href?i.href instanceof r.A?this.baseUrl=i.href.href||e:"string"==typeof i.href?this.baseUrl=i.href:this.baseUrl=e:this.baseUrl=e,this.requestUpdate()},placeholder:"https://example.com",inputStyle:"height: 40px; padding: 0.5rem; border: 1px solid #e0e0e0; border-radius: 4px; width: 100%;",style:"width: 100%;"})}
704
+ ${L({value:this.baseUrl||"",onChange:t=>{const e=t.target.value||"",i=S(e,null,this.baseUrl?new r.A(this.baseUrl):{});null===i?this.baseUrl=e:i.href?i.href instanceof r.A?this.baseUrl=i.href.href||e:"string"==typeof i.href?this.baseUrl=i.href:this.baseUrl=e:this.baseUrl=e,this.requestUpdate()},placeholder:"https://example.com",inputStyle:"height: 40px; padding: 0.5rem; border: 1px solid #e0e0e0; border-radius: 4px; width: 100%;",style:"width: 100%;"})}
689
705
  </div>
690
706
 
691
707
  <h6
@@ -851,18 +867,18 @@
851
867
  </cdtr-row>
852
868
  </div>
853
869
  </div>
854
- `}}}customElements.get("paper-button")||Promise.resolve().then(i.bind(i,39239)),customElements.get("cdtr-emoji-picker")||i.e(3105).then(i.t.bind(i,63105,23));class C extends(U(s.WF)){constructor(){super(),this.inputRef=(0,a._)(),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.urlInputFocused=!1,this._urlInputRawValue="",this._lastSyncedMyHref=void 0,this._lastBodySyncHref=void 0,this.lastUrl=void 0,this.target="_blank",this.anchors=[],this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0}),this.options=c,this.body="",this.subject="",this.name=o.M.get("lang",c[0].text),this.initAutomations()}onDispatch(){const t=function(t){const{href:e,protocol:i,params:s,body:o,subject:r,target:n,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=S(e,i,s,o,r,n);return c?{dispatched:!0,href:c.url,protocol:c.protocol,params:c.params,value:c.url,link:c.url,lastUrl:c.url}:{dispatched:!1}}({href:this.href,protocol:this.protocol,params:this.params,body:this.body,subject:this.subject,target:this.target,dispatchEvent:this.dispatchEvent.bind(this),event:this.event});if(t.dispatched){if(t.href){this.href=t.href,this.protocol=t.protocol,this.params=t.params?{...t.params}:{},this.value=t.value,this.link=t.link,this.lastUrl=t.lastUrl;const e="string"==typeof t.href?t.href:t.href?.href;this._urlInputRawValue=null!=e&&""!==e?String(e):""}this.dispatchEvent(this.event)}}onChangeLink(t){const e=t.target.value;this._urlInputRawValue=e;const i=R(e,this.protocol,this.href);null!==i?(this.href=i.href,this.protocol=i.protocol,i.clearParams&&(this.body="",this.subject=""),void 0!==i.body&&(this.body=i.body),void 0!==i.subject&&(this.subject=i.subject),i.shouldBlur&&this.onBlur()):this.href=e}onKeyDown(t){if("submit"===t.type){const t=this.inputRef?.value;void 0!==t?.value&&this.onChangeLink({target:{value:t.value}}),t&&"function"==typeof t.success&&t.success(),this.onDispatch()}}onUrlInputFocus(){const t=this.inputRef?.value?.value;null!=t&&(this._urlInputRawValue=t),this.urlInputFocused=!0}onUrlInputBlur(){this.urlInputFocused=!1,this.hasButton||this.onDispatch()}onBlur(){this.hasButton||this.onDispatch()}onClickOk(){this.onDispatch()}onChangeTarget(t){const e={target:t.target.value};this.target=e.target,t.stopPropagation(),!this.hasButton&&this.href&&this.onBlur()}resolveAnchors(){this.anchors=function(){const t=o.M.get("components");return t?.filter(t=>"anchor"===t.type&&t.props.name||t.props.element_ID)||[]}()}onChangeType(t){const e=function(t,e,i,s){const o=e.find(e=>e.type===t);if(!o)return{forceProtocolChange:!1};const r="anchor"===o.text,n=s!==o.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:o.type,forceProtocolChange:!0,shouldResolveAnchors:r,clearParams:n}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),e.forceProtocolChange){const t=new r.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new r.A(this.href);const t=String(this.href?.href||"").match(/^\[\[([^\]]+)\]\]\?/),e=this.href&&this.href.params&&this.href.params[p];(t||e)&&this.parseAutomationLink(this.href)}render(){const t=o.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new r.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const n=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==n){this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");n.match(/^\[\[([^\]]+)\]\]\?/)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null)}const l=function(t,e,i){let s=[];return t.isEmail?s=[]:t.isPhone?s=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(s=[{type:"https:",text:o.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(s=[]),s}(i,this.protocol,this.options);let c=i.href;const h=String(i.href||""),d=h.match(/^\[\[([^\]]+)\]\]\?/),m=i.params&&i.params[p];if(d)c=h;else if(m){const t=u,e=[];i.params&&Object.keys(i.params).forEach(s=>{if(!t.includes(s)){const t=i.params[s];e.push(`${s}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const s=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${s}`:`${i.protocol}${s}`:s,e.length>0&&(c+=`?${e.join("&")}`)}const g=function(t){switch(t){case"mailto:":return"what_the_email_address";case"tel:":return"what_the_phone_number";case"sms:":case"whatsapp:":return"what_the_phone_number_to_send_msg";case"anchor:":return"what_the_anchor_name";case"file:":return"what_the_file_name";default:return"what_the_url_address"}}(this.protocol),f=[...this.options],b=f.findIndex(t=>"http:"===t.type);b>-1&&f.splice(b,1);const y=o.M.get("config","editor","configure","editorProps","automations"),v={url:i,href:this.href,protocol:this.protocol,anchors:this.anchors,body:this.body,subject:this.subject,onChangeLink:this.onChangeLink.bind(this),onBlur:this.onBlur.bind(this),onRequest:this.onRequest,updateBody:t=>{this.body=t},updateSubject:t=>{this.subject=t}},x=null!=c&&""!==c?String(c):"",w=this._urlInputRawValue!==x,$=void 0!==this._lastSyncedMyHref&&x!==this._lastSyncedMyHref,A=this.urlInputFocused&&this._urlInputRawValue&&x&&!$;w&&!A?(this._urlInputRawValue=x,this._lastSyncedMyHref=x):w||(this._lastSyncedMyHref=x);const k=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,S={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,a.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:k};return this.showAutomations?s.qy` <div class="root">${this.renderAutomationsView()}</div>`:s.qy` <div class="root">
855
- ${j=this.label,j?s.qy`<cdtr-title
870
+ `}}}customElements.get("paper-button")||Promise.resolve().then(i.bind(i,39239)),customElements.get("cdtr-emoji-picker")||i.e(3105).then(i.t.bind(i,63105,23));class C extends(U(s.WF)){constructor(){super(),this.inputRef=(0,a._)(),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.urlInputFocused=!1,this._urlInputRawValue="",this._lastSyncedMyHref=void 0,this._lastBodySyncHref=void 0,this.lastUrl=void 0,this.target="_blank",this.anchors=[],this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0}),this.options=c,this.body="",this.subject="",this.name=o.M.get("lang",c[0].text),this.initAutomations()}onDispatch(){const t=function(t){const{href:e,protocol:i,params:s,body:o,subject:r,target:n,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=_(e,i,s,o,r,n);return c?{dispatched:!0,href:c.url,protocol:c.protocol,params:c.params,value:c.url,link:c.url,lastUrl:c.url}:{dispatched:!1}}({href:this.href,protocol:this.protocol,params:this.params,body:this.body,subject:this.subject,target:this.target,dispatchEvent:this.dispatchEvent.bind(this),event:this.event});if(t.dispatched){if(t.href){this.href=t.href,this.protocol=t.protocol,this.params=t.params?{...t.params}:{},this.value=t.value,this.link=t.link,this.lastUrl=t.lastUrl;const e="string"==typeof t.href?t.href:t.href?.href;this._urlInputRawValue=null!=e&&""!==e?String(e):""}this.dispatchEvent(this.event)}}onChangeLink(t){const e=t.target.value;this._urlInputRawValue=e;const i=S(e,this.protocol,this.href);null!==i?(this.href=i.href,this.protocol=i.protocol,i.clearParams&&(this.body="",this.subject=""),void 0!==i.body&&(this.body=i.body),void 0!==i.subject&&(this.subject=i.subject),i.shouldBlur&&this.onBlur()):this.href=e}onKeyDown(t){if("submit"===t.type){const t=this.inputRef?.value;void 0!==t?.value&&this.onChangeLink({target:{value:t.value}}),t&&"function"==typeof t.success&&t.success(),this.onDispatch()}}onUrlInputFocus(){const t=this.inputRef?.value?.value;null!=t&&(this._urlInputRawValue=t),this.urlInputFocused=!0}onUrlInputBlur(){this.urlInputFocused=!1,this.hasButton||this.onDispatch()}onBlur(){this.hasButton||this.onDispatch()}onClickOk(){this.onDispatch()}onChangeTarget(t){const e={target:t.target.value};this.target=e.target,t.stopPropagation(),!this.hasButton&&this.href&&this.onBlur()}resolveAnchors(){this.anchors=R()}onChangeType(t){const e=function(t,e,i,s){const o=e.find(e=>e.type===t);if(!o)return{forceProtocolChange:!1};const r="anchor"===o.text,n=s!==o.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:o.type,forceProtocolChange:!0,shouldResolveAnchors:r,clearParams:n}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),e.forceProtocolChange){const t=new r.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new r.A(this.href);const t=String(this.href?.href||"").match(/^\[\[([^\]]+)\]\]\?/),e=this.href&&this.href.params&&this.href.params[p];(t||e)&&this.parseAutomationLink(this.href)}render(){const t=o.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new r.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const n=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==n){this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");n.match(/^\[\[([^\]]+)\]\]\?/)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null)}const l=function(t,e,i){let s=[];return t.isEmail?s=[]:t.isPhone?s=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(s=[{type:"https:",text:o.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(s=[]),s}(i,this.protocol,this.options);let c=i.href;const h=String(i.href||""),d=h.match(/^\[\[([^\]]+)\]\]\?/),m=i.params&&i.params[p];if(d)c=h;else if(m){const t=u,e=[];i.params&&Object.keys(i.params).forEach(s=>{if(!t.includes(s)){const t=i.params[s];e.push(`${s}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const s=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${s}`:`${i.protocol}${s}`:s,e.length>0&&(c+=`?${e.join("&")}`)}const f=function(t){switch(t){case"mailto:":return"what_the_email_address";case"tel:":return"what_the_phone_number";case"sms:":case"whatsapp:":return"what_the_phone_number_to_send_msg";case"anchor:":return"what_the_anchor_name";case"file:":return"what_the_file_name";default:return"what_the_url_address"}}(this.protocol),g=[...this.options],b=g.findIndex(t=>"http:"===t.type);b>-1&&g.splice(b,1);const y=o.M.get("config","editor","configure","editorProps","automations"),v={url:i,href:this.href,protocol:this.protocol,anchors:this.anchors,body:this.body,subject:this.subject,onChangeLink:this.onChangeLink.bind(this),onBlur:this.onBlur.bind(this),onRequest:this.onRequest,updateBody:t=>{this.body=t},updateSubject:t=>{this.subject=t}},x=null!=c&&""!==c?String(c):"",w=this._urlInputRawValue!==x,$=void 0!==this._lastSyncedMyHref&&x!==this._lastSyncedMyHref,A=this.urlInputFocused&&this._urlInputRawValue&&x&&!$;w&&!A?(this._urlInputRawValue=x,this._lastSyncedMyHref=x):w||(this._lastSyncedMyHref=x);const _=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,S={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,a.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:_};return this.showAutomations?s.qy` <div class="root">${this.renderAutomationsView()}</div>`:s.qy` <div class="root">
871
+ ${F=this.label,F?s.qy`<cdtr-title
856
872
  style="font-weight: 700;
857
873
  font-size: 14.4px;
858
874
  margin-bottom: 0.6rem;
859
875
  color: #000000b0;"
860
- ><lang-text text=${j}></lang-text
876
+ ><lang-text text=${F}></lang-text
861
877
  ><cdtr-divider></cdtr-divider
862
878
  ></cdtr-title>`:null}
863
879
  <cdtr-row alignItems="center" justify="space-between" spacing="10">
864
- ${I=this.options,q=this.protocol,F=this.onChangeType.bind(this),s.qy`
865
- <cdtr-dropdown @change=${t=>F(t.target.value)}>
880
+ ${I=this.options,q=this.protocol,j=this.onChangeType.bind(this),s.qy`
881
+ <cdtr-dropdown @change=${t=>j(t.target.value)}>
866
882
  <cdtr-dropdown-button
867
883
  minWidth=${100}
868
884
  class=" dropdown-button"
@@ -913,10 +929,10 @@
913
929
 
914
930
  <div class="input-wrapper">
915
931
  <cdtr-title class="explain-title"
916
- ><lang-text .text="${g}"></lang-text
932
+ ><lang-text .text="${f}"></lang-text
917
933
  ></cdtr-title>
918
934
  ${function(t){const{protocol:e,url:i,autofocus:s,inputRef:o,onChangeLink:r,onBlur:n,onFocus:a,onKeyDown:l,myHref:c}=t;return"anchor:"===e?null:L({value:c,inputRef:o,autofocus:s,onChange:r,onBlur:n,onFocus:a,onKeyDown:l})}(S)}
919
- ${_(this.protocol,v)}
935
+ ${k(this.protocol,v)}
920
936
  ${y?s.qy` <cdtr-divider></cdtr-divider>
921
937
  <cdtr-row justify="flex-start" mt="1">
922
938
  <cdtr-title class="explain-title"
@@ -947,4 +963,4 @@
947
963
  <lang-text text="add_now"></lang-text>
948
964
  </paper-button>
949
965
  </cdtr-row>`:null}
950
- </div>`;var R,U,C,M,I,q,F,j}}C.styles=n,C.properties={href:{type:String,reflect:!0},value:{type:Object},protocol:{type:String},name:{type:String},label:{type:String},target:{type:String},hasButton:{type:Boolean},params:{type:Object},explain:{type:String},anchors:{type:Array},link:{},body:{type:String},subject:{type:String},autofocus:{type:Boolean},onRequest:{type:Function}},customElements.get("cdtr-link-element")||customElements.define("cdtr-link-element",C)},88385(t,e,i){i.d(e,{A:()=>a});const s=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function r(t){const e={},i=/([^&=]+)=?([^&]*)/g,s=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let r,n=-1!==o?t.substring(o+1):"";for(;null!==(r=i.exec(n));){const t=s(r[1]),i=s(r[2]);t&&(e[t]=i)}return e}function n(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class a{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){if(this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),/^\[\[[^\]]+\]\]\?/.test(this.href)){const t=this.href;this.isValid=!1,this.protocol=e?.protocol??"",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.params={...this.params,...e?.params,...r(t)};const i=t.indexOf("?");return this.url=i>-1?t.slice(0,i):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol??a.getProtocol(this.href);const i=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=s(i),this.isPhone=o(i),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...r(this.href)},this.url=n(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams()}addParam(t,e){this.params[t]=e,this.href=this.getUrlWithParams()}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const i in this.params){const s=this.params[i],o=encodeURIComponent(i).replace(/%24/g,"$");if(s){const i=encodeURIComponent(s).replace(/%24/g,"$");t+=`${o}=${i}&`,e+=`${o}=${i}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const i=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return i(this.protocol+"//"+t);if("whatsapp:"===this.protocol){const s=this.extractPhoneFromTextUsingRegex(t);return s.length>0?i("https://wa.me/"+s[0]+e):i("https://wa.me/"+e)}return i(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}a.resetURL=n}}]);
966
+ </div>`;var R,U,C,M,I,q,j,F}}C.styles=n,C.properties={href:{type:String,reflect:!0},value:{type:Object},protocol:{type:String},name:{type:String},label:{type:String},target:{type:String},hasButton:{type:Boolean},params:{type:Object},explain:{type:String},anchors:{type:Array},link:{},body:{type:String},subject:{type:String},autofocus:{type:Boolean},onRequest:{type:Function}},customElements.get("cdtr-link-element")||customElements.define("cdtr-link-element",C)},88385(t,e,i){i.d(e,{A:()=>a});const s=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function r(t){const e={},i=/([^&=]+)=?([^&]*)/g,s=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let r,n=-1!==o?t.substring(o+1):"";for(;null!==(r=i.exec(n));){const t=s(r[1]),i=s(r[2]);t&&(e[t]=i)}return e}function n(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class a{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){if(this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),/^\[\[[^\]]+\]\]\?/.test(this.href)){const t=this.href;this.isValid=!1,this.protocol=e?.protocol??"",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.params={...this.params,...e?.params,...r(t)};const i=t.indexOf("?");return this.url=i>-1?t.slice(0,i):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol||this.protocol||a.getProtocol(this.href);const i=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=s(i),this.isPhone=o(i),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...r(this.href)},this.url=n(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams(),this.isAnchor="anchor:"===this.protocol||this.href.startsWith("#")}addParam(t,e){this.params[t]=e,this.href=this.getUrlWithParams()}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const i in this.params){const s=this.params[i],o=encodeURIComponent(i).replace(/%24/g,"$");if(s){const i=encodeURIComponent(s).replace(/%24/g,"$");t+=`${o}=${i}&`,e+=`${o}=${i}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const i=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return i(this.protocol+"//"+t);if(this.isAnchor||"anchor:"===this.protocol)return t?i(t.startsWith("#")?t:`#${t}`):"";if("whatsapp:"===this.protocol){const s=this.extractPhoneFromTextUsingRegex(t);return s.length>0?i("https://wa.me/"+s[0]+e):i("https://wa.me/"+e)}return i(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}a.resetURL=n}}]);
Binary file