@creaditor/newsletter-starterkit 1.0.37-preview.3 → 1.0.37-preview.4

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.
package/README.md CHANGED
@@ -241,7 +241,7 @@ function NewsletterEditor() {
241
241
 
242
242
  ## Changelog
243
243
 
244
- ### 1.0.37-preview.2
244
+ ### 1.0.37-preview.3
245
245
 
246
246
  **Merged updates since `1.0.37-preview.1`**
247
247
 
@@ -0,0 +1 @@
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[2355],{92355:(e,t,n)=>{n.r(t),n.d(t,{default:()=>w});var r="undefined"!=typeof window?window:null,i=null===r,s=i?void 0:r.document,o="addEventListener",a="removeEventListener",u="getBoundingClientRect",l="_a",c="_b",f="_c",h="horizontal",m=function(){return!1},d=i?"calc":["","-webkit-","-moz-","-o-"].filter((function(e){var t=s.createElement("div");return t.style.cssText="width:"+e+"calc(9px)",!!t.style.length})).shift()+"calc",p=function(e){return"string"==typeof e||e instanceof String},g=function(e){if(p(e)){var t=s.querySelector(e);if(!t)throw new Error("Selector "+e+" did not match a DOM element");return t}return e},v=function(e,t,n){var r=e[t];return void 0!==r?r:n},y=function(e,t,n,r){if(t){if("end"===r)return 0;if("center"===r)return e/2}else if(n){if("start"===r)return 0;if("center"===r)return e/2}return e},z=function(e,t){var n=s.createElement("div");return n.className="gutter gutter-"+t,n},S=function(e,t,n){var r={};return p(t)?r[e]=t:r[e]=d+"("+t+"% - "+n+"px)",r},b=function(e,t){var n;return(n={})[e]=t+"px",n};const w=function(e,t){if(void 0===t&&(t={}),i)return{};var n,d,p,w,E,k,x=e;Array.from&&(x=Array.from(x));var O=g(x[0]).parentNode,C=getComputedStyle?getComputedStyle(O):null,A=C?C.flexDirection:null,M=v(t,"sizes")||x.map((function(){return 100/x.length})),U=v(t,"minSize",100),D=Array.isArray(U)?U:x.map((function(){return U})),F=v(t,"maxSize",1/0),j=Array.isArray(F)?F:x.map((function(){return F})),B=v(t,"expandToMin",!1),L=v(t,"gutterSize",10),T=v(t,"gutterAlign","center"),_=v(t,"snapOffset",30),N=Array.isArray(_)?_:x.map((function(){return _})),R=v(t,"dragInterval",1),q=v(t,"direction",h),H=v(t,"cursor",q===h?"col-resize":"row-resize"),I=v(t,"gutter",z),W=v(t,"elementStyle",S),X=v(t,"gutterStyle",b);function Y(e,t,r,i){var s=W(n,t,r,i);Object.keys(s).forEach((function(t){e.style[t]=s[t]}))}function G(){return k.map((function(e){return e.size}))}function J(e){return"touches"in e?e.touches[0][d]:e[d]}function K(e){var t=k[this.a],n=k[this.b],r=t.size+n.size;t.size=e/this.size*r,n.size=r-e/this.size*r,Y(t.element,t.size,this[c],t.i),Y(n.element,n.size,this[f],n.i)}function P(e){var n,r=k[this.a],i=k[this.b];this.dragging&&(n=J(e)-this.start+(this[c]-this.dragOffset),R>1&&(n=Math.round(n/R)*R),n<=r.minSize+r.snapOffset+this[c]?n=r.minSize+this[c]:n>=this.size-(i.minSize+i.snapOffset+this[f])&&(n=this.size-(i.minSize+this[f])),n>=r.maxSize-r.snapOffset+this[c]?n=r.maxSize+this[c]:n<=this.size-(i.maxSize-i.snapOffset+this[f])&&(n=this.size-(i.maxSize+this[f])),K.call(this,n),v(t,"onDrag",m)(G()))}function Q(){var e=k[this.a].element,t=k[this.b].element,r=e[u](),i=t[u]();this.size=r[n]+i[n]+this[c]+this[f],this.start=r[p],this.end=r[w]}function V(e){var t=function(e){if(!getComputedStyle)return null;var t=getComputedStyle(e);if(!t)return null;var n=e[E];return 0===n?null:n-=q===h?parseFloat(t.paddingLeft)+parseFloat(t.paddingRight):parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)}(O);if(null===t)return e;if(D.reduce((function(e,t){return e+t}),0)>t)return e;var n=0,r=[],i=e.map((function(i,s){var o=t*i/100,a=y(L,0===s,s===e.length-1,T),u=D[s]+a;return o<u?(n+=u-o,r.push(0),u):(r.push(o-u),o)}));return 0===n?e:i.map((function(e,i){var s=e;if(n>0&&r[i]-n>0){var o=Math.min(n,r[i]-n);n-=o,s=e-o}return s/t*100}))}function Z(){var e=this,n=k[e.a].element,i=k[e.b].element;e.dragging&&v(t,"onDragEnd",m)(G()),e.dragging=!1,r[a]("mouseup",e.stop),r[a]("touchend",e.stop),r[a]("touchcancel",e.stop),r[a]("mousemove",e.move),r[a]("touchmove",e.move),e.stop=null,e.move=null,n[a]("selectstart",m),n[a]("dragstart",m),i[a]("selectstart",m),i[a]("dragstart",m),n.style.userSelect="",n.style.webkitUserSelect="",n.style.MozUserSelect="",n.style.pointerEvents="",i.style.userSelect="",i.style.webkitUserSelect="",i.style.MozUserSelect="",i.style.pointerEvents="",e.gutter.style.cursor="",e.parent.style.cursor="",s.body.style.cursor=""}function $(e){if(!("button"in e)||0===e.button){var n=this,i=k[n.a].element,a=k[n.b].element;n.dragging||v(t,"onDragStart",m)(G()),e.preventDefault(),n.dragging=!0,n.move=P.bind(n),n.stop=Z.bind(n),r[o]("mouseup",n.stop),r[o]("touchend",n.stop),r[o]("touchcancel",n.stop),r[o]("mousemove",n.move),r[o]("touchmove",n.move),i[o]("selectstart",m),i[o]("dragstart",m),a[o]("selectstart",m),a[o]("dragstart",m),i.style.userSelect="none",i.style.webkitUserSelect="none",i.style.MozUserSelect="none",i.style.pointerEvents="none",a.style.userSelect="none",a.style.webkitUserSelect="none",a.style.MozUserSelect="none",a.style.pointerEvents="none",n.gutter.style.cursor=H,n.parent.style.cursor=H,s.body.style.cursor=H,Q.call(n),n.dragOffset=J(e)-n.end}}q===h?(n="width",d="clientX",p="left",w="right",E="clientWidth"):"vertical"===q&&(n="height",d="clientY",p="top",w="bottom",E="clientHeight"),M=V(M);var ee=[];function te(e){var t=e.i===ee.length,n=t?ee[e.i-1]:ee[e.i];Q.call(n);var r=t?n.size-e.minSize-n[f]:e.minSize+n[c];K.call(n,r)}return(k=x.map((function(e,t){var r,i={element:g(e),size:M[t],minSize:D[t],maxSize:j[t],snapOffset:N[t],i:t};if(t>0&&((r={a:t-1,b:t,dragging:!1,direction:q,parent:O})[c]=y(L,t-1==0,!1,T),r[f]=y(L,!1,t===x.length-1,T),"row-reverse"===A||"column-reverse"===A)){var s=r.a;r.a=r.b,r.b=s}if(t>0){var a=I(t,q,i.element);!function(e,t,r){var i=X(n,t,r);Object.keys(i).forEach((function(t){e.style[t]=i[t]}))}(a,L,t),r[l]=$.bind(r),a[o]("mousedown",r[l]),a[o]("touchstart",r[l]),O.insertBefore(a,i.element),r.gutter=a}return Y(i.element,i.size,y(L,0===t,t===x.length-1,T),t),t>0&&ee.push(r),i}))).forEach((function(e){var t=e.element[u]()[n];t<e.minSize&&(B?te(e):e.minSize=t)})),{setSizes:function(e){var t=V(e);t.forEach((function(e,n){if(n>0){var r=ee[n-1],i=k[r.a],s=k[r.b];i.size=t[n-1],s.size=e,Y(i.element,i.size,r[c],i.i),Y(s.element,s.size,r[f],s.i)}}))},getSizes:G,collapse:function(e){te(k[e])},destroy:function(e,t){ee.forEach((function(r){if(!0!==t?r.parent.removeChild(r.gutter):(r.gutter[a]("mousedown",r[l]),r.gutter[a]("touchstart",r[l])),!0!==e){var i=W(n,r.a.size,r[c]);Object.keys(i).forEach((function(e){k[r.a].element.style[e]="",k[r.b].element.style[e]=""}))}}))},parent:O,pairs:ee}}}}]);
Binary file
@@ -0,0 +1 @@
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6001],{46001:(t,e,n)=>{n.r(e),n.d(e,{default:()=>x});const s="undefined"!=typeof window?window:null,i=null===s,r=i?void 0:s.document,o="addEventListener",l="removeEventListener",c="getBoundingClientRect",a="_b",u="_c",h="horizontal",p=()=>!1,f=!1,d=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return f&&console.log("[Split.js]",...e)},m=i?"calc":`${["","-webkit-","-moz-","-o-"].filter((t=>{const e=r.createElement("div");return e.style.cssText=`width:${t}calc(9px)`,!!e.style.length})).shift()}calc`,g=t=>"string"==typeof t||t instanceof String,y=t=>{if(g(t)){const e=r.querySelector(t);if(!e)throw new Error(`Selector ${t} did not match a DOM element`);return e}return t},z=(t,e,n)=>{const s=t[e];return void 0!==s?s:n},S=(t,e,n,s)=>{if(e){if("end"===s)return 0;if("center"===s)return t/2}else if(n){if("start"===s)return 0;if("center"===s)return t/2}return t},b=(t,e)=>{const n=r.createElement("div");return n.className=`gutter gutter-${e}`,n},v=(t,e,n)=>{const s={};return g(e)?s[t]=e:s[t]=`${m}(${e}% - ${n}px)`,s},w=(t,e)=>({[t]:`${e}px`}),x=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i)return{};let n,f,m,g,x,E,C=t;Array.from&&(C=Array.from(C));const D=y(C[0]).parentNode,k=getComputedStyle?getComputedStyle(D):null,O=k?k.flexDirection:null;let A=z(e,"sizes")||C.map((()=>100/C.length));const M=z(e,"minSize",100),U=Array.isArray(M)?M:C.map((()=>M)),$=z(e,"maxSize",1/0),_=Array.isArray($)?$:C.map((()=>$)),B=z(e,"expandToMin",!1),j=z(e,"gutterSize",10),F=z(e,"gutterAlign","center"),R=z(e,"snapOffset",30),T=Array.isArray(R)?R:C.map((()=>R)),L=z(e,"dragInterval",1),N=z(e,"direction",h),X=z(e,"cursor",N===h?"col-resize":"row-resize"),Y=z(e,"gutter",b),P=z(e,"elementStyle",v),V=z(e,"gutterStyle",w);function q(t,e,s,i){const r=P(n,e,s,i);Object.keys(r).forEach((e=>{t.style[e]=r[e]}))}function H(){return E.map((t=>t.size))}function I(t){return"touches"in t?t.touches[0][f]:t[f]}function W(t){const e=E[this.a],n=E[this.b],s=e.size+n.size;e.size=t/this.size*s,n.size=s-t/this.size*s,q(e.element,e.size,this[a],e.i),q(n.element,n.size,this[u],n.i)}function G(t){let n;const s=E[this.a],i=E[this.b];this.dragging&&(n=I(t)-this.start+(this[a]-this.dragOffset),L>1&&(n=Math.round(n/L)*L),n<=s.minSize+s.snapOffset+this[a]?n=s.minSize+this[a]:n>=this.size-(i.minSize+i.snapOffset+this[u])&&(n=this.size-(i.minSize+this[u])),n>=s.maxSize-s.snapOffset+this[a]?n=s.maxSize+this[a]:n<=this.size-(i.maxSize-i.snapOffset+this[u])&&(n=this.size-(i.maxSize+this[u])),W.call(this,n),z(e,"onDrag",p)(H()))}function J(){const t=E[this.a].element,e=E[this.b].element,s=t[c](),i=e[c]();this.size=s[n]+i[n]+this[a]+this[u],this.start=s[m],this.end=s[g]}function K(t){const e=function(t){if(!getComputedStyle)return null;const e=getComputedStyle(t);if(!e)return null;let n=t[x];return 0===n?null:(n-=N===h?parseFloat(e.paddingLeft)+parseFloat(e.paddingRight):parseFloat(e.paddingTop)+parseFloat(e.paddingBottom),n)}(D);if(null===e)return t;if(U.reduce(((t,e)=>t+e),0)>e)return t;let n=0;const s=[],i=t.map(((i,r)=>{const o=e*i/100,l=S(j,0===r,r===t.length-1,F),c=U[r]+l;return o<c?(n+=c-o,s.push(0),c):(s.push(o-c),o)}));return 0===n?t:i.map(((t,i)=>{let r=t;if(n>0&&s[i]-n>0){const e=Math.min(n,s[i]-n);n-=e,r=t-e}return r/e*100}))}function Q(){const t=this,n=E[t.a].element,i=E[t.b].element;t.dragging&&z(e,"onDragEnd",p)(H()),t.dragging=!1,s[l]("mouseup",t.stop),s[l]("touchend",t.stop),s[l]("touchcancel",t.stop),s[l]("mousemove",t.move),s[l]("touchmove",t.move),t.stop=null,t.move=null,n[l]("selectstart",p),n[l]("dragstart",p),i[l]("selectstart",p),i[l]("dragstart",p),n.style.userSelect="",n.style.webkitUserSelect="",n.style.MozUserSelect="",n.style.pointerEvents="",i.style.userSelect="",i.style.webkitUserSelect="",i.style.MozUserSelect="",i.style.pointerEvents="",t.gutter.style.cursor="",t.parent.style.cursor="",r.body.style.cursor=""}function Z(t){if(d("startDragging",t.type,t.target?.className),"button"in t&&0!==t.button)return;const n=this,i=E[n.a].element,l=E[n.b].element;n.dragging||z(e,"onDragStart",p)(H()),t.preventDefault(),n.dragging=!0,n.move=G.bind(n),n.stop=Q.bind(n),s[o]("mouseup",n.stop),s[o]("touchend",n.stop),s[o]("touchcancel",n.stop),s[o]("mousemove",n.move),s[o]("touchmove",n.move),i[o]("selectstart",p),i[o]("dragstart",p),l[o]("selectstart",p),l[o]("dragstart",p),i.style.userSelect="none",i.style.webkitUserSelect="none",i.style.MozUserSelect="none",i.style.pointerEvents="none",l.style.userSelect="none",l.style.webkitUserSelect="none",l.style.MozUserSelect="none",l.style.pointerEvents="none",n.gutter.style.cursor=X,n.parent.style.cursor=X,r.body.style.cursor=X,J.call(n),n.dragOffset=I(t)-n.end}N===h?(n="width",f="clientX",m="left",g="right",x="clientWidth"):"vertical"===N&&(n="height",f="clientY",m="top",g="bottom",x="clientHeight"),A=K(A);const tt=[];E=C.map(((t,e)=>{const s={element:y(t),size:A[e],minSize:U[e],maxSize:_[e],snapOffset:T[e],i:e};let i;if(e>0&&(i={a:e-1,b:e,dragging:!1,direction:N,parent:D},i[a]=S(j,e-1==0,!1,F),i[u]=S(j,!1,e===C.length-1,F),"row-reverse"===O||"column-reverse"===O)){const t=i.a;i.a=i.b,i.b=t}if(e>0){const t=Y(e,N,s.element);!function(t,e,s){const i=V(n,e,s);Object.keys(i).forEach((e=>{t.style[e]=i[e]}))}(t,j,e),t.style.position="relative";const l=(D.ownerDocument||r).createElement("div");l.setAttribute("data-split-gutter-hit","1"),l.style.cssText=N===h?"position:absolute;top:0;bottom:0;width:16px;left:-8px;cursor:col-resize;z-index:100;":"position:absolute;left:0;right:0;height:16px;top:-8px;cursor:row-resize;z-index:100;";const c=t=>{"button"in t&&0!==t.button||(t.preventDefault(),t.stopPropagation(),Z.call(i,t))};i._directStart=c,l[o]("mousedown",c),l[o]("touchstart",c),t.appendChild(l),i._hitStrip=l,D.insertBefore(t,s.element),i.gutter=t}return q(s.element,s.size,S(j,0===e,e===C.length-1,F),e),e>0&&tt.push(i),s}));const et=(D.ownerDocument||r).defaultView||s,nt=t=>{const e="touches"in t?t.touches[0].clientX:t.clientX,n="touches"in t?t.touches[0].clientY:t.clientY;for(let s=0;s<tt.length;s++){const i=tt[s].gutter;if(!i.getBoundingClientRect)continue;const r=i.getBoundingClientRect(),o=(r.left+r.right)/2,l=(r.top+r.bottom)/2;if(N===h?Math.abs(e-o)<=24&&n>=r.top&&n<=r.bottom:Math.abs(n-l)<=24&&e>=r.left&&e<=r.right)return d("gutter hit",t.type,s),t.preventDefault(),t.stopPropagation(),void Z.call(tt[s],t)}};function st(t){const e=t.i===tt.length,n=e?tt[t.i-1]:tt[t.i];J.call(n);const s=e?n.size-t.minSize-n[u]:t.minSize+n[a];W.call(n,s)}return et[o]("mousedown",nt,!0),et[o]("touchstart",nt,!0),E.forEach((t=>{const e=t.element[c]()[n];e<t.minSize&&(B?st(t):t.minSize=e)})),d("init","elements=",E?.length,"pairs=",tt?.length),{setSizes:function(t){const e=K(t);e.forEach(((t,n)=>{if(n>0){const s=tt[n-1],i=E[s.a],r=E[s.b];i.size=e[n-1],r.size=t,q(i.element,i.size,s[a],i.i),q(r.element,r.size,s[u],r.i)}}))},getSizes:H,collapse(t){st(E[t])},destroy:function(t,e){const i=tt[0]&&tt[0].parent&&tt[0].parent.ownerDocument&&tt[0].parent.ownerDocument.defaultView||s;i&&(i[l]("mousedown",nt,!0),i[l]("touchstart",nt,!0)),tt.forEach((s=>{const i=s._hitStrip||s.gutter;if(s._directStart&&i&&(i[l]("mousedown",s._directStart),i[l]("touchstart",s._directStart)),!0!==e&&s.parent.removeChild(s.gutter),!0!==t){const t=P(n,E[s.a].size,s[a],s.a);Object.keys(t).forEach((t=>{E[s.a].element.style[t]="",E[s.b].element.style[t]=""}))}}))},parent:D,pairs:tt}}}}]);
Binary file
@@ -1 +1 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6652],{96652:(e,n,t)=>{t.r(n);var o=t(40949),a=t(43214),r=t(46062),s=t.n(r),l=t(32877),c=t.n(l),p=t(96793),i=t.n(p),A=t(17892),d=t.n(A),m=t(11173),C=t.n(m),f=t(9328),g={};g.setAttributes=d(),g.insert=i().bind(null,"head"),g.domAPI=c(),g.insertStyleElement=C();s()(f.Z,g);const b=f.Z&&f.Z.locals?f.Z.locals:void 0;var x=t(58860),h=t(70235),E=(t(1434),t(45607));let u,y=[],B=!1;const k=e=>{const n=e.detail,t=h.h.get("components",n.dataset.id);if(!t)throw new Error("component is not defined");const o=t?.element?.nextElementSibling;if(o){const e=h.h.get("components",o.dataset.id);e&&E.Z.clean().selectComponent(e)}else{const e=t.element.previousElementSibling;if(e){const n=h.h.get("components",e.dataset.id);n&&E.Z.clean().selectComponent(n)}}E.Z.store().removeComponent({componentId:t.id})},v=(0,o.Z)("cdtr-background-handle-bar",{onClick:()=>{setTimeout((()=>{E.Z.selectComponent(h.h.get("components").find((e=>e.type.equalWith("root"))))}),0)},target:".section-component",onRemove:k}),Z=()=>{const e=h.h.get("config","editor","configure","editorProps");if(!e)return!0;return e&&"object"==typeof e&&!1!==e.addNewElementsFunctionality},w=(0,o.Z)("cdtr-element-handle-bar",{onRemove:k,onClone:e=>{const n=e.detail,t=h.h.get("components",n.dataset.id);if(!t)throw new Error("component is not defined");const o=t.closest("section");let a=o.children.findIndex((e=>e===t.id));"number"!=typeof a?a=0:a++,E.Z.cloneComponent({componentId:t.id,parentId:o.id,index:a})},target:".block-component"}),W=(0,o.Z)("paper-button",{style:{left:0,top:0,opacity:.7},className:b.componentName}),M=(0,o.Z)("paper-button",{style:{left:0,top:0,zIndex:100,minWidth:"60px"},className:b.componentName}),U=(0,o.Z)("paper-button",{style:{left:0,top:0,opacity:.7},className:`${b.componentCardName} ${b.componentName}`},h.h.get("lang","card")),N=(0,o.Z)("paper-button",{style:{left:"10%",top:0,opacity:.7,transform:"translateY(-100%)",zIndex:3},className:`${b.componentName}`},h.h.get("lang","block")||"block"),S=(0,o.Z)("cdtr-fab-button",{"data-name":"add-new-block-v1",onMouseUp:e=>{x.Z.dispatch("open_add_menu",{type:"block-component",target:e.target.closest(".block-component")})},class:b.addIcon},(0,o.Z)("cdtr-add-icon",{iconStyle:"fill:#fff;"})),z=(0,o.Z)("paper-button",{onMouseUp:e=>x.Z.dispatch("open_add_menu",{type:"section-component",target:e.target.closest(".section-component")}),class:b.addSection},(0,o.Z)("cdtr-add-icon",{iconStyle:"fill:#fff;"}),(0,o.Z)("lang-text",{text:"add_section"}));a.Z.connect(a.F.KEY_DOWN,(e=>{if("Delete"===e.key){const n=document.querySelector("[data-type='block'].selected");n&&(e.preventDefault(),k({detail:n}))}}));const F=(0,o.Z)("div",{className:b.breadcrumbs});a.Z.connect(a.F.KEY_DOWN,(e=>{if("Control"!==e.key||!document.activeElement||document.activeElement.closest("[contenteditable]"))return;B=!0;E.Z.components.find((e=>e.isSelected))&&document.body.appendChild(F)})),a.Z.connect(a.F.KEY_UP,(e=>{B=!1}));const O=e=>{let{path:n,target:t,shiftKey:o,ctrlKey:a}=e;const r=a;if(h.h.set({ctrlKey:r}),t.closest("cdtr-move-handle-bar"))return;let s=t.closest("[class*='-component']");t.closest(".block-component");setTimeout((()=>{if(!s)return;const e=h.h.get("components",s.dataset.id);if(s&&e)if(r&&E.Z.components.length>0&&E.Z.components[0].type===e.type)E.Z.selectComponent(e);else switch(E.Z.clean().selectComponent(e),s.appendChild(M),M.dataset.mounted=e.type,M.innerHTML=e.props.name||h.h.get("lang",e.type)||e.type.getElementType(),e.type){case"block":M.style.left="10%",M.style.transform="rotate(0deg) translate(-5%,-100%)";break;case"form":M.style.left="100%",M.style.transform="rotate(90deg) translate(10%, -7px)";break;case"card":M.style.transform="translate(-70%,120%) rotate(-90deg)",M.style.left="0",M.style.top="0";const e=h.h.get("components",M.dataset.id);e&&(M.innerHTML=e.props.name||h.h.get("lang",e.type)||e.type.getElementType());break;default:M.style.transform="rotate(0deg) translate(-103%,-100%)",M.style.left="100%"}else{if(s=s.closest(".text-component"),!s)return E.Z.clean();E.Z.clean().selectComponent(e)}if(E.Z.components.filter((e=>"block"!==e.type&&"section"!==e.type)).length>0)w.remove(),S.remove();else{const e=E.Z.components.find((e=>"block"===e.type));e&&(u=e,Z()&&(e.appendChild(w),e.appendChild(S)))}}),130)},I=e=>{const n=e.target;if(!n)return;let t=n.closest("[class*='-component']");if(t){const e=t.closest(".card-component"),o=t.closest(".block-component"),a=h.h.get("components",t.dataset.id);if(a){switch(W.innerHTML=a.props.name||h.h.get("lang",a.type)||a.type.getElementType(),t.appendChild(W),a.type){case"card":case"form":case"block":W.remove();break;case"form":W.style.left="100%",W.style.transform="rotate(90deg) translate(10%, -7px)";break;default:W.style.transform="translate(-103%,-100%)",W.style.left="100%"}e?e.appendChild(U):n.closest(".card-component")||U.remove(),o&&(o?o.appendChild(N):N.remove())}y.forEach((e=>e.classList.remove("selected-on-hover"))),a&&"form"===a.type&&(t=n.closest(".card-component")),t.classList.add("selected-on-hover"),y=[t];const r=n.closest("section.section-component"),s=Array.from(document.body.querySelectorAll(".section-component"));if(v.sectionCounter=s.length,r?Z()&&(r.appendChild(z),r.appendChild(v)):v.remove(),u===r&&u&&u.contains(w))return;const l=E.Z.components.filter((e=>"block"!==e.type&&"section"!==e.type));o&&0===l.length?(u=o,Z()&&(o.appendChild(w),o.appendChild(S))):(w.remove(),o&&Z()&&o.appendChild(S),u=null),o||S.remove()}else W.remove(),N.remove()};const Y=setInterval((()=>{h.h.get("config","target")&&(clearInterval(Y),function(){const e=h.h.get("config","target");e&&"true"!==e.dataset?.cdtrListenersAttached&&(e.dataset.cdtrListenersAttached="true",e.addEventListener(a.F.MOUSE_DOWN,O))}(),a.Z.connect(a.F.MOUSE_OVER,I))}),50)},9328:(e,n,t)=>{t.d(n,{Z:()=>l});var o=t(40272),a=t.n(o),r=t(82609),s=t.n(r)()(a());s.push([e.id,".MO1bHL0Mf6pjhEtylQC_ {\n outline: 1px solid var(--primary) !important;\n}\n.MO1bHL0Mf6pjhEtylQC_ {\n /* background: rgba(0, 0, 255, 0.041); */\n}\n.QRabUK5WcW0UEvk5Gl4A{\n left:0;\n top:0;\n opacity:.7;\n transform: translate(-70%,120%) rotate(-90deg)\n}\n.fFpcfOw2e_4jcwlu9RkW{\n position: absolute;\n padding:2px;\n background: var(--primary);\n width: -moz-fit-content;\n width: fit-content;\n text-align: center;\n border-radius: 0;\n z-index: 99;\n color: var(--primary-text);\n font-size: 11px;\n /* zindex 99 to be strong than the split cells, fix the zindex there before fix here */\n}\n\n.xx7ldRh0c8iUAfIGZgAA {\n position: absolute;\n top: 0;\n left: 0;\n font-size: 12px;\n width: 100%;\n height: 100%;\n z-index: 1;\n}\n.NaXFMGugy5ZAgwCl1CR2 {\n transform: translateY(-100%);\n}\n.xJCqQVfziE9Wepw5WRYw {\n outline: black 1px solid;\n}\n.o4KmgQFcCaF1bh4BEUrs {\n position: absolute;\n background: rgb(255, 255, 255);\n z-index: 3;\n width: auto;\n min-width: 100px;\n color: black;\n border-radius: 0.2rem;\n min-height: 27px;\n box-shadow: rgba(0, 0, 0, 0.02) 0px 1px 3px 0px,\n rgba(27, 31, 35, 0.15) 0px 0px 0px 1px;\n}\n.XmM6cGXGiBaGwyP5KrLn {\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99;\n}\n.bgoCbWHegQxp7l0GPJa1 {\n position: absolute;\n top: 100%;\n left: 0;\n transform: translate(50%, -50%);\n z-index: 99;\n background: var(--primary);\n padding: 8px;\n color: #fff;\n border-radius: 20px;\n box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;\n}\n.xUyjjx7MdpTSI8OJ7U8q {\n background: #fff;\n fill: var(--primary);\n position: absolute;\n top: 0;\n left: 0;\n box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;\n padding: 3px;\n min-width: 10px;\n cursor: grab;\n}\n.xUyjjx7MdpTSI8OJ7U8q:active {\n cursor: grabbing !important;\n}\n","",{version:3,sources:["webpack://./src/core/EditorUI/handlers/handleComponents/style.module.css"],names:[],mappings:"AAAA;EACE,4CAA4C;AAE9C;AAHA;EAEE,wCAAwC;AAC1C;AACA;EACE,MAAM;EACN,KAAK;EACL,UAAU;EACV;AACF;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,0BAA0B;EAC1B,uBAAkB;EAAlB,kBAAkB;EAClB,kBAAkB;EAClB,gBAAgB;EAChB,WAAW;EACX,0BAA0B;EAC1B,eAAe;EACf,sFAAsF;AACxF;;AAEA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,eAAe;EACf,WAAW;EACX,YAAY;EACZ,UAAU;AACZ;AACA;EACE,4BAA4B;AAC9B;AACA;EACE,wBAAwB;AAC1B;AACA;EACE,kBAAkB;EAClB,8BAA8B;EAC9B,UAAU;EACV,WAAW;EACX,gBAAgB;EAChB,YAAY;EACZ,qBAAqB;EACrB,gBAAgB;EAChB;0CACwC;AAC1C;AACA;EACE,kBAAkB;EAClB,SAAS;EACT,SAAS;EACT,gCAAgC;EAChC,WAAW;AACb;AACA;EACE,kBAAkB;EAClB,SAAS;EACT,OAAO;EACP,+BAA+B;EAC/B,WAAW;EACX,0BAA0B;EAC1B,YAAY;EACZ,WAAW;EACX,mBAAmB;EACnB,2FAA2F;AAC7F;AACA;EACE,gBAAgB;EAChB,oBAAoB;EACpB,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,2CAA2C;EAC3C,YAAY;EACZ,eAAe;EACf,YAAY;AACd;AACA;EACE,2BAA2B;AAC7B",sourcesContent:[".onHover {\n outline: 1px solid var(--primary) !important;\n /* background: rgba(0, 0, 255, 0.041); */\n}\n.componentCardName{\n left:0;\n top:0;\n opacity:.7;\n transform: translate(-70%,120%) rotate(-90deg)\n}\n.componentName{\n position: absolute;\n padding:2px;\n background: var(--primary);\n width: fit-content;\n text-align: center;\n border-radius: 0;\n z-index: 99;\n color: var(--primary-text);\n font-size: 11px;\n /* zindex 99 to be strong than the split cells, fix the zindex there before fix here */\n}\n\n.tagContainer {\n position: absolute;\n top: 0;\n left: 0;\n font-size: 12px;\n width: 100%;\n height: 100%;\n z-index: 1;\n}\n.tagName {\n transform: translateY(-100%);\n}\n.pesudoSelected {\n outline: black 1px solid;\n}\n.breadcrumbs {\n position: absolute;\n background: rgb(255, 255, 255);\n z-index: 3;\n width: auto;\n min-width: 100px;\n color: black;\n border-radius: 0.2rem;\n min-height: 27px;\n box-shadow: rgba(0, 0, 0, 0.02) 0px 1px 3px 0px,\n rgba(27, 31, 35, 0.15) 0px 0px 0px 1px;\n}\n.addIcon {\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99;\n}\n.addSection {\n position: absolute;\n top: 100%;\n left: 0;\n transform: translate(50%, -50%);\n z-index: 99;\n background: var(--primary);\n padding: 8px;\n color: #fff;\n border-radius: 20px;\n box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;\n}\n.colHandle {\n background: #fff;\n fill: var(--primary);\n position: absolute;\n top: 0;\n left: 0;\n box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;\n padding: 3px;\n min-width: 10px;\n cursor: grab;\n}\n.colHandle:active {\n cursor: grabbing !important;\n}\n"],sourceRoot:""}]),s.locals={onHover:"MO1bHL0Mf6pjhEtylQC_",componentCardName:"QRabUK5WcW0UEvk5Gl4A",componentName:"fFpcfOw2e_4jcwlu9RkW",tagContainer:"xx7ldRh0c8iUAfIGZgAA",tagName:"NaXFMGugy5ZAgwCl1CR2",pesudoSelected:"xJCqQVfziE9Wepw5WRYw",breadcrumbs:"o4KmgQFcCaF1bh4BEUrs",addIcon:"XmM6cGXGiBaGwyP5KrLn",addSection:"bgoCbWHegQxp7l0GPJa1",colHandle:"xUyjjx7MdpTSI8OJ7U8q"};const l=s}}]);
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6652],{96652:(e,n,t)=>{t.r(n);var o=t(40949),a=t(43214),r=t(46062),s=t.n(r),l=t(32877),c=t.n(l),p=t(96793),i=t.n(p),A=t(17892),d=t.n(A),m=t(11173),C=t.n(m),f=t(9328),g={};g.setAttributes=d(),g.insert=i().bind(null,"head"),g.domAPI=c(),g.insertStyleElement=C();s()(f.Z,g);const b=f.Z&&f.Z.locals?f.Z.locals:void 0;var x=t(58860),h=t(70235),E=(t(92070),t(45607));let u,y=[],B=!1;const k=e=>{const n=e.detail,t=h.h.get("components",n.dataset.id);if(!t)throw new Error("component is not defined");const o=t?.element?.nextElementSibling;if(o){const e=h.h.get("components",o.dataset.id);e&&E.Z.clean().selectComponent(e)}else{const e=t.element.previousElementSibling;if(e){const n=h.h.get("components",e.dataset.id);n&&E.Z.clean().selectComponent(n)}}E.Z.store().removeComponent({componentId:t.id})},v=(0,o.Z)("cdtr-background-handle-bar",{onClick:()=>{setTimeout((()=>{E.Z.selectComponent(h.h.get("components").find((e=>e.type.equalWith("root"))))}),0)},target:".section-component",onRemove:k}),Z=()=>{const e=h.h.get("config","editor","configure","editorProps");if(!e)return!0;return e&&"object"==typeof e&&!1!==e.addNewElementsFunctionality},w=(0,o.Z)("cdtr-element-handle-bar",{onRemove:k,onClone:e=>{const n=e.detail,t=h.h.get("components",n.dataset.id);if(!t)throw new Error("component is not defined");const o=t.closest("section");let a=o.children.findIndex((e=>e===t.id));"number"!=typeof a?a=0:a++,E.Z.cloneComponent({componentId:t.id,parentId:o.id,index:a})},target:".block-component"}),W=(0,o.Z)("paper-button",{style:{left:0,top:0,opacity:.7},className:b.componentName}),M=(0,o.Z)("paper-button",{style:{left:0,top:0,zIndex:100,minWidth:"60px"},className:b.componentName}),U=(0,o.Z)("paper-button",{style:{left:0,top:0,opacity:.7},className:`${b.componentCardName} ${b.componentName}`},h.h.get("lang","card")),N=(0,o.Z)("paper-button",{style:{left:"10%",top:0,opacity:.7,transform:"translateY(-100%)",zIndex:3},className:`${b.componentName}`},h.h.get("lang","block")||"block"),S=(0,o.Z)("cdtr-fab-button",{"data-name":"add-new-block-v1",onMouseUp:e=>{x.Z.dispatch("open_add_menu",{type:"block-component",target:e.target.closest(".block-component")})},class:b.addIcon},(0,o.Z)("cdtr-add-icon",{iconStyle:"fill:#fff;"})),z=(0,o.Z)("paper-button",{onMouseUp:e=>x.Z.dispatch("open_add_menu",{type:"section-component",target:e.target.closest(".section-component")}),class:b.addSection},(0,o.Z)("cdtr-add-icon",{iconStyle:"fill:#fff;"}),(0,o.Z)("lang-text",{text:"add_section"}));a.Z.connect(a.F.KEY_DOWN,(e=>{if("Delete"===e.key){const n=document.querySelector("[data-type='block'].selected");n&&(e.preventDefault(),k({detail:n}))}}));const F=(0,o.Z)("div",{className:b.breadcrumbs});a.Z.connect(a.F.KEY_DOWN,(e=>{if("Control"!==e.key||!document.activeElement||document.activeElement.closest("[contenteditable]"))return;B=!0;E.Z.components.find((e=>e.isSelected))&&document.body.appendChild(F)})),a.Z.connect(a.F.KEY_UP,(e=>{B=!1}));const O=e=>{let{path:n,target:t,shiftKey:o,ctrlKey:a}=e;const r=a;if(h.h.set({ctrlKey:r}),t.closest("cdtr-move-handle-bar"))return;let s=t.closest("[class*='-component']");t.closest(".block-component");setTimeout((()=>{if(!s)return;const e=h.h.get("components",s.dataset.id);if(s&&e)if(r&&E.Z.components.length>0&&E.Z.components[0].type===e.type)E.Z.selectComponent(e);else switch(E.Z.clean().selectComponent(e),s.appendChild(M),M.dataset.mounted=e.type,M.innerHTML=e.props.name||h.h.get("lang",e.type)||e.type.getElementType(),e.type){case"block":M.style.left="10%",M.style.transform="rotate(0deg) translate(-5%,-100%)";break;case"form":M.style.left="100%",M.style.transform="rotate(90deg) translate(10%, -7px)";break;case"card":M.style.transform="translate(-70%,120%) rotate(-90deg)",M.style.left="0",M.style.top="0";const e=h.h.get("components",M.dataset.id);e&&(M.innerHTML=e.props.name||h.h.get("lang",e.type)||e.type.getElementType());break;default:M.style.transform="rotate(0deg) translate(-103%,-100%)",M.style.left="100%"}else{if(s=s.closest(".text-component"),!s)return E.Z.clean();E.Z.clean().selectComponent(e)}if(E.Z.components.filter((e=>"block"!==e.type&&"section"!==e.type)).length>0)w.remove(),S.remove();else{const e=E.Z.components.find((e=>"block"===e.type));e&&(u=e,Z()&&(e.appendChild(w),e.appendChild(S)))}}),130)},I=e=>{const n=e.target;if(!n)return;let t=n.closest("[class*='-component']");if(t){const e=t.closest(".card-component"),o=t.closest(".block-component"),a=h.h.get("components",t.dataset.id);if(a){switch(W.innerHTML=a.props.name||h.h.get("lang",a.type)||a.type.getElementType(),t.appendChild(W),a.type){case"card":case"form":case"block":W.remove();break;case"form":W.style.left="100%",W.style.transform="rotate(90deg) translate(10%, -7px)";break;default:W.style.transform="translate(-103%,-100%)",W.style.left="100%"}e?e.appendChild(U):n.closest(".card-component")||U.remove(),o&&(o?o.appendChild(N):N.remove())}y.forEach((e=>e.classList.remove("selected-on-hover"))),a&&"form"===a.type&&(t=n.closest(".card-component")),t.classList.add("selected-on-hover"),y=[t];const r=n.closest("section.section-component"),s=Array.from(document.body.querySelectorAll(".section-component"));if(v.sectionCounter=s.length,r?Z()&&(r.appendChild(z),r.appendChild(v)):v.remove(),u===r&&u&&u.contains(w))return;const l=E.Z.components.filter((e=>"block"!==e.type&&"section"!==e.type));o&&0===l.length?(u=o,Z()&&(o.appendChild(w),o.appendChild(S))):(w.remove(),o&&Z()&&o.appendChild(S),u=null),o||S.remove()}else W.remove(),N.remove()};const Y=setInterval((()=>{h.h.get("config","target")&&(clearInterval(Y),function(){const e=h.h.get("config","target");e&&"true"!==e.dataset?.cdtrListenersAttached&&(e.dataset.cdtrListenersAttached="true",e.addEventListener(a.F.MOUSE_DOWN,O))}(),a.Z.connect(a.F.MOUSE_OVER,I))}),50)},9328:(e,n,t)=>{t.d(n,{Z:()=>l});var o=t(40272),a=t.n(o),r=t(82609),s=t.n(r)()(a());s.push([e.id,".MO1bHL0Mf6pjhEtylQC_ {\n outline: 1px solid var(--primary) !important;\n}\n.MO1bHL0Mf6pjhEtylQC_ {\n /* background: rgba(0, 0, 255, 0.041); */\n}\n.QRabUK5WcW0UEvk5Gl4A{\n left:0;\n top:0;\n opacity:.7;\n transform: translate(-70%,120%) rotate(-90deg)\n}\n.fFpcfOw2e_4jcwlu9RkW{\n position: absolute;\n padding:2px;\n background: var(--primary);\n width: -moz-fit-content;\n width: fit-content;\n text-align: center;\n border-radius: 0;\n z-index: 99;\n color: var(--primary-text);\n font-size: 11px;\n /* zindex 99 to be strong than the split cells, fix the zindex there before fix here */\n}\n\n.xx7ldRh0c8iUAfIGZgAA {\n position: absolute;\n top: 0;\n left: 0;\n font-size: 12px;\n width: 100%;\n height: 100%;\n z-index: 1;\n}\n.NaXFMGugy5ZAgwCl1CR2 {\n transform: translateY(-100%);\n}\n.xJCqQVfziE9Wepw5WRYw {\n outline: black 1px solid;\n}\n.o4KmgQFcCaF1bh4BEUrs {\n position: absolute;\n background: rgb(255, 255, 255);\n z-index: 3;\n width: auto;\n min-width: 100px;\n color: black;\n border-radius: 0.2rem;\n min-height: 27px;\n box-shadow: rgba(0, 0, 0, 0.02) 0px 1px 3px 0px,\n rgba(27, 31, 35, 0.15) 0px 0px 0px 1px;\n}\n.XmM6cGXGiBaGwyP5KrLn {\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99;\n}\n.bgoCbWHegQxp7l0GPJa1 {\n position: absolute;\n top: 100%;\n left: 0;\n transform: translate(50%, -50%);\n z-index: 99;\n background: var(--primary);\n padding: 8px;\n color: #fff;\n border-radius: 20px;\n box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;\n}\n.xUyjjx7MdpTSI8OJ7U8q {\n background: #fff;\n fill: var(--primary);\n position: absolute;\n top: 0;\n left: 0;\n box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;\n padding: 3px;\n min-width: 10px;\n cursor: grab;\n}\n.xUyjjx7MdpTSI8OJ7U8q:active {\n cursor: grabbing !important;\n}\n","",{version:3,sources:["webpack://./src/core/EditorUI/handlers/handleComponents/style.module.css"],names:[],mappings:"AAAA;EACE,4CAA4C;AAE9C;AAHA;EAEE,wCAAwC;AAC1C;AACA;EACE,MAAM;EACN,KAAK;EACL,UAAU;EACV;AACF;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,0BAA0B;EAC1B,uBAAkB;EAAlB,kBAAkB;EAClB,kBAAkB;EAClB,gBAAgB;EAChB,WAAW;EACX,0BAA0B;EAC1B,eAAe;EACf,sFAAsF;AACxF;;AAEA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,eAAe;EACf,WAAW;EACX,YAAY;EACZ,UAAU;AACZ;AACA;EACE,4BAA4B;AAC9B;AACA;EACE,wBAAwB;AAC1B;AACA;EACE,kBAAkB;EAClB,8BAA8B;EAC9B,UAAU;EACV,WAAW;EACX,gBAAgB;EAChB,YAAY;EACZ,qBAAqB;EACrB,gBAAgB;EAChB;0CACwC;AAC1C;AACA;EACE,kBAAkB;EAClB,SAAS;EACT,SAAS;EACT,gCAAgC;EAChC,WAAW;AACb;AACA;EACE,kBAAkB;EAClB,SAAS;EACT,OAAO;EACP,+BAA+B;EAC/B,WAAW;EACX,0BAA0B;EAC1B,YAAY;EACZ,WAAW;EACX,mBAAmB;EACnB,2FAA2F;AAC7F;AACA;EACE,gBAAgB;EAChB,oBAAoB;EACpB,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,2CAA2C;EAC3C,YAAY;EACZ,eAAe;EACf,YAAY;AACd;AACA;EACE,2BAA2B;AAC7B",sourcesContent:[".onHover {\n outline: 1px solid var(--primary) !important;\n /* background: rgba(0, 0, 255, 0.041); */\n}\n.componentCardName{\n left:0;\n top:0;\n opacity:.7;\n transform: translate(-70%,120%) rotate(-90deg)\n}\n.componentName{\n position: absolute;\n padding:2px;\n background: var(--primary);\n width: fit-content;\n text-align: center;\n border-radius: 0;\n z-index: 99;\n color: var(--primary-text);\n font-size: 11px;\n /* zindex 99 to be strong than the split cells, fix the zindex there before fix here */\n}\n\n.tagContainer {\n position: absolute;\n top: 0;\n left: 0;\n font-size: 12px;\n width: 100%;\n height: 100%;\n z-index: 1;\n}\n.tagName {\n transform: translateY(-100%);\n}\n.pesudoSelected {\n outline: black 1px solid;\n}\n.breadcrumbs {\n position: absolute;\n background: rgb(255, 255, 255);\n z-index: 3;\n width: auto;\n min-width: 100px;\n color: black;\n border-radius: 0.2rem;\n min-height: 27px;\n box-shadow: rgba(0, 0, 0, 0.02) 0px 1px 3px 0px,\n rgba(27, 31, 35, 0.15) 0px 0px 0px 1px;\n}\n.addIcon {\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99;\n}\n.addSection {\n position: absolute;\n top: 100%;\n left: 0;\n transform: translate(50%, -50%);\n z-index: 99;\n background: var(--primary);\n padding: 8px;\n color: #fff;\n border-radius: 20px;\n box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;\n}\n.colHandle {\n background: #fff;\n fill: var(--primary);\n position: absolute;\n top: 0;\n left: 0;\n box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;\n padding: 3px;\n min-width: 10px;\n cursor: grab;\n}\n.colHandle:active {\n cursor: grabbing !important;\n}\n"],sourceRoot:""}]),s.locals={onHover:"MO1bHL0Mf6pjhEtylQC_",componentCardName:"QRabUK5WcW0UEvk5Gl4A",componentName:"fFpcfOw2e_4jcwlu9RkW",tagContainer:"xx7ldRh0c8iUAfIGZgAA",tagName:"NaXFMGugy5ZAgwCl1CR2",pesudoSelected:"xJCqQVfziE9Wepw5WRYw",breadcrumbs:"o4KmgQFcCaF1bh4BEUrs",addIcon:"XmM6cGXGiBaGwyP5KrLn",addSection:"bgoCbWHegQxp7l0GPJa1",colHandle:"xUyjjx7MdpTSI8OJ7U8q"};const l=s}}]);
Binary file
@@ -1,5 +1,5 @@
1
1
  /*! For license information please see 7988.creaditor.bundle.js.LICENSE.txt */
