soliddesigner 0.1.4 → 0.1.7

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.
@@ -0,0 +1 @@
1
+ import{oi as t}from"./chunk-KMNI2D3U.js";var e=class{static prefix="[SolidLog]";static log(o,...i){t()&&console.log(`%c${this.prefix}`,"color: #4CAF50; font-weight: bold;",o,...i)}static info(o,...i){t()&&console.info(`%c${this.prefix}`,"color: #2196F3; font-weight: bold;",o,...i)}static warn(o,...i){t()&&console.warn(`%c${this.prefix}`,"color: #FFC107; font-weight: bold;",o,...i)}static error(o,...i){t()&&console.error(`%c${this.prefix}`,"color: #F44336; font-weight: bold;",o,...i)}static debug(o,...i){t()&&console.debug(`%c${this.prefix}`,"color: #9E9E9E; font-weight: bold;",o,...i)}};export{e as a};
@@ -0,0 +1,85 @@
1
+ import{a as fe}from"./chunk-TOQU4CNM.js";import{Ab as me,B as Vt,Ba as w,C as Gt,D as En,Ed as De,Fd as we,Ff as G,G as ct,Gd as se,Ha as Dn,Hc as An,Hd as Se,I as R,If as $,Ih as Zt,J as ut,Jf as Nn,Jh as ht,Kc as H,Kf as On,Kh as pt,La as wn,Lc as _n,Ld as je,Lg as X,M as Ve,Mg as Q,Na as Sn,O as Ut,Qc as ie,Ta as q,Tf as Rn,U as jt,Ua as W,Uf as xn,Va as Cn,X as Ge,Xa as Tn,Xf as K,Yf as te,Za as dt,Zc as zt,Zf as Kt,_ as vn,_a as ve,a as S,af as de,b as N,bd as Ln,bf as M,cd as qt,cf as V,da as U,df as Ce,f as z,fb as A,hd as k,k as yn,ka as v,kb as Ht,ma as Ee,n as Y,nf as He,qd as Ue,ra as j,rf as Wt,si as mt,t as _,v as ue,vb as $t,vf as $e,wb as ft,wh as Pn,x as lt,xd as Fn,xi as In,y as P,yi as Jt,za as T,zd as Mn}from"./chunk-KMNI2D3U.js";var Vn=null;function gt(){return Vn}function Ur(r){Vn??=r}var Yt=class{},Xt=(()=>{class r{historyGo(e){throw new Error("")}static \u0275fac=function(n){return new(n||r)};static \u0275prov=v({token:r,factory:()=>w(Gn),providedIn:"platform"})}return r})();var Gn=(()=>{class r extends Xt{_location;_history;_doc=w(ve);constructor(){super(),this._location=window.location,this._history=window.history}getBaseHrefFromDOM(){return gt().getBaseHref(this._doc)}onPopState(e){let n=gt().getGlobalEventTarget(this._doc,"window");return n.addEventListener("popstate",e,!1),()=>n.removeEventListener("popstate",e)}onHashChange(e){let n=gt().getGlobalEventTarget(this._doc,"window");return n.addEventListener("hashchange",e,!1),()=>n.removeEventListener("hashchange",e)}get href(){return this._location.href}get protocol(){return this._location.protocol}get hostname(){return this._location.hostname}get port(){return this._location.port}get pathname(){return this._location.pathname}get search(){return this._location.search}get hash(){return this._location.hash}set pathname(e){this._location.pathname=e}pushState(e,n,i){this._history.pushState(e,n,i)}replaceState(e,n,i){this._history.replaceState(e,n,i)}forward(){this._history.forward()}back(){this._history.back()}historyGo(e=0){this._history.go(e)}getState(){return this._history.state}static \u0275fac=function(n){return new(n||r)};static \u0275prov=v({token:r,factory:()=>new r,providedIn:"platform"})}return r})();function Un(r,t){return r?t?r.endsWith("/")?t.startsWith("/")?r+t.slice(1):r+t:t.startsWith("/")?r+t:`${r}/${t}`:r:t}function kn(r){let t=r.search(/#|\?|$/);return r[t-1]==="/"?r.slice(0,t-1)+r.slice(t):r}function he(r){return r&&r[0]!=="?"?`?${r}`:r}var bt=(()=>{class r{historyGo(e){throw new Error("")}static \u0275fac=function(n){return new(n||r)};static \u0275prov=v({token:r,factory:()=>w(Hn),providedIn:"root"})}return r})(),jn=new j(""),Hn=(()=>{class r extends bt{_platformLocation;_baseHref;_removeListenerFns=[];constructor(e,n){super(),this._platformLocation=e,this._baseHref=n??this._platformLocation.getBaseHrefFromDOM()??w(ve).location?.origin??""}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(e){this._removeListenerFns.push(this._platformLocation.onPopState(e),this._platformLocation.onHashChange(e))}getBaseHref(){return this._baseHref}prepareExternalUrl(e){return Un(this._baseHref,e)}path(e=!1){let n=this._platformLocation.pathname+he(this._platformLocation.search),i=this._platformLocation.hash;return i&&e?`${n}${i}`:n}pushState(e,n,i,s){let o=this.prepareExternalUrl(i+he(s));this._platformLocation.pushState(e,n,o)}replaceState(e,n,i,s){let o=this.prepareExternalUrl(i+he(s));this._platformLocation.replaceState(e,n,o)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(e=0){this._platformLocation.historyGo?.(e)}static \u0275fac=function(n){return new(n||r)(T(Xt),T(jn,8))};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})(),$n=(()=>{class r{_subject=new Y;_basePath;_locationStrategy;_urlChangeListeners=[];_urlChangeSubscription=null;constructor(e){this._locationStrategy=e;let n=this._locationStrategy.getBaseHref();this._basePath=$r(kn(Bn(n))),this._locationStrategy.onPopState(i=>{this._subject.next({url:this.path(!0),pop:!0,state:i.state,type:i.type})})}ngOnDestroy(){this._urlChangeSubscription?.unsubscribe(),this._urlChangeListeners=[]}path(e=!1){return this.normalize(this._locationStrategy.path(e))}getState(){return this._locationStrategy.getState()}isCurrentPathEqualTo(e,n=""){return this.path()==this.normalize(e+he(n))}normalize(e){return r.stripTrailingSlash(Hr(this._basePath,Bn(e)))}prepareExternalUrl(e){return e&&e[0]!=="/"&&(e="/"+e),this._locationStrategy.prepareExternalUrl(e)}go(e,n="",i=null){this._locationStrategy.pushState(i,"",e,n),this._notifyUrlChangeListeners(this.prepareExternalUrl(e+he(n)),i)}replaceState(e,n="",i=null){this._locationStrategy.replaceState(i,"",e,n),this._notifyUrlChangeListeners(this.prepareExternalUrl(e+he(n)),i)}forward(){this._locationStrategy.forward()}back(){this._locationStrategy.back()}historyGo(e=0){this._locationStrategy.historyGo?.(e)}onUrlChange(e){return this._urlChangeListeners.push(e),this._urlChangeSubscription??=this.subscribe(n=>{this._notifyUrlChangeListeners(n.url,n.state)}),()=>{let n=this._urlChangeListeners.indexOf(e);this._urlChangeListeners.splice(n,1),this._urlChangeListeners.length===0&&(this._urlChangeSubscription?.unsubscribe(),this._urlChangeSubscription=null)}}_notifyUrlChangeListeners(e="",n){this._urlChangeListeners.forEach(i=>i(e,n))}subscribe(e,n,i){return this._subject.subscribe({next:e,error:n??void 0,complete:i??void 0})}static normalizeQueryParams=he;static joinWithSlash=Un;static stripTrailingSlash=kn;static \u0275fac=function(n){return new(n||r)(T(bt))};static \u0275prov=v({token:r,factory:()=>jr(),providedIn:"root"})}return r})();function jr(){return new $n(T(bt))}function Hr(r,t){if(!r||!t.startsWith(r))return t;let e=t.substring(r.length);return e===""||["/",";","?","#"].includes(e[0])?e:t}function Bn(r){return r.replace(/\/index.html$/,"")}function $r(r){if(new RegExp("^(https?:)?//").test(r)){let[,e]=r.split(/\/\/[^\/]+/);return e}return r}var nn=(function(r){return r[r.Decimal=0]="Decimal",r[r.Percent=1]="Percent",r[r.Currency=2]="Currency",r[r.Scientific=3]="Scientific",r})(nn||{});var ne={Decimal:0,Group:1,List:2,PercentSign:3,PlusSign:4,MinusSign:5,Exponential:6,SuperscriptingExponent:7,PerMille:8,Infinity:9,NaN:10,TimeSeparator:11,CurrencyDecimal:12,CurrencyGroup:13};function Te(r,t){let e=Wt(r),n=e[$e.NumberSymbols][t];if(typeof n>"u"){if(t===ne.CurrencyDecimal)return e[$e.NumberSymbols][ne.Decimal];if(t===ne.CurrencyGroup)return e[$e.NumberSymbols][ne.Group]}return n}function Yn(r,t){return Wt(r)[$e.NumberFormats][t]}var qr=/^(\d+)?\.((\d+)(-(\d+))?)?$/,zn=22,yt=".",ze="0",Wr=";",Kr=",",Qt="#";function Zr(r,t,e,n,i,s,o=!1){let a="",l=!1;if(!isFinite(r))a=Te(e,ne.Infinity);else{let c=Xr(r);o&&(c=Yr(c));let f=t.minInt,d=t.minFrac,u=t.maxFrac;if(s){let g=s.match(qr);if(g===null)throw new U(2306,!1);let D=g[1],y=g[3],C=g[5];D!=null&&(f=en(D)),y!=null&&(d=en(y)),C!=null?u=en(C):y!=null&&d>u&&(u=d)}Qr(c,d,u);let p=c.digits,m=c.integerLen,E=c.exponent,b=[];for(l=p.every(g=>!g);m<f;m++)p.unshift(0);for(;m<0;m++)p.unshift(0);m>0?b=p.splice(m,p.length):(b=p,p=[0]);let h=[];for(p.length>=t.lgSize&&h.unshift(p.splice(-t.lgSize,p.length).join(""));p.length>t.gSize;)h.unshift(p.splice(-t.gSize,p.length).join(""));p.length&&h.unshift(p.join("")),a=h.join(Te(e,n)),b.length&&(a+=Te(e,i)+b.join("")),E&&(a+=Te(e,ne.Exponential)+"+"+E)}return r<0&&!l?a=t.negPre+a+t.negSuf:a=t.posPre+a+t.posSuf,a}function Xn(r,t,e){let n=Yn(t,nn.Decimal),i=Jr(n,Te(t,ne.MinusSign));return Zr(r,i,t,ne.Group,ne.Decimal,e)}function Jr(r,t="-"){let e={minInt:1,minFrac:0,maxFrac:0,posPre:"",posSuf:"",negPre:"",negSuf:"",gSize:0,lgSize:0},n=r.split(Wr),i=n[0],s=n[1],o=i.indexOf(yt)!==-1?i.split(yt):[i.substring(0,i.lastIndexOf(ze)+1),i.substring(i.lastIndexOf(ze)+1)],a=o[0],l=o[1]||"";e.posPre=a.substring(0,a.indexOf(Qt));for(let f=0;f<l.length;f++){let d=l.charAt(f);d===ze?e.minFrac=e.maxFrac=f+1:d===Qt?e.maxFrac=f+1:e.posSuf+=d}let c=a.split(Kr);if(e.gSize=c[1]?c[1].length:0,e.lgSize=c[2]||c[1]?(c[2]||c[1]).length:0,s){let f=i.length-e.posPre.length-e.posSuf.length,d=s.indexOf(Qt);e.negPre=s.substring(0,d).replace(/'/g,""),e.negSuf=s.slice(d+f).replace(/'/g,"")}else e.negPre=t+e.posPre,e.negSuf=e.posSuf;return e}function Yr(r){if(r.digits[0]===0)return r;let t=r.digits.length-r.integerLen;return r.exponent?r.exponent+=2:(t===0?r.digits.push(0,0):t===1&&r.digits.push(0),r.integerLen+=2),r}function Xr(r){let t=Math.abs(r)+"",e=0,n,i,s,o,a;for((i=t.indexOf(yt))>-1&&(t=t.replace(yt,"")),(s=t.search(/e/i))>0?(i<0&&(i=s),i+=+t.slice(s+1),t=t.substring(0,s)):i<0&&(i=t.length),s=0;t.charAt(s)===ze;s++);if(s===(a=t.length))n=[0],i=1;else{for(a--;t.charAt(a)===ze;)a--;for(i-=s,n=[],o=0;s<=a;s++,o++)n[o]=Number(t.charAt(s))}return i>zn&&(n=n.splice(0,zn-1),e=i-1,i=1),{digits:n,exponent:e,integerLen:i}}function Qr(r,t,e){if(t>e)throw new U(2307,!1);let n=r.digits,i=n.length-r.integerLen,s=Math.min(Math.max(t,i),e),o=s+r.integerLen,a=n[o];if(o>0){n.splice(Math.max(r.integerLen,o));for(let d=o;d<n.length;d++)n[d]=0}else{i=Math.max(0,i),r.integerLen=1,n.length=Math.max(1,o=s+1),n[0]=0;for(let d=1;d<o;d++)n[d]=0}if(a>=5)if(o-1<0){for(let d=0;d>o;d--)n.unshift(0),r.integerLen++;n.unshift(1),r.integerLen++}else n[o-1]++;for(;i<Math.max(0,s);i++)n.push(0);let l=s!==0,c=t+r.integerLen,f=n.reduceRight(function(d,u,p,m){return u=u+d,m[p]=u<10?u:u-10,l&&(m[p]===0&&p>=c?m.pop():l=!1),u>=10?1:0},0);f&&(n.unshift(f),r.integerLen++)}function en(r){let t=parseInt(r);if(isNaN(t))throw new U(2305,!1);return t}var tn=/\s+/,qn=[],ei=(()=>{class r{_ngEl;_renderer;initialClasses=qn;rawClass;stateMap=new Map;constructor(e,n){this._ngEl=e,this._renderer=n}set klass(e){this.initialClasses=e!=null?e.trim().split(tn):qn}set ngClass(e){this.rawClass=typeof e=="string"?e.trim().split(tn):e}ngDoCheck(){for(let n of this.initialClasses)this._updateState(n,!0);let e=this.rawClass;if(Array.isArray(e)||e instanceof Set)for(let n of e)this._updateState(n,!0);else if(e!=null)for(let n of Object.keys(e))this._updateState(n,!!e[n]);this._applyStateDiff()}_updateState(e,n){let i=this.stateMap.get(e);i!==void 0?(i.enabled!==n&&(i.changed=!0,i.enabled=n),i.touched=!0):this.stateMap.set(e,{enabled:n,changed:!0,touched:!0})}_applyStateDiff(){for(let e of this.stateMap){let n=e[0],i=e[1];i.changed?(this._toggleClass(n,i.enabled),i.changed=!1):i.touched||(i.enabled&&this._toggleClass(n,!1),this.stateMap.delete(n)),i.touched=!1}}_toggleClass(e,n){e=e.trim(),e.length>0&&e.split(tn).forEach(i=>{n?this._renderer.addClass(this._ngEl.nativeElement,i):this._renderer.removeClass(this._ngEl.nativeElement,i)})}static \u0275fac=function(n){return new(n||r)(k(me),k(qt))};static \u0275dir=se({type:r,selectors:[["","ngClass",""]],inputs:{klass:[0,"class","klass"],ngClass:"ngClass"}})}return r})(),ti=(()=>{class r{_viewContainerRef;ngComponentOutlet=null;ngComponentOutletInputs;ngComponentOutletInjector;ngComponentOutletEnvironmentInjector;ngComponentOutletContent;ngComponentOutletNgModule;ngComponentOutletNgModuleFactory;_componentRef;_moduleRef;_inputsUsed=new Map;get componentInstance(){return this._componentRef?.instance??null}constructor(e){this._viewContainerRef=e}_needToReCreateNgModuleInstance(e){return e.ngComponentOutletNgModule!==void 0||e.ngComponentOutletNgModuleFactory!==void 0}_needToReCreateComponentInstance(e){return e.ngComponentOutlet!==void 0||e.ngComponentOutletContent!==void 0||e.ngComponentOutletInjector!==void 0||e.ngComponentOutletEnvironmentInjector!==void 0||this._needToReCreateNgModuleInstance(e)}ngOnChanges(e){if(this._needToReCreateComponentInstance(e)&&(this._viewContainerRef.clear(),this._inputsUsed.clear(),this._componentRef=void 0,this.ngComponentOutlet)){let n=this.ngComponentOutletInjector||this._viewContainerRef.parentInjector;this._needToReCreateNgModuleInstance(e)&&(this._moduleRef?.destroy(),this.ngComponentOutletNgModule?this._moduleRef=Mn(this.ngComponentOutletNgModule,Wn(n)):this.ngComponentOutletNgModuleFactory?this._moduleRef=this.ngComponentOutletNgModuleFactory.create(Wn(n)):this._moduleRef=void 0),this._componentRef=this._viewContainerRef.createComponent(this.ngComponentOutlet,{injector:n,ngModuleRef:this._moduleRef,projectableNodes:this.ngComponentOutletContent,environmentInjector:this.ngComponentOutletEnvironmentInjector})}}ngDoCheck(){if(this._componentRef){if(this.ngComponentOutletInputs)for(let e of Object.keys(this.ngComponentOutletInputs))this._inputsUsed.set(e,!0);this._applyInputStateDiff(this._componentRef)}}ngOnDestroy(){this._moduleRef?.destroy()}_applyInputStateDiff(e){for(let[n,i]of this._inputsUsed)i?(e.setInput(n,this.ngComponentOutletInputs[n]),this._inputsUsed.set(n,!1)):(e.setInput(n,void 0),this._inputsUsed.delete(n))}static \u0275fac=function(n){return new(n||r)(k(Ue))};static \u0275dir=se({type:r,selectors:[["","ngComponentOutlet",""]],inputs:{ngComponentOutlet:"ngComponentOutlet",ngComponentOutletInputs:"ngComponentOutletInputs",ngComponentOutletInjector:"ngComponentOutletInjector",ngComponentOutletEnvironmentInjector:"ngComponentOutletEnvironmentInjector",ngComponentOutletContent:"ngComponentOutletContent",ngComponentOutletNgModule:"ngComponentOutletNgModule",ngComponentOutletNgModuleFactory:"ngComponentOutletNgModuleFactory"},exportAs:["ngComponentOutlet"],features:[$t]})}return r})();function Wn(r){return r.get(Fn).injector}var Et=class{$implicit;ngForOf;index;count;constructor(t,e,n,i){this.$implicit=t,this.ngForOf=e,this.index=n,this.count=i}get first(){return this.index===0}get last(){return this.index===this.count-1}get even(){return this.index%2===0}get odd(){return!this.even}},Qn=(()=>{class r{_viewContainer;_template;_differs;set ngForOf(e){this._ngForOf=e,this._ngForOfDirty=!0}set ngForTrackBy(e){this._trackByFn=e}get ngForTrackBy(){return this._trackByFn}_ngForOf=null;_ngForOfDirty=!0;_differ=null;_trackByFn;constructor(e,n,i){this._viewContainer=e,this._template=n,this._differs=i}set ngForTemplate(e){e&&(this._template=e)}ngDoCheck(){if(this._ngForOfDirty){this._ngForOfDirty=!1;let e=this._ngForOf;!this._differ&&e&&(this._differ=this._differs.find(e).create(this.ngForTrackBy))}if(this._differ){let e=this._differ.diff(this._ngForOf);e&&this._applyChanges(e)}}_applyChanges(e){let n=this._viewContainer;e.forEachOperation((i,s,o)=>{if(i.previousIndex==null)n.createEmbeddedView(this._template,new Et(i.item,this._ngForOf,-1,-1),o===null?void 0:o);else if(o==null)n.remove(s===null?void 0:s);else if(s!==null){let a=n.get(s);n.move(a,o),Kn(a,i)}});for(let i=0,s=n.length;i<s;i++){let a=n.get(i).context;a.index=i,a.count=s,a.ngForOf=this._ngForOf}e.forEachIdentityChange(i=>{let s=n.get(i.currentIndex);Kn(s,i)})}static ngTemplateContextGuard(e,n){return!0}static \u0275fac=function(n){return new(n||r)(k(Ue),k(zt),k(In))};static \u0275dir=se({type:r,selectors:[["","ngFor","","ngForOf",""]],inputs:{ngForOf:"ngForOf",ngForTrackBy:"ngForTrackBy",ngForTemplate:"ngForTemplate"}})}return r})();function Kn(r,t){r.context.$implicit=t.item}var qe=(()=>{class r{_viewContainer;_context=new vt;_thenTemplateRef=null;_elseTemplateRef=null;_thenViewRef=null;_elseViewRef=null;constructor(e,n){this._viewContainer=e,this._thenTemplateRef=n}set ngIf(e){this._context.$implicit=this._context.ngIf=e,this._updateView()}set ngIfThen(e){Zn(e,!1),this._thenTemplateRef=e,this._thenViewRef=null,this._updateView()}set ngIfElse(e){Zn(e,!1),this._elseTemplateRef=e,this._elseViewRef=null,this._updateView()}_updateView(){this._context.$implicit?this._thenViewRef||(this._viewContainer.clear(),this._elseViewRef=null,this._thenTemplateRef&&(this._thenViewRef=this._viewContainer.createEmbeddedView(this._thenTemplateRef,this._context))):this._elseViewRef||(this._viewContainer.clear(),this._thenViewRef=null,this._elseTemplateRef&&(this._elseViewRef=this._viewContainer.createEmbeddedView(this._elseTemplateRef,this._context)))}static ngIfUseIfTypeGuard;static ngTemplateGuard_ngIf;static ngTemplateContextGuard(e,n){return!0}static \u0275fac=function(n){return new(n||r)(k(Ue),k(zt))};static \u0275dir=se({type:r,selectors:[["","ngIf",""]],inputs:{ngIf:"ngIf",ngIfThen:"ngIfThen",ngIfElse:"ngIfElse"}})}return r})(),vt=class{$implicit=null;ngIf=null};function Zn(r,t){if(r&&!r.createEmbeddedView)throw new U(2020,!1)}var ni=(()=>{class r{_ngEl;_differs;_renderer;_ngStyle=null;_differ=null;constructor(e,n,i){this._ngEl=e,this._differs=n,this._renderer=i}set ngStyle(e){this._ngStyle=e,!this._differ&&e&&(this._differ=this._differs.find(e).create())}ngDoCheck(){if(this._differ){let e=this._differ.diff(this._ngStyle);e&&this._applyChanges(e)}}_setStyle(e,n){let[i,s]=e.split("."),o=i.indexOf("-")===-1?void 0:_n.DashCase;n!=null?this._renderer.setStyle(this._ngEl.nativeElement,i,s?`${n}${s}`:n,o):this._renderer.removeStyle(this._ngEl.nativeElement,i,o)}_applyChanges(e){e.forEachRemovedItem(n=>this._setStyle(n.key,null)),e.forEachAddedItem(n=>this._setStyle(n.key,n.currentValue)),e.forEachChangedItem(n=>this._setStyle(n.key,n.currentValue))}static \u0275fac=function(n){return new(n||r)(k(me),k(Jt),k(qt))};static \u0275dir=se({type:r,selectors:[["","ngStyle",""]],inputs:{ngStyle:"ngStyle"}})}return r})(),ri=(()=>{class r{_viewContainerRef;_viewRef=null;ngTemplateOutletContext=null;ngTemplateOutlet=null;ngTemplateOutletInjector=null;constructor(e){this._viewContainerRef=e}ngOnChanges(e){if(this._shouldRecreateView(e)){let n=this._viewContainerRef;if(this._viewRef&&n.remove(n.indexOf(this._viewRef)),!this.ngTemplateOutlet){this._viewRef=null;return}let i=this._createContextForwardProxy();this._viewRef=n.createEmbeddedView(this.ngTemplateOutlet,i,{injector:this.ngTemplateOutletInjector??void 0})}}_shouldRecreateView(e){return!!e.ngTemplateOutlet||!!e.ngTemplateOutletInjector}_createContextForwardProxy(){return new Proxy({},{set:(e,n,i)=>this.ngTemplateOutletContext?Reflect.set(this.ngTemplateOutletContext,n,i):!1,get:(e,n,i)=>{if(this.ngTemplateOutletContext)return Reflect.get(this.ngTemplateOutletContext,n,i)}})}static \u0275fac=function(n){return new(n||r)(k(Ue))};static \u0275dir=se({type:r,selectors:[["","ngTemplateOutlet",""]],inputs:{ngTemplateOutletContext:"ngTemplateOutletContext",ngTemplateOutlet:"ngTemplateOutlet",ngTemplateOutletInjector:"ngTemplateOutletInjector"},features:[$t]})}return r})();function er(r,t){return new U(2100,!1)}var ii=(()=>{class r{transform(e){if(e==null)return null;if(typeof e!="string")throw er(r,e);return e.toUpperCase()}static \u0275fac=function(n){return new(n||r)};static \u0275pipe=Se({name:"uppercase",type:r,pure:!0})}return r})();function si(r,t){return{key:r,value:t}}var oi=(()=>{class r{differs;constructor(e){this.differs=e}differ;keyValues=[];compareFn=Jn;transform(e,n=Jn){if(!e||!(e instanceof Map)&&typeof e!="object")return null;this.differ??=this.differs.find(e).create();let i=this.differ.diff(e),s=n!==this.compareFn;return i&&(this.keyValues=[],i.forEachItem(o=>{this.keyValues.push(si(o.key,o.currentValue))})),(i||s)&&(n&&this.keyValues.sort(n),this.compareFn=n),this.keyValues}static \u0275fac=function(n){return new(n||r)(k(Jt,16))};static \u0275pipe=Se({name:"keyvalue",type:r,pure:!1})}return r})();function Jn(r,t){let e=r.key,n=t.key;if(e===n)return 0;if(e==null)return 1;if(n==null)return-1;if(typeof e=="string"&&typeof n=="string")return e<n?-1:1;if(typeof e=="number"&&typeof n=="number")return e-n;if(typeof e=="boolean"&&typeof n=="boolean")return e<n?-1:1;let i=String(e),s=String(n);return i==s?0:i<s?-1:1}var ai=(()=>{class r{_locale;constructor(e){this._locale=e}transform(e,n,i){if(!li(e))return null;i||=this._locale;try{let s=ci(e);return Xn(s,i,n)}catch(s){throw er(r,s.message)}}static \u0275fac=function(n){return new(n||r)(k(Pn,16))};static \u0275pipe=Se({name:"number",type:r,pure:!0})}return r})();function li(r){return!(r==null||r===""||r!==r)}function ci(r){if(typeof r=="string"&&!isNaN(Number(r)-parseFloat(r)))return Number(r);if(typeof r!="number")throw new U(2309,!1);return r}var ge=(()=>{class r{static \u0275fac=function(n){return new(n||r)};static \u0275mod=we({type:r});static \u0275inj=Ee({})}return r})();function rn(r,t){t=encodeURIComponent(t);for(let e of r.split(";")){let n=e.indexOf("="),[i,s]=n==-1?[e,""]:[e.slice(0,n),e.slice(n+1)];if(i.trim()===t)return decodeURIComponent(s)}return null}var We=class{};var ui="browser";function Bo(r){return r===ui}var Je=class{},rr=(()=>{class r{handle(e){return e.key}static \u0275fac=function(n){return new(n||r)};static \u0275prov=v({token:r,factory:r.\u0275fac})}return r})(),Ae=class{},ir=(()=>{class r extends Ae{compile(e,n){return e}compileTranslations(e,n){return e}static \u0275fac=(()=>{let e;return function(i){return(e||(e=ft(r)))(i||r)}})();static \u0275prov=v({token:r,factory:r.\u0275fac})}return r})(),_e=class{},sr=(()=>{class r extends _e{getTranslation(e){return _({})}static \u0275fac=(()=>{let e;return function(i){return(e||(e=ft(r)))(i||r)}})();static \u0275prov=v({token:r,factory:r.\u0275fac})}return r})();function Ye(r,t){if(r===t)return!0;if(r===null||t===null)return!1;if(r!==r&&t!==t)return!0;let e=typeof r,n=typeof t,i;if(e==n&&e=="object")if(Array.isArray(r)){if(!Array.isArray(t))return!1;if((i=r.length)==t.length){for(let s=0;s<i;s++)if(!Ye(r[s],t[s]))return!1;return!0}}else{if(Array.isArray(t))return!1;if(oe(r)&&oe(t)){let s=Object.create(null);for(let o in r){if(!Ye(r[o],t[o]))return!1;s[o]=!0}for(let o in t)if(!(o in s)&&typeof t[o]<"u")return!1;return!0}}return!1}function Z(r){return typeof r<"u"&&r!==null}function nr(r){return r!==void 0}function oe(r){return Ze(r)&&!be(r)&&r!==null}function Ze(r){return typeof r=="object"&&r!==null}function be(r){return Array.isArray(r)}function Xe(r){return typeof r=="string"}function di(r){return typeof r=="function"}function Dt(r){if(be(r))return r.map(t=>Dt(t));if(oe(r)){let t={};return Object.keys(r).forEach(e=>{t[e]=Dt(r[e])}),t}else return r}function ln(r,t){if(!Ze(r))return Dt(t);let e=Dt(r);return Ze(e)&&Ze(t)&&Object.keys(t).forEach(n=>{oe(t[n])?n in r?e[n]=ln(r[n],t[n]):Object.assign(e,{[n]:t[n]}):Object.assign(e,{[n]:t[n]})}),e}function or(r,t){let e=t.split(".");t="";do{t+=e.shift();let n=!e.length;if(Z(r)){if(oe(r)&&nr(r[t])&&(oe(r[t])||be(r[t])||n)){r=r[t],t="";continue}if(be(r)){let i=parseInt(t,10);if(nr(r[i])&&(oe(r[i])||be(r[i])||n)){r=r[i],t="";continue}}}if(n){r=void 0;continue}t+="."}while(e.length);return r}function fi(r,t,e){return ln(r,hi(t,e))}function hi(r,t){return r.split(".").reduceRight((e,n)=>({[n]:e}),t)}var Le=class{},ar=(()=>{class r extends Le{templateMatcher=/{{\s?([^{}\s]*)\s?}}/g;interpolate(e,n){if(Xe(e))return this.interpolateString(e,n);if(di(e))return this.interpolateFunction(e,n)}interpolateFunction(e,n){return e(n)}interpolateString(e,n){return n?e.replace(this.templateMatcher,(i,s)=>{let o=this.getInterpolationReplacement(n,s);return o!==void 0?o:i}):e}getInterpolationReplacement(e,n){return this.formatValue(or(e,n))}formatValue(e){if(Xe(e))return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(e===null)return"null";if(be(e))return e.join(", ");if(Ze(e))return typeof e.toString=="function"&&e.toString!==Object.prototype.toString?e.toString():JSON.stringify(e)}static \u0275fac=(()=>{let e;return function(i){return(e||(e=ft(r)))(i||r)}})();static \u0275prov=v({token:r,factory:r.\u0275fac})}return r})(),sn=(()=>{class r{_onTranslationChange=new Y;_onLangChange=new Y;_onFallbackLangChange=new Y;fallbackLang=null;currentLang;translations={};languages=[];getTranslations(e){return this.translations[e]}setTranslations(e,n,i){this.translations[e]=i&&this.hasTranslationFor(e)?ln(this.translations[e],n):n,this.addLanguages([e]),this._onTranslationChange.next({lang:e,translations:this.getTranslations(e)})}getLanguages(){return this.languages}getCurrentLang(){return this.currentLang}getFallbackLang(){return this.fallbackLang}setFallbackLang(e,n=!0){this.fallbackLang=e,n&&this._onFallbackLangChange.next({lang:e,translations:this.translations[e]})}setCurrentLang(e,n=!0){this.currentLang=e,n&&this._onLangChange.next({lang:e,translations:this.translations[e]})}get onTranslationChange(){return this._onTranslationChange.asObservable()}get onLangChange(){return this._onLangChange.asObservable()}get onFallbackLangChange(){return this._onFallbackLangChange.asObservable()}addLanguages(e){this.languages=Array.from(new Set([...this.languages,...e]))}hasTranslationFor(e){return typeof this.translations[e]<"u"}deleteTranslations(e){delete this.translations[e]}getTranslation(e){let n=this.getValue(this.currentLang,e);return n===void 0&&this.fallbackLang!=null&&this.fallbackLang!==this.currentLang&&(n=this.getValue(this.fallbackLang,e)),n}getValue(e,n){return or(this.getTranslations(e),n)}static \u0275fac=function(n){return new(n||r)};static \u0275prov=v({token:r,factory:r.\u0275fac})}return r})(),on=new j("TRANSLATE_CONFIG"),Ke=r=>ue(r)?r:_(r);var wt=(()=>{class r{loadingTranslations;pending=!1;_translationRequests={};lastUseLanguage=null;currentLoader=w(_e);compiler=w(Ae);parser=w(Le);missingTranslationHandler=w(Je);store=w(sn);extend=!1;get onTranslationChange(){return this.store.onTranslationChange}get onLangChange(){return this.store.onLangChange}get onFallbackLangChange(){return this.store.onFallbackLangChange}get onDefaultLangChange(){return this.store.onFallbackLangChange}constructor(){let e=S({extend:!1,fallbackLang:null},w(on,{optional:!0}));e.lang&&this.use(e.lang),e.fallbackLang&&this.setFallbackLang(e.fallbackLang),e.extend&&(this.extend=!0)}setFallbackLang(e){this.getFallbackLang()||this.store.setFallbackLang(e,!1);let n=this.loadOrExtendLanguage(e);return ue(n)?(n.pipe(Ve(1)).subscribe({next:()=>{this.store.setFallbackLang(e)},error:()=>{}}),n):(this.store.setFallbackLang(e),_(this.store.getTranslations(e)))}use(e){this.lastUseLanguage=e,this.getCurrentLang()||this.store.setCurrentLang(e,!1);let n=this.loadOrExtendLanguage(e);return ue(n)?(n.pipe(Ve(1)).subscribe({next:()=>{this.changeLang(e)},error:()=>{}}),n):(this.changeLang(e),_(this.store.getTranslations(e)))}loadOrExtendLanguage(e){if(!this.store.hasTranslationFor(e)||this.extend)return this._translationRequests[e]=this._translationRequests[e]||this.loadAndCompileTranslations(e),this._translationRequests[e]}changeLang(e){e===this.lastUseLanguage&&this.store.setCurrentLang(e)}getCurrentLang(){return this.store.getCurrentLang()}loadAndCompileTranslations(e){this.pending=!0;let n=this.currentLoader.getTranslation(e).pipe(jt(1),Ve(1));return this.loadingTranslations=n.pipe(P(i=>this.compiler.compileTranslations(i,e)),jt(1),Ve(1)),this.loadingTranslations.subscribe({next:i=>{this.store.setTranslations(e,i,this.extend),this.pending=!1},error:i=>{this.pending=!1}}),n}setTranslation(e,n,i=!1){let s=this.compiler.compileTranslations(n,e);this.store.setTranslations(e,s,i||this.extend)}getLangs(){return this.store.getLanguages()}addLangs(e){this.store.addLanguages(e)}getParsedResultForKey(e,n){let i=this.getTextToInterpolate(e);if(Z(i))return this.runInterpolation(i,n);let s=this.missingTranslationHandler.handle(S({key:e,translateService:this},n!==void 0&&{interpolateParams:n}));return s!==void 0?s:e}getFallbackLang(){return this.store.getFallbackLang()}getTextToInterpolate(e){return this.store.getTranslation(e)}runInterpolation(e,n){if(Z(e))return be(e)?this.runInterpolationOnArray(e,n):oe(e)?this.runInterpolationOnDict(e,n):this.parser.interpolate(e,n)}runInterpolationOnArray(e,n){return e.map(i=>this.runInterpolation(i,n))}runInterpolationOnDict(e,n){let i={};for(let s in e){let o=this.runInterpolation(e[s],n);o!==void 0&&(i[s]=o)}return i}getParsedResult(e,n){return e instanceof Array?this.getParsedResultForArray(e,n):this.getParsedResultForKey(e,n)}getParsedResultForArray(e,n){let i={},s=!1;for(let a of e)i[a]=this.getParsedResultForKey(a,n),s=s||ue(i[a]);if(!s)return i;let o=e.map(a=>Ke(i[a]));return En(o).pipe(P(a=>{let l={};return a.forEach((c,f)=>{l[e[f]]=c}),l}))}get(e,n){if(!Z(e)||!e.length)throw new Error('Parameter "key" is required and cannot be empty');return this.pending?this.loadingTranslations.pipe(ut(()=>Ke(this.getParsedResult(e,n)))):Ke(this.getParsedResult(e,n))}getStreamOnTranslationChange(e,n){if(!Z(e)||!e.length)throw new Error('Parameter "key" is required and cannot be empty');return Vt(Gt(()=>this.get(e,n)),this.onTranslationChange.pipe(Ge(()=>{let i=this.getParsedResult(e,n);return Ke(i)})))}stream(e,n){if(!Z(e)||!e.length)throw new Error('Parameter "key" required');return Vt(Gt(()=>this.get(e,n)),this.onLangChange.pipe(Ge(()=>{let i=this.getParsedResult(e,n);return Ke(i)})))}instant(e,n){if(!Z(e)||e.length===0)throw new Error('Parameter "key" is required and cannot be empty');let i=this.getParsedResult(e,n);return ue(i)?Array.isArray(e)?e.reduce((s,o)=>(s[o]=o,s),{}):e:i}set(e,n,i=this.getCurrentLang()){this.store.setTranslations(i,fi(this.store.getTranslations(i),e,Xe(n)?this.compiler.compile(n,i):this.compiler.compileTranslations(n,i)),!1)}reloadLang(e){return this.resetLang(e),this.loadAndCompileTranslations(e)}resetLang(e){delete this._translationRequests[e],this.store.deleteTranslations(e)}static getBrowserLang(){if(typeof window>"u"||!window.navigator)return;let e=this.getBrowserCultureLang();return e?e.split(/[-_]/)[0]:void 0}static getBrowserCultureLang(){if(!(typeof window>"u"||typeof window.navigator>"u"))return window.navigator.languages?window.navigator.languages[0]:window.navigator.language||window.navigator.browserLanguage||window.navigator.userLanguage}getBrowserLang(){return r.getBrowserLang()}getBrowserCultureLang(){return r.getBrowserCultureLang()}get defaultLang(){return this.getFallbackLang()}get currentLang(){return this.store.getCurrentLang()}get langs(){return this.store.getLanguages()}setDefaultLang(e){return this.setFallbackLang(e)}getDefaultLang(){return this.getFallbackLang()}static \u0275fac=function(n){return new(n||r)};static \u0275prov=v({token:r,factory:r.\u0275fac})}return r})(),Xo=(()=>{class r{translateService=w(wt);element=w(me);_ref=w(mt);key;lastParams;currentParams;onLangChangeSub;onFallbackLangChangeSub;onTranslationChangeSub;set translate(e){e&&(this.key=e,this.checkNodes())}set translateParams(e){Ye(this.currentParams,e)||(this.currentParams=e,this.checkNodes(!0))}constructor(){this.onTranslationChangeSub||(this.onTranslationChangeSub=this.translateService.onTranslationChange.subscribe(e=>{e.lang===this.translateService.currentLang&&this.checkNodes(!0,e.translations)})),this.onLangChangeSub||(this.onLangChangeSub=this.translateService.onLangChange.subscribe(e=>{this.checkNodes(!0,e.translations)})),this.onFallbackLangChangeSub||(this.onFallbackLangChangeSub=this.translateService.onFallbackLangChange.subscribe(e=>{this.checkNodes(!0)}))}ngAfterViewChecked(){this.checkNodes()}checkNodes(e=!1,n){let i=this.element.nativeElement.childNodes;i.length||(this.setContent(this.element.nativeElement,this.key),i=this.element.nativeElement.childNodes),i.forEach(s=>{let o=s;if(o.nodeType===3){let a;if(e&&(o.lastKey=null),Z(o.lookupKey))a=o.lookupKey;else if(this.key)a=this.key;else{let l=this.getContent(o),c=l.trim();c.length&&(o.lookupKey=c,l!==o.currentValue?(a=c,o.originalContent=l||o.originalContent):o.originalContent&&(a=o.originalContent.trim()))}this.updateValue(a,o,n)}})}updateValue(e,n,i){if(e){if(n.lastKey===e&&this.lastParams===this.currentParams)return;this.lastParams=this.currentParams;let s=o=>{(o!==e||!n.lastKey)&&(n.lastKey=e),n.originalContent||(n.originalContent=this.getContent(n)),Xe(o)?n.currentValue=o:Z(o)?n.currentValue=JSON.stringify(o):n.currentValue=n.originalContent||e,this.setContent(n,this.key?n.currentValue:n.originalContent.replace(e,n.currentValue)),this._ref.markForCheck()};if(Z(i)){let o=this.translateService.getParsedResult(e,this.currentParams);ue(o)?o.subscribe({next:s}):s(o)}else this.translateService.get(e,this.currentParams).subscribe(s)}}getContent(e){return Z(e.textContent)?e.textContent:e.data}setContent(e,n){Z(e.textContent)?e.textContent=n:e.data=n}ngOnDestroy(){this.onLangChangeSub&&this.onLangChangeSub.unsubscribe(),this.onFallbackLangChangeSub&&this.onFallbackLangChangeSub.unsubscribe(),this.onTranslationChangeSub&&this.onTranslationChangeSub.unsubscribe()}static \u0275fac=function(n){return new(n||r)};static \u0275dir=se({type:r,selectors:[["","translate",""],["","ngx-translate",""]],inputs:{translate:"translate",translateParams:"translateParams"}})}return r})(),Fe=(()=>{class r{translate=w(wt);_ref=w(mt);value="";lastKey=null;lastParams=[];onTranslationChange;onLangChange;onFallbackLangChange;updateValue(e,n,i){let s=o=>{this.value=o!==void 0?o:e,this.lastKey=e,this._ref.markForCheck()};if(i){let o=this.translate.getParsedResult(e,n);ue(o)?o.subscribe(s):s(o)}this.translate.get(e,n).subscribe(s)}transform(e,...n){if(!e||!e.length)return e;if(Ye(e,this.lastKey)&&Ye(n,this.lastParams))return this.value;let i;if(Z(n[0])&&n.length)if(Xe(n[0])&&n[0].length){let s=n[0].replace(/(')?([a-zA-Z0-9_]+)(')?(\s)?:/g,'"$2":').replace(/:(\s)?(')(.*?)(')/g,':"$3"');try{i=JSON.parse(s)}catch(o){throw new SyntaxError(`Wrong parameter in TranslatePipe. Expected a valid Object, received: ${n[0]}`)}}else oe(n[0])&&(i=n[0]);return this.lastKey=e,this.lastParams=n,this.updateValue(e,i),this._dispose(),this.onTranslationChange||(this.onTranslationChange=this.translate.onTranslationChange.subscribe(s=>{(this.lastKey&&s.lang===this.translate.getCurrentLang()||s.lang===this.translate.getFallbackLang())&&(this.lastKey=null,this.updateValue(e,i,s.translations))})),this.onLangChange||(this.onLangChange=this.translate.onLangChange.subscribe(s=>{this.lastKey&&(this.lastKey=null,this.updateValue(e,i,s.translations))})),this.onFallbackLangChange||(this.onFallbackLangChange=this.translate.onFallbackLangChange.subscribe(()=>{this.lastKey&&(this.lastKey=null,this.updateValue(e,i))})),this.value}_dispose(){typeof this.onTranslationChange<"u"&&(this.onTranslationChange.unsubscribe(),this.onTranslationChange=void 0),typeof this.onLangChange<"u"&&(this.onLangChange.unsubscribe(),this.onLangChange=void 0),typeof this.onFallbackLangChange<"u"&&(this.onFallbackLangChange.unsubscribe(),this.onFallbackLangChange=void 0)}ngOnDestroy(){this._dispose()}static \u0275fac=function(n){return new(n||r)};static \u0275pipe=Se({name:"translate",type:r,pure:!1});static \u0275prov=v({token:r,factory:r.\u0275fac})}return r})();function lr(r){return{provide:_e,useClass:r}}function cr(r){return{provide:Ae,useClass:r}}function ur(r){return{provide:Le,useClass:r}}function dr(r){return{provide:Je,useClass:r}}function Qo(r={}){return an(S({compiler:cr(ir),parser:ur(ar),loader:lr(sr),missingTranslationHandler:dr(rr)},r),!0)}function an(r={},t){let e=[];r.loader&&e.push(r.loader),r.compiler&&e.push(r.compiler),r.parser&&e.push(r.parser),r.missingTranslationHandler&&e.push(r.missingTranslationHandler),t&&e.push(sn),(r.useDefaultLang||r.defaultLanguage)&&(console.warn("The `useDefaultLang` and `defaultLanguage` options are deprecated. Please use `fallbackLang` instead."),r.useDefaultLang===!0&&r.defaultLanguage&&(r.fallbackLang=r.defaultLanguage));let n={fallbackLang:r.fallbackLang??null,lang:r.lang,extend:r.extend??!1};return e.push({provide:on,useValue:n}),e.push({provide:wt,useClass:wt,deps:[sn,_e,Ae,Le,Je,on]}),e}var Me=(()=>{class r{static forRoot(e={}){return{ngModule:r,providers:[...an(S({compiler:cr(ir),parser:ur(ar),loader:lr(sr),missingTranslationHandler:dr(rr)},e),!0)]}}static forChild(e={}){return{ngModule:r,providers:[...an(e,e.isolate??!1)]}}static \u0275fac=function(n){return new(n||r)};static \u0275mod=we({type:r});static \u0275inj=Ee({})}return r})();var ee=class r{params=A({});pageGuid=A("");setParams(t){this.params.update(e=>S(S({},e),t))}updateTemplateName(t){this.params.update(e=>{let n=e.templateData?N(S({},e.templateData),{publicationTemplateName:t}):{publicationTemplateName:t};return N(S({},e),{templateData:n})})}get token(){return this.params().token}get type(){return this.params().type}get guid(){return this.params().guid}get apiUrl(){return this.params().apiUrl}get language(){return this.params().language}get templateData(){return this.params().templateData}get documentData(){return this.params().documentData}static \u0275fac=function(e){return new(e||r)};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var fr=class r{modalState=new Y;modalState$=this.modalState.asObservable();open(t,e){this.modalState.next({component:t,data:e})}close(){this.modalState.next(null)}static \u0275fac=function(e){return new(e||r)};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var Re=class{},Qe=class{},L=class r{headers;normalizedNames=new Map;lazyInit;lazyUpdate=null;constructor(t){t?typeof t=="string"?this.lazyInit=()=>{this.headers=new Map,t.split(`
2
+ `).forEach(e=>{let n=e.indexOf(":");if(n>0){let i=e.slice(0,n),s=e.slice(n+1).trim();this.addHeaderEntry(i,s)}})}:typeof Headers<"u"&&t instanceof Headers?(this.headers=new Map,t.forEach((e,n)=>{this.addHeaderEntry(n,e)})):this.lazyInit=()=>{this.headers=new Map,Object.entries(t).forEach(([e,n])=>{this.setHeaderEntries(e,n)})}:this.headers=new Map}has(t){return this.init(),this.headers.has(t.toLowerCase())}get(t){this.init();let e=this.headers.get(t.toLowerCase());return e&&e.length>0?e[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(t){return this.init(),this.headers.get(t.toLowerCase())||null}append(t,e){return this.clone({name:t,value:e,op:"a"})}set(t,e){return this.clone({name:t,value:e,op:"s"})}delete(t,e){return this.clone({name:t,value:e,op:"d"})}maybeSetNormalizedName(t,e){this.normalizedNames.has(e)||this.normalizedNames.set(e,t)}init(){this.lazyInit&&(this.lazyInit instanceof r?this.copyFrom(this.lazyInit):this.lazyInit(),this.lazyInit=null,this.lazyUpdate&&(this.lazyUpdate.forEach(t=>this.applyUpdate(t)),this.lazyUpdate=null))}copyFrom(t){t.init(),Array.from(t.headers.keys()).forEach(e=>{this.headers.set(e,t.headers.get(e)),this.normalizedNames.set(e,t.normalizedNames.get(e))})}clone(t){let e=new r;return e.lazyInit=this.lazyInit&&this.lazyInit instanceof r?this.lazyInit:this,e.lazyUpdate=(this.lazyUpdate||[]).concat([t]),e}applyUpdate(t){let e=t.name.toLowerCase();switch(t.op){case"a":case"s":let n=t.value;if(typeof n=="string"&&(n=[n]),n.length===0)return;this.maybeSetNormalizedName(t.name,e);let i=(t.op==="a"?this.headers.get(e):void 0)||[];i.push(...n),this.headers.set(e,i);break;case"d":let s=t.value;if(!s)this.headers.delete(e),this.normalizedNames.delete(e);else{let o=this.headers.get(e);if(!o)return;o=o.filter(a=>s.indexOf(a)===-1),o.length===0?(this.headers.delete(e),this.normalizedNames.delete(e)):this.headers.set(e,o)}break}}addHeaderEntry(t,e){let n=t.toLowerCase();this.maybeSetNormalizedName(t,n),this.headers.has(n)?this.headers.get(n).push(e):this.headers.set(n,[e])}setHeaderEntries(t,e){let n=(Array.isArray(e)?e:[e]).map(s=>s.toString()),i=t.toLowerCase();this.headers.set(i,n),this.maybeSetNormalizedName(t,i)}forEach(t){this.init(),Array.from(this.normalizedNames.keys()).forEach(e=>t(this.normalizedNames.get(e),this.headers.get(e)))}};var Ct=class{encodeKey(t){return hr(t)}encodeValue(t){return hr(t)}decodeKey(t){return decodeURIComponent(t)}decodeValue(t){return decodeURIComponent(t)}};function pi(r,t){let e=new Map;return r.length>0&&r.replace(/^\?/,"").split("&").forEach(i=>{let s=i.indexOf("="),[o,a]=s==-1?[t.decodeKey(i),""]:[t.decodeKey(i.slice(0,s)),t.decodeValue(i.slice(s+1))],l=e.get(o)||[];l.push(a),e.set(o,l)}),e}var mi=/%(\d[a-f0-9])/gi,gi={40:"@","3A":":",24:"$","2C":",","3B":";","3D":"=","3F":"?","2F":"/"};function hr(r){return encodeURIComponent(r).replace(mi,(t,e)=>gi[e]??t)}function St(r){return`${r}`}var ae=class r{map;encoder;updates=null;cloneFrom=null;constructor(t={}){if(this.encoder=t.encoder||new Ct,t.fromString){if(t.fromObject)throw new U(2805,!1);this.map=pi(t.fromString,this.encoder)}else t.fromObject?(this.map=new Map,Object.keys(t.fromObject).forEach(e=>{let n=t.fromObject[e],i=Array.isArray(n)?n.map(St):[St(n)];this.map.set(e,i)})):this.map=null}has(t){return this.init(),this.map.has(t)}get(t){this.init();let e=this.map.get(t);return e?e[0]:null}getAll(t){return this.init(),this.map.get(t)||null}keys(){return this.init(),Array.from(this.map.keys())}append(t,e){return this.clone({param:t,value:e,op:"a"})}appendAll(t){let e=[];return Object.keys(t).forEach(n=>{let i=t[n];Array.isArray(i)?i.forEach(s=>{e.push({param:n,value:s,op:"a"})}):e.push({param:n,value:i,op:"a"})}),this.clone(e)}set(t,e){return this.clone({param:t,value:e,op:"s"})}delete(t,e){return this.clone({param:t,value:e,op:"d"})}toString(){return this.init(),this.keys().map(t=>{let e=this.encoder.encodeKey(t);return this.map.get(t).map(n=>e+"="+this.encoder.encodeValue(n)).join("&")}).filter(t=>t!=="").join("&")}clone(t){let e=new r({encoder:this.encoder});return e.cloneFrom=this.cloneFrom||this,e.updates=(this.updates||[]).concat(t),e}init(){this.map===null&&(this.map=new Map),this.cloneFrom!==null&&(this.cloneFrom.init(),this.cloneFrom.keys().forEach(t=>this.map.set(t,this.cloneFrom.map.get(t))),this.updates.forEach(t=>{switch(t.op){case"a":case"s":let e=(t.op==="a"?this.map.get(t.param):void 0)||[];e.push(St(t.value)),this.map.set(t.param,e);break;case"d":if(t.value!==void 0){let n=this.map.get(t.param)||[],i=n.indexOf(St(t.value));i!==-1&&n.splice(i,1),n.length>0?this.map.set(t.param,n):this.map.delete(t.param)}else{this.map.delete(t.param);break}}}),this.cloneFrom=this.updates=null)}};var Tt=class{map=new Map;set(t,e){return this.map.set(t,e),this}get(t){return this.map.has(t)||this.map.set(t,t.defaultValue()),this.map.get(t)}delete(t){return this.map.delete(t),this}has(t){return this.map.has(t)}keys(){return this.map.keys()}};function bi(r){switch(r){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"JSONP":return!1;default:return!0}}function pr(r){return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer}function mr(r){return typeof Blob<"u"&&r instanceof Blob}function gr(r){return typeof FormData<"u"&&r instanceof FormData}function yi(r){return typeof URLSearchParams<"u"&&r instanceof URLSearchParams}var br="Content-Type",yr="Accept",vr="X-Request-URL",Dr="text/plain",wr="application/json",Ei=`${wr}, ${Dr}, */*`,Ne=class r{url;body=null;headers;context;reportProgress=!1;withCredentials=!1;credentials;keepalive=!1;cache;priority;mode;redirect;referrer;integrity;responseType="json";method;params;urlWithParams;transferCache;timeout;constructor(t,e,n,i){this.url=e,this.method=t.toUpperCase();let s;if(bi(this.method)||i?(this.body=n!==void 0?n:null,s=i):s=n,s){if(this.reportProgress=!!s.reportProgress,this.withCredentials=!!s.withCredentials,this.keepalive=!!s.keepalive,s.responseType&&(this.responseType=s.responseType),s.headers&&(this.headers=s.headers),s.context&&(this.context=s.context),s.params&&(this.params=s.params),s.priority&&(this.priority=s.priority),s.cache&&(this.cache=s.cache),s.credentials&&(this.credentials=s.credentials),typeof s.timeout=="number"){if(s.timeout<1||!Number.isInteger(s.timeout))throw new U(2822,"");this.timeout=s.timeout}s.mode&&(this.mode=s.mode),s.redirect&&(this.redirect=s.redirect),s.integrity&&(this.integrity=s.integrity),s.referrer&&(this.referrer=s.referrer),this.transferCache=s.transferCache}if(this.headers??=new L,this.context??=new Tt,!this.params)this.params=new ae,this.urlWithParams=e;else{let o=this.params.toString();if(o.length===0)this.urlWithParams=e;else{let a=e.indexOf("?"),l=a===-1?"?":a<e.length-1?"&":"";this.urlWithParams=e+l+o}}}serializeBody(){return this.body===null?null:typeof this.body=="string"||pr(this.body)||mr(this.body)||gr(this.body)||yi(this.body)?this.body:this.body instanceof ae?this.body.toString():typeof this.body=="object"||typeof this.body=="boolean"||Array.isArray(this.body)?JSON.stringify(this.body):this.body.toString()}detectContentTypeHeader(){return this.body===null||gr(this.body)?null:mr(this.body)?this.body.type||null:pr(this.body)?null:typeof this.body=="string"?Dr:this.body instanceof ae?"application/x-www-form-urlencoded;charset=UTF-8":typeof this.body=="object"||typeof this.body=="number"||typeof this.body=="boolean"?wr:null}clone(t={}){let e=t.method||this.method,n=t.url||this.url,i=t.responseType||this.responseType,s=t.keepalive??this.keepalive,o=t.priority||this.priority,a=t.cache||this.cache,l=t.mode||this.mode,c=t.redirect||this.redirect,f=t.credentials||this.credentials,d=t.referrer||this.referrer,u=t.integrity||this.integrity,p=t.transferCache??this.transferCache,m=t.timeout??this.timeout,E=t.body!==void 0?t.body:this.body,b=t.withCredentials??this.withCredentials,h=t.reportProgress??this.reportProgress,g=t.headers||this.headers,D=t.params||this.params,y=t.context??this.context;return t.setHeaders!==void 0&&(g=Object.keys(t.setHeaders).reduce((C,F)=>C.set(F,t.setHeaders[F]),g)),t.setParams&&(D=Object.keys(t.setParams).reduce((C,F)=>C.set(F,t.setParams[F]),D)),new r(e,n,E,{params:D,headers:g,context:y,reportProgress:h,responseType:i,withCredentials:b,transferCache:p,keepalive:s,cache:a,priority:o,timeout:m,mode:l,redirect:c,credentials:f,referrer:d,integrity:u})}},ye=(function(r){return r[r.Sent=0]="Sent",r[r.UploadProgress=1]="UploadProgress",r[r.ResponseHeader=2]="ResponseHeader",r[r.DownloadProgress=3]="DownloadProgress",r[r.Response=4]="Response",r[r.User=5]="User",r})(ye||{}),xe=class{headers;status;statusText;url;ok;type;redirected;constructor(t,e=200,n="OK"){this.headers=t.headers||new L,this.status=t.status!==void 0?t.status:e,this.statusText=t.statusText||n,this.url=t.url||null,this.redirected=t.redirected,this.ok=this.status>=200&&this.status<300}},At=class r extends xe{constructor(t={}){super(t)}type=ye.ResponseHeader;clone(t={}){return new r({headers:t.headers||this.headers,status:t.status!==void 0?t.status:this.status,statusText:t.statusText||this.statusText,url:t.url||this.url||void 0})}},et=class r extends xe{body;constructor(t={}){super(t),this.body=t.body!==void 0?t.body:null}type=ye.Response;clone(t={}){return new r({body:t.body!==void 0?t.body:this.body,headers:t.headers||this.headers,status:t.status!==void 0?t.status:this.status,statusText:t.statusText||this.statusText,url:t.url||this.url||void 0,redirected:t.redirected??this.redirected})}},Oe=class extends xe{name="HttpErrorResponse";message;error;ok=!1;constructor(t){super(t,0,"Unknown Error"),this.status>=200&&this.status<300?this.message=`Http failure during parsing for ${t.url||"(unknown url)"}`:this.message=`Http failure response for ${t.url||"(unknown url)"}: ${t.status} ${t.statusText}`,this.error=t.error||null}},vi=200,Di=204;function dn(r,t){return{body:t,headers:r.headers,context:r.context,observe:r.observe,params:r.params,reportProgress:r.reportProgress,responseType:r.responseType,withCredentials:r.withCredentials,credentials:r.credentials,transferCache:r.transferCache,timeout:r.timeout,keepalive:r.keepalive,priority:r.priority,cache:r.cache,mode:r.mode,redirect:r.redirect,integrity:r.integrity,referrer:r.referrer}}var re=(()=>{class r{handler;constructor(e){this.handler=e}request(e,n,i={}){let s;if(e instanceof Ne)s=e;else{let l;i.headers instanceof L?l=i.headers:l=new L(i.headers);let c;i.params&&(i.params instanceof ae?c=i.params:c=new ae({fromObject:i.params})),s=new Ne(e,n,i.body!==void 0?i.body:null,{headers:l,context:i.context,params:c,reportProgress:i.reportProgress,responseType:i.responseType||"json",withCredentials:i.withCredentials,transferCache:i.transferCache,keepalive:i.keepalive,priority:i.priority,cache:i.cache,mode:i.mode,redirect:i.redirect,credentials:i.credentials,referrer:i.referrer,integrity:i.integrity,timeout:i.timeout})}let o=_(s).pipe(ut(l=>this.handler.handle(l)));if(e instanceof Ne||i.observe==="events")return o;let a=o.pipe(ct(l=>l instanceof et));switch(i.observe||"body"){case"body":switch(s.responseType){case"arraybuffer":return a.pipe(P(l=>{if(l.body!==null&&!(l.body instanceof ArrayBuffer))throw new U(2806,!1);return l.body}));case"blob":return a.pipe(P(l=>{if(l.body!==null&&!(l.body instanceof Blob))throw new U(2807,!1);return l.body}));case"text":return a.pipe(P(l=>{if(l.body!==null&&typeof l.body!="string")throw new U(2808,!1);return l.body}));case"json":default:return a.pipe(P(l=>l.body))}case"response":return a;default:throw new U(2809,!1)}}delete(e,n={}){return this.request("DELETE",e,n)}get(e,n={}){return this.request("GET",e,n)}head(e,n={}){return this.request("HEAD",e,n)}jsonp(e,n){return this.request("JSONP",e,{params:new ae().append(n,"JSONP_CALLBACK"),observe:"body",responseType:"json"})}options(e,n={}){return this.request("OPTIONS",e,n)}patch(e,n,i={}){return this.request("PATCH",e,dn(i,n))}post(e,n,i={}){return this.request("POST",e,dn(i,n))}put(e,n,i={}){return this.request("PUT",e,dn(i,n))}static \u0275fac=function(n){return new(n||r)(T(Re))};static \u0275prov=v({token:r,factory:r.\u0275fac})}return r})();var wi=new j("");function Sr(r,t){return t(r)}function Si(r,t){return(e,n)=>t.intercept(e,{handle:i=>r(i,n)})}function Ci(r,t,e){return(n,i)=>Sn(e,()=>t(n,s=>r(s,i)))}var Cr=new j(""),hn=new j(""),Tr=new j(""),pn=new j("",{providedIn:"root",factory:()=>!0});function Ti(){let r=null;return(t,e)=>{r===null&&(r=(w(Cr,{optional:!0})??[]).reduceRight(Si,Sr));let n=w(Ht);if(w(pn)){let s=n.add();return r(t,e).pipe(Ut(s))}else return r(t,e)}}var _t=(()=>{class r extends Re{backend;injector;chain=null;pendingTasks=w(Ht);contributeToStability=w(pn);constructor(e,n){super(),this.backend=e,this.injector=n}handle(e){if(this.chain===null){let n=Array.from(new Set([...this.injector.get(hn),...this.injector.get(Tr,[])]));this.chain=n.reduceRight((i,s)=>Ci(i,s,this.injector),Sr)}if(this.contributeToStability){let n=this.pendingTasks.add();return this.chain(e,i=>this.backend.handle(i)).pipe(Ut(n))}else return this.chain(e,n=>this.backend.handle(n))}static \u0275fac=function(n){return new(n||r)(T(Qe),T(wn))};static \u0275prov=v({token:r,factory:r.\u0275fac})}return r})();var Ai=/^\)\]\}',?\n/,_i=RegExp(`^${vr}:`,"m");function Li(r){return"responseURL"in r&&r.responseURL?r.responseURL:_i.test(r.getAllResponseHeaders())?r.getResponseHeader(vr):null}var fn=(()=>{class r{xhrFactory;constructor(e){this.xhrFactory=e}handle(e){if(e.method==="JSONP")throw new U(-2800,!1);let n=this.xhrFactory;return _(null).pipe(Ge(()=>new yn(s=>{let o=n.build();if(o.open(e.method,e.urlWithParams),e.withCredentials&&(o.withCredentials=!0),e.headers.forEach((b,h)=>o.setRequestHeader(b,h.join(","))),e.headers.has(yr)||o.setRequestHeader(yr,Ei),!e.headers.has(br)){let b=e.detectContentTypeHeader();b!==null&&o.setRequestHeader(br,b)}if(e.timeout&&(o.timeout=e.timeout),e.responseType){let b=e.responseType.toLowerCase();o.responseType=b!=="json"?b:"text"}let a=e.serializeBody(),l=null,c=()=>{if(l!==null)return l;let b=o.statusText||"OK",h=new L(o.getAllResponseHeaders()),g=Li(o)||e.url;return l=new At({headers:h,status:o.status,statusText:b,url:g}),l},f=()=>{let{headers:b,status:h,statusText:g,url:D}=c(),y=null;h!==Di&&(y=typeof o.response>"u"?o.responseText:o.response),h===0&&(h=y?vi:0);let C=h>=200&&h<300;if(e.responseType==="json"&&typeof y=="string"){let F=y;y=y.replace(Ai,"");try{y=y!==""?JSON.parse(y):null}catch(I){y=F,C&&(C=!1,y={error:I,text:y})}}C?(s.next(new et({body:y,headers:b,status:h,statusText:g,url:D||void 0})),s.complete()):s.error(new Oe({error:y,headers:b,status:h,statusText:g,url:D||void 0}))},d=b=>{let{url:h}=c(),g=new Oe({error:b,status:o.status||0,statusText:o.statusText||"Unknown Error",url:h||void 0});s.error(g)},u=d;e.timeout&&(u=b=>{let{url:h}=c(),g=new Oe({error:new DOMException("Request timed out","TimeoutError"),status:o.status||0,statusText:o.statusText||"Request timeout",url:h||void 0});s.error(g)});let p=!1,m=b=>{p||(s.next(c()),p=!0);let h={type:ye.DownloadProgress,loaded:b.loaded};b.lengthComputable&&(h.total=b.total),e.responseType==="text"&&o.responseText&&(h.partialText=o.responseText),s.next(h)},E=b=>{let h={type:ye.UploadProgress,loaded:b.loaded};b.lengthComputable&&(h.total=b.total),s.next(h)};return o.addEventListener("load",f),o.addEventListener("error",d),o.addEventListener("timeout",u),o.addEventListener("abort",d),e.reportProgress&&(o.addEventListener("progress",m),a!==null&&o.upload&&o.upload.addEventListener("progress",E)),o.send(a),s.next({type:ye.Sent}),()=>{o.removeEventListener("error",d),o.removeEventListener("abort",d),o.removeEventListener("load",f),o.removeEventListener("timeout",u),e.reportProgress&&(o.removeEventListener("progress",m),a!==null&&o.upload&&o.upload.removeEventListener("progress",E)),o.readyState!==o.DONE&&o.abort()}})))}static \u0275fac=function(n){return new(n||r)(T(We))};static \u0275prov=v({token:r,factory:r.\u0275fac})}return r})(),Ar=new j(""),Fi="XSRF-TOKEN",Mi=new j("",{providedIn:"root",factory:()=>Fi}),Ni="X-XSRF-TOKEN",Oi=new j("",{providedIn:"root",factory:()=>Ni}),tt=class{},Ri=(()=>{class r{doc;cookieName;lastCookieString="";lastToken=null;parseCount=0;constructor(e,n){this.doc=e,this.cookieName=n}getToken(){let e=this.doc.cookie||"";return e!==this.lastCookieString&&(this.parseCount++,this.lastToken=rn(e,this.cookieName),this.lastCookieString=e),this.lastToken}static \u0275fac=function(n){return new(n||r)(T(ve),T(Mi))};static \u0275prov=v({token:r,factory:r.\u0275fac})}return r})(),xi=/^(?:https?:)?\/\//i;function Pi(r,t){if(!w(Ar)||r.method==="GET"||r.method==="HEAD"||xi.test(r.url))return t(r);let e=w(tt).getToken(),n=w(Oi);return e!=null&&!r.headers.has(n)&&(r=r.clone({headers:r.headers.set(n,e)})),t(r)}var mn=(function(r){return r[r.Interceptors=0]="Interceptors",r[r.LegacyInterceptors=1]="LegacyInterceptors",r[r.CustomXsrfConfiguration=2]="CustomXsrfConfiguration",r[r.NoXsrfProtection=3]="NoXsrfProtection",r[r.JsonpSupport=4]="JsonpSupport",r[r.RequestsMadeViaParent=5]="RequestsMadeViaParent",r[r.Fetch=6]="Fetch",r})(mn||{});function Ii(r,t){return{\u0275kind:r,\u0275providers:t}}function _r(...r){let t=[re,fn,_t,{provide:Re,useExisting:_t},{provide:Qe,useFactory:()=>w(wi,{optional:!0})??w(fn)},{provide:hn,useValue:Pi,multi:!0},{provide:Ar,useValue:!0},{provide:tt,useClass:Ri}];for(let e of r)t.push(...e.\u0275providers);return Dn(t)}var Er=new j("");function Lr(){return Ii(mn.LegacyInterceptors,[{provide:Er,useFactory:Ti},{provide:hn,useExisting:Er,multi:!0}])}var ki=(()=>{class r{static \u0275fac=function(n){return new(n||r)};static \u0275mod=we({type:r});static \u0275inj=Ee({providers:[_r(Lr())]})}return r})();var Lt=class r{constructor(t,e){this.http=t;this.appParams=e}getAssetByGuid(t){let e=this.appParams.apiUrl,n=new L({Authorization:`bearer ${this.appParams.token}`}),i=`${e}Dam/assets/${t}`;return this.http.get(i,{headers:n})}getSVGTemplate(t){let e=`${this.appParams.apiUrl}DataSheets/${t}`,n=this.appParams.token,i=new L({Authorization:`bearer ${n}`});return this.http.get(e,{headers:i}).pipe(R(s=>(console.error("Error in getSVGTemplate",s),_(null))))}getTemplateBackgroundsList(t){let e=`${this.appParams.apiUrl}DataSheets/backgrounds/template?templateId=${t}`,n=this.appParams.token,i=new L({Authorization:`bearer ${n}`});return this.http.get(e,{headers:i}).pipe(R(s=>(console.error("Error in getTemplateBackgroundsList",s),_(null))))}getSVGDocumentPages(t){let e=`${this.appParams.apiUrl}dam/documents/${t}`,n=this.appParams.token,i=new L({Authorization:`bearer ${n}`});return this.http.get(e,{headers:i}).pipe(R(s=>(console.error("Error in getSVGDocumentPages",s),_(null))))}getTemplateDimensions(){let t=`${this.appParams.apiUrl}DataSheets/templateDimensions`,e=this.appParams.token,n=new L({Authorization:`bearer ${e}`});return this.http.get(t,{headers:n}).pipe(R(i=>(console.error("Error in getTemplateDimensions",i),_(null))))}saveDocument(t,e){switch(t){case"productblock":t="productblocks";break;case"background":t="backgrounds";break;case"cover":t="coverpages";break;case"marketing":t="marketing";break;case"document":t="documents";break;default:break}let n=`${this.appParams.apiUrl}DataSheets/upload/${t.toLowerCase()}`,i=new L({Authorization:`bearer ${this.appParams.token}`});return this.http.post(n,e,{headers:i}).pipe(R(s=>(console.error("Error saving document",s),_(null))))}loadSvgFromUrl(t){let e=Date.now(),n=t.includes("?")?"&":"?",i=`${t}${n}date=${e}`;return this.http.get(i,{responseType:"text"}).pipe(R(s=>(console.error("Error loading SVG from URL",s),_(""))))}addDocumentPage(t,e){let n=`${this.appParams.apiUrl}Dam/documents/page`,i=new L({Authorization:`bearer ${this.appParams.token}`,"Content-Type":"application/json"}),s={assetGuid:t};return e!=null&&(s.start=e),this.http.post(n,s,{headers:i}).pipe(P(o=>o?.addPageToDocument),R(o=>(console.error("Error adding document page",o),_(null))))}duplicateDocumentPage(t,e){let n=`${this.appParams.apiUrl}Dam/documents/page`,i=new L({Authorization:`bearer ${this.appParams.token}`,"Content-Type":"application/json"});return this.http.post(n,{assetGuid:t,fileGuid:e},{headers:i}).pipe(P(s=>s?.addPageToDocument),R(s=>(console.error("Error duplicating document page",s),_(null))))}moveDocumentPage(t,e,n){let i=`${this.appParams.apiUrl}Dam/documents/page/${t}/${e}/${n}`,s=new L({Authorization:`bearer ${this.appParams.token}`,"Content-Type":"application/json"});return this.http.put(i,null,{headers:s}).pipe(P(o=>o?.movePageOfDocument),R(o=>(console.error("Error moving document page",o),_(null))))}deleteDocumentPage(t,e){let n=`${this.appParams.apiUrl}Dam/documents/page/${t}/${e}`,i=new L({Authorization:`bearer ${this.appParams.token}`});return this.http.delete(n,{headers:i}).pipe(P(s=>s?.deletePageOfDocument),R(s=>(console.error("Error deleting document page",s),_(null))))}updateTemplateField(t,e){let n=`${this.appParams.apiUrl}DataSheets/field`,i=new L({Authorization:`bearer ${this.appParams.token}`,"Content-Type":"application/json"});return this.http.put(n,{publicationTemplateGuid:this.appParams.guid,fieldName:t,fieldValue:e},{headers:i}).pipe(R(s=>(console.error("Error updating template field",s),_(null))))}getTemplates(){let t=`${this.appParams.apiUrl}DataSheets/publicationstemplates`,e=new L({Authorization:`bearer ${this.appParams.token}`});return this.http.get(t,{headers:e}).pipe(P(n=>n?.Gabarits||[]),R(n=>(console.error("Error fetching templates",n),_([]))))}publishYoubooky(){let t=`${this.appParams.apiUrl}DataSheets/youbooky`,e=new L({Authorization:`bearer ${this.appParams.token}`,"Content-Type":"application/json"}),n={documentGuid:this.appParams.guid,isPublication:!1};return this.http.post(t,n,{headers:e}).pipe(R(i=>(console.error("Error publishing to Youbooky",i),_(null))))}checkPdfExistence(){let t=`${this.appParams.apiUrl}Dam/documents/exist/${this.appParams.guid}`,e=new L({Authorization:`bearer ${this.appParams.token}`});return this.http.get(t,{headers:e}).pipe(R(n=>(console.error("Error checking PDF existence",n),_(null))))}generatePdf(t=!1,e="rgb",n=!1,i=!1){let s=`${this.appParams.apiUrl}DataSheets/generate/svg`,o=new L({Authorization:`bearer ${this.appParams.token}`,"Content-Type":"application/json"}),a={source:6,sourceGuid:this.appParams.guid,type:1,highDefinition:t,imageColorProfile:e,bleedMargin:n,cuttingLines:i,language:this.appParams.language};return this.http.post(s,a,{headers:o}).pipe(R(l=>(console.error("Error generating PDF",l),_(null))))}static \u0275fac=function(e){return new(e||r)(T(re),T(ee))};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var nt="1.104";function Gi(r,t){let e=r.getAttribute("data-sp-version");if(!e){let o=r.getAttribute("version");e=o&&o!=="1.1"?o:"1.0"}let n=["1.0","1.1","1.101","1.102","1.103","1.104"],i=n.indexOf(e);if(i===-1)return console.warn("Unknown version:",e),!1;if(i===n.length-1)return r.setAttribute("data-sp-version",e),r.setAttribute("version","1.1"),!1;let s=!1;for(let o=i+1;o<n.length;o++){let a=n[o],l=ji[a];typeof l=="function"&&(l(r,t),r.setAttribute("data-sp-version",a),r.setAttribute("version","1.1"),s=!0)}return s}var Mr=["B","I","U","FONT"];function Nr(r,t){if(!r.trim())return null;let e=document.createElement("tspan"),n=e,i=t.slice();for(let s=i.length-1;s>=0;s--){let o=document.createElement(i[s].nodeName.toLowerCase());for(let a of Array.from(i[s].attributes))o.setAttribute(a.name,a.value);n.appendChild(o),n=o}return n.textContent=r,e}function Ui(r){let t=/\{\{([^}]+)\}\}/g,e=[];function n(i,s=[]){if(i.nodeType===Node.TEXT_NODE){let o=i.textContent||"",a=0,l;for(;(l=t.exec(o))!==null;){let d=o.slice(a,l.index),u=l[0];a=t.lastIndex;let p=null;d&&(p=Nr(d,s)),p||(p=document.createElement("tspan")),e.push(p);let m=l[1],E=s.every(h=>Mr.includes(h.nodeName)),b=document.createElement("tspan");if(b.setAttribute("class","textAttribute"),b.setAttribute("contenteditable","false"),b.setAttribute("data-info",m),b.setAttribute("data-show-text","true"),E){let h=b;for(let g=s.length-1;g>=0;g--){let D=document.createElement(s[g].nodeName.toLowerCase());for(let y of Array.from(s[g].attributes))D.setAttribute(y.name,y.value);h.appendChild(D),h=D}h.textContent=m}else b.textContent=m;e.push(b)}let c=o.slice(a),f=null;c&&(f=Nr(c,s)),f||(f=document.createElement("tspan")),e.push(f)}else if(i.nodeType===Node.ELEMENT_NODE&&Mr.includes(i.nodeName))for(let o of Array.from(i.childNodes))n(o,[...s,i]);else for(let o of Array.from(i.childNodes))n(o,s)}return n(r),e}var ji={"1.1":(r,t)=>{},"1.101":(r,t)=>{r.querySelectorAll('foreignObject[data-type="text"] > div > *:not(div)').forEach(i=>{let s=document.createElement("div");s.innerHTML=i.outerHTML,s.setAttribute("data-info",i.getAttribute("data-info")||""),i.replaceWith(s)}),r.querySelectorAll('foreignObject[data-type="text"] > div > div:not(.textAttribute)').forEach(i=>{let s=document.createElement("div");s.innerHTML=i.innerHTML;let o=Ui(s).filter(l=>l!==null),a=document.createElement("div");a.setAttribute("data-info",i.getAttribute("data-info")||""),o.forEach(l=>a.appendChild(l)),i.replaceWith(a)})},"1.102":(r,t)=>{let e=/(.*?)\{\{(.*?)\}\}(.*)/;r.querySelectorAll('foreignObject[data-type="variantsTable"]').forEach(i=>{let s=i.querySelector("tbody");if(!s||s.children.length<2)return;Array.from(s.children[1].children).forEach(a=>{let l=a.querySelector(".cellContent");if(!l)return;let f=(l.textContent||"").match(e);f&&(l.innerHTML=`<tspan></tspan><tspan class="textAttribute">${f[2]}</tspan><tspan></tspan>`)})})},"1.103":(r,t)=>{r.querySelectorAll('foreignObject[data-type="productTable"]').forEach(n=>{let i=n.querySelector("tbody");if(!i)return;Array.from(i.querySelectorAll("tr")).forEach(o=>{if(o.classList.contains("columns-index-row"))return;Array.from(o.children).forEach(l=>{if(l.classList.contains("row-index-cell"))return;let c=l,f=c.textContent?.trim();if(!f)return;let d=/\{\{(.+?)\}\}/g,u=0,p="";p+="<tspan></tspan>";let m;for(;(m=d.exec(f))!==null;){let b=f.slice(u,m.index),h=m[1];b&&(p+=`<tspan>${b}</tspan>`),p+=`<tspan class="textAttribute" contenteditable="false">${h}</tspan>`,u=d.lastIndex}let E=f.slice(u);E&&(p+=`<tspan>${E}</tspan>`),p+="<tspan></tspan>",c.innerHTML=p})})})},"1.104":(r,t)=>{r.querySelectorAll('foreignObject[data-type="variantsTable"] table, foreignObject[data-type="productTable"] table').forEach(l=>{let c=l;c.style.removeProperty("height"),c.style.minWidth==="var(--min-width)"&&c.style.removeProperty("min-width")}),r.querySelectorAll('foreignObject[data-type="variantsTable"], foreignObject[data-type="productTable"]').forEach(l=>{l.style.removeProperty("--min-width")}),r.querySelectorAll('foreignObject[data-type="productTable"] .wrap').forEach(l=>{l.removeAttribute("style")});let s=r.querySelectorAll('foreignObject[data-type="variantsTable"] table td, foreignObject[data-type="variantsTable"] table th');if(s.forEach(l=>{let c=l;(c.style.padding==="0px"||c.style.padding==="0")&&(c.style.removeProperty("padding"),c.getAttribute("style")||c.removeAttribute("style"))}),s.forEach(l=>{l.classList.contains("fixed-width")&&(l.classList.remove("fixed-width"),l.classList.length===0&&l.removeAttribute("class"))}),r.querySelectorAll('foreignObject[data-type="variantsTable"] table td div.wrap, foreignObject[data-type="variantsTable"] table th div.wrap').forEach(l=>{l.removeAttribute("style")}),r.querySelectorAll('foreignObject[data-type="variantsTable"] table td > div div, foreignObject[data-type="variantsTable"] table th > div div').forEach(l=>{let c=l;c.style.whiteSpace==="pre-wrap"&&(c.style.removeProperty("white-space"),c.getAttribute("style")||c.removeAttribute("style"))}),t&&t.publicationTemplateSettingVariants)try{let l=typeof t.publicationTemplateSettingVariants=="string"?JSON.parse(t.publicationTemplateSettingVariants):t.publicationTemplateSettingVariants;l?.backgroundVariation&&r.querySelectorAll('foreignObject[data-type="variantsTable"] table, table[data-type="variantsTable"], foreignObject[data-type="productTable"] table, table[data-type="productTable"]').forEach(f=>{if(l.backgroundVariation.hasVariation){f.setAttribute("data-background-variation","true");let d=l.backgroundVariation.backgroundColor;if(d)if(d.startsWith("rgb")){let u=d.replace(/^rgba?\(|\s+|\)$/g,"").split(","),p=parseInt(u[0]||"0",10).toString(16).padStart(2,"0"),m=parseInt(u[1]||"0",10).toString(16).padStart(2,"0"),E=parseInt(u[2]||"0",10).toString(16).padStart(2,"0");f.setAttribute("data-background-variation-color",`#${p}${m}${E}`)}else f.setAttribute("data-background-variation-color",d)}else f.setAttribute("data-background-variation","false")})}catch(l){console.warn("Could not parse publicationTemplateSettingVariants",l)}}};function Hi(r){r.querySelectorAll('foreignObject[data-type="text"], foreignObject[data-type="variantsTable"], foreignObject[data-type="productTable"]').forEach(e=>{e.querySelectorAll("tspan.textAttribute").forEach(n=>{let i=n;for(;i.children.length>0;)i=i.children[0];let o=i.innerHTML.replace(/^\{\{(.*)\}\}$/,"$1");i.innerHTML=o,i.setAttribute("data-info",o)})})}function Or(r){r.querySelectorAll('foreignObject[data-type="text"], foreignObject[data-type="variantsTable"], foreignObject[data-type="productTable"]').forEach(e=>{e.querySelectorAll("tspan.textAttribute").forEach(n=>{let i=n;for(;i.children.length>0;)i=i.children[0];let s=i.innerHTML;!s.startsWith("{{")&&!s.endsWith("}}")&&(i.innerHTML=`{{${s}}}`,i.setAttribute("data-info",`{{${s}}}`))})})}function $i(r){r.querySelectorAll("[data-type='text']").forEach(e=>{let n=e.querySelector("style");n&&n.remove()})}function zi(r){let t=r.querySelector("#Block");t&&t.remove()}function qi(r){let t=Array.from(r.children).filter(e=>e.tagName.toLowerCase()==="g"&&!e.hasAttribute("data-side"));if(t.length===1)t[0].removeAttribute("id");else if(t.length>1){let e=0;t.forEach(n=>{if(!n.id){let i=1;for(;r.querySelector(`#group_${i}`);)i++;let s=`group_${i}`;n.setAttribute("id",s),e++}})}t.forEach(e=>{e.style.pointerEvents="all"})}function Ha(r,t){Zi(r),Xi(r),zi(r);let e=Gi(r,t);return Hi(r),$i(r),Ki(r),Wi(r),qi(r),Ji(r),e}function Wi(r){r.querySelectorAll("style").forEach(e=>e.remove())}function Ki(r){let t=Array.from(r.querySelectorAll("g")),e=null;if(e=t.find(n=>{if(n.getAttribute("data-side")==="left")return!0;let i=n.querySelector("title");return i&&i.textContent?.trim()==="Layer 1"})||null,!e){let i=Array.from(r.children).filter(s=>s.tagName.toLowerCase()!=="defs").filter(s=>s.tagName.toLowerCase()==="g");i.length>0&&(e=i[0])}}function Zi(r){Yi(r)}function Ji(r){let t=r.getAttribute("fill"),e=r.style.backgroundColor;(!t||t==="none"||t==="transparent")&&(!e||e==="none"||e==="transparent")&&(r.style.backgroundColor="#FFFFFF")}function Yi(r){let t=r.querySelectorAll('foreignObject[data-type="text"]')}function Xi(r){r.querySelectorAll("*").forEach(e=>{if(e instanceof SVGElement&&e.hasAttribute("style")){let n=e.getAttribute("style");n&&n.split(";").forEach(s=>{let o=s.split(":");if(o.length>1){let a=o[0].trim(),l=o.slice(1).join(":").trim();a&&l&&["fill","stroke","stroke-width","opacity","font-size","font-family"].includes(a)&&(e.hasAttribute(a)||e.setAttribute(a,l))}})}})}function $a(r){return r=r.replace(/<DIV/g,"<div").replace(/<\/DIV/g,"</div").replace(/<SPAN/g,"<tspan").replace(/<\/SPAN/g,"</tspan").replace(/<span/g,"<tspan").replace(/<\/span/g,"</tspan").replace(/<TSPAN/g,"<tspan").replace(/<\/TSPAN/g,"</tspan").replace(/<I>/g,"<i>").replace(/<\/I>/g,"</i>").replace(/<B>/g,"<b>").replace(/<\/B>/g,"</b>").replace(/<U>/g,"<u>").replace(/<\/U>/g,"</u>").replace(/<col(?!group)([^>]*)\/>/g,"<col$1>").replace(/<col(?!group)([^>]*)>/g,"<col$1/>"),r=r.replace(/{{Modèle code \(Déclinaison\)}}/g,"{{R\xE9f\xE9rence (D\xE9clinaison)}}"),r=r.replace(/{{Model code \(Variant\)}}/g,"{{Reference (Variant)}}"),r=r.replace(/{{Código de modelo SKU \(Declinación\)}}/g,"{{Referencia (Declinaci\xF3n)}}"),r=r.replace(/{{Modelcode \(Varianten\)}}/g,"{{Referentie (Varianten)}}"),r}function Qi(r){let t="",e=0;for(;;){let n=r.indexOf("<!--",e);if(n===-1){t+=r.slice(e);break}t+=r.slice(e,n);let i=r.indexOf("-->",n+4);if(i===-1){t+=r.slice(n);break}e=i+3}return t}function es(r){let t="<TSPAN",e=t.length,n="",i=0;for(;;){let s=r.indexOf(t,i);if(s===-1){n+=r.slice(i);break}let o=s,a=!0;for(;a;){for(a=!1;o>0&&(r[o-1]===" "||r[o-1]===" "||r[o-1]===`
3
+ `||r[o-1]==="\r");)o--,a=!0;let l="-->";if(o>=l.length&&r.slice(o-l.length,o)===l){let c=r.lastIndexOf("<!--",o-l.length);c!==-1&&c<o&&(o=c,a=!0)}}o>0&&r[o-1]===">"?n+=r.slice(i,o):n+=r.slice(i,s),n+=t,i=s+e}return n}function Rr(r){return r=Qi(r),r=r.replace(/<div([^>]*)\s*\/>/gi,"<div$1></div>"),r=r.replace(/<font([^>]*)\s*\/>/gi,"<font$1></font>"),r=r.replace(/<b(?=\s|\/)([^>]*)\/>/gi,"<b$1></b>"),r=r.replace(/<br(?=\s|\/)([^>]*)\/>/gi,"<br$1></br>"),r=r.replace(/<tspan\b/gi,"<TSPAN"),r=r.replace(/<\/tspan\s*>/gi,"</TSPAN>"),r=r.replace(/<TSPAN\b([^>]*)>([\s\S]*?)<\/TSPAN>/gi,(t,e,n)=>{let i=n.replace(/\s*\n\s*/g,"");return`<TSPAN${e}>${i}</TSPAN>`}),r=es(r),r=r.replace(/<TSPAN([^>]*)\s*\/>/gi,"<TSPAN$1></TSPAN>"),r=r.replace(/{{Référence \(Déclinaison\)}}/g,"{{Mod\xE8le code (D\xE9clinaison)}}"),r=r.replace(/{{Reference \(Variant\)}}/g,"{{Model code (Variant)}}"),r=r.replace(/{{Referencia \(Declinación\)}}/g,"{{C\xF3digo de modelo SKU (Declinaci\xF3n)}}"),r=r.replace(/{{Referentie \(Varianten\)}}/g,"{{Modelcode (Varianten)}}"),r=r.replace(/xmlns:undefined="[^"]*"/g,""),r=r.replace(/&quot;/g,"'"),r=r.replace(/font-family:\s*['"]*([^;'"\n\r]+?)['"]*(?=[;"]|$)/g,(t,e)=>{let n=e.trim();return n.includes(" ")?`font-family: '${n}'`:`font-family: ${n}`}),r=r.replace(/<line\b[^>]*\bclass="[^"]*\bsnappingLine\b[^"]*"[^>]*>[\s\S]*?<\/line>/g,""),r=r.replace(new RegExp("<col(?!group)([^>]*?)(?<!\\/)>","g"),"<col$1/>"),r=r.replace(new RegExp("<img([^>]*?)(?<!\\/)>","g"),"<img$1/>"),r=r.replace(/&nbsp;/g," "),r=r.replace(/<br\s*\/?>\s*<\/br>/g,"<br/>"),r=r.replace(/<br>/g,"<br/>"),r=ts(r),r}function ts(r){return r.replace(/font-family:\s*['"]?([^;'"\n\r]+?)['"]?(?=[;"]|$)/g,(t,e)=>{let n=e.trim();return`font-family: ${n.includes(" ")?`'${n}'`:n}`})}var x=class{static canvasService;static documentRoot;static setDocumentRoot(t){this.documentRoot=t}static setCanvasService(t){this.canvasService=t}static getDocumentRoot(){return this.documentRoot}static getElementById(t){if(!t)return null;let e=this.getDocumentRoot();return e&&"getElementById"in e?e.getElementById(t):e&&"querySelector"in e?e.querySelector(`[id="${t}"]`):document.getElementById(t)}static getSelection(){let t=this.getDocumentRoot();if(t&&typeof t.getSelection=="function"){let e=t.getSelection();if(e)return e}return window.getSelection()}static create(t,e={}){e.id=this.getNextId(e["data-type"]||t);let n=document.createElementNS("http://www.w3.org/2000/svg",t);for(let i in e)e.hasOwnProperty(i)&&n.setAttribute(i,e[i]);return n}static findParent(t,e){let n=t.parentNode;for(;n;){if(n.nodeName.toLowerCase()===e.toLowerCase())return n;n=n.parentNode}return null}static getElementType(t){return t?t.getAttribute("data-type")||t.tagName.toLowerCase():null}static getNextId(t){let n=this.canvasService?.drawingGroup||this.getDocumentRoot()?.querySelector(".drawing-layer");if(!n){console.warn("No container found for element type: "+t);let o=this.getDocumentRoot()||document,a=1,l=`${t}_${a}`;for(;o.querySelector(`#${l}`);)a++,l=`${t}_${a}`;return l}t==="dynamicImage"&&(t="image");let i=1,s=`${t}_${i}`;for(;n.querySelector(`#${s}`);)i++,s=`${t}_${i}`;return s}static cloneWithNewIds(t,e=new Set){let n=t.cloneNode(!0),i=this.canvasService?.drawingGroup||this.getDocumentRoot()?.querySelector(".drawing-layer"),s=a=>{let l=a;l==="dynamicImage"&&(l="image");let c=1,f=`${l}_${c}`;for(;i&&i.querySelector(`#${f}`)||e.has(f);)c++,f=`${l}_${c}`;return e.add(f),f},o=a=>{if(a.hasAttribute("id")){let l=this.getElementType(a)||a.tagName.toLowerCase();a.setAttribute("id",s(l))}Array.from(a.children).forEach(l=>{l instanceof SVGElement&&o(l)})};return o(n),n}static getRotation(t){let e=t.getAttribute("transform");if(!e)return 0;let n=e.match(/rotate\(([-+]?\d*\.?\d+)/);return n?Number.parseFloat(n[1]):0}static setAttribute(t,e,n){if(!t)return;let i=this.getElementType(t);switch(e){case"x":this.setX(t,i,n);break;case"y":this.setY(t,i,n);break;case"width":this.setWidth(t,i,n);break;case"height":this.setHeight(t,i,n);break;case"rotation":this.setRotation(t,n);break;case"fill":this.setFill(t,String(n));break;case"stroke":this.setStroke(t,String(n));break;default:t.setAttribute(e,String(n));break}}static setX(t,e,n){if(e==="circle"){let s=Number(t.getAttribute("r")||0);t.setAttribute("cx",String(Number(n)+s))}else if(e==="ellipse"){let s=Number(t.getAttribute("rx")||0);t.setAttribute("cx",String(Number(n)+s))}else if(e==="path"||e==="g"||e==="line"){let s=0;e==="line"?s=Number(t.getAttribute("x1")||0):s=t.getBBox().x;let o=Number(n)-s;Math.abs(o)>.001&&this.shiftElement(t,o,0)}else t.setAttribute("x",String(n));let i=this.getRotation(t);Math.abs(i)>.001&&this.setRotation(t,i)}static setY(t,e,n){if(e==="circle"){let s=Number(t.getAttribute("r")||0);t.setAttribute("cy",String(Number(n)+s))}else if(e==="ellipse"){let s=Number(t.getAttribute("ry")||0);t.setAttribute("cy",String(Number(n)+s))}else if(e==="path"||e==="g"||e==="line"){let s=0;e==="line"?s=Number(t.getAttribute("y1")||0):s=t.getBBox().y;let o=Number(n)-s;Math.abs(o)>.001&&this.shiftElement(t,0,o)}else t.setAttribute("y",String(n));let i=this.getRotation(t);Math.abs(i)>.001&&this.setRotation(t,i)}static shiftElement(t,e,n){if(Math.abs(e)<.001&&Math.abs(n)<.001)return;let i=this.getElementType(t);if(i==="g")Array.from(t.children).forEach(o=>{o instanceof SVGElement&&this.shiftElement(o,e,n)});else if(i==="path"){let o=t.getAttribute("d")||"";t.setAttribute("d",this.shiftPath(o,e,n))}else if(i==="circle"||i==="ellipse"){let o=Number(t.getAttribute("cx")||0),a=Number(t.getAttribute("cy")||0);t.setAttribute("cx",String(o+e)),t.setAttribute("cy",String(a+n))}else if(i==="line"){let o=Number(t.getAttribute("x1")||0),a=Number(t.getAttribute("y1")||0),l=Number(t.getAttribute("x2")||0),c=Number(t.getAttribute("y2")||0);t.setAttribute("x1",String(o+e)),t.setAttribute("y1",String(a+n)),t.setAttribute("x2",String(l+e)),t.setAttribute("y2",String(c+n))}else{let o=Number(t.getAttribute("x")||0),a=Number(t.getAttribute("y")||0);t.setAttribute("x",String(o+e)),t.setAttribute("y",String(a+n))}let s=this.getRotation(t);Math.abs(s)>.001&&this.setRotation(t,s)}static setWidth(t,e,n){let i=Number(n);if(e==="circle"){let o=Number(t.getAttribute("r")||0),a=i/2,l=Number(t.getAttribute("cx")||0);t.setAttribute("cx",String(l-o+a)),t.setAttribute("r",String(a))}else if(e==="ellipse"){let o=Number(t.getAttribute("rx")||0),a=i/2,l=Number(t.getAttribute("cx")||0);t.setAttribute("cx",String(l-o+a)),t.setAttribute("rx",String(a))}else if(e==="path"||e==="g"){let o=t.getBBox();if(o.width>0){let a=i/o.width;this.scaleElement(t,a,1,o.x,o.y)}}else t.setAttribute("width",String(n));let s=this.getRotation(t);Math.abs(s)>.001&&this.setRotation(t,s)}static setHeight(t,e,n){let i=Number(n);if(e==="circle"){let o=Number(t.getAttribute("r")||0),a=i/2,l=Number(t.getAttribute("cy")||0);t.setAttribute("cy",String(l-o+a)),t.setAttribute("r",String(a))}else if(e==="ellipse"){let o=Number(t.getAttribute("ry")||0),a=i/2,l=Number(t.getAttribute("cy")||0);t.setAttribute("cy",String(l-o+a)),t.setAttribute("ry",String(a))}else if(e==="path"||e==="g"){let o=t.getBBox();if(o.height>0){let a=i/o.height;this.scaleElement(t,1,a,o.x,o.y)}}else t.setAttribute("height",String(n));let s=this.getRotation(t);Math.abs(s)>.001&&this.setRotation(t,s)}static scaleElement(t,e,n,i,s){if(Math.abs(e-1)<.001&&Math.abs(n-1)<.001)return;let o=this.getElementType(t);if(o==="g")Array.from(t.children).forEach(l=>{l instanceof SVGElement&&this.scaleElement(l,e,n,i,s)});else if(o==="path"){let l=t.getBBox(),c=t.getAttribute("d")||"",f=l.width*e,d=l.height*n,u=i+(l.x-i)*e,p=s+(l.y-s)*n;t.setAttribute("d",this.scalePath(c,l,u,p,f,d))}else if(o==="circle"){let l=Number(t.getAttribute("cx")||0),c=Number(t.getAttribute("cy")||0),f=Number(t.getAttribute("r")||0);t.setAttribute("cx",String(i+(l-i)*e)),t.setAttribute("cy",String(s+(c-s)*n)),t.setAttribute("r",String(f*Math.sqrt(e*n)))}else if(o==="ellipse"){let l=Number(t.getAttribute("cx")||0),c=Number(t.getAttribute("cy")||0),f=Number(t.getAttribute("rx")||0),d=Number(t.getAttribute("ry")||0);t.setAttribute("cx",String(i+(l-i)*e)),t.setAttribute("cy",String(s+(c-s)*n)),t.setAttribute("rx",String(f*e)),t.setAttribute("ry",String(d*n))}else if(o==="line"){let l=Number(t.getAttribute("x1")||0),c=Number(t.getAttribute("y1")||0),f=Number(t.getAttribute("x2")||0),d=Number(t.getAttribute("y2")||0);t.setAttribute("x1",String(i+(l-i)*e)),t.setAttribute("y1",String(s+(c-s)*n)),t.setAttribute("x2",String(i+(f-i)*e)),t.setAttribute("y2",String(s+(d-s)*n))}else{let l=Number(t.getAttribute("x")||0),c=Number(t.getAttribute("y")||0),f=Number(t.getAttribute("width")||0),d=Number(t.getAttribute("height")||0);t.setAttribute("x",String(i+(l-i)*e)),t.setAttribute("y",String(s+(c-s)*n)),t.setAttribute("width",String(f*e)),t.setAttribute("height",String(d*n))}let a=this.getRotation(t);Math.abs(a)>.001&&this.setRotation(t,a)}static setRotation(t,e){let n=Number(e),i=t.getAttribute("transform")||"",s=i,o=i.replace(/rotate\([^)]+\)/g,"").trim();o!==i&&t.setAttribute("transform",o);let a=t.getBBox?t.getBBox():{x:0,y:0,width:0,height:0},l=a.x+a.width/2,c=a.y+a.height/2;if(Math.abs(n)>.001){let f=`rotate(${n} ${l} ${c})`;t.setAttribute("transform",`${o} ${f}`.trim())}else o?t.setAttribute("transform",o):t.removeAttribute("transform")}static shiftPath(t,e,n){return this.transformPath(t,1,1,e,n)}static scalePath(t,e,n,i,s,o){let a=e.width===0?1:s/e.width,l=e.height===0?1:o/e.height,c=n-e.x*a,f=i-e.y*l;return this.transformPath(t,a,l,c,f)}static transformPath(t,e,n,i,s){let o=/([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g,a,l="",c=!0;for(;(a=o.exec(t))!==null;){let f=a[1],d=a[2].trim(),u=d?d.match(/[-+]?(?:\d*\.\d+|\d+)(?:[eE][-+]?\d+)?/g)?.map(Number)||[]:[],p=f.toUpperCase(),m=f===f.toLowerCase()&&p!=="Z",E=[];switch(p){case"M":for(let h=0;h<u.length;h+=2){let g=m;c&&h===0&&(g=!1),g?E.push(u[h]*e,u[h+1]*n):E.push(u[h]*e+i,u[h+1]*n+s)}c&&(c=!1);break;case"L":case"T":for(let h=0;h<u.length;h+=2)m?E.push(u[h]*e,u[h+1]*n):E.push(u[h]*e+i,u[h+1]*n+s);c&&(c=!1);break;case"H":for(let h=0;h<u.length;h++)E.push(m?u[h]*e:u[h]*e+i);break;case"V":for(let h=0;h<u.length;h++)E.push(m?u[h]*n:u[h]*n+s);break;case"C":for(let h=0;h<u.length;h+=6)m?(E.push(u[h]*e,u[h+1]*n),E.push(u[h+2]*e,u[h+3]*n),E.push(u[h+4]*e,u[h+5]*n)):(E.push(u[h]*e+i,u[h+1]*n+s),E.push(u[h+2]*e+i,u[h+3]*n+s),E.push(u[h+4]*e+i,u[h+5]*n+s));break;case"S":case"Q":for(let h=0;h<u.length;h+=4)m?(E.push(u[h]*e,u[h+1]*n),E.push(u[h+2]*e,u[h+3]*n)):(E.push(u[h]*e+i,u[h+1]*n+s),E.push(u[h+2]*e+i,u[h+3]*n+s));break;case"A":for(let h=0;h<u.length;h+=7){E.push(Math.abs(u[h]*e),Math.abs(u[h+1]*n)),E.push(u[h+2]),E.push(u[h+3]);let g=u[h+4];e*n<0&&(g=g===1?0:1),E.push(g),m?E.push(u[h+5]*e,u[h+6]*n):E.push(u[h+5]*e+i,u[h+6]*n+s)}break;case"Z":break}let b=E.map(h=>Number.isInteger(h)?h:Number(h.toFixed(3)));l+=f+b.join(" ")+" "}return l.trim()}static setStyle(t,e,n){t&&t.style.setProperty(e,String(n))}static getStyle(t,e){return t?t.style.getPropertyValue(e):null}static getFill(t){if(!t)return null;let e=this.getElementType(t);return e&&["rect","circle","ellipse","path","polygon","polyline","line"].includes(e)?t.getAttribute("fill")||t.style.fill:t.style.fill||t.getAttribute("fill")}static setFill(t,e){if(!t)return;let n=this.getElementType(t);n&&["rect","circle","ellipse","path","polygon","polyline","line"].includes(n)?(t.setAttribute("fill",e),t.style.fill=""):t.style.fill=e}static getStroke(t){if(!t)return null;let e=this.getElementType(t);return e&&["rect","circle","ellipse","path","polygon","polyline","line"].includes(e)?t.getAttribute("stroke")||t.style.stroke:t.style.stroke||t.getAttribute("stroke")}static setStroke(t,e){if(!t)return;let n=this.getElementType(t);n&&["rect","circle","ellipse","path","polygon","polyline","line"].includes(n)?(t.setAttribute("stroke",e),t.style.stroke=""):t.style.stroke=e}static removeAttribute(t,e){t.removeAttribute(e)}static toggleVisibility(t){if(!t)return;t.getAttribute("display")!=="none"?t.setAttribute("display","none"):t.removeAttribute("display")}static toggleLock(t){if(!t)return;t.getAttribute("data-protected")==="true"?t.removeAttribute("data-protected"):t.setAttribute("data-protected","true")}};var rt=class{static isCtrlOrCmd(t){return t.ctrlKey||t.metaKey}static isShift(t){return t.shiftKey}static isAlt(t){return t.altKey}static getShortcutString(t){let e=this.isCtrlOrCmd(t)?"cmd_":"",n=t.key.toLowerCase();if(["control","meta","shift","alt"].includes(n))return n;let i=this.isShift(t)?"shift_":"",s=this.isAlt(t)?"alt_":"";return`${e}${i}${s}${n}`}};var Pe=class r{_eventBus=new Y;constructor(){this.initGlobalListeners()}emit(t,e){this._eventBus.next({type:t,payload:e})}on(t){return this._eventBus.asObservable().pipe(ct(e=>e.type===t),P(e=>e.payload))}get all$(){return this._eventBus.asObservable()}initGlobalListeners(){window.addEventListener("keydown",t=>this.handleKeyDown(t)),window.addEventListener("keyup",t=>this.handleKeyUp(t)),document.addEventListener("paste",t=>this.handlePaste(t))}handlePaste(t){let e=t.composedPath&&t.composedPath().length>0?t.composedPath()[0]:t.target;e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable||this.emit("SHORTCUT_PASTE")}handleKeyDown(t){let e=rt.getShortcutString(t);if(t.repeat&&!["arrowleft","arrowright","arrowup","arrowdown","shift_arrowleft","shift_arrowright","shift_arrowup","shift_arrowdown","backspace","delete"].includes(e))return;if(e==="alt"){this.emit("SHORTCUT_ALT_DOWN"),x.getElementById("svg-editor")?.classList.add("altPressed");return}let n=t.composedPath&&t.composedPath().length>0?t.composedPath()[0]:t.target;if((n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.isContentEditable)&&!["cmd_s","cmd_z","cmd_y","cmd_shift_z","escape"].includes(e))return;let s=!0;switch(e){case"m":this.emit("SHORTCUT_TOOL_PAN");break;case"v":this.emit("SHORTCUT_TOOL_SELECT");break;case"t":this.emit("SHORTCUT_TOOL_TEXT");break;case"r":this.emit("SHORTCUT_TOOL_RECT");break;case"o":this.emit("SHORTCUT_TOOL_ELLIPSE");break;case"l":this.emit("SHORTCUT_TOOL_LINE");break;case"n":this.emit("SHORTCUT_TOOL_PENCIL");break;case"p":this.emit("SHORTCUT_TOOL_PATH");break;case"i":this.emit("SHORTCUT_TOOL_IMAGE");break;case"b":this.emit("SHORTCUT_TOOL_BARCODE");break;case"q":this.emit("SHORTCUT_TOOL_QRCODE");break;case"shift_x":this.emit("SHORTCUT_SWITCH_PAINT");break;case"cmd_s":this.emit("SHORTCUT_SAVE");break;case"cmd_z":this.emit("SHORTCUT_UNDO");break;case"cmd_y":this.emit("SHORTCUT_REDO");break;case"cmd_shift_z":this.emit("SHORTCUT_REDO");break;case"cmd_c":this.emit("SHORTCUT_COPY");break;case"cmd_v":this.emit("SHORTCUT_PASTE");break;case"cmd_x":this.emit("SHORTCUT_CUT");break;case"cmd_d":this.emit("SHORTCUT_DUPLICATE");break;case"cmd_u":this.emit("SHORTCUT_VIEW_SOURCE");break;case"cmd_a":this.emit("SHORTCUT_SELECT_ALL");break;case"cmd_g":this.emit("SHORTCUT_GROUP");break;case"cmd_shift_g":this.emit("SHORTCUT_UNGROUP");break;case"cmd_k":this.emit("SHORTCUT_PLACE_IMAGE");break;case"backspace":case"delete":this.emit("SHORTCUT_DELETE");break;case"cmd_arrowleft":this.emit("SHORTCUT_ROTATE",-1);break;case"cmd_arrowright":this.emit("SHORTCUT_ROTATE",1);break;case"cmd_shift_arrowleft":this.emit("SHORTCUT_ROTATE",-5);break;case"cmd_shift_arrowright":this.emit("SHORTCUT_ROTATE",5);break;case"shift_o":this.emit("SHORTCUT_CYCLE_ELEMENT",0);break;case"shift_p":this.emit("SHORTCUT_CYCLE_ELEMENT",1);break;case"shift_r":this.emit("SHORTCUT_TOGGLE_RULERS");break;case"cmd_+":this.emit("SHORTCUT_ZOOM_IN");break;case"cmd_-":this.emit("SHORTCUT_ZOOM_OUT");break;case"cmd_=":this.emit("SHORTCUT_ZOOM_RESET");break;case"arrowleft":this.emit("SHORTCUT_NUDGE",{dx:-1,dy:0});break;case"arrowright":this.emit("SHORTCUT_NUDGE",{dx:1,dy:0});break;case"arrowup":this.emit("SHORTCUT_NUDGE",{dx:0,dy:-1});break;case"arrowdown":this.emit("SHORTCUT_NUDGE",{dx:0,dy:1});break;case"shift_arrowleft":this.emit("SHORTCUT_JUMP",{dx:-10,dy:0});break;case"shift_arrowright":this.emit("SHORTCUT_JUMP",{dx:10,dy:0});break;case"shift_arrowup":this.emit("SHORTCUT_JUMP",{dx:0,dy:-10});break;case"shift_arrowdown":this.emit("SHORTCUT_JUMP",{dx:0,dy:10});break;case"cmd_arrowup":this.emit("SHORTCUT_BRING_FORWARD");break;case"cmd_arrowdown":this.emit("SHORTCUT_SEND_BACKWARD");break;case"cmd_shift_arrowup":this.emit("SHORTCUT_BRING_TO_FRONT");break;case"cmd_shift_arrowdown":this.emit("SHORTCUT_SEND_TO_BACK");break;case"cmd_b":this.emit("SHORTCUT_TEXT_BOLD");break;case"cmd_i":this.emit("SHORTCUT_TEXT_ITALIC");break;case"escape":case"enter":this.emit("SHORTCUT_ESCAPE_MODE");break;case"shift_?":case"cmd_shift_?":case"ctrl_?":this.emit("SHORTCUT_HELP");break;case" ":this.emit("SHORTCUT_PAN_START");break;default:s=!1}s&&t.preventDefault()}handleKeyUp(t){let e=t.composedPath&&t.composedPath().length>0?t.composedPath()[0]:t.target;if(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)return;let i=rt.getShortcutString(t);i==="alt"&&(this.emit("SHORTCUT_ALT_UP"),x.getElementById("svg-editor")?.classList.remove("altPressed")),i===" "&&this.emit("SHORTCUT_PAN_STOP")}static \u0275fac=function(e){return new(e||r)};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var Ie=class r{appParams=w(ee);properties=A({width:800,height:600,unit:this.getInitialUnit(),backgroundColor:"#ffffff",marginVertical:0,headerHeight:0,footerHeight:0,marginLeft:0,marginRight:0,bleedMargin:0,side:"left"});getInitialUnit(){let t=this.appParams.params(),e=["px","cm","mm","in"],n=(t.unit||"mm").toLowerCase();return e.includes(n)?n:"mm"}constructor(){}get dimensions(){return this.properties}updateDimensions(t,e){this.properties.update(n=>N(S({},n),{width:t,height:e,viewBox:`0 0 ${t} ${e}`}))}updateUnit(t){this.properties.update(e=>N(S({},e),{unit:t}))}updateProperty(t,e){this.properties.update(n=>{let i=N(S({},n),{[t]:e});return(t==="width"||t==="height")&&(i.viewBox=`0 0 ${i.width} ${i.height}`),i})}static \u0275fac=function(e){return new(e||r)};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var it=class r{config=A({showGrid:!0,showRulers:!0,showWireframe:!1,showMargins:!0,snapToGrid:!1,theme:"light"});updateConfig(t){this.config.update(e=>S(S({},e),t))}toggleGrid(){this.config.update(t=>N(S({},t),{showGrid:!t.showGrid}))}toggleRulers(){this.config.update(t=>N(S({},t),{showRulers:!t.showRulers}))}toggleWireframe(){this.config.update(t=>N(S({},t),{showWireframe:!t.showWireframe}))}toggleMargins(){this.config.update(t=>N(S({},t),{showMargins:!t.showMargins}))}static \u0275fac=function(e){return new(e||r)};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var Ft=class r{selectedElements=A([]);updated=A(0);count=ht(()=>this.selectedElements().length);isEmpty=ht(()=>this.count()===0);first=ht(()=>this.selectedElements()[0]||null);select(t){this.selectedElements.set(t)}add(t){this.selectedElements.update(e=>e.includes(t)?e:[...e,t])}toggle(t){this.selectedElements.update(e=>e.indexOf(t)>-1?e.filter(i=>i!==t):[...e,t])}clear(){this.selectedElements.set([])}triggerUpdate(){this.updated.update(t=>t+1)}static \u0275fac=function(e){return new(e||r)};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var ke=class r{constructor(){}toSvgColor(t){return t}hexToRgba(t){t=t.trim(),t.startsWith("#")&&(t=t.substring(1));let e=0,n=0,i=0,s=1;return t.length===3||t.length===4?(e=parseInt(t[0]+t[0],16),n=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16),t.length===4&&(s=parseInt(t[3]+t[3],16)/255)):(t.length===6||t.length===8)&&(e=parseInt(t.substring(0,2),16),n=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16),t.length===8&&(s=parseInt(t.substring(6,8),16)/255)),{r:e,g:n,b:i,a:s}}rgbaToHex(t){let{r:e,g:n,b:i,a:s}=t,o=l=>{let c=Math.round(l).toString(16);return c.length===1?"0"+c:c},a="#"+o(e)+o(n)+o(i);return s<1&&(a+=o(Math.round(s*255))),a}rgbToHsv(t,e,n){t/=255,e/=255,n/=255;let i=Math.max(t,e,n),s=Math.min(t,e,n),o=0,a,l=i,c=i-s;if(a=i===0?0:c/i,i===s)o=0;else{switch(i){case t:o=(e-n)/c+(e<n?6:0);break;case e:o=(n-t)/c+2;break;case n:o=(t-e)/c+4;break}o/=6}return{h:o*360,s:a*100,v:l*100}}hsvToRgb(t,e,n){let i,s,o;t=t/360,e=e/100,n=n/100;let a=Math.floor(t*6),l=t*6-a,c=n*(1-e),f=n*(1-l*e),d=n*(1-(1-l)*e);switch(a%6){case 0:i=n,s=d,o=c;break;case 1:i=f,s=n,o=c;break;case 2:i=c,s=n,o=d;break;case 3:i=c,s=f,o=n;break;case 4:i=d,s=c,o=n;break;case 5:i=n,s=c,o=f;break}return{r:Math.round(i*255),g:Math.round(s*255),b:Math.round(o*255)}}rgbToHsl(t,e,n){t/=255,e/=255,n/=255;let i=Math.max(t,e,n),s=Math.min(t,e,n),o=0,a,l=(i+s)/2;if(i===s)o=a=0;else{let c=i-s;switch(a=l>.5?c/(2-i-s):c/(i+s),i){case t:o=(e-n)/c+(e<n?6:0);break;case e:o=(n-t)/c+2;break;case n:o=(t-e)/c+4;break}o/=6}return{h:Math.round(o*360),s:Math.round(a*100),l:Math.round(l*100)}}hslToRgb(t,e,n){let i,s,o;if(t/=360,e/=100,n/=100,e===0)i=s=o=n;else{let a=(f,d,u)=>(u<0&&(u+=1),u>1&&(u-=1),u<.16666666666666666?f+(d-f)*6*u:u<.5?d:u<.6666666666666666?f+(d-f)*(.6666666666666666-u)*6:f),l=n<.5?n*(1+e):n+e-n*e,c=2*n-l;i=a(c,l,t+1/3),s=a(c,l,t),o=a(c,l,t-1/3)}return{r:Math.round(i*255),g:Math.round(s*255),b:Math.round(o*255)}}rgbToCmyk(t,e,n){let i=1-t/255,s=1-e/255,o=1-n/255,a=Math.min(i,Math.min(s,o));return i=(i-a)/(1-a)||0,s=(s-a)/(1-a)||0,o=(o-a)/(1-a)||0,{c:Math.round(i*100),m:Math.round(s*100),y:Math.round(o*100),k:Math.round(a*100)}}cmykToRgb(t,e,n,i){t=t/100,e=e/100,n=n/100,i=i/100;let s=255*(1-t)*(1-i),o=255*(1-e)*(1-i),a=255*(1-n)*(1-i);return{r:Math.round(s),g:Math.round(o),b:Math.round(a)}}isHex(t){return typeof t!="string"?!1:(t=t.trim(),/^#([0-9A-F]{3}){1,2}$/i.test(t)||/^#([0-9A-F]{4}){1,2}$/i.test(t))}isRgb(t){return typeof t=="string"?t.trim().toLowerCase().startsWith("rgb"):typeof t=="object"&&t!==null&&"r"in t&&"g"in t&&"b"in t}isHsl(t){return typeof t=="string"?t.trim().toLowerCase().startsWith("hsl"):typeof t=="object"&&t!==null&&"h"in t&&"s"in t&&"l"in t}isHsv(t){return typeof t=="string"?t.trim().toLowerCase().startsWith("hsv"):typeof t=="object"&&t!==null&&"h"in t&&"s"in t&&"v"in t}isCmyk(t){return typeof t=="string"?t.trim().toLowerCase().startsWith("cmyk"):typeof t=="object"&&t!==null&&"c"in t&&"m"in t&&"y"in t&&"k"in t}toRgba(t){if(!t)return{r:0,g:0,b:0,a:1};if(typeof t=="string"){t=t.trim().toLowerCase();let e={white:"#ffffff",black:"#000000",red:"#ff0000",green:"#00ff00",blue:"#0000ff",yellow:"#ffff00",cyan:"#00ffff",magenta:"#ff00ff",transparent:"#00000000"};e[t]&&(t=e[t])}if(this.isHex(t))return this.hexToRgba(t);if(this.isRgb(t))return typeof t=="string"?this.parseRgbString(t):{r:Number(t.r),g:Number(t.g),b:Number(t.b),a:t.a!==void 0?Number(t.a):1};if(this.isHsl(t)){if(typeof t=="string")return this.parseHslString(t);let e=this.hslToRgb(t.h,t.s,t.l);return N(S({},e),{a:t.a!==void 0?Number(t.a):1})}if(this.isHsv(t)){if(typeof t=="string")return this.parseHsvString(t);let e=this.hsvToRgb(t.h,t.s,t.v);return N(S({},e),{a:t.a!==void 0?Number(t.a):1})}if(this.isCmyk(t)){if(typeof t=="string")return this.parseCmykString(t);let e=this.cmykToRgb(t.c,t.m,t.y,t.k);return N(S({},e),{a:1})}return{r:0,g:0,b:0,a:1}}toHex(t){let e=this.toRgba(t);return this.rgbaToHex(e)}toHsl(t){let e=this.toRgba(t),n=this.rgbToHsl(e.r,e.g,e.b);return N(S({},n),{a:e.a})}toHsv(t){let e=this.toRgba(t),n=this.rgbToHsv(e.r,e.g,e.b);return N(S({},n),{a:e.a})}toCmyk(t){let e=this.toRgba(t);return this.rgbToCmyk(e.r,e.g,e.b)}parseRgbString(t){let e=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);return e?{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10),a:e[4]?parseFloat(e[4]):1}:{r:0,g:0,b:0,a:1}}parseHslString(t){let e=t.match(/hsla?\((\d+),\s*(\d+)%,\s*(\d+)%(?:,\s*([\d.]+))?\)/);if(e){let n=parseInt(e[1],10),i=parseInt(e[2],10),s=parseInt(e[3],10),o=e[4]?parseFloat(e[4]):1,a=this.hslToRgb(n,i,s);return N(S({},a),{a:o})}return{r:0,g:0,b:0,a:1}}parseHsvString(t){let e=t.match(/hsva?\((\d+),\s*(\d+)%?,\s*(\d+)%?(?:,\s*([\d.]+))?\)/);if(e){let n=parseInt(e[1],10),i=parseInt(e[2],10),s=parseInt(e[3],10),o=e[4]?parseFloat(e[4]):1,a=this.hsvToRgb(n,i,s);return N(S({},a),{a:o})}return{r:0,g:0,b:0,a:1}}parseCmykString(t){let e=t.match(/cmyk\((\d+)%?,\s*(\d+)%?,\s*(\d+)%?,\s*(\d+)%?\)/);if(e){let n=parseInt(e[1],10),i=parseInt(e[2],10),s=parseInt(e[3],10),o=parseInt(e[4],10),a=this.cmykToRgb(n,i,s,o);return N(S({},a),{a:1})}return{r:0,g:0,b:0,a:1}}static \u0275fac=function(e){return new(e||r)};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var pe=class r{_svgElement=null;_wrapperElement=null;_transform={x:0,y:0,scale:1};zoomLevel=A(1);panOffset=A({x:0,y:0});baseScale=A(1);isReady=A(!1);currentContext=A(null);modifiedPulse=A(0);isSilent=A(!0);versionUpgraded=A(!1);disabledElems=[];docService=w(Ie);eventsService=w(Pe);selectionStore=w(Ft);colorService=w(ke);injector=w(dt);constructor(){this.eventsService.on("SHORTCUT_DELETE").subscribe(()=>this.deleteSelectedElements()),this.eventsService.on("SHORTCUT_NUDGE").subscribe(t=>this.nudgeSelectedElements(t.dx,t.dy)),this.eventsService.on("SHORTCUT_JUMP").subscribe(t=>this.nudgeSelectedElements(t.dx,t.dy)),this.eventsService.on("SHORTCUT_ROTATE").subscribe(t=>this.rotateSelectedElements(t)),this.eventsService.on("SHORTCUT_SELECT_ALL").subscribe(()=>this.selectAllElements()),this.eventsService.on("SHORTCUT_ZOOM_RESET").subscribe(()=>this.zoomReset()),this.eventsService.on("SHORTCUT_BRING_TO_FRONT").subscribe(()=>this.bringToFront()),this.eventsService.on("SHORTCUT_SEND_TO_BACK").subscribe(()=>this.sendToBack()),this.eventsService.on("SHORTCUT_BRING_FORWARD").subscribe(()=>this.bringForward()),this.eventsService.on("SHORTCUT_SEND_BACKWARD").subscribe(()=>this.sendBackward()),this.eventsService.on("SHORTCUT_CYCLE_ELEMENT").subscribe(t=>this.cycleSelectedElement(t)),pt(()=>{let t=this.docService.properties(),e=`${t.width}-${t.height}-${t.doublePage}`;Zt(()=>{this.isReady()&&this.modifiedPulse.update(n=>n+1)})})}get svgElement(){if(!this._svgElement)throw new Error("Canvas not initialized. Call setSvgElement() first.");return this._svgElement}get wrapperElement(){if(!this._wrapperElement)throw new Error("Wrapper element not set. Call setWrapperElement() first.");return this._wrapperElement}setSvgElement(t){this._svgElement=t,this.isReady.set(!0);let e=t.querySelector("g.drawing-layer");this.setContext(e||t),this.initMutationObserver(t)}_mutationObserver=null;initMutationObserver(t){this._mutationObserver&&this._mutationObserver.disconnect(),this._mutationObserver=new MutationObserver(()=>{this.modifiedPulse.update(e=>e+1)}),this._mutationObserver.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["fill","stroke","style"]})}setContext(t){if(this.leaveContext(),!t)return;this.currentContext.set(t);let e=this.drawingGroup;if(!e||t===e)return;let n=t;for(;n&&n!==e;){let i=n.parentElement;i&&Array.from(i.children).forEach(s=>{if(s!==n&&s instanceof SVGGraphicsElement){let o=s.getAttribute("opacity");this.disabledElems.push({elem:s,origOpac:o}),s.setAttribute("opacity",(Number.parseFloat(o||"1")*.33).toFixed(2)),s.style.pointerEvents="none",s.classList.add("se-disabled-context"),o&&s.setAttribute("data-orig-opacity",o)}}),n=i}}leaveContext(){this.disabledElems.forEach(({elem:t,origOpac:e})=>{e?t.setAttribute("opacity",e):t.removeAttribute("opacity"),t.style.pointerEvents="inherit",t.classList.remove("se-disabled-context"),t.removeAttribute("data-orig-opacity")}),this.disabledElems=[]}restoreContextInClone(t){t.querySelectorAll(".se-disabled-context").forEach(e=>{if(e instanceof SVGGraphicsElement){let n=e.getAttribute("data-orig-opacity");n?e.setAttribute("opacity",n):e.removeAttribute("opacity"),e.style.pointerEvents="",e.classList.remove("se-disabled-context"),e.removeAttribute("data-orig-opacity")}})}setWrapperElement(t){this._wrapperElement=t,this._wrapperElement.addEventListener("wheel",this.handleWheel.bind(this),{passive:!1})}destroy(){this._wrapperElement&&this._wrapperElement.removeEventListener("wheel",this.handleWheel.bind(this))}get drawingGroup(){return this._svgElement?this._svgElement.querySelector("g.drawing-layer"):null}get activeContainer(){let t=this.currentContext(),e=this.drawingGroup;if(t&&e&&t===e){let n=this.docService.properties().side||"left",i=Array.from(e.children).find(s=>s.tagName.toLowerCase()==="g"&&s.getAttribute("data-side")===n);if(i instanceof SVGGElement)return i}return t||e||this.svgElement}getSvgPoint(t,e,n){if(!this._svgElement)throw new Error("SVG not ready");let i=this._svgElement.createSVGPoint();i.x=t,i.y=e;let o=(n||this._svgElement).getScreenCTM();return o?i.matrixTransform(o.inverse()):i}screenToLocal(t,e,n){if(!this._svgElement)throw new Error("SVG not ready");let i=this._svgElement.createSVGPoint();return i.x=t,i.y=e,i.matrixTransform(n.inverse())}handleWheel(t){if(t.preventDefault(),t.ctrlKey||t.metaKey){let n=-Math.sign(t.deltaY),i=Math.exp(n*.1);this.zoom(i,t.clientX,t.clientY)}else this.pan(-t.deltaX,-t.deltaY)}zoom(t,e,n){if(!this._svgElement)return;let i=this._transform.scale,s=i*t,o=s/this.baseScale();if(o<.05||o>16)return;let a=this._svgElement.getBoundingClientRect(),l=e-a.left,c=n-a.top,f=s/i;this._transform.x+=l*(1-f),this._transform.y+=c*(1-f),this._transform.scale=s,this.zoomLevel.set(s),this.panOffset.set({x:this._transform.x,y:this._transform.y}),this.updateTransform()}pan(t,e){this._transform.x+=t,this._transform.y+=e,this.panOffset.set({x:this._transform.x,y:this._transform.y}),this.updateTransform()}updateTransform(){this._svgElement&&(this._svgElement.style.transform=`translate(${this._transform.x}px, ${this._transform.y}px) scale(${this._transform.scale})`)}getTransform(){return S({},this._transform)}groupElements(t){if(!t||t.length===0||!t[0].parentElement)return null;let n=[...t].sort((s,o)=>s===o?0:s.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),i=document.createElementNS("http://www.w3.org/2000/svg","g");return i.id=x.getNextId("group"),n[0].before(i),n.forEach(s=>i.appendChild(s)),i}alignElements(t,e,n){!t||t.length===0||(t.forEach(i=>{let s=i.getBBox();switch(e){case"left":x.setAttribute(i,"x",n.x);break;case"center":x.setAttribute(i,"x",n.x+n.width/2-s.width/2);break;case"right":x.setAttribute(i,"x",n.x+n.width-s.width);break;case"top":x.setAttribute(i,"y",n.y);break;case"middle":x.setAttribute(i,"y",n.y+n.height/2-s.height/2);break;case"bottom":x.setAttribute(i,"y",n.y+n.height-s.height);break}}),this.modifiedPulse.update(i=>i+1))}ungroupElement(t){if(!t.parentElement)return[];let n=Array.from(t.children);return n.forEach(i=>{t.before(i)}),t.remove(),n}migrateLegacyToDoublePage(){let t=this.drawingGroup;if(!t||Array.from(t.children).some(l=>l.hasAttribute&&l.hasAttribute("data-side")))return;let n=document.createElementNS("http://www.w3.org/2000/svg","g");n.setAttribute("data-side","left");let i=document.createElementNS("http://www.w3.org/2000/svg","g");i.setAttribute("data-side","right");let s=[],o=l=>{l.tagName.toLowerCase()==="g"&&!l.id&&!l.hasAttribute("data-gsvg")&&!l.hasAttribute("app-table")?Array.from(l.children).forEach(o):s.push(l)};Array.from(t.children).forEach(o),t.innerHTML="";let a=new Set;s.forEach(l=>{l.id&&a.add(l.id),l.querySelectorAll("[id]").forEach(c=>{a.add(c.id)})}),s.forEach(l=>{if(n.appendChild(l),l instanceof SVGElement){let c=x.cloneWithNewIds(l,a);i.appendChild(c)}}),t.appendChild(n),t.appendChild(i)}deleteSelectedElements(){let t=this.selectionStore.selectedElements();t.length!==0&&(t.forEach(e=>e.remove()),this.selectionStore.clear(),this.modifiedPulse.update(e=>e+1))}nudgeSelectedElements(t,e){let n=this.selectionStore.selectedElements();n.length!==0&&(n.forEach(i=>{x.shiftElement(i,t,e)}),this.modifiedPulse.update(i=>i+1))}rotateSelectedElements(t){let e=this.selectionStore.selectedElements();e.length!==0&&(e.forEach(n=>{let i=x.getRotation(n);x.setAttribute(n,"rotation",i+t)}),this.modifiedPulse.update(n=>n+1))}selectAllElements(){let t=this.currentContext();if(!t)return;let e=Array.from(t.children).filter(n=>!(n instanceof SVGGraphicsElement)||!n.id||n.hasAttribute("data-side")?!1:!this.isLockedOrOverlay(n));this.selectionStore.select(e)}zoomReset(){if(!this._svgElement||!this._wrapperElement)return;let t=this.baseScale();this._transform.scale=t,this.zoomLevel.set(t);let e=this.docService.properties().width,n=this.docService.properties().height,i=this._wrapperElement.clientWidth,s=this._wrapperElement.clientHeight,o=getComputedStyle(this._wrapperElement),a=parseFloat(o.getPropertyValue("--container-width"))||300,l=parseFloat(o.getPropertyValue("--spacing-s"))||12,f=this.injector.get(it).config().showRulers,d=f?30:0,u=a+2*l+d,p=a+2*l,m=l+(f?30:0),E=l,b=e*t,h=n*t,g=u+(i-u-p)/2,D=m+(s-m-E)/2;this._transform.x=g-b/2,this._transform.y=D-h/2,this.panOffset.set({x:this._transform.x,y:this._transform.y}),this.updateTransform()}bringToFront(){let t=this.selectionStore.selectedElements();t.length!==0&&(t.sort((e,n)=>e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),t.forEach(e=>{let n=e.parentElement;n&&n.appendChild(e)}),this.modifiedPulse.update(e=>e+1))}sendToBack(){let t=this.selectionStore.selectedElements();t.length!==0&&(t.sort((e,n)=>e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1),t.forEach(e=>{let n=e.parentElement;n&&n.insertBefore(e,n.firstElementChild)}),this.modifiedPulse.update(e=>e+1))}bringForward(){let t=this.selectionStore.selectedElements();t.length!==0&&(t.sort((e,n)=>e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1),t.forEach(e=>{let n=e.nextElementSibling;n&&!t.includes(n)&&n.after(e)}),this.modifiedPulse.update(e=>e+1))}sendBackward(){let t=this.selectionStore.selectedElements();t.length!==0&&(t.sort((e,n)=>e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),t.forEach(e=>{let n=e.previousElementSibling;n&&!t.includes(n)&&n.before(e)}),this.modifiedPulse.update(e=>e+1))}cycleSelectedElement(t){let e=this.currentContext();if(!e)return;let n=Array.from(e.children).filter(o=>!(o instanceof SVGGraphicsElement)||!o.id||o.hasAttribute("data-side")?!1:!this.isLockedOrOverlay(o));if(n.length===0)return;let i=this.selectionStore.first(),s=0;if(i){let o=n.indexOf(i);t===0?s=(o+1)%n.length:s=(o-1+n.length)%n.length}this.selectionStore.select([n[s]])}loadedSvg=null;creationOverlayRect=null;startDrawingSelection(t,e){if(!this.isReady())return;this.finishDrawingSelection(),this.creationOverlayRect=document.createElementNS("http://www.w3.org/2000/svg","rect"),this.creationOverlayRect.setAttribute("id","creation-band-overlay"),this.creationOverlayRect.setAttribute("fill","transparent"),this.creationOverlayRect.setAttribute("stroke","var(--active)"),this.creationOverlayRect.setAttribute("stroke-width","1"),this.creationOverlayRect.setAttribute("x",String(t)),this.creationOverlayRect.setAttribute("y",String(e)),this.creationOverlayRect.setAttribute("width","0"),this.creationOverlayRect.setAttribute("height","0"),this.creationOverlayRect.style.pointerEvents="none";let n=this._svgElement?.querySelector(".overlay-layer");n?n.appendChild(this.creationOverlayRect):this._svgElement?.appendChild(this.creationOverlayRect)}updateDrawingSelection(t,e,n,i){this.creationOverlayRect&&(this.creationOverlayRect.setAttribute("x",String(t)),this.creationOverlayRect.setAttribute("y",String(e)),this.creationOverlayRect.setAttribute("width",String(n)),this.creationOverlayRect.setAttribute("height",String(i)))}finishDrawingSelection(){this.creationOverlayRect&&(this.creationOverlayRect.remove(),this.creationOverlayRect=null),this.isReady()&&this._svgElement?.querySelectorAll("#creation-band-overlay")?.forEach(e=>e.remove())}fitToScreen(){if(!this.wrapperElement||!this._svgElement)return;let t=this.wrapperElement.clientWidth,e=this.wrapperElement.clientHeight;if(t===0||e===0){requestAnimationFrame(()=>this.fitToScreen());return}let n=this.docService.properties().width,i=this.docService.properties().height;if(!n||!i||n===0||i===0)return;let s=getComputedStyle(this.wrapperElement),o=parseFloat(s.getPropertyValue("--container-width"))||300,a=parseFloat(s.getPropertyValue("--spacing-s"))||12,c=this.injector.get(it).config().showRulers,f=c?30:0,d=o+2*a+f,u=o+2*a,p=a+(c?30:0),m=a,E=t-d-u-40,b=e-p-m-40,h=E/n,g=b/i,D=Math.min(h,g);this.baseScale.set(D);let y=D*.9;this._transform.scale=y,this.zoomLevel.set(y);let C=n*y,F=i*y,I=d+(t-d-u)/2,B=p+(e-p-m)/2;this._transform.x=I-C/2,this._transform.y=B-F/2,this.panOffset.set({x:this._transform.x,y:this._transform.y}),this.updateTransform()}panToSide(t){if(!this._svgElement||!this._wrapperElement)return;let e=this.docService.properties().width,n=this._transform.scale,i=this._wrapperElement.clientWidth,s=e/2,o=0;t==="left"?o=s/2*n:o=(s+s/2)*n,this._transform.x=i/2-o;let a=this.docService.properties().height*n;this._transform.y=(this._wrapperElement.clientHeight-a)/2,this.panOffset.set({x:this._transform.x,y:this._transform.y}),this.updateTransform()}isLockedOrOverlay(t){return t.getAttribute("data-protected")==="true"||!!t.closest('[data-protected="true"]')||!!t.closest(".overlay-layer")||!!t.closest("[app-grid-overlay]")}findSelectableElement(t){let e=this.currentContext();if(!e)return null;let n=t,i=null;for(;n&&n!==this._svgElement&&n!==e;){if(n.hasAttribute("data-side")){n=n.parentElement;continue}if(this.isLockedOrOverlay(n))return null;let s=n.tagName.toLowerCase();(n instanceof SVGGraphicsElement||["g","svg","foreignobject","use","text","image","rect","circle","ellipse","line","polygon","polyline","path"].includes(s))&&(n.id||s==="g")&&(i=n),n=n.parentElement}return i}_usedColorsCache=[];_lastColorPulse=-1;getMostUsedColors(t=8){let e=this.drawingGroup;if(!e)return[];if(this._lastColorPulse===this.modifiedPulse())return this._usedColorsCache;let n={},i=e.querySelectorAll("*"),s=o=>{if(!(!o||o==="none"||o==="transparent"||o.startsWith("url(")||o.startsWith("var(")))try{let a=this.colorService.toHex(o).toLowerCase();n[a]=(n[a]||0)+1}catch{}};return i.forEach(o=>{s(o.getAttribute("fill")),s(o.getAttribute("stroke"));let a=o.style;a.fill&&s(a.fill),a.stroke&&s(a.stroke)}),this._usedColorsCache=Object.entries(n).sort((o,a)=>a[1]-o[1]).slice(0,t).map(o=>o[0]),this._lastColorPulse=this.modifiedPulse(),this._usedColorsCache}static \u0275fac=function(e){return new(e||r)};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var Mt=class r{injector=w(dt);canvasService=w(pe);generateThumbnail(t=250,e=.2,n){return z(this,null,function*(){let i=this.canvasService.svgElement;if(!i)throw new Error("SVG element not found");n?fe.log("ThumbnailService: Using provided SVG string"):(fe.log("ThumbnailService: Calling saveService.getSvgString()"),n=this.injector.get(Nt).getSvgString());let a=new DOMParser().parseFromString(n||"","image/svg+xml").documentElement;this.cleanForThumbnail(a),yield this.inlineImages(a);let l=parseFloat(i.getAttribute("width")||"100"),c=parseFloat(i.getAttribute("height")||"100"),f=l/c||1;n=new XMLSerializer().serializeToString(a);let d="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(n),u=new Image;yield new Promise((h,g)=>{u.onload=()=>h(),u.onerror=g,u.src=d});let p=3*1024,m=[t,200,150,100],E=[e,.1,.05],b=null;for(let h of m)for(let g of E){let D=h,y=D/f,C=document.createElement("canvas");C.width=D,C.height=y;let F=C.getContext("2d");if(!F)continue;F.imageSmoothingEnabled=!0,F.imageSmoothingQuality="medium",F.fillStyle="white",F.fillRect(0,0,D,y),F.drawImage(u,0,0,D,y);let I=yield new Promise(B=>C.toBlob(B,"image/webp",g));if(I&&(b=I,I.size<=p))return fe.log(`ThumbnailService: Target reached with size ${Math.round(I.size/1024)}KB at ${h}px, quality ${g}`),I}if(fe.warn(`ThumbnailService: Could not reach target 3KB. Returning smallest result of ${Math.round((b?.size||0)/1024)}KB`),!b)throw new Error("Failed to generate thumbnail");return b})}cleanForThumbnail(t){this.injectPageVariables(t),t.querySelectorAll("style").forEach(n=>{let i=n.textContent||"";i=i.replace(/@import[^;]+;/gi,""),i=i.replace(/url\(\s*["']?(?!data:|#)[^)]+\)/gi,"none"),n.textContent=i}),t.querySelectorAll("script, link, iframe, object, embed").forEach(n=>n.remove());let e=this.canvasService.svgElement;t.setAttribute("width",e.getAttribute("width")||"0"),t.setAttribute("height",e.getAttribute("height")||"0")}injectPageVariables(t){let e=document.documentElement,n=getComputedStyle(e),i=["--active","--gray-1","--gray-2","--gray-3","--gray-4","--gray-5","--white","--black","--radius-s","--radius-m"],s=`:root {
4
+ `;i.forEach(a=>{let l=n.getPropertyValue(a).trim();l&&(s+=` ${a}: ${l};
5
+ `)}),s+=`}
6
+ `;let o=document.createElementNS("http://www.w3.org/2000/svg","style");o.textContent=s,t.insertBefore(o,t.firstChild)}inlineImages(t){return z(this,null,function*(){let e=[];t.querySelectorAll("img, image").forEach(n=>{let i=n instanceof HTMLImageElement,s=i?n.src:n.getAttribute("href");s&&!s.startsWith("data:")&&e.push(this.toDataUrl(s).then(o=>{i?n.src=o:n.setAttribute("href",o)}).catch(()=>n.remove()))}),t.querySelectorAll('[style*="background-image"]').forEach(n=>{let i=n,o=i.style.backgroundImage.match(/url\(\s*["']?([^"']+)["']?\s*\)/);o&&o[1]&&!o[1].startsWith("data:")&&e.push(this.toDataUrl(o[1]).then(a=>{i.style.backgroundImage=`url("${a}")`}).catch(()=>{i.style.backgroundImage="none"}))}),yield Promise.all(e)})}toDataUrl(t){return z(this,null,function*(){try{let e=yield fetch(t);if(!e.ok)throw new Error("Fetch failed");let n=yield e.blob();return new Promise((i,s)=>{let o=new FileReader;o.onloadend=()=>i(o.result),o.onerror=s,o.readAsDataURL(n)})}catch{throw new Error("Could not convert to data url")}})}static \u0275fac=function(e){return new(e||r)};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var Ot=class r{appParams=w(ee);http=w(re);currentUser=null;getSettings(t){return t==="apiUrl"?this.appParams.apiUrl:null}getToken(){return this.appParams.token||""}getAlias(){return"Default"}getHeaders(){return new L({Authorization:`bearer ${this.getToken()}`})}getRightsAccesModuleForOneProfile(t){let e=`${this.getSettings("apiUrl")}Rights/Profile/${t}`;return this.http.get(e,{headers:this.getHeaders()})}getCurrentUserLogged(){if(this.currentUser)return _(this.currentUser);let t=`${this.getSettings("apiUrl")}Users/currentUserLogged`;return this.http.get(t,{headers:this.getHeaders()}).pipe(vn(e=>{e&&e.CurrentUserLogged&&(this.currentUser=e.CurrentUserLogged)}))}getCachedUser(){return this.currentUser}static \u0275fac=function(e){return new(e||r)};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var Rt=class r{http=w(re);_settingsService=w(Ot);notifications=A([]);quantity=new Y;show(t,e="info",n=3e3){let i=Math.random().toString(36).substring(2,9),s={id:i,type:e,message:t,closing:!1};this.notifications.update(o=>[...o,s]),n>0&&setTimeout(()=>{this.close(i)},n)}success(t,e=3e3){this.show(t,"success",e)}info(t,e=3e3){this.show(t,"info",e)}warning(t,e=3e3){this.show(t,"warning",e)}error(t,e=3e3){this.show(t,"error",e)}close(t){this.notifications.update(e=>e.map(n=>n.id===t?N(S({},n),{closing:!0}):n)),setTimeout(()=>{this.notifications.update(e=>e.filter(n=>n.id!==t))},400)}sendUpdate(t){this.quantity.next(t)}getUpdate(){return this.quantity.asObservable()}getNotifications(t=0,e){let n=this._settingsService.getHeaders();var i=e?"&limit="+e:"";return this.http.get(this._settingsService.getSettings("apiUrl")+"Notifications?start="+t+i,{headers:n})}static \u0275fac=function(e){return new(e||r)};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var xt=class r{constructor(t,e){this.http=t;this.appParams=e}get headers(){return new L({Authorization:`bearer ${this.appParams.token}`})}getFonts(){let t=`${this.appParams.apiUrl}Publications/fonts`;return this.http.get(t,{headers:this.headers}).pipe(P(e=>e.fonts||[]),R(e=>(console.error("Error fetching fonts",e),_([]))))}addFont(t){let e=`${this.appParams.apiUrl}Publications/fonts`;return this.http.post(e,t,{headers:this.headers}).pipe(R(n=>(console.error("Error adding font",n),_(null))))}updateFont(t){let e=`${this.appParams.apiUrl}Publications/fonts`,n=this.headers.set("Content-Type","application/json");return this.http.put(e,t,{headers:n}).pipe(P(i=>i),R(i=>(console.error("Error updating font",i),_(null))))}deleteFont(t){let e=`${this.appParams.apiUrl}Publications/fonts/${t}`;return this.http.delete(e,{headers:this.headers}).pipe(P(n=>n),R(n=>(console.error("Error deleting font",n),_(null))))}getFontAsBase64(t,e,n){return this.http.get(e,{headers:this.headers,responseType:"arraybuffer"}).pipe(P(i=>({base64:btoa(new Uint8Array(i).reduce((o,a)=>o+String.fromCharCode(a),"")),fontName:t,fontFilename:n})),R(i=>(console.error("Error fetching font as base64",i),_(null))))}static \u0275fac=function(e){return new(e||r)(T(re),T(ee))};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var Pt=class r{constructor(t){this.fontApiService=t}fontsNames=A(["sans-serif","serif","monospace"]);availableFonts=A({});fontsImported=[];customFontFaces={};baseFonts=[{fontName:"sans-serif"},{fontName:"serif"},{fontName:"monospace"},{fontName:"Arial"},{fontName:"Helvetica"},{fontName:"Times New Roman"},{fontName:"Courier New"},{fontName:"Verdana"},{fontName:"Georgia"},{fontName:"Comic Sans MS"},{fontName:"Trebuchet MS"},{fontName:"Arial Black"},{fontName:"Impact"},{fontName:"Abril Fatface"},{fontName:"Aclonica"},{fontName:"Alkatra"},{fontName:"Alegreya"},{fontName:"Alumni Sans"},{fontName:"Andada Pro"},{fontName:"Anek Bangla"},{fontName:"Antonio"},{fontName:"Archivo"},{fontName:"Arimo"},{fontName:"Asap"},{fontName:"Assistant"},{fontName:"Azeret Mono"},{fontName:"Besley"},{fontName:"Big Shoulders Display"},{fontName:"Bitter"},{fontName:"Bodoni Moda"},{fontName:"Brygada 1918"},{fontName:"Cabin"},{fontName:"Catamaran"},{fontName:"Caveat"},{fontName:"Changa"},{fontName:"Cinzel"},{fontName:"Comfortaa"},{fontName:"Commissioner"},{fontName:"Crimson Pro"},{fontName:"Cuprum"},{fontName:"Dancing Script"},{fontName:"Domine"},{fontName:"Dosis"},{fontName:"EB Garamond"},{fontName:"El Messiri"},{fontName:"Encode Sans"},{fontName:"Epilogue"},{fontName:"Exo"},{fontName:"Faustina"},{fontName:"Fira Code"},{fontName:"Fraunces"},{fontName:"Gemunu Libre"},{fontName:"Georama"},{fontName:"Glory"},{fontName:"Gluten"},{fontName:"Grandstander"},{fontName:"Grenze Gotisch"},{fontName:"Hahmlet"},{fontName:"Heebo"},{fontName:"Hepta Slab"},{fontName:"Ibarra Real Nova"},{fontName:"Imbue"},{fontName:"Inconsolata"},{fontName:"Inter"},{fontName:"JetBrains Mono"},{fontName:"Josefin Sans"},{fontName:"Josefin Slab"},{fontName:"Jost"},{fontName:"Jura"},{fontName:"Karla"},{fontName:"Kreon"},{fontName:"Kufam"},{fontName:"Kumbh Sans"},{fontName:"Lemonada"},{fontName:"Lexend"},{fontName:"Libre Franklin"},{fontName:"Literata"},{fontName:"Lora"},{fontName:"Manrope"},{fontName:"Manuale"},{fontName:"Markazi Text"},{fontName:"Maven Pro"},{fontName:"Merriweather Sans"},{fontName:"Mulish"},{fontName:"MuseoModerno"},{fontName:"Newsreader"},{fontName:"Noto Sans Display"},{fontName:"Noto Sans Mono"},{fontName:"Noto Serif Display"},{fontName:"Open Sans"},{fontName:"Orbitron"},{fontName:"Oswald"},{fontName:"Oxanium"},{fontName:"Petrona"},{fontName:"Piazzolla"},{fontName:"Playfair Display"},{fontName:"Podkova"},{fontName:"Public Sans"},{fontName:"Quicksand"},{fontName:"Raleway"},{fontName:"Rasa"},{fontName:"Recursive"},{fontName:"Red Hat Display"},{fontName:"Red Hat Text"},{fontName:"Red Rose"},{fontName:"Reem Kufi"},{fontName:"Roboto Mono"},{fontName:"Roboto Slab"},{fontName:"Rokkitt"},{fontName:"Rosario"},{fontName:"Rubik"},{fontName:"Ruda"},{fontName:"STIX Two Text"},{fontName:"Saira"},{fontName:"Sansita Swashed"},{fontName:"Signika"},{fontName:"Sora"},{fontName:"Space Grotesk"},{fontName:"Spartan"},{fontName:"Stick No Bills"},{fontName:"Syne"},{fontName:"Texturina"},{fontName:"Tourney"},{fontName:"Trispace"},{fontName:"Truculenta"},{fontName:"Urbanist"},{fontName:"Varta"},{fontName:"Vollkorn"},{fontName:"Work Sans"},{fontName:"Yaldevi"},{fontName:"Yanone Kaffeesatz"},{fontName:"Yrsa"}];init(){return z(this,null,function*(){yield this.loadFonts();let t=Object.values(this.availableFonts());this.injectGoogleFontsPreconnect(),this.injectAllGoogleFonts(t),this.injectDocumentFonts(t)})}loadFonts(){return z(this,null,function*(){try{let t=yield lt(this.fontApiService.getFonts()),n=(Array.isArray(t)?t:[]).reduce((o,a)=>{let{fontName:l,fontFilename:c,fontUrl:f,fontPath:d,publicationFontGuid:u,publicationFontId:p,fontGuid:m}=a;return o[l]={fontName:l,fontFilename:c,fontUrl:f,fontPath:d,publicationFontGuid:u,publicationFontId:p,fontGuid:m||u,axes:{ital:{name:"Italic",range:[0,1],value:0},wght:{name:"Weight",range:[400,900],value:400}}},o},{}),i=S({},n);this.baseFonts.forEach(o=>{i[o.fontName]||(i[o.fontName]=o)}),this.availableFonts.set(i),this.injectAllGoogleFonts(t);let s=Object.keys(i).sort();this.fontsNames.set([...new Set(["sans-serif","serif","monospace",...s])]);for(let o of Object.keys(n)){let a=n[o];a.fontUrl&&this.loadCustomFont(a)}}catch(t){console.error("Failed to load fonts",t)}})}injectGoogleFontsPreconnect(){if(!document.getElementById("google-fonts-preconnect")){let t=document.createElement("link");t.id="google-fonts-preconnect",t.rel="preconnect",t.href="https://fonts.googleapis.com",document.head.appendChild(t);let e=document.createElement("link");e.rel="preconnect",e.href="https://fonts.gstatic.com",e.crossOrigin="anonymous",document.head.appendChild(e)}}loadCustomFont(t){return z(this,null,function*(){if(!(!t.fontUrl||!t.fontFilename))try{let e=yield lt(this.fontApiService.getFontAsBase64(t.fontName,t.fontUrl,t.fontFilename));if(e&&e.base64){let{mime:n,type:i}=this.getFontMimeAndType(t.fontUrl),s=`
7
+ @font-face {
8
+ font-family: '${t.fontName}';
9
+ src: url('data:${n};base64,${e.base64}') format('${i}');
10
+ font-weight: normal;
11
+ font-style: normal;
12
+ }
13
+ `;if(this.customFontFaces[t.fontName]=s,!this.isFontAlreadyInDocument(t.fontName)){let o=document.createElement("style");o.innerHTML=s,document.head.appendChild(o)}}}catch(e){console.error(`Failed to load custom font: ${t.fontName}`,e)}})}deleteFont(t){return z(this,null,function*(){let e=t.fontGuid||t.publicationFontGuid||t.fontName;yield lt(this.fontApiService.deleteFont(e)),yield this.loadFonts()})}getFontMimeAndType(t){switch(t.split(".").pop()?.toLowerCase()){case"otf":return{mime:"font/otf",type:"opentype"};case"ttf":return{mime:"font/ttf",type:"truetype"};case"woff":return{mime:"font/woff",type:"woff"};case"woff2":return{mime:"font/woff2",type:"woff2"};default:return{mime:"application/octet-stream",type:"truetype"}}}isFontAlreadyInDocument(t){return Array.from(document.styleSheets).some(e=>{try{return Array.from(e.cssRules||[]).some(n=>n.cssText.includes(`font-family: '${t}'`)||n.cssText.includes(`font-family: "${t}"`))}catch{return!1}})}getGoogleFontLink(t){return`https://fonts.googleapis.com/css2?family=${t.replace(/ /g,"+")}`}injectGoogleFont(t){let e=`google-font-${t.replace(/ /g,"-").toLowerCase()}`;if(!document.getElementById(e)){let n=document.createElement("link");n.id=e,n.rel="stylesheet",n.href=this.getGoogleFontLink(t),document.head.appendChild(n)}}injectAllGoogleFonts(t){t.forEach(e=>{!e.fontUrl&&e.fontName!=="sans-serif"&&e.fontName!=="serif"&&e.fontName!=="monospace"&&this.injectGoogleFont(e.fontName)})}injectDocumentFonts(t){t.forEach(e=>{e.fontUrl&&this.loadCustomFont(e)})}isGoogleFont(t){let e=t.replace(/['"]/g,""),i=this.availableFonts()[e];return i?!i.fontUrl:this.baseFonts.some(s=>s.fontName===e)}getCustomFontUrlFace(t){let e=t.replace(/['"]/g,"").toLowerCase(),n=this.availableFonts(),i=Object.keys(n).find(s=>s.toLowerCase()===e);if(i){let s=n[i];if(s.fontUrl){let o=s.fontUrl.split(".").pop()?.toLowerCase(),a="truetype";return o==="otf"?a="opentype":o==="woff"?a="woff":o==="woff2"&&(a="woff2"),`
14
+ @font-face {
15
+ font-family: '${s.fontName}';
16
+ src: url('${s.fontUrl}') format('${a}');
17
+ font-weight: normal;
18
+ font-style: normal;
19
+ font-display: swap;
20
+ }
21
+ `}}return null}static \u0275fac=function(e){return new(e||r)(T(xt))};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var st=29,ls=`--vertical-padding:5px; --horizontal-padding:5px; min-width: var(--min-width); --indexSize: ${st}px; border-collapse: collapse;`,gn={"font-size":"16px","font-family":"serif",color:"rgb(0, 0, 0)","text-align":"left","justify-content":"normal","align-items":"normal","font-weight":"400","font-style":"normal","text-decoration":"none solid rgb(0, 0, 0)","background-color":"transparent","border-width":"1px","border-color":"rgb(0, 0, 0)","border-style":"solid"},cs=["font-size","font-family","color","text-align","justify-content","align-items","font-weight","font-style","text-decoration","background-color","border-top-width","border-top-color","border-top-style","border-right-width","border-right-color","border-right-style","border-bottom-width","border-bottom-color","border-bottom-style","border-left-width","border-left-color","border-left-style","padding-top","padding-right","padding-bottom","padding-left"],Pr=`<svg class="open" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
22
+ <path d="M3.72727 6H10.2727C10.2727 6 11 6 11 6.88889V13.1111C11 13.1111 11 14 10.2727 14H3.72727C3.72727 14 3 14 3 13.1111V6.88889C3 6.88889 3 6 3.72727 6Z" fill="var(--gray-15)" stroke="none"/>
23
+ <path d="M13 5V3.97726C13 3.35957 12.7192 2.77538 12.2369 2.38951L12.102 2.28162C11.19 1.55199 9.87521 1.6248 9.04932 2.45067V2.45067C8.69759 2.80238 8.49999 3.27941 8.49999 3.77682V6" stroke="var(--gray-15)" stroke-linecap="round" stroke-linejoin="round"/>
24
+ </svg>`,Ir=`<svg class="close" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
25
+ <path d="M3.72727 6H10.2727C10.2727 6 11 6 11 6.88889V13.1111C11 13.1111 11 14 10.2727 14H3.72727C3.72727 14 3 14 3 13.1111V6.88889C3 6.88889 3 6 3.72727 6Z" fill="var(--gray-15)" stroke="none"/>
26
+ <path d="M9 5.8V4.0869C9 3.64531 8.83333 3.22 8.53332 2.89598L8.43577 2.79063C7.5745 1.86045 6.07979 1.94229 5.32522 2.96093V2.96093C5.11401 3.24606 5 3.5915 5 3.94634V7" stroke="var(--gray-15)" stroke-linecap="square" stroke-linejoin="round"/>
27
+ </svg>`,It=class r{constructor(t,e,n){this.canvasService=e;this.colorService=n;this.renderer=t.createRenderer(null,null)}renderer;createProductTable(t,e,n,i,s){return this._createTable(t,e,n,i,"productTable",s)}createVariantsTable(t,e,n,i,s){return this._createTable(t,e,n,i,"variantsTable",s)}_createTable(t,e,n,i,s,o){let a=2,l=2,c=null;o&&(c=o.querySelector("table"),c&&(a=Array.from((c.querySelector("tr")||{children:[]}).children).filter(y=>!y.classList.contains("row-index-cell")).length,l=c.querySelectorAll("tr:not(.spacing-row):not(.columns-index-row)").length));let f=ls;if(o&&c){let y=c.style.getPropertyValue("--vertical-padding"),C=c.style.getPropertyValue("--horizontal-padding");f+=`; --vertical-padding: ${y&&y.trim()?y:"5px"}; --horizontal-padding: ${C&&C.trim()?C:"5px"}`}let d="<colgroup>";for(let y=0;y<a;y++){let C="auto";if(c){let F=c.querySelectorAll("colgroup col"),I=c.querySelector(".columns-index-row")?1:0;F[y+I]&&(C=F[y+I].style.width||"auto")}d+=`<col style="width:${C}; ${C!=="auto"?"max-width:"+C:""}" />`}d+="</colgroup>";let u=c?Array.from(c.querySelectorAll("tr:not(.spacing-row):not(.columns-index-row)")):[],p="";for(let y=0;y<l;y++){let C=u[y]&&u[y].style.minHeight||"10px",F="";u[y]?F=u[y].classList.contains("header-row")?' class="header-row"':"":s==="variantsTable"&&y===0&&(F=' class="header-row"'),p+=`<tr${F} style="min-height:${C}">`;let I=u[y]?Array.from(u[y].children).filter(B=>!B.classList.contains("row-index-cell")):[];for(let B=0;B<a;B++){let le="",ce="",Be="";if(I[B]){let J=I[B],ot=J.querySelector(".cellContent");if(le=ot?ot.innerHTML:J.innerHTML||"",J.style){let Gr=window.getComputedStyle(J);Be=cs.map(bn=>`${bn}:${Gr.getPropertyValue(bn)}`).join(";")}let at=J;at.colSpan>1&&(ce+=` colspan="${at.colSpan}"`),at.rowSpan>1&&(ce+=` rowspan="${at.rowSpan}"`),J.classList.contains("hidden")&&(ce+=' class="hidden"'),Be&&(ce+=` style="${Be}"`),J.dataset.parentColIndex&&(ce+=` data-parent-col-index="${J.dataset.parentColIndex}"`),J.dataset.parentRowIndex&&(ce+=` data-parent-row-index="${J.dataset.parentRowIndex}"`)}else Be=Object.entries(gn).map(([J,ot])=>`${J}:${ot}`).join(";"),s==="variantsTable"&&y===0?B===0?le="R\xE9f\xE9rence":B===1?le="Prix":le=`Title ${B+1}`:s==="variantsTable"&&y===1&&(B===0?le='<tspan></tspan><tspan class="textAttribute" data-type="text">R\xE9f\xE9rence (D\xE9clinaison)</tspan><tspan></tspan>':B===1?le='<tspan></tspan><tspan class="textAttribute" data-type="text">Prix</tspan><tspan></tspan>':le=`<tspan></tspan><tspan class="textAttribute" data-type="text">Variable ${B+1}</tspan><tspan></tspan>`),ce=` style="${Be}"`;p+=`<td${ce}>`,p+='<div class="wrap">',p+=`<div class="cellContent">${le}</div>`,p+="</div></td>"}p+="</tr>"}let m=`<table class="product-table" data-type="${s}" data-already-edited="false" style="${f}" xmlns="http://www.w3.org/1999/xhtml">`+d+"<tbody>"+p+"</tbody></table>",E=Math.max(n,200),b=Math.max(i,80),h=x.create("foreignObject",{x:t.toString(),y:e.toString(),width:E.toString(),height:b.toString(),"data-type":s}),g=this.renderer.createElement("div","http://www.w3.org/1999/xhtml");g.style.overflow="hidden",g.style.pointerEvents="none",g.innerHTML=m,h.appendChild(g);let D=this.canvasService.activeContainer;return D&&this.renderer.appendChild(D,h),setTimeout(()=>this.resizeTableContainer(h),0),h}addRow(t,e,n=!1){if(!(t.tagName==="TABLE"?t:t.querySelector("table")))return;let s=t.querySelectorAll("td.selected, th.selected"),o=null;if(s.length&&!n)o=e==="afterend"?s[s.length-1].parentElement:s[0].parentElement;else{let p=t.querySelectorAll("tr");o=e==="afterend"?p[p.length-1]:p[1]}if(!o)return;let a=t.querySelector(".columns-index-row"),l=a?a.children.length-1:2,c=document.createElement("tr");c.style.minHeight="10px";let f=document.createElement("td");f.classList.add("row-index-cell");let d=document.createElement("span");d.classList.add("index-view");let u=document.createElement("span");u.classList.add("row-resize"),f.appendChild(d),f.appendChild(u),c.appendChild(f);for(let p=0;p<l;p++){let m=document.createElement("td");Object.entries(gn).forEach(([E,b])=>{m.style.setProperty(E,b)}),m.innerHTML='<div class="wrap"><div class="cellContent"></div></div>',c.appendChild(m)}o.insertAdjacentElement(e,c),this.rewriteRowIndexes(t)}removeRow(t){let e=t.querySelectorAll("td.selected, th.selected"),n=[];e.forEach(i=>{let s=i.parentElement;s&&!n.includes(s)&&n.push(s)});for(let i of n){if(t.querySelectorAll("tr").length<=2)break;for(let s of Array.from(i.children))if(s.rowSpan>1&&this.splitCells(t,s),s.classList.contains("hidden")){let o=[s.dataset.parentColIndex,s.dataset.parentRowIndex];if(o[0]&&o[1]){let a=t.querySelectorAll("tr")[parseInt(o[1])].children[parseInt(o[0])];a&&(a.rowSpan-=1)}}i.remove()}this.rewriteRowIndexes(t)}moveRow(t,e){let n=t.querySelectorAll("td.selected, th.selected"),i=[];n.forEach(s=>{let o=s.parentElement;o&&!i.includes(o)&&i.push(o)}),e==="down"&&(i=i.reverse());for(let s of i)if(e==="up"){let o=s.previousElementSibling;if(!o||o.classList.contains("columns-index-row")||o.classList.contains("spacing-row"))return;o.insertAdjacentElement("beforebegin",s)}else{let o=s.nextElementSibling;if(!o)return;o.insertAdjacentElement("afterend",s)}this.rewriteRowIndexes(t)}addColumn(t,e,n=!1){let i=t.tagName==="TABLE"?t:t.querySelector("table");if(!i)return;let s=t.querySelectorAll("td.selected, th.selected"),o=(t.querySelector(".columns-index-row")?.children.length??2)-1,a;if(s.length&&!n){a=Array.prototype.indexOf.call(s[0].parentNode.children,s[0]);for(let d of Array.from(s)){let u=Array.prototype.indexOf.call(d.parentNode.children,d);a=e==="beforebegin"?Math.min(a,u):Math.max(a,u)}}else a=e==="beforebegin"?1:o;let l=this._getColumnByIndex(i,a),c=t.querySelectorAll("colgroup col");for(let d=0;d<l.length;d++){if(!l[d])continue;let u=l[d].parentElement;if(u?.classList.contains("columns-index-row")){let p=document.createElement("td");p.classList.add("col-index-cell");let m=document.createElement("span");m.classList.add("index-view");let E=document.createElement("span");E.classList.add("col-resize");let b=document.createElement("span");b.className="lockIcon",b.innerHTML=`${Ir}${Pr}`,p.appendChild(b),p.appendChild(m),p.appendChild(E),l[d].insertAdjacentElement(e,p)}else if(u?.classList.contains("spacing-row")){let p=document.createElement("td");l[d].insertAdjacentElement(e,p)}else{let p=l[d].style,m=document.createElement("td");m.style.setProperty("font-size",p.fontSize||"16px"),m.style.setProperty("font-family",p.fontFamily||"serif"),m.style.setProperty("color",p.color||"rgb(0, 0, 0)"),m.style.setProperty("text-align",p.textAlign||"left"),m.style.setProperty("justify-content",p.justifyContent||"normal"),m.style.setProperty("align-items",p.alignItems||"normal"),m.style.setProperty("font-weight",p.fontWeight||"400"),m.style.setProperty("font-style",p.fontStyle||"normal"),m.style.setProperty("text-decoration",p.textDecoration||"none solid rgb(0, 0, 0)"),m.style.setProperty("background-color",p.backgroundColor||"rgba(0, 0, 0, 0)"),m.style.setProperty("border-width",p.borderWidth||"1px"),m.style.setProperty("border-color",p.borderColor||"rgb(0, 0, 0)"),m.style.setProperty("border-style",p.borderStyle||"solid"),m.innerHTML='<div class="wrap"><div class="cellContent"></div></div>',(t.dataset?.type||t.querySelector("table")?.dataset?.type)==="variantsTable"&&u===t.querySelectorAll("tr")[3]&&(m.querySelector(".cellContent").innerHTML='<tspan></tspan><tspan class="textAttribute" data-type="text"></tspan><tspan></tspan>'),l[d].insertAdjacentElement(e,m)}}let f=document.createElement("col");f.style.width="auto",c[a]&&c[a].insertAdjacentElement(e,f),this.rewriteColumnsIndexes(t)}removeColumn(t,e=-1){let n=t.tagName==="TABLE"?t:t.querySelector("table");if(!n)return;let i=[];e!==-1?i.push(e):t.querySelectorAll("td.selected, th.selected").forEach(o=>{let a=Array.prototype.indexOf.call(o.parentNode.children,o);i.includes(a)||i.push(a)});for(let s=i.length-1;s>=0;s--){let o=t.querySelectorAll("colgroup col"),a=i[s],l=this._getColumnByIndex(n,a);if((t.querySelector("tr")?.children.length??0)<=2)break;for(let c of l)c&&(c.rowSpan>1&&this.splitCells(t,c),c.remove());o[a]&&o[a].remove()}this.rewriteColumnsIndexes(t)}moveColumn(t,e){let n=t.tagName==="TABLE"?t:t.querySelector("table");if(!n)return;let i=t.querySelectorAll("td.selected, th.selected"),s=[];i.forEach(o=>{let a=Array.prototype.indexOf.call(o.parentNode.children,o);s.includes(a)||s.push(a)}),e==="right"&&(s=s.reverse());for(let o of s){let a=this._getColumnByIndex(n,o),l=t.querySelectorAll("colgroup col");if(e==="left"){let c=this._getColumnByIndex(n,o-1);if(!c[1]||c[1].classList.contains("row-index-cell"))return;for(let f=0;f<a.length;f++)c[f]&&a[f]&&c[f].insertAdjacentElement("beforebegin",a[f]);l[o-1]&&l[o]&&l[o-1].insertAdjacentElement("beforebegin",l[o])}else{let c=this._getColumnByIndex(n,o+1);if(!c[0])return;for(let f=0;f<a.length;f++)c[f]&&a[f]&&c[f].insertAdjacentElement("afterend",a[f]);l[o+1]&&l[o]&&l[o+1].insertAdjacentElement("afterend",l[o])}}this.rewriteColumnsIndexes(t)}mergeCells(t){let e=Array.from(t.querySelectorAll("td.selected, th.selected"));if(e.length<2)return;let n=t.querySelectorAll("tr");if(e.some(m=>m.colSpan!==1||m.rowSpan!==1||m.classList.contains("hidden")))return;let s=1/0,o=1/0,a=-1/0,l=-1/0;e.forEach(m=>{let E=Array.prototype.indexOf.call(m.parentNode.children,m),b=Array.prototype.indexOf.call(m.parentNode.parentNode.children,m.parentNode);s=Math.min(s,E),o=Math.min(o,b),a=Math.max(a,E),l=Math.max(l,b)});let c=a-s+1,f=l-o+1,d=n[o].children[s];d.colSpan=c,d.rowSpan=f;let u=Array.prototype.indexOf.call(d.parentNode.children,d),p=Array.prototype.indexOf.call(d.parentNode.parentNode.children,d.parentNode);for(let m of e)m!==d&&(m.classList.add("hidden"),m.dataset.parentColIndex=String(u),m.dataset.parentRowIndex=String(p))}splitCells(t,e){let n=e??t.querySelector("td.selected, th.selected");if(!n)return;let i=t.querySelectorAll("tr"),s=n.colSpan,o=n.rowSpan;if(s<=1&&o<=1)return;let a=Array.prototype.indexOf.call(n.parentNode.children,n),l=Array.prototype.indexOf.call(n.parentNode.parentNode.children,n.parentNode);for(let c=0;c<o;c++)for(let f=0;f<s;f++){let d=i[l+c];if(!d)continue;let u=d.children[a+f];u&&(u.classList.remove("hidden"),u.classList.remove("d-none"),delete u.dataset.parentColIndex,delete u.dataset.parentRowIndex)}n.colSpan=1,n.rowSpan=1}applyStyleToSelected(t,e,n,i){let s=t.querySelectorAll("td.selected, th.selected");if(s.length===0)return;let o=i!==void 0&&s[0].style.getPropertyValue(e)===n;s.forEach(a=>{let l=o?i??n:n;a.style.setProperty(e,l)})}applyBorderStylesToSelected(t,e,n,i=["all"]){let s=Array.from(t.querySelectorAll("td.selected")),o=Array.from(t.querySelectorAll("tr")),a=o.map(l=>Array.from(l.children));s.forEach(l=>{let c=l.parentElement;if(!c)return;let f=o.indexOf(c),d=Array.prototype.indexOf.call(c.children,l),u=l.rowSpan||1,p=l.colSpan||1;if(i.includes("all"))l.style.setProperty(e,n),["top","bottom","left","right"].forEach(m=>{this._syncAdjacentBorder(a,s,e,n,m,f,d,u,p)});else for(let m of i){let E=e.replace("border","border-"+m);l.style.setProperty(E,n),this._syncAdjacentBorder(a,s,e,n,m,f,d,u,p)}})}_syncAdjacentBorder(t,e,n,i,s,o,a,l,c){let f=[],d="";if(s==="top"){d="bottom";for(let u=a;u<a+c;u++)f.push(this._getVisibleCell(t,o-1,u))}else if(s==="bottom"){d="top";for(let u=a;u<a+c;u++)f.push(this._getVisibleCell(t,o+l,u))}else if(s==="left"){d="right";for(let u=o;u<o+l;u++)f.push(this._getVisibleCell(t,u,a-1))}else if(s==="right"){d="left";for(let u=o;u<o+l;u++)f.push(this._getVisibleCell(t,u,a+c))}f.forEach(u=>{u&&!e.includes(u)&&u.style.setProperty(n.replace("border","border-"+d),i)})}_getVisibleCell(t,e,n){if(e<0||e>=t.length||n<0||n>=t[e].length)return null;let i=t[e][n];if(!i)return null;if(i.classList.contains("hidden")){let s=i.dataset.parentRowIndex,o=i.dataset.parentColIndex;return s!==void 0&&o!==void 0&&t[parseInt(s)][parseInt(o)]||null}return i}clearTableStyle(t){t.querySelectorAll("td").forEach(n=>{n.removeAttribute("style"),n.children[0]&&n.children[0].removeAttribute("style"),n.removeAttribute("colspan"),n.removeAttribute("rowspan"),n.classList.remove("hidden"),delete n.dataset.parentColIndex,delete n.dataset.parentRowIndex}),t.querySelectorAll("colgroup col").forEach(n=>{n.style.width="10px"}),t.querySelectorAll("tr:not(.spacing-row):not(.columns-index-row)").forEach(n=>{n.style.minHeight="10px"})}clearTable(t){t.querySelectorAll("td:not(:has(.index-view)) .cellContent").forEach(e=>{e.innerHTML=""}),this.clearTableStyle(t),t.querySelectorAll("tr:not(.spacing-row):not(.columns-index-row)").forEach(e=>{e.style.minHeight="10px"}),t.querySelectorAll("colgroup col").forEach(e=>{e.style.width="10px",e.style.removeProperty("max-width"),e.style.removeProperty("min-width")})}setDefaultStyleToCell(t){Object.entries(gn).forEach(([e,n])=>{t.style.setProperty(e,n)})}resizeTableContainer(t){let e=t.querySelector("table");if(!e||e.getAttribute("data-locked")==="true")return;let n=this.canvasService.zoomLevel(),i=e.getBoundingClientRect();i.width>0&&i.height>0&&(t.setAttribute("width",String(i.width*(1/n))),t.setAttribute("height",String(i.height*(1/n))))}setTableEditMode(t){let e=t.querySelector("table");e&&(e.classList.add("edit-mode"),t.setAttribute("width",String(Number(t.getAttribute("width"))+st)),t.setAttribute("height",String(Number(t.getAttribute("height"))+st+10)),setTimeout(()=>this.resizeTableContainer(t),100),this.rewriteRowIndexes(t))}removeTableEditMode(t){let e=t.querySelector("table");if(!e)return;let n=e.querySelector(".cell-edit-input");n&&this.removeEditInput(n.closest("td")),e.classList.remove("edit-mode"),t.querySelectorAll(".selected").forEach(i=>i.classList.remove("selected")),this.resizeTableContainer(t)}getTableSize(t){let e=(t.querySelector(".columns-index-row")?.children.length??2)-1;return{rows:t.querySelectorAll("tr").length-1,cols:e}}setTableSize(t,e,n){let i=t.tagName==="TABLE"?t:t.querySelector("table");if(!i)return;let s=i.dataset?.type==="variantsTable",o=this.getTableSize(t);if(s&&(e=3),e>o.rows)for(let a=o.rows;a<e;a++)this.addRow(t,"afterend",!0);else if(e<o.rows){let a=t.querySelectorAll("tr");for(let l=a.length-1;l>e;l--)a[l].remove()}if(n>o.cols)for(let a=o.cols;a<n;a++)this.addColumn(t,"afterend",!0);else if(n<o.cols)for(let a=o.cols;a>n;a--){this._getColumnByIndex(i,a).forEach(f=>f?.remove());let c=t.querySelectorAll("colgroup col");c[a]&&c[a].remove()}this.rewriteRowIndexes(t),this.rewriteColumnsIndexes(t)}setEditInput(t){let e=t.children[0];if(!e)return;let n=e.querySelector(".cellContent");n&&(n.setAttribute("contenteditable","true"),n.classList.add("cell-edit-input"),n.querySelectorAll(".textAttribute").forEach(i=>{i.setAttribute("contenteditable","false"),i.style.userSelect="none"}),n.focus())}removeEditInput(t){let e=t.querySelector(".cell-edit-input");e&&(e.removeAttribute("contenteditable"),e.classList.remove("cell-edit-input"),e.querySelectorAll(".textAttribute").forEach(n=>{n.removeAttribute("contenteditable"),n.style.userSelect=""}),e.innerHTML=e.innerHTML)}selectCells(t,e){this.deselectAllCells(t),e.forEach(n=>n.classList.add("selected"))}deselectAllCells(t){t.querySelectorAll("td.selected, th.selected").forEach(e=>e.classList.remove("selected")),t.querySelectorAll(".cell-edit-input").forEach(e=>{e.removeAttribute("contenteditable"),e.classList.remove("cell-edit-input")})}rewriteRowIndexes(t){let e=t.querySelectorAll(".row-index-cell"),n=t.querySelector("table")?.dataset.type==="variantsTable";e.forEach((i,s)=>{let o=i.querySelector(".index-view");o&&(n&&s===0?o.textContent="":o.textContent=String(s+(n?0:1)))})}rewriteColumnsIndexes(t){t.querySelectorAll(".col-index-cell").forEach((n,i)=>{let s=n.querySelector(".index-view");s&&(s.textContent=this._colIndexToLetter(i))})}exportTable(t){let e=t.tagName==="TABLE"?t:t.querySelector("table");if(!e)return"";let n=e.cloneNode(!0);n.classList.remove("edit-mode"),n.querySelectorAll(".spacing-row").forEach(o=>o.remove()),n.querySelectorAll("tr").forEach(o=>{o.querySelectorAll(".wrap").forEach(a=>{a.style.removeProperty("width")}),o.style.minHeight||(o.style.minHeight="10px")});let i=n.querySelector(".columns-index-row"),s=!!i;if(i&&i.remove(),n.querySelectorAll(".row-index-cell").forEach(o=>o.remove()),n.querySelectorAll(".index-view").forEach(o=>o.remove()),n.querySelectorAll(".col-resize").forEach(o=>o.remove()),n.querySelectorAll(".row-resize").forEach(o=>o.remove()),n.querySelectorAll(".lockIcon").forEach(o=>o.remove()),s){let o=n.querySelector("colgroup col");o&&o.remove()}if(n.querySelectorAll("colgroup col").forEach(o=>{o.style.minWidth="30px"}),n.querySelectorAll(".hidden").forEach(o=>{o.style.display="none"}),n.querySelectorAll(".selected").forEach(o=>o.classList.remove("selected")),n.querySelectorAll(".cell-edit-input").forEach(o=>{o.removeAttribute("contenteditable"),o.classList.remove("cell-edit-input")}),n.querySelectorAll("td .wrap").forEach(o=>{o.removeAttribute("style")}),s){let o=parseFloat(n.style.minWidth);isNaN(o)||(n.style.minWidth=String(o-st)+"px")}return n.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),n.outerHTML}enableEditMode(t){let e=t.dataset.type==="variantsTable"||t.dataset.type==="variantTable"||t.closest("foreignObject")?.dataset.type==="variantsTable";if(t.classList.add("edit-mode"),t.querySelectorAll("td:not(.col-index-cell):not(.row-index-cell):not(.selectAll), th:not(.col-index-cell):not(.row-index-cell):not(.selectAll)").forEach(d=>{if(!d.querySelector(".wrap")){let u=d.innerHTML;d.innerHTML='<div class="wrap"><div class="cellContent"></div></div>';let p=d.querySelector(".cellContent");p.innerHTML=u}}),t.querySelector(".columns-index-row"))return;let n=Array.from(t.querySelectorAll("tr")).filter(d=>!d.classList.contains("spacing-row")),i=0;n.length>0&&(i=Array.from(n[0].children).filter(d=>!d.classList.contains("row-index-cell")).length);let s=t.querySelector("colgroup");if(!s){s=document.createElement("colgroup");for(let d=0;d<i;d++){let u=document.createElement("col");u.style.width="auto",s.appendChild(u)}t.prepend(s)}let o=document.createElement("col");o.style.width="30px",o.style.minWidth="30px",s.prepend(o);let a=document.createElement("tr");a.className="columns-index-row",a.innerHTML='<td class="selectAll"><span class="index-view"></span></td>';for(let d=0;d<i;d++)a.innerHTML+=`<td class="col-index-cell"><span class="index-view">${this._colIndexToLetter(d)}</span><span class="col-resize"></span><span class="lockIcon">${Ir}${Pr}</span></td>`;let l=t.querySelector("thead");l?l.prepend(a):(t.querySelector("tbody")||t).prepend(a);let c=0;if(Array.from(t.querySelectorAll("tr")).forEach(d=>{if(d.classList.contains("columns-index-row")||d.classList.contains("spacing-row"))return;let u=document.createElement(d.parentElement?.tagName==="THEAD"?"th":"td");u.className="row-index-cell";let p=e&&c===0?"":String(c+(e?0:1));u.innerHTML=`<span class="index-view">${p}</span><span class="row-resize"></span>`,d.prepend(u),c++}),e&&!t.querySelector(".spacing-row")){let d=document.createElement("tr");d.className="spacing-row",d.style.height="8px";let u=t.querySelectorAll("tr");if(u.length>2){let p=u[2];p.parentNode?.insertBefore(d,p)}}t.querySelectorAll(".hidden").forEach(d=>{d.style.display="table-cell"});let f=parseFloat(t.style.minWidth);isNaN(f)||(t.style.minWidth=f+st+"px")}_colIndexToLetter(t){let e="",n=t;for(;n>=0;)e=String.fromCharCode(65+n%26)+e,n=Math.floor(n/26)-1;return e}_getColumnByIndex(t,e){let n=t.querySelectorAll("tr"),i=[];return n.forEach(s=>{s.children[e]&&i.push(s.children[e])}),i}exportVariantsTableSettings(t){let e=t.querySelector("table");if(!e)return null;let n=(o,a="rgb(255, 255, 255)")=>{if(!o||o==="transparent"||o==="rgba(0, 0, 0, 0)")return a;let l=this.colorService.toRgba(o);return l.a===0?"rgba(0, 0, 0, 0)":`rgb(${l.r}, ${l.g}, ${l.b})`},i={showHeader:e.getAttribute("data-show-header")!=="false",hideEmptyCells:e.getAttribute("data-remove-empty-cells")==="true",backgroundVariation:{hasVariation:e.getAttribute("data-background-variation")==="true",backgroundColor:n(e.getAttribute("data-background-variation-color")||"#ffffff","rgba(0, 0, 0, 0)")},globalBorder:{color:e.dataset.globalBorderColor||"black",stroke:e.dataset.globalBorderStyle||"solid",width:e.dataset.globalBorderSize||"1px"},width:t.getAttribute("width"),padding:{horizontal:e.style.getPropertyValue("--horizontal-padding"),vertical:e.style.getPropertyValue("--vertical-padding")}},s=e.querySelectorAll("tr:not(.spacing-row):not(.columns-index-row)");return Array.from(s).forEach((o,a)=>{let l=o.querySelectorAll("td, th"),c=a===0?"headerRow":"bodyRow",f=[];Array.from(l).forEach(d=>{let u=d;if(u.classList.contains("row-index-cell"))return;let p=window.getComputedStyle(u),m={text:{alignment:p.textAlign||"left",verticalAlignment:p.verticalAlign||p.alignItems||"top",style:p.fontStyle||"normal",weight:p.fontWeight||"400",decoration:p.textDecoration||"none",color:n(p.color,"rgb(0, 0, 0)"),font:p.fontFamily.split(",")[0].replace(/'/g,"").replace(/"/g,"").trim()||"serif",size:p.fontSize||"16px"},border:{color:n(p.borderColor||"black","rgb(0, 0, 0)"),stroke:p.borderStyle||"solid",width:p.borderWidth||"1px"},backgroundColor:n(p.backgroundColor,"rgba(0, 0, 0, 0)")},E=u.querySelector(".cellContent");if(E){let h=E.textContent||"";m.fieldName=h.replace(/{{(.*)}}/g,"$1").trim()}if(c==="headerRow"){let h=Array.prototype.indexOf.call(o.children,u),g=e.querySelector("colgroup");if(g){let D=g.children[h];D&&(m.width=D.style.width)}}let b=u;u.classList.contains("hidden")&&(m.display=!1),b.colSpan>1&&(m.colSpan=b.colSpan),b.rowSpan>1&&(m.rowSpan=b.rowSpan),f.push(m)}),i[c]=f}),i}static \u0275fac=function(e){return new(e||r)(T(Ln),T(pe),T(ke))};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var kt=class r{isLoading=A(!1);hasError=A(!1);errorKey=A("");isCanvasLoading=A(!1);canvasHasError=A(!1);canvasErrorKey=A("");showLoader(){this.isLoading.set(!0),this.hasError.set(!1),this.errorKey.set("")}hideLoader(){this.isLoading.set(!1)}showError(t){this.isLoading.set(!1),this.hasError.set(!0),this.errorKey.set(t)}showCanvasLoader(){this.isCanvasLoading.set(!0),this.canvasHasError.set(!1),this.canvasErrorKey.set("")}hideCanvasLoader(){this.isCanvasLoading.set(!1)}showCanvasError(t){this.isCanvasLoading.set(!1),this.canvasHasError.set(!0),this.canvasErrorKey.set(t)}reset(){this.isLoading.set(!1),this.hasError.set(!1),this.errorKey.set(""),this.isCanvasLoading.set(!1),this.canvasHasError.set(!1),this.canvasErrorKey.set("")}static \u0275fac=function(e){return new(e||r)};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};var Nt=class r{constructor(t,e,n,i,s,o,a,l,c){this.canvasService=t;this.appParams=e;this.docService=n;this.assetsService=i;this.notificationService=s;this.eventsService=o;this.fontService=a;this.tableService=l;this.loadingService=c;pt(()=>{let f=this.canvasService.modifiedPulse();if(this.canvasService.isSilent()){this.lastPulse=f;return}f>this.lastPulse?(this.lastPulse=f,import("./chunk-JKS5WI7E.js").then(({untracked:u})=>{u(()=>{this.setDirty(!0)})})):this.lastPulse=f}),this.eventsService.on("SHORTCUT_SAVE").subscribe(()=>{this.save()})}isDirty=A(!1);saveSuccessPulse=A({guid:"",count:0});lastPulse=0;thumbnailService=w(Mt);setDirty(t){this.isDirty.set(t)}getSvgString(){if(!this.canvasService.isReady())return"";let t=this.canvasService.svgElement,e=t.cloneNode(!0);this.canvasService.restoreContextInClone(e),Array.from(e.children).forEach(g=>{g.tagName.toLowerCase()!=="defs"&&(g.classList.contains("drawing-layer")||g.remove())}),e.style.removeProperty("transform"),e.style.removeProperty("background-color"),e.setAttribute("data-sp-version",nt),e.setAttribute("version","1.1");let n=this.docService.properties().doublePage||!1;e.setAttribute("data-double-page",String(n)),e.querySelectorAll(".se-selection-box, .se-handler, #canvasGrid, #selection-outline, .page-divider, #creation-band-overlay").forEach(g=>g.remove()),e.querySelectorAll(".context-indicator-target").forEach(g=>{g.classList.remove("context-indicator-target")}),Or(e),Array.from(e.querySelectorAll('g[data-gsvg="true"]')).forEach(g=>{let D=g.attributes.length;for(let y=0;y<g.attributes.length;y++)(g.attributes[y].name==="id"||g.attributes[y].name==="style")&&D--;if(D<=0&&g.children.length>0){let y=g.children[0];g.replaceWith(y)}}),Array.from(e.getElementsByTagName("foreignObject")).forEach(g=>{g.removeAttribute("fill"),g.removeAttribute("stroke")});let i=t.getAttribute("width")||"0",s=t.getAttribute("height")||"0",o=e.getElementById("Block");if(o)o.setAttribute("fill","none");else{let g=document.createElementNS("http://www.w3.org/2000/svg","rect");g.setAttribute("id","Block"),g.setAttribute("x","0"),g.setAttribute("y","0"),g.setAttribute("width",i),g.setAttribute("height",s),g.setAttribute("fill","none"),e.insertBefore(g,e.firstChild)}let a=Math.random().toString(36).substring(2,9);e.setAttribute("id",a);let l=new Set;e.querySelectorAll('[style*="font-family"]').forEach(g=>{let D=g.style.fontFamily;D&&D.split(",").forEach(y=>{let C=y.trim().replace(/['"]/g,"");C&&l.add(C)})}),e.querySelectorAll("[font-family]").forEach(g=>{let D=g.getAttribute("font-family");D&&D.split(",").forEach(y=>{let C=y.trim().replace(/['"]/g,"");C&&l.add(C)})});let c=Array.from(l),f=c.filter(g=>this.fontService.isGoogleFont(g)),d=c.filter(g=>!this.fontService.isGoogleFont(g)),u="";if(f.length>0){let g=f.filter(D=>!["serif","sans-serif","monospace"].includes(D.toLowerCase())).map(D=>D.replace(/ /g,"+")).join("|");g&&(u=`@import url("https://fonts.googleapis.com/css?family=${g}:400,400i,700,700i&display=swap");
28
+ `)}d.forEach(g=>{let D=this.fontService.getCustomFontUrlFace(g);D&&(u+=D+`
29
+ `)});let p=`
30
+ ${u}
31
+
32
+ #${a} foreignObject * {
33
+ box-sizing: border-box;
34
+ }
35
+
36
+ #${a} foreignObject table {
37
+ table-layout: fixed;
38
+ min-height: inherit;
39
+ min-width: var(--min-width);
40
+ border-collapse: collapse;
41
+ }
42
+ #${a} foreignObject td, #${a} foreignObject th {
43
+ line-height: 120%;
44
+ overflow: hidden;
45
+ text-align: left;
46
+ padding: 5px;
47
+ border-width: 0.8px;
48
+ border-color: rgb(0, 0, 0);
49
+ border-style: solid;
50
+ font-family: "serif";
51
+ font-size: 16px;
52
+ color: rgb(0, 0, 0);
53
+ font-style: normal;
54
+ font-weight: 400;
55
+ text-decoration: none solid rgb(0, 0, 0);
56
+ background-color: transparent;
57
+ min-height: inherit;
58
+ }
59
+ #${a} foreignObject .cellContent {
60
+ display: flex;
61
+ align-items: inherit;
62
+ justify-content: inherit;
63
+ width: 100%;
64
+ height: 100%;
65
+ flex-direction: column;
66
+ }
67
+ #${a} foreignObject .cellContent div {
68
+ width: max-content;
69
+ }
70
+ #${a} [locked='true'].fake-textarea > * {
71
+ max-width: 100%;
72
+ }
73
+ #${a} .fake-textarea,
74
+ #${a} .fake-textarea div {
75
+ width: 100%;
76
+ }
77
+ #${a} .fake-textarea {
78
+ display: flex;
79
+ flex-direction: column;
80
+ overflow-wrap: break-word;
81
+ outline: none;
82
+ height: 100%;
83
+ width: 100%;
84
+ }
85
+ `,m=document.createElementNS("http://www.w3.org/2000/svg","style");m.setAttribute("id","style-"+a),m.textContent=p,e.insertBefore(m,e.firstChild);let E=g=>{if(g.nodeType===Node.COMMENT_NODE){g.parentNode?.removeChild(g);return}if(g.nodeType===Node.ELEMENT_NODE){let y=g,C=y.attributes;if(C)for(let F=C.length-1;F>=0;F--){let I=C[F].name;(I.startsWith("_ngcontent")||I.startsWith("_nghost")||I.startsWith("ng-reflect-"))&&y.removeAttribute(I)}}Array.from(g.childNodes).forEach(y=>E(y))};E(e);let b=e.outerHTML;if(b=Rr(b),(this.appParams.type||"documents").toLowerCase()!=="background"){let g=x.getDocumentRoot().querySelector("svg style");if(g){let D=g.cloneNode(!0);E(D),b=b.replace(/<svg[^>]*>/,`$&${D.outerHTML}`)}}return b}save(){return z(this,null,function*(){if(this.loadingService.canvasHasError()){this.notificationService.error("Impossible de sauvegarder : une erreur est survenue lors du chargement de la page.");return}let t=this.getSvgString();if(!t)return;let e=null;try{e=yield this.thumbnailService.generateThumbnail(250,.2,t)}catch(l){console.warn("Thumbnail generation failed during save, proceeding without thumbnail:",l)}let n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),i=this.appParams.type||"document",s=this.appParams.guid||"",o=this.appParams.pageGuid?this.appParams.pageGuid().toString():"1",a=new FormData;a.append("file",n,i=="document"?s:this.appParams.templateData.publicationTemplateName),e&&a.append("thumbnail",e,s+".webp"),a.append("publicationTemplateguid",s),a.append(i=="document"?"pageGuid":"pageId",i=="document"?o:"1"),this.assetsService.saveDocument(i,a).subscribe({next:l=>{if(l===null)this.notificationService.error("Erreur lors de la sauvegarde du document.");else if(this.notificationService.success("Document sauvegard\xE9 avec succ\xE8s !"),this.setDirty(!1),this.saveSuccessPulse.set({guid:o,count:this.saveSuccessPulse().count+1}),i!=="document"){let c=this.appParams.templateData?.publicationTemplateVersion;(this.canvasService.versionUpgraded()||!c)&&["background","cover","marketing","productblock"].includes(i)&&this.assetsService.updateTemplateField("publicationTemplateVersion",nt).subscribe({next:()=>{fe.log("Template version updated to",nt),this.canvasService.versionUpgraded.set(!1),this.appParams.templateData&&(this.appParams.templateData.publicationTemplateVersion=nt)},error:p=>console.error("Error updating template version",p)});let d=x.getDocumentRoot().querySelector('[data-type="variantsTable"]');if(d){let u=this.tableService.exportVariantsTableSettings(d);u&&this.assetsService.updateTemplateField("publicationTemplateSettingVariants",JSON.stringify(u)).subscribe({next:()=>fe.log("Variants settings updated"),error:p=>console.error("Error updating variants settings",p)})}}},error:l=>{this.notificationService.error("Erreur lors de la sauvegarde du document.")}})})}static \u0275fac=function(e){return new(e||r)(T(pe),T(ee),T(Ie),T(Lt),T(Rt),T(Pe),T(Pt),T(It),T(kt))};static \u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})};function fs(r,t){if(r&1){let e=He();M(0,"div",1),G("contextmenu",function(i){return q(e),W(i.preventDefault())}),M(1,"div",2),G("click",function(){q(e);let i=$();return W(i.onAction("open"))}),M(2,"span"),K(3),X(4,"translate"),V()(),Ce(5,"div",3),M(6,"div",2),G("click",function(){q(e);let i=$();return W(i.onAction("insert-before"))}),M(7,"span"),K(8),X(9,"translate"),V()(),M(10,"div",2),G("click",function(){q(e);let i=$();return W(i.onAction("insert-after"))}),M(11,"span"),K(12),X(13,"translate"),V()(),Ce(14,"div",3),M(15,"div",2),G("click",function(){q(e);let i=$();return W(i.onAction("duplicate"))}),M(16,"span"),K(17),X(18,"translate"),V()(),Ce(19,"div",3),M(20,"div",4),G("click",function(){q(e);let i=$();return W(i.onAction("delete"))}),M(21,"span"),K(22),X(23,"translate"),V()()()}if(r&2){let e=$();Rn("top",e.position.y,"px")("left",e.position.x,"px"),H(3),te(Q(4,11,"GLOBAL.PAGES.OPEN")),H(5),te(Q(9,13,"GLOBAL.PAGES.INSERT_BEFORE")),H(4),te(Q(13,15,"GLOBAL.PAGES.INSERT_AFTER")),H(5),te(Q(18,17,"GLOBAL.PAGES.DUPLICATE")),H(3),xn("disabled",e.isCurrentPage),H(2),te(Q(23,19,"GLOBAL.PAGES.DELETE"))}}var kr=class r{constructor(t){this.elementRef=t}visible=!1;position={x:0,y:0};pageIndex=null;isCurrentPage=!1;action=new ie;closeMenu=new ie;onDocumentClick(t){if(this.visible){let e=t.composedPath?t.composedPath():[];(e.length>0?e.includes(this.elementRef.nativeElement):this.elementRef.nativeElement.contains(t.target))||this.closeMenu.emit()}}onAction(t){t==="delete"&&this.isCurrentPage||(this.pageIndex!==null&&this.action.emit({action:t,index:this.pageIndex}),this.closeMenu.emit())}static \u0275fac=function(e){return new(e||r)(k(me))};static \u0275cmp=De({type:r,selectors:[["app-page-context-menu"]],hostBindings:function(e,n){e&1&&G("mousedown",function(s){return n.onDocumentClick(s)},An)},inputs:{visible:"visible",position:"position",pageIndex:"pageIndex",isCurrentPage:"isCurrentPage"},outputs:{action:"action",closeMenu:"closeMenu"},decls:1,vars:1,consts:[["class","context-menu",3,"top","left","contextmenu",4,"ngIf"],[1,"context-menu",3,"contextmenu"],[1,"menu-item",3,"click"],[1,"separator"],[1,"menu-item","delete",3,"click"]],template:function(e,n){e&1&&je(0,fs,24,21,"div",0),e&2&&de("ngIf",n.visible)},dependencies:[ge,qe,Me,Fe],styles:[".context-menu[_ngcontent-%COMP%]{position:fixed;background:var(--gray-4);border:1px solid var(--gray-3);border-radius:var(--radius-m);box-shadow:0 4px 12px #0006;z-index:3000;min-width:180px;padding:4px 0;color:var(--white);-webkit-user-select:none;user-select:none}.menu-item[_ngcontent-%COMP%]{padding:8px 12px;cursor:pointer;display:flex;justify-content:space-between;align-items:center;font-size:13px;transition:background-color .1s ease}.menu-item[_ngcontent-%COMP%]:hover{background:var(--active);color:var(--white)}.menu-item.delete[_ngcontent-%COMP%]:hover{background:#e53935}.menu-item.disabled[_ngcontent-%COMP%]{opacity:.4;cursor:not-allowed;pointer-events:none}.menu-item.disabled[_ngcontent-%COMP%]:hover{background:transparent}.separator[_ngcontent-%COMP%]{height:1px;background-color:var(--gray-3);margin:4px 0}"]})};var hs=["*"];function ps(r,t){if(r&1){let e=He();M(0,"div",7)(1,"button",8),G("click",function(){q(e);let i=$(2);return W(i.close())}),K(2),X(3,"translate"),V(),M(4,"button",9),G("click",function(){q(e);let i=$(2);return W(i.submit())}),K(5),X(6,"translate"),V()()}if(r&2){let e=$(2);H(2),Kt(" ",Q(3,3,"CANCEL")," "),H(2),de("disabled",e.isSubmitDisabled),H(),Kt(" ",Q(6,5,"CONFIRM")," ")}}function ms(r,t){if(r&1){let e=He();M(0,"div",1),G("click",function(){q(e);let i=$();return W(i.close())}),M(1,"div",2),G("click",function(i){return q(e),W(i.stopPropagation())}),M(2,"div",3)(3,"h3"),K(4),V(),M(5,"button",4),G("click",function(){q(e);let i=$();return W(i.close())}),K(6,"\xD7"),V()(),M(7,"div",5),On(8),V(),je(9,ps,7,7,"div",6),V()()}if(r&2){let e=$();H(4),te(e.title),H(5),de("ngIf",e.showFooter)}}var Bt=class r{title="Modal";isOpen=!1;showFooter=!0;isSubmitDisabled=!1;closeEvent=new ie;submitEvent=new ie;close(){this.closeEvent.emit(),this.isOpen=!1}submit(){this.submitEvent.emit()}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=De({type:r,selectors:[["app-basic-modal"]],inputs:{title:"title",isOpen:"isOpen",showFooter:"showFooter",isSubmitDisabled:"isSubmitDisabled"},outputs:{closeEvent:"closeEvent",submitEvent:"submitEvent"},ngContentSelectors:hs,decls:1,vars:1,consts:[["class","modal-backdrop",3,"click",4,"ngIf"],[1,"modal-backdrop",3,"click"],[1,"modal-content",3,"click"],[1,"modal-header"],[1,"close-btn",3,"click"],[1,"modal-body"],["class","modal-footer",4,"ngIf"],[1,"modal-footer"],[1,"cancel-btn",3,"click"],[1,"save-btn",3,"click","disabled"]],template:function(e,n){e&1&&(Nn(),je(0,ms,10,2,"div",0)),e&2&&de("ngIf",n.isOpen)},dependencies:[ge,qe,Me,Fe],styles:[".modal-backdrop[_ngcontent-%COMP%]{position:fixed;top:0;left:0;width:100%;height:100%;background:var(--white-alpha-medium);display:flex;justify-content:center;align-items:center;z-index:2000}.modal-content[_ngcontent-%COMP%]{background:var(--gray-5);border-radius:var(--radius-s);min-width:300px;box-shadow:var(--shadow);color:var(--white)}.modal-header[_ngcontent-%COMP%]{padding:var(--spacing-m);border-bottom:1px solid var(--gray-3);display:flex;justify-content:space-between;align-items:center}.modal-body[_ngcontent-%COMP%]{padding:var(--spacing-m)}.modal-footer[_ngcontent-%COMP%]{padding:var(--spacing-s) var(--spacing-m);border-top:1px solid var(--gray-3);display:flex;justify-content:flex-end;gap:var(--spacing-s)}h3[_ngcontent-%COMP%]{margin:0;font-size:var(--font-size-regular);font-weight:var(--font-weight-semi-bold)}.close-btn[_ngcontent-%COMP%]{background:none;border:none;font-size:24px;cursor:pointer;color:var(--white);transition:color .2s}.close-btn[_ngcontent-%COMP%]:hover{color:var(--error)}.cancel-btn[_ngcontent-%COMP%]{background:var(--gray-4);color:var(--white);border:none;padding:var(--spacing-s) var(--spacing-m);border-radius:var(--radius-s);cursor:pointer;transition:background .2s}.cancel-btn[_ngcontent-%COMP%]:hover{background:var(--gray-3)}.save-btn[_ngcontent-%COMP%]{background:var(--active);color:var(--white);border:none;padding:var(--spacing-s) var(--spacing-m);border-radius:var(--radius-s);cursor:pointer;transition:background .2s}.save-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--active-hover)}.save-btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}"]})};var Vr=class r{message;confirm=new ie;cancel=new ie;onConfirm(){this.confirm.emit()}onCancel(){this.cancel.emit()}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=De({type:r,selectors:[["app-confirm-delete-modal"]],inputs:{message:"message"},outputs:{confirm:"confirm",cancel:"cancel"},decls:9,vars:7,consts:[[3,"closeEvent","submitEvent","title","isOpen"],[1,"confirm-content"],[1,"warning-icon"],["viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M12 9V14M12 17.01L12.01 16.9986M5.07183 19H18.9282C20.4678 19 21.4301 17.3333 20.6603 16L13.7321 4C12.9623 2.66667 11.0378 2.66667 10.268 4L3.33975 16C2.56995 17.3333 3.53223 19 5.07183 19Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"]],template:function(e,n){e&1&&(M(0,"app-basic-modal",0),X(1,"translate"),G("closeEvent",function(){return n.onCancel()})("submitEvent",function(){return n.onConfirm()}),M(2,"div",1)(3,"div",2),Cn(),M(4,"svg",3),Ce(5,"path",4),V()(),Tn(),M(6,"p"),K(7),X(8,"translate"),V()()()),e&2&&(de("title",Q(1,3,"GLOBAL.PAGES.DELETE_CONFIRM_TITLE"))("isOpen",!0),H(7),te(n.message||Q(8,5,"GLOBAL.PAGES.DELETE_CONFIRM_MSG")))},dependencies:[ge,Me,Bt,Fe],styles:[".confirm-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;text-align:center;padding:var(--spacing-m) 0}.warning-icon[_ngcontent-%COMP%]{width:48px;height:48px;background:#e539351a;color:var(--error);border-radius:50%;display:flex;align-items:center;justify-content:center;margin-bottom:var(--spacing-m)}.warning-icon[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{width:28px;height:28px}p[_ngcontent-%COMP%]{margin:0;color:var(--gray-1);font-size:14px;line-height:1.5;max-width:250px}[_nghost-%COMP%] .save-btn{background-color:var(--error)!important}[_nghost-%COMP%] .save-btn:hover{background-color:var(--error)!important}"]})};export{gt as a,Ur as b,Yt as c,$n as d,ei as e,ti as f,Qn as g,qe as h,ni as i,ri as j,ii as k,oi as l,ai as m,ge as n,rn as o,We as p,ui as q,Bo as r,L as s,re as t,_r as u,ki as v,wt as w,Xo as x,Fe as y,Qo as z,Me as A,Ft as B,x as C,Pe as D,ee as E,Ie as F,it as G,ke as H,pe as I,fr as J,Bt as K,It as L,xt as M,Pt as N,Ot as O,Rt as P,qi as Q,Ha as R,$a as S,Mt as T,Lt as U,kt as V,Nt as W,kr as X,Vr as Y};
@@ -1,19 +1,17 @@
1
1
  <!doctype html>
2
2
  <html lang="en" data-beasties-container>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Soliddesigner</title>
6
+ <base href="/">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <link rel="icon" type="image/x-icon" href="favicon.ico">
9
+ <link rel="preconnect" href="https://fonts.googleapis.com">
10
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
+ <style>@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2JL7SUc.woff2) format('woff2');unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa0ZL7SUc.woff2) format('woff2');unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2ZL7SUc.woff2) format('woff2');unicode-range:U+1F00-1FFF;}@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1pL7SUc.woff2) format('woff2');unicode-range:U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;}@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2pL7SUc.woff2) format('woff2');unicode-range:U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;}@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa25L7SUc.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}</style>
12
+ <style>body{margin:0}</style><link rel="stylesheet" href="styles.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.css"></noscript></head>
3
13
 
4
- <head>
5
- <meta charset="utf-8">
6
- <title>Soliddesigner</title>
7
- <base href="/">
8
- <meta name="viewport" content="width=device-width, initial-scale=1">
9
- <link rel="icon" type="image/x-icon" href="favicon.ico">
10
- <link rel="preconnect" href="https://fonts.googleapis.com">
11
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
12
- <style>@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2JL7SUc.woff2) format('woff2');unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa0ZL7SUc.woff2) format('woff2');unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2ZL7SUc.woff2) format('woff2');unicode-range:U+1F00-1FFF;}@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1pL7SUc.woff2) format('woff2');unicode-range:U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;}@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2pL7SUc.woff2) format('woff2');unicode-range:U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;}@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa25L7SUc.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url(https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}</style>
13
- <style>body{margin:0}</style><link rel="stylesheet" href="styles.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.css"></noscript></head>
14
-
15
- <body>
16
- <solid-designer token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VyR3VpZCI6IjAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMCIsIlVzZXJMb2dpbiI6InNvbGlkcGVwcGVyIiwiQWxpYXMiOiJtYWl0cmVzdmlnbmVyb25zIiwiTnVtQ2xpZW50IjoiMDAwMSIsIkJkZE5hbWUiOiJiZGRfbWFpdHJlc3ZpZ25lcm9ucyIsIkxhbmd1YWdlIjoiZnIiLCJTZXR0aW5nc1BhdGgiOiJEOlxcSWJhblxcY3VzdG9tZXJzXFwwMDAxX21haXRyZXN2aWduZXJvbnNcXFNldHRpbmdzXFwiLCJyb2xlIjoiTlVERSIsIm5iZiI6MTc3MzY1MTQ3MSwiZXhwIjoxODA1MTg3NDcxLCJpYXQiOjE3NzM2NTE0NzF9.btM7Aju_woPapoJUCRGc660IGrHe6ZuONo9QF81uRRk" guid="3e7656d6-ee1a-4c29-91d6-a541e31a9ee7" type="document" unit="mm" apiurl="http://localhost/centralstationservice/api/"></solid-designer>
17
- <link rel="modulepreload" href="chunk-W44TPOFU.js"><link rel="modulepreload" href="chunk-B3PWEOJU.js"><script src="polyfills.js" type="module"></script><script src="main.js" type="module"></script></body>
18
-
19
- </html>
14
+ <body>
15
+ <solid-designer token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VyR3VpZCI6IjAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMCIsIlVzZXJMb2dpbiI6InNvbGlkcGVwcGVyIiwiQWxpYXMiOiJoYXVkZWNvZXVyIiwiTnVtQ2xpZW50IjoiODkyMiIsIkJkZE5hbWUiOiJiZGRfODkyMiIsIkxhbmd1YWdlIjoiZnIiLCJTZXR0aW5nc1BhdGgiOiJFOlxcQ3VzdG9tZXJzXFw4OTIyX2hhdWRlY29ldXJcXFNldHRpbmdzIiwicm9sZSI6Ik5VREUiLCJuYmYiOjE3NzQ5NDg2MzcsImV4cCI6MTgwNjQ4NDYzNywiaWF0IjoxNzc0OTQ4NjM3fQ.N6Kk2YgrntZx-NAnrtR8fd5HVQhuahojZtgyvLmYuzw" guid="7093b122-b574-4880-859e-8468dc1fe165" type="document" unit="mm" apiurl="http://localhost/centralstationservice/api/"></solid-designer>
16
+ <link rel="modulepreload" href="chunk-VPM3BUYR.js"><link rel="modulepreload" href="chunk-TOQU4CNM.js"><link rel="modulepreload" href="chunk-KMNI2D3U.js"><script src="polyfills.js" type="module"></script><script src="main.js" type="module"></script></body>
17
+ </html>