2
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[7988,2340],{87988:(t,e,i)=>{i.r(e),i.d(e,{default:()=>g});var n=i(47887),s=i(504);const r=t=>{{const{component:e,commands:i,helpers:r}=t,o=e.tiptap,a=o.state.selection.$anchor.node().attrs,l=o.isActive("heading",{level:1})?"h1":o.isActive("heading",{level:2})?"h2":o.isActive("heading",{level:3})?"h3":o.isActive("heading",{level:4})?"h4":o.isActive("heading",{level:5})?"h5":o.isActive("heading",{level:6})?"h6":"paragraph";let c=t.languageJson;const d=t.language||"he";return c||(c="he"===d?n:s),{select:t=>{let{changeTab:e,tab:i}=t},tabs:t=>{const e=[{text:"design",selected:!0},...o.isActive("customBulletItem")?[{text:"icons"}]:[],{text:"settings"}];return e.forEach((e=>e.selected=e.text===t)),e},layout:t=>{let{tab:n,changeTab:s,tabs:r}=t;const d=[{type:"info",text:"text_micro_copy",active:()=>"design"===n.text},{type:"dropdown",active:()=>"design"===n.text,title:"type",value:l,items:[{value:"H1"},{value:"H2"},{value:"H3"},{value:"H4"},{value:"H5"},{value:"H6"},{value:"paragraph"}],onChange:t=>{const e=t.target.value;switch(e){case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":o.chain().setHeading({level:parseInt(e.slice(1))}).run();break;case"paragraph":o.chain().setParagraph().run()}}},{type:"slider",title:"fontSize",min:8,step:2,max:74,value:parseInt(o.getAttributes("textStyle").fontSize||"16px"),active:()=>"design"===n.text,onInput:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;s.from===s.to?n.chain().selectAll().setFontSize(i).run():n.chain().setFontSize(i).run()}},{type:"divider"},{type:"slider",title:"lineHeight",min:1,max:3,step:.1,value:parseFloat(a.lineHeight||1),active:()=>"design"===n.text,onInput:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;s.from===s.to?n.chain().selectAll().setLineHeight(i).run():n.chain().setLineHeight(i).run()}},{type:"divider",active:()=>"design"===n.text},{type:"slider",title:"letterSpacing",min:1,max:10,step:1,value:parseFloat(a.letterSpacing)||1,active:()=>"design"===n.text,onInput:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;i<=1?s.from===s.to?n.chain().selectAll().setLetterSpacing("normal").run():n.chain().setLetterSpacing("normal").run():s.from===s.to?n.chain().selectAll().setLetterSpacing(i+"px").run():n.chain().setLetterSpacing(i+"px").run()}},{type:"divider",active:()=>"design"===n.text},{type:"colorpicker",active:()=>"design"===n.text,title:"font_color",alpha:!1,value:o.getAttributes("textStyle").color||"#0000",onChange:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;if(s.from===s.to){const{state:t,view:e}=n,r=t.tr,{from:o,to:a}=s.from===s.to?{from:0,to:t.doc.content.size}:{from:s.from,to:s.to};t.doc.nodesBetween(o,a,((e,n)=>{if(e.isText){t.doc.resolve(n);if(!e.marks.some((t=>"link"===t.type.name))){const s=n,o=n+e.nodeSize;r.addMark(s,o,t.schema.marks.textStyle.create({color:i}))}}})),e.dispatch(r)}else n.chain().setColor(i).focus().run()}},{type:"divider",active:()=>"design"===n.text},{type:"colorpicker",active:()=>"design"===n.text,title:"backgroundColor",value:e.props.style.background||e.props.style.backgroundColor||"#fff",onChange:t=>{const e=t.target.value;i.execCommand("style",{background:e,backgroundColor:null})}},{type:"divider",active:()=>"design"===n.text},{type:"slider",active:()=>"design"===n.text,title:"maxWidth",value:parseFloat(e.props.style.width),min:20,max:1e3,onInput:t=>{const e=t.target.value;i.execCommand("style",{width:e+"px"})}},{type:"divider"},{type:"colorpicker",active:()=>"icons"===n.text,title:c.iconColor||"Icon color",alpha:!1,value:o.getAttributes("textStyle").color||"#0000",onChange:t=>{const e=t.target.value;o.chain().setCustomBulletStyles({fill:e}).run()}},{type:"divider",active:()=>"icons"===n.text},{type:"slider",active:()=>"icons"===n.text,title:c.iconSize||"Icon size",value:parseInt(o.getAttributes("customBulletItem").width)||24,min:10,max:40,onInput:t=>{const e=t.target.value;o.chain().setCustomBulletStyles({width:e+"px",height:e+"px"}).run()}},{type:"icons",active:()=>"icons"===n.text,selectedIcon:e.props.src,useIconsApi:!0,iconColor:e.props.iconColor||"000000",iconSize:parseInt(e.props.style?.width,10)||24,onChange:t=>{const i=t.detail;e.tiptap.chain().focus().setCustomBulletIcon({svgIcon:i.urlPng}).run()}}];return d}}}};var o=i(46245);const a=t=>{let{helpers:e,tiptap:i,composeId:n,template:s}=t;return{set:(t,r,a)=>{switch(r){case"style":return"object"==typeof a&&(t[r]=(0,o.Z)(t[r],a),e.mergeDiff(s,{style:t[r]})),!0;case"text":t[r]=a;const l=i.getJSON();return a&&"object"==typeof a&&JSON.stringify(l)!==JSON.stringify(a.childNodes)&&(a&&a.focusedElement&&a.focusedElement===n?(i.chain().focus().setContent(a.childNodes).run(),a.to&&a.from&&i.commands.setTextSelection({from:a.from,to:a.to})):i.chain().setContent(a.childNodes).run()),delete t?.text?.markdown,!0}}}};var l=i(57701),c=i.n(l),d=i(70235);i(32340);const p=[];let h=!1,u=null;const g=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e="text";return{name:e,create:i=>{const{createElement:n,compose:s,helpers:o}=i,{mergeDiff:l}=o,g=document.createElement("div");l(g,{style:s.props.style});const m=d.h.get("config","editor","configure","editorProps","fonts");let f=d.h.get("config","target");"string"==typeof f&&(f=document.querySelector(f)),f||(f=document.body);const y=c()({element:g,container:f||document.body,editable:!0,offsetTop:40,onClickMagic:t=>{let{insertContent:e,getJSON:i,getHTML:n,getText:s,selectAll:r,insertContentHtml:o}=t;const a=d.h.get("injectEditor"),l=document.createElement("cdtr-text-prompt-editor");a(l),l.context=s(),l.addEventListener("text-generation-start",(t=>{r()})),l.addEventListener("text-generation-chunk",(t=>{e(t.detail.chunk)})),l.addEventListener("text-generation-complete",(t=>{r(),o(t.detail.text)})),l.addEventListener("text-generation-error",(t=>{console.error("Text generation error:",t.detail.error)}))},content:"string"==typeof s.props.text.markdown?s.props.text.markdown:s.props.text.childNodes,defaultDirection:"rtl",onBlur:()=>{u===y&&(u=null),setTimeout((()=>{u!==y&&(h=!1)}),150)},onFocus:()=>{if(!h||u===y||null===u){if(h=!0,u=y,p.length>0)for(p.forEach((t=>{t!==y&&t.hideEditor()}));p.length>0;)p.pop();p.push(y),setTimeout((()=>{u===y&&h&&y.showEditor()}),100)}},onUpdate:t=>{let{editor:e,transaction:i}=t;if(0===i.steps.length)return;const n=i.curSelection.from,r=i.curSelection.to,o={childNodes:e.getJSON(),from:n,to:r,focusedElement:s.id};v.commands.execCommand("text",o)},ignoresBlurByQuerySelectors:[".ignore-events"],builder:[{type:"fontFamily",fonts:m||[],useCloud:!0},{type:"fontSize",sizes:t.fontSize||[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74]},{type:"horizonRule"},{type:"clearFormat"},{type:"bold"},{type:"strike"},{type:"italic"},{type:"underline"},{type:"table"},{type:"emoji"},{type:"unLink"},{type:"link"},{type:"customList"},{type:"numbered"},{type:"bullet"},{type:"backcolor"},{type:"fontColor"},{type:"direction"},{type:"justify"},{type:"right"},{type:"center"},{type:"left"},{type:"image"},{type:"mergeTags"},{type:"magic"}]}),v=n({name:e,id:s.id,template:g,defaultProps:{text:{},style:{}},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>g,handleBar:!0,validator:a({template:g,helpers:o,tiptap:y,composeId:s.id}),schema:s.schema,onSelect:t=>{g.classList.add(t)},onDeselect:t=>{g.classList.remove(t)},elementProps:s,remove:()=>{g.remove()},createEditor:r});return s.props.text.markdown&&y.chain().insertContent(" ").run(),v.addProp("tiptap",y),v}}}},32340:(t,e,i)=>{i.r(e),i.d(e,{TextPromptEditor:()=>ft});var n=i(56666),s=i(76828);const r=globalThis,o=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),l=new WeakMap;class c{constructor(t,e,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(o&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=l.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&l.set(e,t))}return t}toString(){return this.cssText}}const d=o?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new c("string"==typeof t?t:t+"",void 0,a))(e)})(t):t,{is:p,defineProperty:h,getOwnPropertyDescriptor:u,getOwnPropertyNames:g,getOwnPropertySymbols:m,getPrototypeOf:f}=Object,y=globalThis,v=y.trustedTypes,x=v?v.emptyScript:"",b=y.reactiveElementPolyfillSupport,$=(t,e)=>t,_={toAttribute(t,e){switch(e){case Boolean:t=t?x:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},A=(t,e)=>!p(t,e),E={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:A};Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;class w extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=E){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(t,i,e);void 0!==n&&h(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){const{get:n,set:s}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:n,set(e){const r=n?.call(this);s?.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??E}static _$Ei(){if(this.hasOwnProperty($("elementProperties")))return;const t=f(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty($("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty($("properties"))){const t=this.properties,e=[...g(t),...m(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(o)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),n=r.litNonce;void 0!==n&&e.setAttribute("nonce",n),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(void 0!==n&&!0===i.reflect){const s=(void 0!==i.converter?.toAttribute?i.converter:_).toAttribute(e,i.type);this._$Em=t,null==s?this.removeAttribute(n):this.setAttribute(n,s),this._$Em=null}}_$AK(t,e){const i=this.constructor,n=i._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=i.getPropertyOptions(n),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:_;this._$Em=n;const r=s.fromAttribute(e,t.type);this[n]=r??this._$Ej?.get(n)??r,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const n=this.constructor,s=this[t];if(i??=n.getPropertyOptions(t),!((i.hasChanged??A)(s,e)||i.useDefault&&i.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:n,wrapped:s},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==s||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===n&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,n=this[e];!0!==t||this._$AL.has(e)||void 0===n||this.C(e,void 0,i,n)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}}w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[$("elementProperties")]=new Map,w[$("finalized")]=new Map,b?.({ReactiveElement:w}),(y.reactiveElementVersions??=[]).push("2.1.1");const S=globalThis,C=S.trustedTypes,T=C?C.createPolicy("lit-html",{createHTML:t=>t}):void 0,k="$lit$",P=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+P,H=`<${N}>`,O=document,U=()=>O.createComment(""),I=t=>null===t||"object"!=typeof t&&"function"!=typeof t,z=Array.isArray,L=t=>z(t)||"function"==typeof t?.[Symbol.iterator],M="[ \t\n\f\r]",R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,B=/-->/g,D=/>/g,j=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),F=/'/g,W=/"/g,J=/^(?:script|style|textarea|title)$/i,Y=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),q=Y(1),V=(Y(2),Y(3),Symbol.for("lit-noChange")),Z=Symbol.for("lit-nothing"),G=new WeakMap,K=O.createTreeWalker(O,129);function Q(t,e){if(!z(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==T?T.createHTML(e):e}const X=(t,e)=>{const i=t.length-1,n=[];let s,r=2===e?"<svg>":3===e?"<math>":"",o=R;for(let e=0;e<i;e++){const i=t[e];let a,l,c=-1,d=0;for(;d<i.length&&(o.lastIndex=d,l=o.exec(i),null!==l);)d=o.lastIndex,o===R?"!--"===l[1]?o=B:void 0!==l[1]?o=D:void 0!==l[2]?(J.test(l[2])&&(s=RegExp("</"+l[2],"g")),o=j):void 0!==l[3]&&(o=j):o===j?">"===l[0]?(o=s??R,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?j:'"'===l[3]?W:F):o===W||o===F?o=j:o===B||o===D?o=R:(o=j,s=void 0);const p=o===j&&t[e+1].startsWith("/>")?" ":"";r+=o===R?i+H:c>=0?(n.push(a),i.slice(0,c)+k+i.slice(c)+P+p):i+P+(-2===c?e:p)}return[Q(t,r+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class tt{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let s=0,r=0;const o=t.length-1,a=this.parts,[l,c]=X(t,e);if(this.el=tt.createElement(l,i),K.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=K.nextNode())&&a.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(k)){const e=c[r++],i=n.getAttribute(t).split(P),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:s,name:o[2],strings:i,ctor:"."===o[1]?rt:"?"===o[1]?ot:"@"===o[1]?at:st}),n.removeAttribute(t)}else t.startsWith(P)&&(a.push({type:6,index:s}),n.removeAttribute(t));if(J.test(n.tagName)){const t=n.textContent.split(P),e=t.length-1;if(e>0){n.textContent=C?C.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],U()),K.nextNode(),a.push({type:2,index:++s});n.append(t[e],U())}}}else if(8===n.nodeType)if(n.data===N)a.push({type:2,index:s});else{let t=-1;for(;-1!==(t=n.data.indexOf(P,t+1));)a.push({type:7,index:s}),t+=P.length-1}s++}}static createElement(t,e){const i=O.createElement("template");return i.innerHTML=t,i}}function et(t,e,i=t,n){if(e===V)return e;let s=void 0!==n?i._$Co?.[n]:i._$Cl;const r=I(e)?void 0:e._$litDirective$;return s?.constructor!==r&&(s?._$AO?.(!1),void 0===r?s=void 0:(s=new r(t),s._$AT(t,i,n)),void 0!==n?(i._$Co??=[])[n]=s:i._$Cl=s),void 0!==s&&(e=et(t,s._$AS(t,e.values),s,n)),e}class it{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,n=(t?.creationScope??O).importNode(e,!0);K.currentNode=n;let s=K.nextNode(),r=0,o=0,a=i[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new nt(s,s.nextSibling,this,t):1===a.type?e=new a.ctor(s,a.name,a.strings,this,t):6===a.type&&(e=new lt(s,this,t)),this._$AV.push(e),a=i[++o]}r!==a?.index&&(s=K.nextNode(),r++)}return K.currentNode=O,n}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class nt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,n){this.type=2,this._$AH=Z,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=et(this,t,e),I(t)?t===Z||null==t||""===t?(this._$AH!==Z&&this._$AR(),this._$AH=Z):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):L(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Z&&I(this._$AH)?this._$AA.nextSibling.data=t:this.T(O.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,n="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=tt.createElement(Q(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new it(n,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new tt(t)),e}k(t){z(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const s of t)n===e.length?e.push(i=new nt(this.O(U()),this.O(U()),this,this.options)):i=e[n],i._$AI(s),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class st{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,n,s){this.type=1,this._$AH=Z,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Z}_$AI(t,e=this,i,n){const s=this.strings;let r=!1;if(void 0===s)t=et(this,t,e,0),r=!I(t)||t!==this._$AH&&t!==V,r&&(this._$AH=t);else{const n=t;let o,a;for(t=s[0],o=0;o<s.length-1;o++)a=et(this,n[i+o],e,o),a===V&&(a=this._$AH[o]),r||=!I(a)||a!==this._$AH[o],a===Z?t=Z:t!==Z&&(t+=(a??"")+s[o+1]),this._$AH[o]=a}r&&!n&&this.j(t)}j(t){t===Z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class rt extends st{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Z?void 0:t}}class ot extends st{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Z)}}class at extends st{constructor(t,e,i,n,s){super(t,e,i,n,s),this.type=5}_$AI(t,e=this){if((t=et(this,t,e,0)??Z)===V)return;const i=this._$AH,n=t===Z&&i!==Z||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,s=t!==Z&&(i===Z||n);n&&this.element.removeEventListener(this.name,this,i),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class lt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){et(this,t)}}const ct=S.litHtmlPolyfillSupport;ct?.(tt,nt),(S.litHtmlVersions??=[]).push("3.3.1");const dt=globalThis;class pt extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const n=i?.renderBefore??e;let s=n._$litPart$;if(void 0===s){const t=i?.renderBefore??null;n._$litPart$=s=new nt(e.insertBefore(U(),t),t,void 0,i??{})}return s._$AI(t),s})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}}pt._$litElement$=!0,pt.finalized=!0,dt.litElementHydrateSupport?.({LitElement:pt});const ht=dt.litElementPolyfillSupport;ht?.({LitElement:pt});(dt.litElementVersions??=[]).push("4.2.1");var ut,gt,mt;let ft=(ut=(t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)})("cdtr-text-prompt-editor"),ut((mt=class extends pt{constructor(){super(),this.prompt=localStorage.getItem("textPromptEditor_prompt")||"",this.generatedText="",this.isLoading=!1,this.context="",this.businessType=localStorage.getItem("textPromptEditor_businessType")||"",this.businessName=localStorage.getItem("textPromptEditor_businessName")||"",this.includeContext="true"===localStorage.getItem("textPromptEditor_includeContext")||!1,this.url=localStorage.getItem("textPromptEditor_url")||"",this.detectCurrentElementType()}connectedCallback(){super.connectedCallback(),setTimeout((()=>{this.detectCurrentElementType()}),100)}detectCurrentElementType(){try{const t=window.getSelection();if(t&&t.rangeCount>0){const e=t.getRangeAt(0).commonAncestorContainer;let i=e.nodeType===Node.TEXT_NODE?e.parentElement:e;for(;i&&i!==document.body;){if(i.tagName&&/^h[1-6]$/i.test(i.tagName)){const t=i.parentElement,e=Array.from(t?.children||[]),n=e.some((t=>t!==i&&/^h[1-6]$/i.test(t.tagName))),s=e.some((t=>t!==i&&/^p$|^div$/i.test(t.tagName)));return!s||n&&!s?(this.contentType="title",void console.log("TextPromptEditor: Detected standalone heading from DOM")):(this.contentType="paragraph",void console.log("TextPromptEditor: Detected heading within paragraph structure"))}this.contentType="paragraph",i=i.parentElement}}this.contentType||(this.contentType="paragraph",console.log("TextPromptEditor: Defaulting to paragraph"))}catch(t){console.warn("Error detecting current element type:",t),this.contentType||(this.contentType="paragraph")}}handleIncludeContextChange(t){this.includeContext=!t.target.checked,localStorage.setItem("textPromptEditor_includeContext",this.includeContext)}handleContentTypeChange(t){this.contentType=t,this.dispatchEvent(new CustomEvent("content-type-changed",{detail:{contentType:this.contentType},bubbles:!0,composed:!0}))}handlePromptChange(t){this.prompt=t.target.value,localStorage.setItem("textPromptEditor_prompt",this.prompt);["כתוב כותרת","כתוב תמונה","כתבי כותרת","write heading"].some((t=>this.prompt.startsWith(t)))&&this.handleContentTypeChange("title")}handleBusinessTypeChange(t){this.businessType=t.target.value,localStorage.setItem("textPromptEditor_businessType",this.businessType)}handleBusinessNameChange(t){this.businessName=t.target.value,localStorage.setItem("textPromptEditor_businessName",this.businessName)}handleUrlChange(t){this.url=t.target.value,localStorage.setItem("textPromptEditor_url",this.url)}async handleGenerate(){this.isLoading=!0,this.generatedText="";try{if("title"===this.contentType){Array.from(document.querySelectorAll(".text-component")).map((t=>t.textContent)).join("\n")}this.context.length>1500&&(this.context=this.context.slice(0,1500));const t=s.W7.agent_url,e=await fetch(t+"prompt/text",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:this.prompt,context:this.includeContext?this.context:"",businessType:this.businessType,businessName:this.businessName,contentType:this.contentType,url:this.url,options:{maxTokens:1e3,temperature:0,model:"gpt-3.5-turbo"}})});if(!e.ok)throw new Error("Failed to generate text");const i=e.body.getReader(),n=new TextDecoder;let r="";for(;;){const{done:t,value:e}=await i.read();if(t){this.dispatchEvent(new CustomEvent("text-generation-complete",{detail:{text:this.generatedText},bubbles:!0,composed:!0}));break}r+=n.decode(e,{stream:!0});const s=r.split("\n\n");for(let t=0;t<s.length-1;t++){const e=s[t];if(e.startsWith("data: "))try{const t=e.slice(6),i=JSON.parse(t);if("start"===i.metadata?.type){this.generatedText="",this.dispatchEvent(new CustomEvent("text-generation-start",{detail:{model:i.metadata.model},bubbles:!0,composed:!0}));continue}i.text&&(this.generatedText+=i.text,this.dispatchEvent(new CustomEvent("text-generation-chunk",{detail:{chunk:i.text,fullText:this.generatedText},bubbles:!0,composed:!0}))),"complete"===i.status&&(this.generatedText=this.generatedText.replace(/^"|"$/g,""),this.dispatchEvent(new CustomEvent("text-generation-complete",{detail:{text:this.generatedText},bubbles:!0,composed:!0})))}catch(t){console.error("Error parsing JSON:",t)}}r=s[s.length-1]}}catch(t){console.error("Error generating text:",t),this.dispatchEvent(new CustomEvent("text-generation-error",{detail:{error:t.message},bubbles:!0,composed:!0}))}finally{this.isLoading=!1}}render(){const t=this.contentType;return q`
2
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[7988,2340],{87988:(t,e,i)=>{i.r(e),i.d(e,{default:()=>g});var n=i(47887),s=i(504);const r=t=>{{const{component:e,commands:i,helpers:r}=t,o=e.tiptap,a=o.state.selection.$anchor.node().attrs,l=o.isActive("heading",{level:1})?"h1":o.isActive("heading",{level:2})?"h2":o.isActive("heading",{level:3})?"h3":o.isActive("heading",{level:4})?"h4":o.isActive("heading",{level:5})?"h5":o.isActive("heading",{level:6})?"h6":"paragraph";let c=t.languageJson;const d=t.language||"he";return c||(c="he"===d?n:s),{select:t=>{let{changeTab:e,tab:i}=t},tabs:t=>{const e=o.isActive("customBulletItem"),i=[{text:"design",selected:!e},...e?[{text:"icons",selected:!0}]:[],{text:"settings"}];return i.forEach((e=>e.selected=e.text===t)),i},layout:t=>{let{tab:n,changeTab:s,tabs:r}=t;const d=[{type:"info",text:"text_micro_copy",active:()=>"design"===n.text},{type:"dropdown",active:()=>"design"===n.text,title:"type",value:l,items:[{value:"H1"},{value:"H2"},{value:"H3"},{value:"H4"},{value:"H5"},{value:"H6"},{value:"paragraph"}],onChange:t=>{const e=t.target.value;switch(e){case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":o.chain().setHeading({level:parseInt(e.slice(1))}).run();break;case"paragraph":o.chain().setParagraph().run()}}},{type:"slider",title:"fontSize",min:8,step:2,max:74,value:parseInt(o.getAttributes("textStyle").fontSize||"16px"),active:()=>"design"===n.text,onInput:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;s.from===s.to?n.chain().selectAll().setFontSize(i).run():n.chain().setFontSize(i).run()}},{type:"divider"},{type:"slider",title:"lineHeight",min:1,max:3,step:.1,value:parseFloat(a.lineHeight||1),active:()=>"design"===n.text,onInput:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;s.from===s.to?n.chain().selectAll().setLineHeight(i).run():n.chain().setLineHeight(i).run()}},{type:"divider",active:()=>"design"===n.text},{type:"slider",title:"letterSpacing",min:1,max:10,step:1,value:parseFloat(a.letterSpacing)||1,active:()=>"design"===n.text,onInput:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;i<=1?s.from===s.to?n.chain().selectAll().setLetterSpacing("normal").run():n.chain().setLetterSpacing("normal").run():s.from===s.to?n.chain().selectAll().setLetterSpacing(i+"px").run():n.chain().setLetterSpacing(i+"px").run()}},{type:"divider",active:()=>"design"===n.text},{type:"colorpicker",active:()=>"design"===n.text,title:"font_color",alpha:!1,value:o.getAttributes("textStyle").color||"#0000",onChange:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;if(s.from===s.to){const{state:t,view:e}=n,r=t.tr,{from:o,to:a}=s.from===s.to?{from:0,to:t.doc.content.size}:{from:s.from,to:s.to};t.doc.nodesBetween(o,a,((e,n)=>{if(e.isText){t.doc.resolve(n);if(!e.marks.some((t=>"link"===t.type.name))){const s=n,o=n+e.nodeSize;r.addMark(s,o,t.schema.marks.textStyle.create({color:i}))}}})),e.dispatch(r)}else n.chain().setColor(i).focus().run()}},{type:"divider",active:()=>"design"===n.text},{type:"colorpicker",active:()=>"design"===n.text,title:"backgroundColor",value:e.props.style.background||e.props.style.backgroundColor||"#fff",onChange:t=>{const e=t.target.value;i.execCommand("style",{background:e,backgroundColor:null})}},{type:"divider",active:()=>"design"===n.text},{type:"slider",active:()=>"design"===n.text,title:"maxWidth",value:parseFloat(e.props.style.width),min:20,max:1e3,onInput:t=>{const e=t.target.value;i.execCommand("style",{width:e+"px"})}},{type:"divider"},{type:"colorpicker",active:()=>"icons"===n.text,title:c.iconColor||"Icon color",alpha:!1,value:o.getAttributes(" textStyle").color||"#0000",onChange:t=>{const e=t.target.value;o.chain().setCustomBulletStyles({fill:e}).run()}},{type:"divider",active:()=>"icons"===n.text},{type:"slider",active:()=>"icons"===n.text,title:c.iconSize||"Icon size",value:parseInt(o.getAttributes("customBulletItem").width)||24,min:10,max:40,onInput:t=>{const e=t.target.value;o.chain().setCustomBulletStyles({width:e+"px",height:e+"px"}).run()}},{type:"icons",active:()=>"icons"===n.text,selectedIcon:e.props.src,useIconsApi:!0,iconColor:e.props.iconColor||"000000",iconSize:parseInt(e.props.style?.width,10)||24,onChange:t=>{const i=t.detail;e.tiptap.chain().focus().setCustomBulletIcon({svgIcon:i.urlPng}).run()}}];return d}}}};var o=i(46245);const a=t=>{let{helpers:e,tiptap:i,composeId:n,template:s}=t;return{set:(t,r,a)=>{switch(r){case"style":return"object"==typeof a&&(t[r]=(0,o.Z)(t[r],a),e.mergeDiff(s,{style:t[r]})),!0;case"text":t[r]=a;const l=i.getJSON();return a&&"object"==typeof a&&JSON.stringify(l)!==JSON.stringify(a.childNodes)&&(a&&a.focusedElement&&a.focusedElement===n?(i.chain().focus().setContent(a.childNodes).run(),a.to&&a.from&&i.commands.setTextSelection({from:a.from,to:a.to})):i.chain().setContent(a.childNodes).run()),delete t?.text?.markdown,!0}}}};var l=i(57701),c=i.n(l),d=i(70235);i(32340);const p=[];let h=!1,u=null;const g=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e="text";return{name:e,create:i=>{const{createElement:n,compose:s,helpers:o}=i,{mergeDiff:l}=o,g=document.createElement("div");l(g,{style:s.props.style});const m=d.h.get("config","editor","configure","editorProps","fonts");let f=d.h.get("config","target");"string"==typeof f&&(f=document.querySelector(f)),f||(f=document.body);const y=c()({element:g,container:f||document.body,editable:!0,offsetTop:40,onClickMagic:t=>{let{insertContent:e,getJSON:i,getHTML:n,getText:s,selectAll:r,insertContentHtml:o}=t;const a=d.h.get("injectEditor"),l=document.createElement("cdtr-text-prompt-editor");a(l),l.context=s(),l.addEventListener("text-generation-start",(t=>{r()})),l.addEventListener("text-generation-chunk",(t=>{e(t.detail.chunk)})),l.addEventListener("text-generation-complete",(t=>{r(),o(t.detail.text)})),l.addEventListener("text-generation-error",(t=>{console.error("Text generation error:",t.detail.error)}))},content:"string"==typeof s.props.text.markdown?s.props.text.markdown:s.props.text.childNodes,defaultDirection:"rtl",onBlur:()=>{u===y&&(u=null),setTimeout((()=>{u!==y&&(h=!1)}),150)},onFocus:()=>{if(!h||u===y||null===u){if(h=!0,u=y,p.length>0)for(p.forEach((t=>{t!==y&&t.hideEditor()}));p.length>0;)p.pop();p.push(y),setTimeout((()=>{u===y&&h&&y.showEditor()}),100)}},onUpdate:t=>{let{editor:e,transaction:i}=t;if(0===i.steps.length)return;const n=i.curSelection.from,r=i.curSelection.to,o={childNodes:e.getJSON(),from:n,to:r,focusedElement:s.id};v.commands.execCommand("text",o)},ignoresBlurByQuerySelectors:[".ignore-events"],builder:[{type:"fontFamily",fonts:m||[],useCloud:!0},{type:"fontSize",sizes:t.fontSize||[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74]},{type:"horizonRule"},{type:"clearFormat"},{type:"bold"},{type:"strike"},{type:"italic"},{type:"underline"},{type:"table"},{type:"emoji"},{type:"unLink"},{type:"link"},{type:"customList"},{type:"numbered"},{type:"bullet"},{type:"backcolor"},{type:"fontColor"},{type:"direction"},{type:"justify"},{type:"right"},{type:"center"},{type:"left"},{type:"image"},{type:"mergeTags"},{type:"magic"}]}),v=n({name:e,id:s.id,template:g,defaultProps:{text:{},style:{}},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>g,handleBar:!0,validator:a({template:g,helpers:o,tiptap:y,composeId:s.id}),schema:s.schema,onSelect:t=>{g.classList.add(t)},onDeselect:t=>{g.classList.remove(t)},elementProps:s,remove:()=>{g.remove()},createEditor:r});return s.props.text.markdown&&y.chain().insertContent(" ").run(),v.addProp("tiptap",y),v}}}},32340:(t,e,i)=>{i.r(e),i.d(e,{TextPromptEditor:()=>ft});var n=i(56666),s=i(76828);const r=globalThis,o=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),l=new WeakMap;class c{constructor(t,e,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(o&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=l.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&l.set(e,t))}return t}toString(){return this.cssText}}const d=o?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new c("string"==typeof t?t:t+"",void 0,a))(e)})(t):t,{is:p,defineProperty:h,getOwnPropertyDescriptor:u,getOwnPropertyNames:g,getOwnPropertySymbols:m,getPrototypeOf:f}=Object,y=globalThis,v=y.trustedTypes,x=v?v.emptyScript:"",b=y.reactiveElementPolyfillSupport,$=(t,e)=>t,_={toAttribute(t,e){switch(e){case Boolean:t=t?x:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},A=(t,e)=>!p(t,e),E={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:A};Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;class w extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=E){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(t,i,e);void 0!==n&&h(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){const{get:n,set:s}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:n,set(e){const r=n?.call(this);s?.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??E}static _$Ei(){if(this.hasOwnProperty($("elementProperties")))return;const t=f(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty($("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty($("properties"))){const t=this.properties,e=[...g(t),...m(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(o)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),n=r.litNonce;void 0!==n&&e.setAttribute("nonce",n),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(void 0!==n&&!0===i.reflect){const s=(void 0!==i.converter?.toAttribute?i.converter:_).toAttribute(e,i.type);this._$Em=t,null==s?this.removeAttribute(n):this.setAttribute(n,s),this._$Em=null}}_$AK(t,e){const i=this.constructor,n=i._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=i.getPropertyOptions(n),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:_;this._$Em=n;const r=s.fromAttribute(e,t.type);this[n]=r??this._$Ej?.get(n)??r,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const n=this.constructor,s=this[t];if(i??=n.getPropertyOptions(t),!((i.hasChanged??A)(s,e)||i.useDefault&&i.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:n,wrapped:s},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==s||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===n&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,n=this[e];!0!==t||this._$AL.has(e)||void 0===n||this.C(e,void 0,i,n)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}}w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[$("elementProperties")]=new Map,w[$("finalized")]=new Map,b?.({ReactiveElement:w}),(y.reactiveElementVersions??=[]).push("2.1.1");const S=globalThis,C=S.trustedTypes,T=C?C.createPolicy("lit-html",{createHTML:t=>t}):void 0,k="$lit$",P=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+P,H=`<${N}>`,O=document,U=()=>O.createComment(""),I=t=>null===t||"object"!=typeof t&&"function"!=typeof t,z=Array.isArray,L=t=>z(t)||"function"==typeof t?.[Symbol.iterator],M="[ \t\n\f\r]",R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,B=/-->/g,D=/>/g,j=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),F=/'/g,W=/"/g,J=/^(?:script|style|textarea|title)$/i,Y=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),q=Y(1),V=(Y(2),Y(3),Symbol.for("lit-noChange")),Z=Symbol.for("lit-nothing"),G=new WeakMap,K=O.createTreeWalker(O,129);function Q(t,e){if(!z(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==T?T.createHTML(e):e}const X=(t,e)=>{const i=t.length-1,n=[];let s,r=2===e?"<svg>":3===e?"<math>":"",o=R;for(let e=0;e<i;e++){const i=t[e];let a,l,c=-1,d=0;for(;d<i.length&&(o.lastIndex=d,l=o.exec(i),null!==l);)d=o.lastIndex,o===R?"!--"===l[1]?o=B:void 0!==l[1]?o=D:void 0!==l[2]?(J.test(l[2])&&(s=RegExp("</"+l[2],"g")),o=j):void 0!==l[3]&&(o=j):o===j?">"===l[0]?(o=s??R,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?j:'"'===l[3]?W:F):o===W||o===F?o=j:o===B||o===D?o=R:(o=j,s=void 0);const p=o===j&&t[e+1].startsWith("/>")?" ":"";r+=o===R?i+H:c>=0?(n.push(a),i.slice(0,c)+k+i.slice(c)+P+p):i+P+(-2===c?e:p)}return[Q(t,r+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class tt{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let s=0,r=0;const o=t.length-1,a=this.parts,[l,c]=X(t,e);if(this.el=tt.createElement(l,i),K.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=K.nextNode())&&a.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(k)){const e=c[r++],i=n.getAttribute(t).split(P),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:s,name:o[2],strings:i,ctor:"."===o[1]?rt:"?"===o[1]?ot:"@"===o[1]?at:st}),n.removeAttribute(t)}else t.startsWith(P)&&(a.push({type:6,index:s}),n.removeAttribute(t));if(J.test(n.tagName)){const t=n.textContent.split(P),e=t.length-1;if(e>0){n.textContent=C?C.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],U()),K.nextNode(),a.push({type:2,index:++s});n.append(t[e],U())}}}else if(8===n.nodeType)if(n.data===N)a.push({type:2,index:s});else{let t=-1;for(;-1!==(t=n.data.indexOf(P,t+1));)a.push({type:7,index:s}),t+=P.length-1}s++}}static createElement(t,e){const i=O.createElement("template");return i.innerHTML=t,i}}function et(t,e,i=t,n){if(e===V)return e;let s=void 0!==n?i._$Co?.[n]:i._$Cl;const r=I(e)?void 0:e._$litDirective$;return s?.constructor!==r&&(s?._$AO?.(!1),void 0===r?s=void 0:(s=new r(t),s._$AT(t,i,n)),void 0!==n?(i._$Co??=[])[n]=s:i._$Cl=s),void 0!==s&&(e=et(t,s._$AS(t,e.values),s,n)),e}class it{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,n=(t?.creationScope??O).importNode(e,!0);K.currentNode=n;let s=K.nextNode(),r=0,o=0,a=i[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new nt(s,s.nextSibling,this,t):1===a.type?e=new a.ctor(s,a.name,a.strings,this,t):6===a.type&&(e=new lt(s,this,t)),this._$AV.push(e),a=i[++o]}r!==a?.index&&(s=K.nextNode(),r++)}return K.currentNode=O,n}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class nt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,n){this.type=2,this._$AH=Z,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=et(this,t,e),I(t)?t===Z||null==t||""===t?(this._$AH!==Z&&this._$AR(),this._$AH=Z):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):L(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Z&&I(this._$AH)?this._$AA.nextSibling.data=t:this.T(O.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,n="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=tt.createElement(Q(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new it(n,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new tt(t)),e}k(t){z(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const s of t)n===e.length?e.push(i=new nt(this.O(U()),this.O(U()),this,this.options)):i=e[n],i._$AI(s),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class st{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,n,s){this.type=1,this._$AH=Z,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Z}_$AI(t,e=this,i,n){const s=this.strings;let r=!1;if(void 0===s)t=et(this,t,e,0),r=!I(t)||t!==this._$AH&&t!==V,r&&(this._$AH=t);else{const n=t;let o,a;for(t=s[0],o=0;o<s.length-1;o++)a=et(this,n[i+o],e,o),a===V&&(a=this._$AH[o]),r||=!I(a)||a!==this._$AH[o],a===Z?t=Z:t!==Z&&(t+=(a??"")+s[o+1]),this._$AH[o]=a}r&&!n&&this.j(t)}j(t){t===Z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class rt extends st{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Z?void 0:t}}class ot extends st{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Z)}}class at extends st{constructor(t,e,i,n,s){super(t,e,i,n,s),this.type=5}_$AI(t,e=this){if((t=et(this,t,e,0)??Z)===V)return;const i=this._$AH,n=t===Z&&i!==Z||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,s=t!==Z&&(i===Z||n);n&&this.element.removeEventListener(this.name,this,i),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class lt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){et(this,t)}}const ct=S.litHtmlPolyfillSupport;ct?.(tt,nt),(S.litHtmlVersions??=[]).push("3.3.1");const dt=globalThis;class pt extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const n=i?.renderBefore??e;let s=n._$litPart$;if(void 0===s){const t=i?.renderBefore??null;n._$litPart$=s=new nt(e.insertBefore(U(),t),t,void 0,i??{})}return s._$AI(t),s})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}}pt._$litElement$=!0,pt.finalized=!0,dt.litElementHydrateSupport?.({LitElement:pt});const ht=dt.litElementPolyfillSupport;ht?.({LitElement:pt});(dt.litElementVersions??=[]).push("4.2.1");var ut,gt,mt;let ft=(ut=(t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)})("cdtr-text-prompt-editor"),ut((mt=class extends pt{constructor(){super(),this.prompt=localStorage.getItem("textPromptEditor_prompt")||"",this.generatedText="",this.isLoading=!1,this.context="",this.businessType=localStorage.getItem("textPromptEditor_businessType")||"",this.businessName=localStorage.getItem("textPromptEditor_businessName")||"",this.includeContext="true"===localStorage.getItem("textPromptEditor_includeContext")||!1,this.url=localStorage.getItem("textPromptEditor_url")||"",this.detectCurrentElementType()}connectedCallback(){super.connectedCallback(),setTimeout((()=>{this.detectCurrentElementType()}),100)}detectCurrentElementType(){try{const t=window.getSelection();if(t&&t.rangeCount>0){const e=t.getRangeAt(0).commonAncestorContainer;let i=e.nodeType===Node.TEXT_NODE?e.parentElement:e;for(;i&&i!==document.body;){if(i.tagName&&/^h[1-6]$/i.test(i.tagName)){const t=i.parentElement,e=Array.from(t?.children||[]),n=e.some((t=>t!==i&&/^h[1-6]$/i.test(t.tagName))),s=e.some((t=>t!==i&&/^p$|^div$/i.test(t.tagName)));return!s||n&&!s?(this.contentType="title",void console.log("TextPromptEditor: Detected standalone heading from DOM")):(this.contentType="paragraph",void console.log("TextPromptEditor: Detected heading within paragraph structure"))}this.contentType="paragraph",i=i.parentElement}}this.contentType||(this.contentType="paragraph",console.log("TextPromptEditor: Defaulting to paragraph"))}catch(t){console.warn("Error detecting current element type:",t),this.contentType||(this.contentType="paragraph")}}handleIncludeContextChange(t){this.includeContext=!t.target.checked,localStorage.setItem("textPromptEditor_includeContext",this.includeContext)}handleContentTypeChange(t){this.contentType=t,this.dispatchEvent(new CustomEvent("content-type-changed",{detail:{contentType:this.contentType},bubbles:!0,composed:!0}))}handlePromptChange(t){this.prompt=t.target.value,localStorage.setItem("textPromptEditor_prompt",this.prompt);["כתוב כותרת","כתוב תמונה","כתבי כותרת","write heading"].some((t=>this.prompt.startsWith(t)))&&this.handleContentTypeChange("title")}handleBusinessTypeChange(t){this.businessType=t.target.value,localStorage.setItem("textPromptEditor_businessType",this.businessType)}handleBusinessNameChange(t){this.businessName=t.target.value,localStorage.setItem("textPromptEditor_businessName",this.businessName)}handleUrlChange(t){this.url=t.target.value,localStorage.setItem("textPromptEditor_url",this.url)}async handleGenerate(){this.isLoading=!0,this.generatedText="";try{if("title"===this.contentType){Array.from(document.querySelectorAll(".text-component")).map((t=>t.textContent)).join("\n")}this.context.length>1500&&(this.context=this.context.slice(0,1500));const t=s.W7.agent_url,e=await fetch(t+"prompt/text",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:this.prompt,context:this.includeContext?this.context:"",businessType:this.businessType,businessName:this.businessName,contentType:this.contentType,url:this.url,options:{maxTokens:1e3,temperature:0,model:"gpt-3.5-turbo"}})});if(!e.ok)throw new Error("Failed to generate text");const i=e.body.getReader(),n=new TextDecoder;let r="";for(;;){const{done:t,value:e}=await i.read();if(t){this.dispatchEvent(new CustomEvent("text-generation-complete",{detail:{text:this.generatedText},bubbles:!0,composed:!0}));break}r+=n.decode(e,{stream:!0});const s=r.split("\n\n");for(let t=0;t<s.length-1;t++){const e=s[t];if(e.startsWith("data: "))try{const t=e.slice(6),i=JSON.parse(t);if("start"===i.metadata?.type){this.generatedText="",this.dispatchEvent(new CustomEvent("text-generation-start",{detail:{model:i.metadata.model},bubbles:!0,composed:!0}));continue}i.text&&(this.generatedText+=i.text,this.dispatchEvent(new CustomEvent("text-generation-chunk",{detail:{chunk:i.text,fullText:this.generatedText},bubbles:!0,composed:!0}))),"complete"===i.status&&(this.generatedText=this.generatedText.replace(/^"|"$/g,""),this.dispatchEvent(new CustomEvent("text-generation-complete",{detail:{text:this.generatedText},bubbles:!0,composed:!0})))}catch(t){console.error("Error parsing JSON:",t)}}r=s[s.length-1]}}catch(t){console.error("Error generating text:",t),this.dispatchEvent(new CustomEvent("text-generation-error",{detail:{error:t.message},bubbles:!0,composed:!0}))}finally{this.isLoading=!1}}render(){const t=this.contentType;return q`
3
3
  <cdtr-editor-container>
4
4
  <div class="editor-container">
5
5
  <div class="prompt-section">
Binary file