PageSourceSearch

https://www.hollyhomer.com/en/chunk-B3X6KECO.js

js hollyhomer.com collected 2026-10-04 03:34:37 UTC 60,497 bytes, 2 lines download raw bytes

1import{a as gt,g as Ai}from"./chunk-T7HOAXJ5.js";import{c as Ri}from"./chunk-6DX3Z7R6.js";import{a as Ui}from"./chunk-6CSAQ4GV.js";import{b as ft,e as Oi,f as Li}from"./chunk-QVSNORG5.js";import{a as Fe}from"./chunk-BOKGPF5L.js";import{a as pt}from"./chunk-NPPDZT3N.js";import{a as ct}from"./chunk-H3FVH65J.js";import{a as Ei,c as $i,d as Vi,e as De}from"./chunk-5KMSWIXJ.js";import{a as Ii}from"./chunk-3CAPO2TL.js";import{k as lt}from"./chunk-FWUTYCZQ.js";import{a as Mi,b as Si,c as Di}from"./chunk-4M2GDFDH.js";import{d as at}from"./chunk-CHZLVAUG.js";import{a as Pi}from"./chunk-P6NYSXLC.js";import{a as li}from"./chunk-6GJZ5DGV.js";import{a as rt}from"./chunk-PM4ZPVPD.js";import{a as wi}from"./chunk-6VKMXZGV.js";import{a as st}from"./chunk-SPMPVOUW.js";import{a as Fi}from"./chunk-MQTNR3WQ.js";import{m as Xe}from"./chunk-WATQXADU.js";import{n as ki}from"./chunk-BTF5W6KP.js";import{b as Ze}from"./chunk-LJ6K3IYK.js";import{a as Ti,b as pe}from"./chunk-LY2L7L3N.js";import{c as Je}from"./chunk-HEKBPXP7.js";import{A as yi,B as nt,F as vi,Oa as bi,Pa as xi,W as _i,i as hi,m as z,n as gi,o as Ie,t as ke,ta as ce}from"./chunk-C53UORQN.js";import{Ea as ui,Xa as fi,Ya as Pe,c as Y,d as ci,e as pi,f as ut,g as ht,ga as di,la as mi}from"./chunk-GRKZLBTJ.js";import{G as B,i as He,j as ei,l as ti,o as ii,v as oi}from"./chunk-DNJMDJPD.js";import{a as Ae,b as Kt,c as re,f as N}from"./chunk-WYFHTUC5.js";import{i as Ge}from"./chunk-SJPXSUWQ.js";import{A as Re,c as Jt,d as ge,o as Zt,p as mt,w as Xt}from"./chunk-YBSG77R6.js";import{b as j}from"./chunk-JMVK4GP4.js";import{g as Wt,i as Te,j as Yt,o as Qt}from"./chunk-DXTONCKZ.js";import{b as Ue,c as xe}from"./chunk-HRCH7YTL.js";import{a as W,c as ne}from"./chunk-V2N2YMJZ.js";import{d as le}from"./chunk-3WKYSXKM.js";import{d as ot,e as Se}from"./chunk-QHZU4PST.js";import{b as et,c as tt,d as Ci,i as it,j as Me}from"./chunk-HFX225X2.js";import{a as Ke}from"./chunk-CJEIUXWH.js";import{E as si,H as qe,I as se,c as Ne,f as Ce,i as we,j as Be,k as ni,n as ae,q as je,u as ze,x as ri,y as ai}from"./chunk-3QAVFP5S.js";import{b as We,c as Ye,i as Qe}from"./chunk-LS74OHRZ.js";import{i as Gt,j as ie,l as oe}from"./chunk-NKUORADV.js";import{m as qt}from"./chunk-A5YLLBSK.js";import{i as ee,s as zt}from"./chunk-224PXFJJ.js";import{p as te}from"./chunk-2K5EWLY6.js";import{$ as Pt,$b as Et,C as bt,Cd as X,Da as Oe,E as xt,Ec as x,Fb as U,G as Tt,Gc as C,Hb as Dt,J as $,Ja as he,K as wt,Kc as Ot,L as $e,La as Mt,Lc as Lt,Mc as Ut,N as ue,Nd as jt,Pa as St,Qc as Le,R as Ve,Rc as fe,Sc as A,Uc as At,Vc as p,Wc as be,Xc as O,_b as Ft,aa as It,ac as $t,b as dt,ba as kt,ca as R,cc as Vt,da as Ee,dc as w,f as ve,fa as _e,fc as P,g as D,ic as Q,id as Rt,jc as K,jd as Ht,kc as I,kd as Nt,la as V,lc as s,ld as Bt,mc as l,n as F,nc as b,pb as c,qa as a,r as de,rc as J,rd as q,sc as Z,sd as G,t as _,u as me,vc as H,xa as k,ya as M}from"./chunk-QXK5WLZZ.js";import{a as y,b as v}from"./chunk-MH5V57HS.js";var Uo=(()=>{class n{http=a(te);postTypes=a(ce);auth=a(ke);security=a(Ie);snackbar=a(z);time=a(Ge);config=a(Pe);matomo=a(gi);storage=a(fi);router=a(Te);emoji=a(_i);whatsNewService=a(xi);analytics=hi("PostService");hasViewedCache=new Map;_notFound$=new ve;notFound$=this._notFound$.asObservable();channelHelper$=new D(null);newPostTemplate$=me([this.postTypes.postTypes$(),this.auth.currentUser$,this.config.config$]).pipe(_(([e,t,i])=>({postId:void 0,postType:Object.values(e).find(r=>r.isDefault)??{postTypeId:B,name:"Unlabelled"},mediaType:"image",title:void 0,cardLink:void 0,image:null,video:{url:null,videoProviderId:null,duration:null,image:null,previewUrl:null},embed:{html:null,image:null},map:void 0,survey:{anonymousTypeId:Xt.Public,hasResults:!1,hideResults:!1,allowUnregistered:!1,retake:!1,questions:[]},channels:[],modules:[],photos:[],tasks:[],ctas:[],body:"",landingPage:!1,allowComments:i.enableCommentsOnNewPosts??!0,includeInDigest:i.autoIncludeContentInDigest??!1,startDate:null,endDate:null,creatorId:t.campaign_user_id,sendNotification:!0,pinned:!1,fullWidth:!1,author:{authorId:t.campaign_user_id,image:{url:t.profileImage.url,cropData:t.profileImage.cropData,blurHash:t.profileImage.blurHash,color:t.profileImage.color,stockPhoto:t.profileImage.stockPhoto},firstName:t.first_name,lastName:t.last_name,fullName:t.fullName},keywords:[],slug:null})));clearChannelHelper(){this.channelHelper$.next(null)}canCreate(e,t){return e??=[],this.security.canItem(re.Create,e.map(i=>i.channelId),t??!1)}convertPostTimesFromUtc(e){return v(y({}
1,e),{startDate:e.startDate?new Date(e.startDate):null,endDate:e.endDate?new Date(e.endDate):null,suggestedStartDate:e.suggestedStartDate?new Date(e.suggestedStartDate):null,suggestedEndDate:e.suggestedEndDate?new Date(e.suggestedEndDate):null,lastUpdate:e.lastUpdate?new Date(e.lastUpdate):void 0,tasks:e.tasks??[]})}initPost$(e,t,i){return t?me([this.config.config$,this.postTypes.postTypes$(),this.auth.currentUser$]).pipe(ue(1),_(([o,r,f])=>{t.mediaType==="none"&&(t.landingPage?t.mediaType="nocard":t.mediaType="alpha"),t.keywords=t.keywords??[];let g=e,d=e;i?t.isDraft&&(g=e,d=t.channels):t.isDraft&&(t.postId?(g=t.channels,d=t.channels):(g=e,d=e));let u=[],m=[];if(d.forEach(E=>{if(o.allowUgc){u.push(E),m.push(E);return}this.security.canItem(re.Create,[E.channelId],f.campaign_user_id===t.creatorId)&&u.push(E),this.security.canItem(re.PublishScheduleArchive,[E.channelId],f.campaign_user_id===t.creatorId)&&m.push(E)}),d=m.length>0?m:u,t.postId&&t.channels?.length){let E=new Map(t.channels.map(ye=>[ye.channelId,ye.visibility]));d=d.map(ye=>{let _t=E.get(ye.channelId);return _t!=null?v(y({},ye),{visibility:_t}):ye})}i&&t.isDraft?this.checkCurrentChannelMissingFromDraft(g,t.channels):this.channelHelper$.next(null);let S=this.security.canItem(re.PublishScheduleArchive,d.map(E=>E.channelId),!0),T=r.find(E=>E.postTypeId===(t.postType?.postTypeId??t.postTypeId))??{postTypeId:B,name:"Unlabelled"};return v(y({},t),{visibility:t.visibility??Jt.FollowChannel,postType:T,mediaType:t.mediaType??"nocard",channels:d,photos:t.photos?.filter(E=>!!E.image),isOwner:this.auth.currentUser$.value?.campaign_user_id===t.creatorId,ugc:!t.postId&&!S,active:S&&(!t.postId&&i||!!t.postId&&!!t.active)})})):F(null)}checkCurrentChannelMissingFromDraft(e,t){let i=new Set(t?.map(r=>r?.channelId)??[]),o=(e??[]).filter(r=>r?.channelId!=null&&!i.has(r.channelId));this.channelHelper$.next(o.length>0?{addableChannels:o}:null)}getPostFromServer$(e){if(!e)throw new Error("Cannot get post without postId");return this.http.get(`/api/posts/${e}`).pipe(_(t=>this.convertPostTimesFromUtc(t)))}deletePost$(e){return this.http.delete(`/api/posts/${e}`)}publishPost$(e){return this.http.post(`/api/posts/${e}/compact`,{active:!0})}unpublishPost$(e){return this.http.post(`/api/posts/${e}/compact`,{active:!1})}getPostVersions$(e){return this.http.get(`/api/posts/${e}/versions`)}getPostVersion$(e,t){return this.http.get(`/api/posts/${e}/versions/${t}`)}convertImageUrlToMediaCropImage$(e){return this.http.request("POST","/api/upload/proxy",{params:{url:e,type:"posts"}})}convertUnfurlToPost$(e,t){if(!e)throw new Error("Cannot convert unfurl to post without unfurl");return this.newPostTemplate$.pipe(ue(1),R(i=>{if(i.title=e.title||e.fallback,i.cardLink=e.fromUrl,(e.serviceName==="YouTube"||e.serviceName==="Vimeo")&&(e.type==="oembed"||e.type==="video"))return i.mediaType="video",i.video={url:e.fromUrl,image:null,videoProviderId:null,duration:null,previewUrl:e.fromUrl},e.description&&(i.body+=`<p>${e.description}</p>`),i.body+=`<p>From <a target="_blank" href=${e.fromUrl}>${e.fromUrl}</a></p>`,this.convertImageUrlToMediaCropImage$(e.thumbUrl).pipe(_(o=>(i.video??={},i.video.image=o,i)));switch(e.type){case"article":return i.mediaType="nocard",e.description&&(i.body+=`<p>${e.description}</p>`),i.body+=`<p>From <a target="_blank" href=${e.fromUrl}>${e.fromUrl}</a></p>`,e.imageUrl?(i.mediaType="image",i.image={},this.convertImageUrlToMediaCropImage$(e.imageUrl).pipe(_(o=>(i.image=o,i)))):F(i);case"image":return i.mediaType="image",i.image={},this.convertImageUrlToMediaCropImage$(e.imageUrl).pipe(_(o=>(i.image=o,i)));case"video":case"oembed":return!i.ugc||t?(i.mediaType="custom",i.embed={html:e.videoEmbed??e.oEmbed??null,image:null},e.description&&(i.body+=`<p>${e.description}</p>`),i.body+=`<p>From <a target="_blank" href=${e.fromUrl}>${e.fromUrl}</a></p>`,e.imageUrl||e.thumbUrl?this.convertImageUrlToMediaCropImage$(e.imageUrl||e.thumbUrl).pipe(_(o=>(i.embed??={},i.embed.image=o,i))):F(i)):(i.mediaType="nocard",i.body=e.videoEmbed??"",e.description&&(i.body+=`<p>${e.description}</p>`),i.body+=`<p>From <a target="_blank" href=${e.fromUrl}>${e.fromUrl}</a></p>`,e.imageUrl||e.thumbUrl?(i.mediaType="image",this.convertImageUrlToMediaCropImage$(e.imageUrl||e.thumbUrl).pipe(_(o=>(i.image=o,i)))):F(i));default:throw new Error(`Unfurl type ${e.type} is not supported`)}}))}
1getPost$(e,t){let{contentType:i,contentId:o}=this.extractContentInfo(e);if(!this.isValidContentId(o))return this.processItem({contentId:o,contentType:i,notFound:!0},e,t);let r=mi(i,o);return this.auth.isAuthenticated$.pipe(R(()=>{let f=this.storage.contentStore$.pipe(_(d=>d[r])),g=this.whatsNewService.getContentItemAndCache$(i,o).pipe($(d=>this.whatsNewService.handleError(d,i,o)));return xt(f.pipe(Tt(Boolean)),g)}),Ve(),_e(()=>this.hasViewedCache.set(o,!1)),R(f=>this.processItem(f,e,t)),Pt(1))}extractContentInfo(e){let t=e.contentType.toLowerCase(),i=e[ii[t]];return{contentType:t,contentId:i}}isValidContentId(e){return/^\d+$/.test(String(e))}processItem(e,t,i){return e?e.notFound?(this.handleNotFound(e.contentId),F(e)):e.forbidden?F(e):this.handleValidItem(e,t,i):F(null)}handleNotFound(e){window.notFound=!0,this._notFound$.next(e)}handleValidItem(e,t,i){return window.notFound=!1,F(e).pipe(_e(()=>this.handleRouting(e,t)),_e(()=>this.handleViewed(e,i)),_(o=>this.mapToPostDetail(o)))}handleRouting(e,t){t.contentType!=="posts"?this.router.navigate(["posts",e.contentId],{queryParams:t,replaceUrl:!0}):(e?.slug??"")!==(t.slug??"")&&this.router.navigate(["posts",e.contentId].concat(e.slug?[e.slug]:[]),{queryParams:t,replaceUrl:!0})}handleViewed(e,t){!this.hasViewedCache.get(e.contentId)&&!t&&(this.hasViewedCache.set(e.contentId,!0),this.markAsViewed(e),this.trackPageView(e))}markAsViewed(e){let t={postId:e.contentId.toString()};this.http.post("/api/viewed",null,{params:t}).subscribe()}trackPageView(e){let t=(e.landingPage?"Page":"Post")+" - "+e.title;e.title&&oi.exec(e.title)?this.emoji.init().then(()=>{let i=this.emoji.replaceColons(t,void 0,"native");this.analytics.trackPageView({title:i}),this.matomo.trackPageView(i)}):(this.analytics.trackPageView({title:t}),this.matomo.trackPageView(t))}mapToPostDetail(e){return v(y({},e),{modules:e.modules||[],channels:e.channels||[],canPublish:this.security.canItem(re.PublishScheduleArchive,e.channels,e.author?.authorId===this.auth.currentUser$.value?.campaign_user_id)})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=V({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Hi=(()=>{class n{colorToHsl(e){let t=ut(e);if(!t)return null;try{let i=ci(t);return this.rgbToHsl(i.r,i.g,i.b)}catch{return null}}hslToHex(e){let t=this.hslToRgb(e.h,e.s,e.l);return pi(t)}generateHarmonies(e){let t=ut(e);if(!t)return[];let i=this.colorToHsl(t);if(!i)return[];let o=[],r=this.rotateHue(i,180);o.push({name:"Complementary",colors:[t,this.hslToHex(r)]});let f=this.rotateHue(i,30),g=this.rotateHue(i,-30);o.push({name:"Analogous",colors:[this.hslToHex(g),t,this.hslToHex(f)]});let d=this.rotateHue(i,120),u=this.rotateHue(i,240);o.push({name:"Triadic",colors:[t,this.hslToHex(d),this.hslToHex(u)]});let m=this.rotateHue(i,150),S=this.rotateHue(i,210);return o.push({name:"Split-Complementary",colors:[t,this.hslToHex(m),this.hslToHex(S)]}),o}isChallengingColor(e){let t=this.colorToHsl(e);if(!t)return!1;let i=t.l>=40&&t.l<=60,o=t.s>=80;return i||o&&t.l>=50&&t.l<=70}rotateHue(e,t){let i=(e.h+t)%360;return i<0&&(i+=360),v(y({},e),{h:i})}rgbToHsl(e,t,i){e/=255,t/=255,i/=255;let o=Math.max(e,t,i),r=Math.min(e,t,i),f=(o+r)/2,g=0,d=0;if(o!==r){let u=o-r;switch(d=f>.5?u/(2-o-r):u/(o+r),o){case e:g=((t-i)/u+(t<i?6:0))/6;break;case t:g=((i-e)/u+2)/6;break;case i:g=((e-t)/u+4)/6;break}}return{h:Math.round(g*360),s:Math.round(d*100),l:Math.round(f*100)}}hslToRgb(e,t,i){e/=360,t/=100,i/=100;let o,r,f;if(t===0)o=r=f=i;else{let g=(m,S,T)=>(T<0&&(T+=1),T>1&&(T-=1),T<.16666666666666666?m+(S-m)*6*T:T<.5?S:T<.6666666666666666?m+(S-m)*(.6666666666666666-T)*6:m),d=i<.5?i*(1+t):i+t-i*t,u=2*i-d;o=g(u,d,e+1/3),r=g(u,d,e),f=g(u,d,e-1/3)}return{r:Math.round(o*255),g:Math.round(r*255),b:Math.round(f*255)}}static \u0275fac=function(t){return new(t||n)};static \u0275prov=V({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function Ct(n,h){let e;return t=>t.pristine?(e=t.value,F(null)):e===t.value?F(null):bt(300).pipe(R(()=>n.get("/api/postTypes/inUse",{params:{name:t.value,excludeId:h?.toString()??""}})),_(i=>i?null:{nameInUse:!0}))}var Ki=(n,h)=>h.color;function Ji(n,h){n&1&&(s(0,"mat-error"),p(1,"Label name is required"),l())}function Zi(n,h){n&1&&(s(0,"mat-error"),p(1,"Label name cannot be longer than 40 characters"),l())}function Xi(n,h){n&1&&(s(0,"mat-error"),p(1,"Label name is already in use"),l())}function eo(n,h){if(n&1&&(s(0,"span",24),p(1),l()),n&2){let e=C(2);c(),be(e.contrastStatus())}}function to(n,h){if(n&1&&(s(0,"div",21),b(1,"mat-icon",22),s(2,"span",23),p(3),l(),w(4,eo,2,1,"span",24),l()),n&2){let e=h,t=C();At("contrast-"+t.contrastStatus()),I("matTooltip",t.getContrastTooltip(t.contrastStatus(),e)),c(),I("svgIcon",t.getStatusIcon(t.contrastStatus())),c(2),O("",e.toFixed(2),":1"),c(),P(t.contrastStatus()!=="fail"&&t.contrastStatus()!=="unknown"?4:-1)}}function io(n,h){if(n&1){let e=H();s(0,"button",30),x("click",function(){let i=k(e).$implicit,o=C(3);return M(o.applyFix(i))}),b(1,"span",31),s(2,"span",32),p(3),l(),s(4,"span",33),p(5),l()()}if(n&2){let e=h.$implicit;c(),fe("background-color",e.color),c(2),be(e.color),c(2),O("(+",e.improvement,")")}}function oo(n,h){if(n&1&&(s(0,"div",27)(1,"div",28),p(2,"Quick fix:"),l(),Q(3,io,6,4,"button",29,Ki),l()),n&2){let e=C(2);c(3),K(e.quickFixes())}}function no(n,h){if(n&1&&(s(0,"ih-info-panel",17),$t(function(){return"ih-in-out-max-height-leave"}),Et(function(){return"ih-in-out-max-height-enter"}),s(1,"div",25)(2,"div",26),p(3," The contrast between the label color and text color may make the label hard to read. "),l(),w(4,oo,5,0,"div",27),l()()),n&2){let e=C();c(4),P(e.quickFixes().length>0?4:-1)}}var Ni=(()=>{class n{hostClass=!0;config=a(Pe);saveChangesDialog=a(st);cd=a(jt);destroyRef=a(Oe);http=a(te);logger=le("CreatePostTypeComponent");mdDialogRef=a(We);snackbar=a(z);postTypeService=a(ce);colorHarmonyService=a(Hi);postTypeToEdit=a(Ye,{optional:!0});isEditing=!!this.postTypeToEdit?.postTypeId;DEFAULT_FORE_COLOR="#ffffff";DEFAULT_BACK_COLOR="#0000ff";postTypes$=new D([]);hasChanges=!1;saving$=new D(!1);config$=this.config.config$;submitted$=new D(!1);editIndex$=new D(null);createPostTypeForm=new ni({name:new ae("",[Ce.required,Ce.maxLength(40)],[Ct(this.http)]),foreColor:new ae(this.DEFAULT_FORE_COLOR,[Ce.required]),backColor:new ae(this.DEFAULT_BACK_COLOR,[Ce.required])});backColorValue=he(this.DEFAULT_BACK_COLOR);foreColorValue=he(this.DEFAULT_FORE_COLOR);currentContrastRatio=X(()=>{let e=this.backColorValue(),t=this.foreColorValue();return!e||!t?null:Y(e,t)});contrastStatus=X(()=>{let e=this.currentContrastRatio();return e===null?"unknown":e>=7?"aaa":e>=4.5?"aa":e>=3?"warn":"fail"});insufficientContrast=X(()=>{let e=this.currentContrastRatio();return e!==null&&e<4.5});previewLowContrast=X(()=>!ht(this.backColorValue(),"#FFFFFF",1.2));quickFixes=X(()=>this.insufficientContrast()?this.generateQuickFixes(this.backColorValue(),this.foreColorValue()):[]);constructor(){this.isEditing&&this.postTypeToEdit?(this.saveChangesDialog.pageTitle="edit label",this.createPostTypeForm.controls.name.setAsyncValidators([Ct(this.http,this.postTypeToEdit.postTypeId)]),this.createPostTypeForm.patchValue({name:this.postTypeToEdit.name?.toLocaleUpperCase(),foreColor:this.postTypeToEdit.foreColor,backColor:this.postTypeToEdit.backColor}),this.backColorValue.set(this.postTypeToEdit.backColor??this.DEFAULT_BACK_COLOR),this.foreColorValue.set(this.postTypeToEdit.foreColor??this.DEFAULT_FORE_COLOR)):this.saveChangesDialog.pageTitle="create label",this.createPostTypeForm.get("backColor").valueChanges.pipe(W(this.destroyRef)).subscribe(e=>{if(!e)return;let t=ht(e,"#FFFFFF",4)?"#FFFFFF":"#000000";this.createPostTypeForm.patchValue({foreColor:t}),this.backColorValue.set(e),this.cd.markForCheck()}),this.createPostTypeForm.get("foreColor").valueChanges.pipe(W(this.destroyRef)).subscribe(e=>{e&&(this.foreColorValue.set(e),this.cd.markForCheck())})}setModified(){this.saveChangesDialog.setModified()}cancel(){this.mdDialogRef.close()}applyFix(e){this.createPostTypeForm.patchValue({foreColor:e.color})}getStatusIcon(e){switch(e){case"aaa":case"aa":return"check-circle";case"warn":return"alert";case"fail":return"alert-circle";default:return"help-circle"}}getContrastTooltip(e,t){switch(e){case"aaa":return`Optimal contrast (${t.toFixed(2)}:1). Exceeds WCAG AAA standards.`;case"aa":return`Good contrast (${t.toFixed(2)}:1). Meets WCAG AA standards.`;case"warn":return`Poor contrast (${t.toFixed(2)}:1). Meets WCAG AA for large text (18pt+) but fails for normal text (requires 4.5:1).`;case"fail":return`Insufficient contrast (${t.toFixed(2)}:1). Fails WCAG AA for large text (requires 3:1).`;default:return"Calculating contrast ratio..."}}save(){if(!this.createPostTypeForm.valid)return;let e=this.createPostTypeForm.value,t=this.isEditing&&this.postTypeToEdit?v(y({},e),{postTypeId:this.postTypeToEdit.postTypeId}):e;this.attemptSave(t)}attemptSave(e){this.saving$.next(!0),(this.isEditing?this.postTypeService.updatePostType$(e):this.postTypeService.createPostType$(e)).pipe(W(this.destroyRef)).subscribe({next:()=>{this.mdDialogRef.close(this.createPostTypeForm.value);let i=this.isEditing?"updated":"created";this.snackbar.open(`Post label ${this.createPostTypeForm.controls.name.value} ${i}`)},error:i=>{this.logger.error("Failed to save post type",{error:i,isEditing:this.isEditing}),this.saving$.next(!1);let o=this.isEditing?"update":"create";this.snackbar.open(`Unable to ${o} label`,"TRY AGAIN").then(r=>{r.onAction().pipe(ue(1),W(this.destroyRef)).subscribe(()=>this.attemptSave(e))})}})}generateQuickFixes(e,t){let i=[],r=Y(e,t),f=Y(e,"#FFFFFF");f>=4.5&&i.push({color:"#FFFFFF",improvement:(f-r).toFixed(1)});let g=Y(e,"#000000");g>=4.5&&i.push({color:"#000000",improvement:(g-r).toFixed(1)});let d=this.colorHarmonyService.colorToHsl(t);if(d){let u=Y(e,"#FFFFFF")>Y(e,"#000000"),m=y({},d),S=Y(e,this.colorHarmonyService.hslToHex(m));for(let T=0;T<50&&S<4.5;T++)m.l+=u?2:-2,m.l=Math.max(0,Math.min(100,m.l)),S=Y(e,this.colorHarmonyService.hslToHex(m));if(S>=4.5){let T=this.colorHarmonyService.hslToHex(m);i.some(E=>E.color.toLowerCase()===T.toLowerCase())||i.push({color:T,improvement:(S-r).toFixed(1)})}}return i.filter((u,m,S)=>m===S.findIndex(T=>T.color.toLowerCase()===u.color.toLowerCase())).sort((u,m)=>parseFloat(m.improvement)-parseFloat(u.improvement))}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["ih-create-post-type"]],hostVars:2,hostBindings:function(t,i){t&2&&A("ih-create-post-type",i.hostClass)},decls:36,vars:20,consts:[["name",""],["ih-header",""],["ih-content",""],["id","createPostTypeForm","name","createPostTypeForm","method","POST",3,"ngSubmit","formGroup"],[1,"create-post-type-fields"],[1,"post-type-label-preview-container"],[1,"post-type-label"],["appearance","outline",1,"post-type-label-form-field"],["ihUppercase","","matInput","","formControlName","name","maxlength","40"],["align","end"],[1,"color-picker-container"],["for","pckBackColor",1,"control-label"],["id","pckBackColor","formControlName","backColor","matTooltip","Backgroun
1d color of the label"],[1,"control-label-wrapper"],["for","pckForeColor",1,"control-label"],[1,"contrast-ratio-badge",3,"class","matTooltip"],["id","pckForeColor","formControlName","foreColor","matTooltip","Text color of the label"],["type","warning",1,"contrast-warning"],["ih-footer",""],["mat-button","","type","button",3,"click"],["mat-flat-button","","color","primary","form","createPostTypeForm",3,"ihInProgress","inProgressText"],[1,"contrast-ratio-badge",3,"matTooltip"],[3,"svgIcon"],[1,"ratio-value"],[1,"wcag-level"],[1,"warning-content"],[1,"warning-text"],[1,"quick-fixes"],[1,"quick-fix-label"],["type","button",1,"fix-option"],["type","button",1,"fix-option",3,"click"],[1,"color-swatch"],[1,"color-value"],[1,"improvement"]],template:function(t,i){if(t&1&&(s(0,"ih-basic-dialog"),J(1,1),p(2),Z(),J(3,2),s(4,"form",3),x("ngSubmit",function(){return i.save()}),s(5,"div",4)(6,"div",5)(7,"span",6),p(8),l()(),s(9,"mat-form-field",7)(10,"mat-label"),p(11,"Label name"),l(),b(12,"input",8,0),s(14,"mat-hint",9),p(15
1),l(),w(16,Ji,2,0,"mat-error"),w(17,Zi,2,0,"mat-error"),w(18,Xi,2,0,"mat-error"),l(),s(19,"div",10)(20,"label",11),p(21,"Label color"),l(),b(22,"ih-color-picker",12),l(),s(23,"div",10)(24,"div",13)(25,"label",14),p(26,"Text color"),l(),w(27,to,5,6,"div",15),l(),b(28,"ih-color-picker",16),w(29,no,5,1,"ih-info-panel",17),l()()(),Z(),J(30,18),s(31,"button",19),x("click",function(){return i.cancel()}),p(32,"Cancel"),l(),s(33,"button",20),q(34,"async"),p(35),l(),Z(),l()),t&2){let o,r=Le(13);c(2),be(i.isEditing?"Edit label":"Create label"),c(2),I("formGroup",i.createPostTypeForm),c(3),fe("background-color",i.createPostTypeForm.value.backColor)("color",i.createPostTypeForm.value.foreColor),A("low-contrast",i.previewLowContrast()),c(),O(" ",r.value?r.value:"Label name"," "),c(7),O("",r.value.length," / 40"),c(),P(i.createPostTypeForm.controls.name.hasError("required")?16:-1),c(),P(i.createPostTypeForm.controls.name.hasError("maxlength")?17:-1),c(),P(i.createPostTypeForm.controls.name.hasError("nameInUse")?18:-1),c(9),P((o=i.currentContrastRatio())?27:-1,o),c(2),P(i.insufficientContrast()?29:-1),c(4),I("ihInProgress",G(34,18,i.saving$)??!1)("inProgressText",i.isEditing?"Saving":"Creating"),c(2),O(" ",i.isEditing?"Save":"Create"," ")}},dependencies:[qe,je,Ne,we,Be,si,oe,ie,lt,Qe,Ze,Me,it,et,Ci,tt,xe,Ue,Se,ot,Xe,De,pe,at,Je,rt,wi,se,ai,ri,Ke,Ui,ct,Fi,ki,ee],styles:[".create-post-type-fields[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}.post-type-label-preview-container[_ngcontent-%COMP%]{padding-bottom:8px}.post-type-label[_ngcontent-%COMP%]{border:1px solid transparent;border-radius:16px;font-size:.625rem;font-weight:500;line-height:.6875rem;max-width:200px;overflow:hidden;padding:4px 8px;text-align:center;text-overflow:ellipsis;text-transform:uppercase;vertical-align:middle;white-space:nowrap;width:auto}.post-type-label.low-contrast[_ngcontent-%COMP%]{border-color:var(--mat-sys-outline-variant)}.post-type-label-form-field[_ngcontent-%COMP%]{width:100%}.color-picker-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.color-picker-container[_ngcontent-%COMP%]   .control-label[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface-variant);font-size:14px;font-weight:500}.control-label-wrapper[_ngcontent-%COMP%]{align-items:center;display:flex;gap:12px;justify-content:space-between}.contrast-ratio-badge[_ngcontent-%COMP%]{align-items:center;border-radius:16px;color:#fff;display:inline-flex;font-size:12px;font-weight:600;gap:6px;padding:4px 8px}.contrast-ratio-badge[_ngcontent-%COMP%]   .mat-icon[_ngcontent-%COMP%]{height:16px;width:16px}.contrast-ratio-badge[_ngcontent-%COMP%]   .wcag-level[_ngcontent-%COMP%]{font-weight:700;text-transform:uppercase}.contrast-ratio-badge.contrast-fail[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_subtle-pulse 2s ease-in-out infinite;background:linear-gradient(135deg,#ff5252,#ff1744)}.contrast-ratio-badge.contrast-warn[_ngcontent-%COMP%]{background:linear-gradient(135deg,#ffc107,#ff9800);color:#000}.contrast-ratio-badge.contrast-aa[_ngcontent-%COMP%]{background:linear-gradient(135deg,#4caf50,#45a049)}.contrast-ratio-badge.contrast-aaa[_ngcontent-%COMP%]{background:linear-gradient(135deg,#2196f3,#1976d2)}.contrast-ratio-badge.contrast-unknown[_ngcontent-%COMP%]{background:var(--mat-sys-surface-variant, #e0e0e0);color:var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6))}@keyframes _ngcontent-%COMP%_subtle-pulse{0%{box-shadow:0 0 #ff174466}70%{box-shadow:0 0 0 6px #ff174400}to{box-shadow:0 0 #ff174400}}.contrast-warning[_ngcontent-%COMP%]{margin-top:8px;overflow:hidden}.contrast-warning[_ngcontent-%COMP%]   .warning-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.contrast-warning[_ngcontent-%COMP%]   .warning-text[_ngcontent-%COMP%]{margin:0}.contrast-warning[_ngcontent-%COMP%]   .quick-fixes[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.contrast-warning[_ngcontent-%COMP%]   .quick-fix-label[_ngcontent-%COMP%]{font-size:14px;font-weight:600;margin:0}.contrast-warning[_ngcontent-%COMP%]   .fix-option[_ngcontent-%COMP%]{align-items:center;background:transparent;border:none;border-radius:4px;color:inherit;cursor:pointer;display:flex;font:inherit;gap:8px;padding:4px 0;text-align:left;transition:background-color .15s ease;width:100%}.contrast-warning[_ngcontent-%COMP%]   .fix-option[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-surface-variant, rgba(0, 0, 0, .04));padding-left:4px;padding-right:4px}.contrast-warning[_ngcontent-%COMP%]   .fix-option[_ngcontent-%COMP%]   .color-swatch[_ngcontent-%COMP%]{border:1px solid var(--mat-sys-outline-variant, rgba(0, 0, 0, .2));border-radius:3px;flex-shrink:0;height:16px;width:16px}.contrast-warning[_ngcontent-%COMP%]   .fix-option[_ngcontent-%COMP%]   .color-value[_ngcontent-%COMP%]{font-family:ui-monospace,Cascadia Code,Source Code Pro,Menlo,Consolas,DejaVu Sans Mono,monospace;font-size:13px;font-weight:500;text-transform:uppercase}.contrast-warning[_ngcontent-%COMP%]   .fix-option[_ngcontent-%COMP%]   .improvement[_ngcontent-%COMP%]{font-size:13px;margin-left:4px;opacity:.7}
1#btnPostSubmit[_ngcontent-%COMP%]{display:none}"],changeDetection:0})}return n})();var Bi=(()=>{class n{lazyDialog=a(j);async open(e){return(await this.lazyDialog.getDialogService()).open(Ni,{data:e,panelClass:["create-post-type-dialog","basic-dialog"],maxWidth:void 0})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=V({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Rn=(()=>{class n{hostClass=!0;saving$=new D(!1);save(){}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["ih-pinned-content"]],hostVars:2,hostBindings:function(t,i){t&2&&A("ih-pinned-content",i.hostClass)},decls:6,vars:3,consts:[["editorTitle","Pinned content","editorIconPath","M16,12V4H17V2H7V4H8V12L6,14V16H11.2V22H12.8V16H18V14L16,12Z","formId","pinnedContentForm",3,"saving"],["id","pinnedContentForm",3,"ngSubmit"],[1,"form-panel","fx-layout-column","fx-layout-align-center-center"]],template:function(t,i){t&1&&(s(0,"ih-admin-base",0),q(1,"async"),s(2,"form",1),x("ngSubmit",function(){return i.save()}),s(3,"div",2)(4,"h1"),p(5,"Coming soon..."),l()()()()),t&2&&I("saving",G(1,1,i.saving$))},dependencies:[se,je,Be,Fe,ee],encapsulation:2,changeDetection:0})}return n})();var zn=(()=>{class n{lazyDialog=a(j);async open(e){let t=await import("./post-call-to-action-list-dialog.component-GZJHLFY5.js").then(o=>o.PostCallToActionListDialogComponent);return(await this.lazyDialog.getDialogService()).open(t,{panelClass:["post-call-to-action-list-dialog","dialog-no-padding"],data:e,maxWidth:void 0})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=V({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ji=(()=>{class n{filterChips=a(pt);http=a(te);channelService=a(nt);channelDialog=a(Ii);config=a(Pe);logger=le("PostFilterChipsDirective");landingPage=!1;channelDialogHandler;_channelsInitialized=!1;_channels;set channels(e){this._channels=e}get channels(){return this._channels}ngOnInit(){this.filterChips.types=[{name:"Title",id:"title",type:ge.Text,inputLabel:"Contains",queryParam:"query"},{name:"Status",id:"status",type:ge.Select,queryParam:"filterType",options:[{name:"Published",value:"published"},{name:"Draft",value:"unpublished"},{name:"Scheduled",value:"scheduled"},{name:"Expired",value:"expired"},{name:"Archived",value:"archived"}]},{name:"Channel",id:"channel",type:ge.Select,queryParam:"channelIds",multiple:!0,options:void 0,onOpenOptionsDialog:()=>Promise.resolve([])},{name:"Module",id:"module",type:ge.Select,queryParam:"moduleIds",multiple:!0,options:void 0},{name:"Post ID",id:"postId",type:ge.Text,inputLabel:"Post ID",queryParam:"postId"}],this.landingPage||(this.filterChips.types.push({name:"Post label",id:"postTypeId",type:ge.Select,queryParam:"postTypeId",options:void 0}),this.loadPostTypes()),this.loadModules(),this._channels?.length?this.applyChannelOptions(this._channels):this.loadChannelsFromService()}applyChannelOptions(e){if(!this._channelsInitialized)try{let t=this.filterChips.types.find(o=>o.id==="channel");if(!t){this.logger.warn("Channel filter not found in filterChips.types");return}let i=v(y({},t),{options:e,onOpenOptionsDialog:this.channelDialogHandler||(()=>Promise.resolve([]))});this.filterChips.types=this.filterChips.types.map(o=>o.id==="channel"?i:o),this._channelsInitialized=!0}catch(t){this.logger.error("Failed to process channels for filter",{error:t})}}async loadPostTypes(){try{let t=await de(this.http.get("/api/posts/postTypes?context=contentFilter"))??[],i=this.filterChips.types.find(r=>r.id==="postTypeId");if(!i)return;let o=v(y({},i),{options:t.map(r=>({name:r.name??"",value:r.postTypeId.toString()})).sort((r,f)=>r.name.localeCompare(f.name))});o.options.unshift({name:"Unlabelled",value:"0"}),this.filterChips.types=this.filterChips.types.map(r=>r.id==="postTypeId"?o:r)}catch(e){this.logger.error("Failed to fetch post types for filter",{error:e});let t=this.filterChips.types.find(i=>i.id==="postTypeId");if(t){let i=v(y({},t),{options:[{name:"Unlabelled",value:"0"}]});this.filterChips.types=this.filterChips.types.map(o=>o.id==="postTypeId"?i:o)}}}async loadModules(){try{let e=await de(this.config.availableModules$);
1if(this.logger.debug("Modules loaded",{moduleCount:e?.length??0}),!e||e.length===0)return;let t=this.filterChips.types.find(r=>r.id==="module");if(!t){this.logger.warn("Module filter not found in filterChips.types");return}let i=[...e].sort((r,f)=>r.key-f.key).map(r=>({name:r.title,value:r.key.toString()})),o=v(y({},t),{options:i});this.filterChips.types=this.filterChips.types.map(r=>r.id==="module"?o:r)}catch(e){this.logger.error("Failed to load modules for filter",{error:e})}}async loadChannelsFromService(){try{let e=await de(this.channelService.getFilterableChannels()),t=this.filterChips.types.find(o=>o.id==="channel");if(!t){this.logger.warn("Channel filter not found in filterChips.types");return}let i=v(y({},t),{options:e.map(o=>({name:o.name,value:o.channelId.toString()})),onOpenOptionsDialog:async o=>{let r=await this.channelDialog.open({dialogTitle:"Select Channels",selectedChannels:o?e.filter(g=>o.map(u=>Number(u.value)).filter(u=>Number.isFinite(u)).includes(g.channelId)):[],context:"contentFilter",isContentCreator:!0,includeEveryone:!0},!1);return(await de(r.afterClosed()))?.map(g=>({name:g.name,value:g.channelId.toString()}))??[]}});this.filterChips.types=this.filterChips.types.map(o=>o.id==="channel"?i:o),this._channelsInitialized=!0}catch(e){this.logger.error("Failed to fetch channels for filter",{error:e});let t=this.filterChips.types.find(i=>i.id==="channel");if(t){let i=v(y({},t),{options:[]});this.filterChips.types=this.filterChips.types.map(o=>o.id==="channel"?i:o)}}}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Dt({type:n,selectors:[["","ihPostFilterChips",""]],inputs:{landingPage:"landingPage",channelDialogHandler:"channelDialogHandler",channels:"channels"}})}return n})();var zi=(()=>{class n{lazyDialog=a(j);async open(e){let t=await import("./post-task-list-dialog.component-RUVKMZMF.js").then(o=>o.PostTaskListDialogComponent);return(await this.lazyDialog.getDialogService()).open(t,{panelClass:["post-task-list-dialog","basic-dialog"],data:e,maxWidth:void 0})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=V({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ro=()=>[],ao=(n,h)=>({loading:n,items:h});function so(n,h){if(n&1){let e=H();s(0,"ih-content-list-item",8),x("editClicked",function(i){k(e);let o=C(2);return M(o.showEditor(i))})("publishClicked",function(i){k(e);let o=C(2);return M(o.publish(i))})("deleteClicked",function(i){k(e);let o=C(2);return M(o.deleteItem(i))})("pinClicked",function(i){k(e);let o=C(2);return M(o.togglePin(i))})("cloneClicked",function(i){k(e);let o=C(2);return M(o.clone(i))})("copyContentLinkClicked",function(i){k(e);let o=C(2);return M(o.copyContentLink(i))})("showViewersClicked",function(i){k(e);let o=C(2);return M(o.showViewers(i))})("showCtaClicked",function(i){k(e);let o=C(2);return M(o.showCtaResponses(i))})("showVolunteersClicked",function(i){k(e);let o=C(2);return M(o.showTaskVolunteers(i))})("showTicketsClicked",function(i){k(e);let o=C(2);return M(o.showTickets(i))})("showResponsesClicked",function(i){k(e);let o=C(2);return M(o.showResponses(i))}),l()}if(n&2){let e=h.$implicit;I("item",e)}}function lo(n,h){n&1&&(s(0,"div",6),b(1,"mat-spinner"),l())}function co(n,h){n&1&&(s(0,"div",7),p(1,"No matching results found"),l())}function po(n,h){if(n&1&&(Q(0,so,1,1,"ih-content-list-item",5,Vt().trackByFn,!0),w(2,lo,2,0,"div",6),w(3,co,2,0,"div",7)),n&2){let e=h;K(e.items),c(2),P(e.loading?2:-1),c(),P(!e.loading&&e.items.length===0?3:-1)}}var Hr=(()=>{class n{hostClass=!0;ihPostListItem;http=a(te);snackbar=a(z);saveChangesDialog=a(st);auth=a(ke);security=a(Ie);postEditor=a(ei);channel=a(nt);route=a(Wt);content=a(Li);postCtaListDialog=a(ti);postTaskListDialog=a(zi);contentViewersDialog=a(Oi);clipboard=a(vi);time=a(Ge);product=a(He);router=a(Te);logger=le("PostListComponent");checklistFacade=a(Ri);skip$=new D(0);filters$=new D([]);destroy$=new ve;title=ne(this.route.data.pipe(_(e=>e.title)),{initialValue:void 0});singular=ne(this.route.data.pipe(_(e=>e.singular)),{initialValue:void 0});svgIcon=ne(this.route.data.pipe(_(e=>e.svgIcon)),{initialValue:void 0});items$=new D([]);editingOrder$=new D(!1);loading$=new D(!0);noMore$=new D(!1);landingPage=ne(this.route.data.pipe(_(e=>e.landingPage)),{initialValue:void 0});constructor(){this.auth.isAuthenticated$.pipe(W()).subscribe(e=>{e||(this.logger.debug("User is not authenticated, redirecting to home page"),this.router.navigate(["/home"]))})}ngOnInit(){this.saveChangesDialog.pageTitle="post list",this.route.data.pipe(It(1),Ee(this.destroy$)).subscribe(()=>
1{this.items$.next([]),this.noMore$.next(!1),this.skip$.next(0),this.filters$.next([])}),me([this.skip$,this.filters$]).pipe($e(100),R(([e,t])=>{this.loading$.next(!0);let i={contentType:Kt.Post,skip:e.toString(),take:"40",landingPage:this.route.snapshot.data.landingPage?"true":"false"};return t.forEach(o=>{i[o.queryParam]=o.multiple?JSON.stringify(o.query.map(r=>r.value)):o.query.value}),this.http.get("/api/content",{params:i})}),$((e,t)=>{throw this.loading$.next(!1),this.snackbar.open("Error loading posts","TRY AGAIN").then(i=>i.onAction().subscribe(()=>t)),e}),Ee(this.destroy$)).subscribe(e=>{this.loading$.next(!1),this.noMore$.next(e.length<40),e.forEach(t=>{t.channels.forEach(i=>{i.svg=di(i.joinType)}),t.canEdit=this.security.canItem(re.Edit,t.channels.map(i=>i.channelId),this.auth.currentUser$.value.campaign_user_id===t.createdBy?.authorId),t.status=this.content.getContentStatus(t.active,t.archived,t.startDate,t.endDate)}),this.items$.next([...this.items$.value,...e])})}ngOnDestroy(){this.destroy$.next()}loadMore(){this.loading$.value||this.noMore$.value||(this.loading$.next(!0),this.skip$.next(this.skip$.value+40))}contentItemHash(e,t){return"post"+t.contentId.toString()+t.updatedAt?.toString()}toggleEditOrder(){this.editingOrder$.next(!this.editingOrder$.value)}drop(e){let t=this.items$.value[e.previousIndex].contentId,i=e.currentIndex+(e.previousIndex<e.currentIndex?1:0),o=i<this.items$.value.length?this.items$.value[i].contentId:null;gt(this.items$.value,e.previousIndex,e.currentIndex),this.items$.next([...this.items$.value]),this.http.put(`/api/posts/${t.toString()}/before${o?"/"+o:""}`,{}).pipe($((r,f)=>{throw this.snackbar.open("Error moving post","TRY AGAIN").then(g=>g.onAction().subscribe(()=>f)),gt(this.items$.value,e.currentIndex,e.previousIndex),this.items$.next([...this.items$.value]),r})).subscribe(()=>{})}filterChanged(e){let t=this.filters$.value;JSON.stringify(t)!==JSON.stringify(e)&&(this.noMore$.next(!1),this.filters$.next(e),this.skip$.next(0),this.items$.next([]))}publish(e){let t=e.active?"Unpublish":"Publish",i=e.active?"Unpublishing":"Publishing",o=e.active?"Unpublished":"Published",r=e.active?N.Draft:N.Published;this.updateState(e,r,t,i,o)}deleteItem(e){let t=e.archived?"Restore":"Delete",i=e.archived?"Restoring":"Deleting",o=e.archived?"Restored":"Deleted",r=e.archived?N.Draft:N.Deleted;this.updateState(e,r,t,i,o)}updateState(e,t,i,o,r){this.snackbar.open(`${o} please wait...`,void 0,{duration:6e4});let f,g=!1,d=!1;switch(t){case N.Draft:f=Ae.Draft;break;case N.Published:f=Ae.Published,g=!0;break;case N.Deleted:f=Ae.Deleted,d=!0;break;default:throw new Error("Invalid state")}this.content.updateContentItemState$(e.contentType,e.contentId,f).pipe($((u,m)=>{throw this.snackbar.dismiss(),this.snackbar.open(`Something went wrong while we tried to ${i.toLocaleLowerCase()} that. Please contact us`,"TRY AGAIN").then(S=>S.onAction().subscribe(()=>setTimeout(()=>m))),u})).subscribe(()=>{this.snackbar.open(r);let u=this.items$.value,m=u.findIndex(T=>T.contentId===e.contentId),S=t===N.Published?new Date:u[m].publishedAt;u[m]=v(y({},u[m]),{status:t,active:g,archived:d,publishedAt:S}),this.items$.next([...u]),t===N.Published&&this.checklistFacade.checkAndTrackFirstPostCompletion()})}togglePin(e){this.content.setPostPinned$(e.contentId,!e.pinned).subscribe(()=>{let t=this.items$.value,i=t.findIndex(o=>o.contentId===e.contentId);t[i]=v(y({},t[i]),{pinned:!e.pinned}),this.items$.next([...t])})}clone(e){this.snackbar.open("Cloning please wait...",void 0,{duration:6e4}),this.http.post(`/api/${e.contentType}/${e.contentId}/clone`,{}).subscribe({next:()=>{this.snackbar.open("Cloning process complete"),this.skip$.next(0),this.items$.next([])},error:t=>{this.snackbar.dismiss(),console.error("Unable to clone",t),this.snackbar.open("Something went wrong while we tried to clone that. Please contact us","TRY AGAIN").then(i=>i.onAction().subscribe(()=>setTimeout(()=>this.clone(e))))}})}copyContentLink(e){let t=ui({path:"posts/",id:`${e.contentId}/`,slug:`${e.slug?e.slug:""}`},"url",!1);this.clipboard.copyTextToClipboard(t.contentToCopy??"").then(()=>{this.snackbar.open(t.successMessage)},()=>{this.snackbar.open(t.failMessage)})}async showEditor(e){let t=this.product!==Re.Builder?await de(this.channel.homeChannel$.pipe(ue(1))):null;(await this.postEditor.open({instantPublish:!0,landingPage:this.route.
1snapshot.data.landingPage,channelIds:e?.channels.map(o=>o.channelId)??[t?.channelId??window.campaign.homeChannel.channelId],postId:e?.contentId})).postComplete.subscribe(o=>{if(!o.postId){this.skip$.next(0),this.items$.next([]);return}let r=this.items$.value,f=r.findIndex(m=>m.contentId===o.postId),g={authorId:this.auth.currentUser$.value.campaign_user_id,firstName:this.auth.currentUser$.value.first_name,lastName:this.auth.currentUser$.value.last_name,fullName:this.auth.currentUser$.value.fullName,email:this.auth.currentUser$.value.email,handle:this.auth.currentUser$.value.handle,image:{url:this.auth.currentUser$.value.profileImage?.url??"",color:this.auth.currentUser$.value.profileImage.color??"",blurHash:this.auth.currentUser$.value.profileImage.blurHash??"",stockPhoto:this.auth.currentUser$.value.profileImage.stockPhoto??void 0,cropData:this.auth.currentUser$.value.profileImage.cropData??void 0}},d=this.content.getContentStatus(o.active??!1,o.deleted??!1,o.startDate??null,o.endDate??null),u=null;switch(o.mediaType){case"image":u={url:o.image?.url??"",color:o.image?.color??"",blurHash:o.image?.blurHash??"",stockPhoto:o.image?.stockPhoto??void 0,cropData:o.image?.cropData??{x:0,y:0,w:0,h:0,ow:0,oh:0}};break;case"video":u={url:o.video?.image?.url??"",color:o.video?.image?.color??"",blurHash:o.video?.image?.blurHash??"",stockPhoto:o.video?.image?.stockPhoto??void 0,cropData:o.video?.image?.cropData??{x:0,y:0,w:0,h:0,ow:0,oh:0}};break;case"custom":u={url:o.embed?.image?.url??"",color:o.embed?.image?.color??"",blurHash:o.embed?.image?.blurHash??"",stockPhoto:o.embed?.image?.stockPhoto??void 0,cropData:o.embed?.image?.cropData??{x:0,y:0,w:0,h:0,ow:0,oh:0}};break}r[f]=v(y({},r[f]),{title:o.title??"",status:d,mediaType:o.mediaType,image:u,channels:o.channels.map(m=>({channelId:m.channelId,name:m.name,handle:m.handle,everyone:m.everyone??!1,visibleForGuests:m.visibleForGuests,contentVisibleForGuests:m.contentVisibleForGuests,joinType:m.joinType})),modules:o.modules,active:o.active??!1,updatedAt:new Date,updatedBy:g,slug:o.slug??"",archived:o.deleted??!1,startDate:o.startDate??void 0,endDate:o.endDate??void 0,landingPage:o.landingPage}),this.items$.next([...r])})}async showViewers(e){await this.contentViewersDialog.open({contentType:e.contentType,contentId:e.contentId})}showTickets(e){}showResponses(e){window.open("/api/posts/"+e.contentId+"/survey/export?tz="+Intl.DateTimeFormat().resolvedOptions().timeZone)}showTaskVolunteers(e){this.http.get("/api/posts/"+e.contentId).subscribe(t=>{let i=this.time.convertFromRawContentItem(t);this.postTaskListDialog.open({hideApply:!0,canPublish:e.channels.some(o=>this.security.canChannel(mt.PostsPublishScheduleArchive,o.channelId)),post:i})})}showCtaResponses(e){this.http.get("/api/posts/"+e.contentId).subscribe(t=>{let i=this.time.convertFromRawContentItem(t);this.postCtaListDialog.open({hideApply:!0,canPublish:e.channels.some(o=>this.security.canChannel(mt.PostsPublishScheduleArchive,o.channelId)),post:i,showHeader:!0})})}trackByFn(e,t){return t.contentId.toString()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["ih-posts"]],viewQuery:function(t,i){if(t&1&&Ot(ft,5,St),t&2){let o;Lt(o=Ut())&&(i.ihPostListItem=o.first)}},hostBindings:function(t,i){t&1&&x("class.ih-post-list",function(){return i.hostClass()})},decls:9,vars:15,consts:[["formId","postsForm","infiniteScroll","",3,"scrolled","editorTitle","svgIcon","infiniteScrollDistance","immediateCheck"],["button-controls",""],["mat-flat-button","",1,"post-add-post-button",3,"click"],["ihPostFilterChips","",3,"filterChanged","landingPage"],[1,"post-list-container"],[3,"item"],[1,"loading-container"],[1,"not-found","fx-flex","fx-layout-row","fx-layout-align-center-center"],[3,"editClicked","publishClicked","deleteClicked","pinClicked","cloneClicked","copyContentLinkClicked","showViewersClicked","showCtaClicked","showVolunteersClicked","showTicketsClicked","showResponsesClicked","item"]],template:function(t,i){if(t&1&&(s(0,"ih-admin-base",0),x("scrolled",function(){return i.loadM
1ore()}),s(1,"div",1)(2,"button",2),x("click",function(){return i.showEditor()}),p(3),l()(),s(4,"ih-filter-chips",3),x("filterChanged",function(r){return i.filterChanged(r)}),l(),s(5,"div",4),w(6,po,4,2),q(7,"async"),q(8,"async"),l()()),t&2){let o;I("editorTitle",i.title())("svgIcon",i.svgIcon())("infiniteScrollDistance",5)("immediateCheck",!1),c(3),O("Add ",i.singular()),c(),I("landingPage",i.landingPage()),c(2),P((o=Bt(12,ao,G(7,7,i.loading$),G(8,9,i.items$)??Ht(11,ro)))?6:-1,o)}},dependencies:[zt,Qt,Ai,oe,ie,pe,Ti,qt,Fe,ft,pt,ji,Pi,ee],styles:["[_nghost-%COMP%]{display:block;height:100%;margin-left:auto;margin-right:auto;color:#000000de}[_nghost-%COMP%]     .cdk-virtual-scroll-content-wrapper{padding:8px 16px 16px;right:0}.ih-content-list-item[_ngcontent-%COMP%]{margin-top:8px}ih-filter-chips[_ngcontent-%COMP%]{background-color:#fff}.post-list-container[_ngcontent-%COMP%]{height:calc(100% - 112px);overflow:auto;padding:8px}ih-content-list-item[_ngcontent-%COMP%]{margin:0 auto;max-width:1280px}.loading-container[_ngcontent-%COMP%]{align-items:center;display:flex;height:120px;justify-content:center}.not-found[_ngcontent-%COMP%]{margin:20px auto;font-size:22px;background-color:#fff;border-radius:20px;padding:8px 16px;max-width:304px}@media screen and (max-width:599px){[_nghost-%COMP%]     .cdk-virtual-scroll-content-wrapper{padding:0}}"],changeDetection:0})}return n})();var Gr=(()=>{class n{lazyDialog=a(j);async open(e){let t=await import("./post-task-volunteer-list-dialog.component-JRTZ7I3C.js").then(o=>o.PostTaskVolunteerListDialogComponent);return(await this.lazyDialog.getDialogService()).open(t,{data:e,panelClass:["post-task-volunteer-list-dialog","basic-dialog"],maxHeight:void 0,maxWidth:void 0,width:void 0})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=V({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var mo=(n,h)=>h.postTypeId;function uo(n,h){if(n&1&&(s(0,"mat-radio-button",4)(1,"div",9)(2,"div",10),p(3),l(),s(4,"div",11),p(5),l()()()),n&2){let e=h.$implicit,t=h.$index;I("value",e),c(2),fe("color",t===0?"#000":e.foreColor)("background-color",t===0?"#fff":e.backColor),A("first",t===0),c(),O(" ",e.name," "),c(2),O("",e.postCount," posts")}}var qi=(()=>{class n{sourcePostType=a(Ye);mdDialogRef=a(We);postTypeService=a(ce);snackbar=a(z);hostClass=!0;postTypes$=me([this.postTypeService.postTypes$(),this.postTypeService.postTypeCounts$().pipe(kt([]))]).pipe(_(([e,t])=>{let i=new Map(t.map(o=>[o.postTypeId??B,o.postCount]));return e.map(o=>v(y({},o),{postCount:i.get(o.postTypeId??B)??0}))}));saving$=new D(!1);mergePostTypeControl=new ae(null,[Ce.required]);cancel(){this.mdDialogRef.close()}merge(){this.mergePostTypeControl.valid&&(this.saving$.next(!0),this.postTypeService.transferPosts$(this.sourcePostType.postTypeId,this.mergePostTypeControl.value.postTypeId).pipe($((e,t)=>(console.error(e),this.saving$.next(!1),this.snackbar.open("Unable to transfer label","TRY AGAIN").then(i=>{i.onAction().pipe(wt(()=>t))}),F(null)))).subscribe(()=>{this.mdDialogRef.close(!0),this.snackbar.open("Posts in "+this.sourcePostType.name+" have been transferred to "+this.mergePostTypeControl.value?.name)}))}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["ih-transfer-post-type"]],hostVars:2,hostBindings:function(t,i){t&2&&A("ih-merge-post-type",i.hostClass)},decls:15,vars:4,consts:[[3,"scrollable"],["ih-header",""],["ih-content",""],[1,"post-type-radio-group","fx-layout-column","fx-flex",3,"formControl"],[1,"post-type-radio-button","fx-layout-row","fx-flex",3,"value"],["ih-footer",""],["mat-button","",3,"click"],["mat-flat-button","","color","warn","type","submit","form","mergePostTypeForm",3,"click"],[1,"wrapper","site-min-height","merge-post-type"],[1,"post-type-label-container","fx-layout-row","fx-flex","fx-layout-align-space-between-center"],[1,"post-type-label"],[1,"post-type-count","fx-layout-align-end","fx-hide-xs"]],template:function(t,i){t&1&&(s(0,"ih-basic-dialog",0),J(1,1),p(2,"Select target label"),Z(),J(3,2),s(4,"mat-radio-group",3),Q(5,uo,6,9,"mat-radio-button",4,mo),q(7,"async"),l(),Z(),J(8,5),s(9,"button",6),x("click",function(){return i.cancel()}),p(10,"Cancel"),l(),s(11,"button",7),x("click",function(){return i.merge()}),p(12,"Transfer"),l(),Z(),l(),b(13,"section",8)(14,"section",8)),t&2&&(I("scrollable",!0),c(4),I("formControl",i.mergePostTypeControl),c(),K(G(7,2,i.postTypes$)))},dependencies:[qe,we,oe,ie,lt,Qe,Ze,Me,xe,Se,Xe,De,pe,Di,Mi,Si,at,Je,se,ze,Ke,ee],styles:[".basic-dialog-header{border-bottom:1px solid #c0c0c0}  .basic-dialog-footer{border-top:1px solid #c0c0c0}  .mat-mdc-radio-button{min-height:56px}  .mat-mdc-radio-button .mdc-form-field{width:100%}  .mat-mdc-radio-button .mdc-form-field .mdc-label{width:100%}.post-type-label[_ngcontent-%COMP%]{border-radius:16px;font-size:.625rem;font-weight:500;line-height:.6875rem;margin-right:8px;
1max-width:200px;overflow:hidden;padding:4px 8px;text-align:center;text-overflow:ellipsis;text-transform:uppercase;vertical-align:initial;white-space:nowrap;width:auto}.post-type-label.first[_ngcontent-%COMP%]{display:flex;align-items:center;font-size:.8125rem;padding:0;border-radius:0;margin-left:2px;color:#000;background-color:#fff}"],changeDetection:0})}return n})();var Gi=(()=>{class n{lazyDialog=a(j);async open(e){return(await this.lazyDialog.getDialogService()).open(qi,{id:"transferPostType",data:e,panelClass:["transfer-post-type-dialog","basic-dialog"],maxWidth:void 0})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=V({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ho=n=>({postTypeId:n}),fo=(n,h)=>h.postTypeId;function go(n,h){n&1&&(s(0,"div",14),b(1,"mat-icon",24),s(2,"div",25),p(3,"Default"),l()())}function Co(n,h){if(n&1){let e=H();s(0,"button",22),x("click",function(){k(e);let i=C().$implicit,o=C();return M(o.showEditPostTypeDialog(i))}),b(1,"mat-icon",26),p(2," Edit label "),l()}}function yo(n,h){if(n&1){let e=H();s(0,"button",22),x("click",function(){k(e);let i=C().$index,o=C();return M(o.setDefault(i))}),b(1,"mat-icon",27),p(2," Set default "),l()}}function vo(n,h){if(n&1){let e=H();s(0,"button",22),x("click",function(){k(e);let i=C().$index,o=C();return M(o.removeDefault(i))}),b(1,"mat-icon",28),p(2," Remove default "),l()}}function _o(n,h){if(n&1){let e=H();s(0,"button",22),x("click",function(){k(e);let i=C().$index,o=C();return M(o.deletePostType(i))}),b(1,"mat-icon",29),p(2," Delete label "),l()}}function bo(n,h){if(n&1){let e=H();s(0,"li",10)(1,"div",11)(2,"span",12),p(3),l()(),b(4,"div",13),w(5,go,4,0,"div",14),s(6,"div",15),p(7),s(8,"span",16),p(9,"\xA0posts"),l()(),s(10,"button",17),b(11,"mat-icon",18),l(),s(12,"mat-menu",null,0),w(14,Co,3,0,"button",19),s(15,"button",20),b(16,"mat-icon",21),p(17," View posts "),l(),w(18,yo,3,0,"button",19),w(19,vo,3,0,"button",19),s(20,"button",22),x("click",function(){let i=k(e).$implicit,o=C();return M(o.showMergePostTypeDialog(i))}),b(21,"mat-icon",23),p(22," Transfer posts "),l(),w(23,_o,3,0,"button",19),l()()}if(n&2){let e=h.$implicit,t=Le(13),i=C(),o=!e.postTypeId;A("is-default",e.isDefault),c(2),fe("color",o?"#000":e.foreColor)("background-color",o?"#fff":e.backColor),A("low-contrast",e.lowContrast)("first",o),c(),O(" ",e.name," "),c(2),P(e.isDefault?5:-1),c(2),O(" ",e.postCount??"0"," "),c(3),I("matMenuTriggerFor",t),Ft("aria-label","Actions for "+e.name),c(4),P(o?-1:14),c(),I("routerLink",i.product!==i.Products.Builder?"/admin/posts":"/communicate/posts")("queryParams",Nt(21,ho,e.postTypeId)),c(3),P(e.isDefault?-1:18),c(),P(e.isDefault&&!o?19:-1),c(4),P(o?-1:23)}}var Ga=(()=>{class n{hostClass=!0;security=a(Ie);snackbar=a(z);createPostTypeDialog=a(Bi);transferPostTypeDialog=a(Gi);confirmDialog=a(yi);logger=le("PostTypesComponent");
1destroyRef=a(Oe);postTypeService=a(ce);auth=a(ke);router=a(Te);product=a(He);Products=Re;NO_LABEL_POSTTYPEID=B;rawPostTypes=ne(this.postTypeService.postTypes$(),{initialValue:[]});postTypeCounts=ne(this.postTypeService.postTypeCounts$(),{initialValue:[]});postTypes=X(()=>{let e=this.rawPostTypes(),t=this.postTypeCounts(),i=new Map(t.map(d=>[d.postTypeId??B,d.postCount])),o=e.map(d=>v(y({},d),{postCount:i.get(d.postTypeId??B)??0})),r=o.find(d=>d.isDefault),f=o.find(d=>!d.postTypeId),g=o.filter(d=>!d.isDefault&&d.postTypeId);return[...r?[r]:[],...f&&f!==r?[f]:[],...g]});constructor(){this.auth.isAuthenticated$.pipe(W(this.destroyRef)).subscribe(e=>{e||(this.logger.debug("User is not authenticated, redirecting to home page"),this.router.navigate(["/home"]))})}ngOnInit(){this.security.can(Zt.ManageAppSettings)||this.snackbar.noPermission()}async showCreatePostTypeDialog(){(await this.createPostTypeDialog.open()).afterClosed().subscribe(t=>{t&&this.postTypeService.reset()})}async showEditPostTypeDialog(e){(await this.createPostTypeDialog.open(e)).afterClosed().subscribe(i=>{i&&this.postTypeService.reset()})}setDefault(e){let t=this.postTypes()[e];this.postTypeService.setDefault(t.postTypeId).pipe($(i=>{throw this.snackbar.open("We were unable to set your post label as default"),this.logger.error("Post type operation failed",{error:i}),i})).subscribe(()=>{this.snackbar.open("Post label set as default")})}showMergePostTypeDialog(e){this.transferPostTypeDialog.open(e)}removeDefault(e){let t=this.postTypes()[e];t.isDefault&&t.postTypeId&&this.postTypeService.removeDefault(t.postTypeId).pipe($(i=>{throw this.snackbar.open("We were unable to unset your post label as default"),this.logger.error("Post type operation failed",{error:i}),i})).subscribe(()=>{this.snackbar.open("Post label is no longer set as default")})}async deletePostType(e){let t=this.postTypes()[e];if(t.isDefault){this.snackbar.open("Cannot delete a post label that is set as default");return}if(!t.postTypeId){this.snackbar.open("Cannot delete the unlabelled post label");return}(await this.confirmDialog.open({title:"Delete post label?",message:"Are you sure you want to delete post label?",confirmText:"DELETE",confirmColor:"warn"})).afterClosed().subscribe(o=>{o&&this.postTypeService.removePostType$(t.postTypeId).pipe($(r=>{throw this.snackbar.open("We were unable to delete your post label"),this.logger.error("Post type operation failed",{error:r}),r})).subscribe(()=>{this.snackbar.open("Post label deleted")})})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["ih-post-types-options"]],hostVars:2,hostBindings:function(t,i){t&2&&A("ih-post-types",i.hostClass)},decls:12,vars:1,consts:[["postTypeMenu","matMenu"],["editorTitle","Post labels","editorIconPath","M17.63,5.84C17.27,5.33 16.67,5 16,5H5A2,2 0 0,0 3,7V17A2,2 0 0,0 5,19H16C16.67,19 17.27,18.66 17.63,18.15L22,12L17.63,5.84Z","formId","postTypesForm"],["button-controls",""],["mat-flat-button","",1,"post-add-label-button",3,"click"],[1,"post-type-label-warning-container"],["type","info",1,"post-type-info-panel","mat-elevation-z2",3,"dismissable"],[1,"post-type-label-warning"],[1,"post-type-list-container"],[1,"post-type-list"],[1,"post-type-row",3,"is-default"],[1,"post-type-row"],[1,"label-preview"],[1,"post-type-label"],[1,"post-type-row-spacer"],[1,"post-type-default-label"],[1,"post-type-post-count"],[1,"post-type-post-count-text","fx-hide-xs"],["mat-icon-button","",3,"matMenuTriggerFor"],["svgIcon","dots-vertical"],["mat-menu-item",""],["mat-menu-item","",3,"routerLink","queryParams"],["svgIcon","file-eye"],["mat-menu-item","",3,"click"],["svgIcon","swap-horizontal-bold"],["svgIcon","star",1,"post-type-default-icon"],[1,"post-type-default-text"],["svgIcon","pencil"],["svgIcon","star"],["svgIcon","star-off"],["svgIcon","delete"]],template:function(t,i){t&1&&(s(0,"ih-admin-base",1)(1,"div",2)(2,"button",3),x("click",function(){return i.showCreatePostTypeDialog()}),p(3,"Add label"),l()(),s(4,"div",4)(5,"ih-info-panel",5)(6,"div",6),p(7," Modifying labels will affect all posts with that label, including posts you do not have permissions to edit "),l()()(),s(8,"div",7)(9,"ul",8),Q(10,bo,24,23,"li",9,fo),l()()()),t&2&&(c(5),I("dismissable",!1),c(5),K(i.postTypes()))},dependencies:[Yt,oe,ie,Gt,xe,Ue,De,$i,Ei,Vi,rt,Fe,ct],styles:["[_nghost-%COMP%]{display:block;height:100%;margin-left:auto;margin-right:auto}.post-type-label-warning-container[_ngcontent-%COMP%]{padding:16px 8px 8px;margin:0 auto;max-width:1280px}.post-type-label-warning-container[_ngcontent-%COMP%]   ih-info-panel[_ngcontent-%COMP%]{border-radius:10px}.post-type-list-container[_ngcontent-%COMP%]{padding:8px 8px 16px}.post-type-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px;list-style:none;margin:0 auto;max-width:1280px;padding:0}.post-type-row[_ngcontent-%COMP%]{align-items:center;background-color:var(--mat-sys-surface);border-left:4px solid transparent;border-radius:var(--mat-sys-corner-large);box-shadow:var(--mat-card-elevated-container-shadow);color:var(--mat-sys-on-surface);display:flex;gap:8px;min-height:56px;padding:0 8px 0 12px}.post-type-row.is-default[_ngcontent-%COMP%]{border-left-color:var(--mat-sys-primary)}.post-type-row-spacer[_ngcontent-%COMP%]{flex:1}.post-type-post-count[_ngcontent-%COMP%]{display:flex;align-items:center;white-space:nowrap;color:var(--mat-sys-on-surface);opacity:.7;font-size:14px}.label-preview[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:20px}.post-type-label[_ngcontent-%COMP%]{border-radius:16px;font-size:.625rem;font-weight:500;line-height:.6875rem;
1max-width:200px;overflow:hidden;padding:4px 8px;text-align:center;text-overflow:ellipsis;text-transform:uppercase;vertical-align:middle;white-space:nowrap;width:auto}.post-type-label.low-contrast[_ngcontent-%COMP%]{border:1px solid var(--mat-sys-outline-variant)}.post-type-label.first[_ngcontent-%COMP%]{font-size:.8125rem;padding:0;border-radius:0;margin-left:2px;color:#000;background-color:#fff}.post-type-default-label[_ngcontent-%COMP%]{align-items:center;color:var(--mat-sys-on-surface-variant);display:inline-flex;font-size:.75rem;font-weight:500;gap:4px;line-height:1;margin-right:8px}.post-type-default-label[_ngcontent-%COMP%]   .post-type-default-icon[_ngcontent-%COMP%]{color:var(--mat-sys-primary);height:14px;width:14px}@media(max-width:400px){.post-type-default-text[_ngcontent-%COMP%]{display:none}}"],changeDetection:0})}return n})();function xo(n,h){n&1&&(s(0,"mat-error"),p(1," Please enter a valid video url "),l())}function To(n,h){if(n&1&&(s(0,"mat-error"),p(1),l()),n&2){let e=C();c(),be(e.reason())}}var rs=(()=>{class n{videoUrlService=a(bi);processingVideo=he(!1);reason=he(null);previewUrl=new ae(null);videoEmbed=he(null);destroy$=new ve;constructor(){Mt(()=>{let e=this.videoEmbed();this.onChanged(e?.url?{url:e.url,previewUrl:e.previewUrl,duration:e.duration,videoProviderId:e.videoProviderId}:void 0)}),this.previewUrl.valueChanges.pipe($e(500),Ve(),R(e=>e?(this.videoEmbed.set({url:e}),this.previewUrl.value&&this.previewUrl.markAsTouched(),this.processVideoUrl$(e).pipe($(t=>(console.debug(t),F(null))))):(this.videoEmbed.set(null),this.onChanged(void 0),F(null))),Ee(this.destroy$)).subscribe()}ngOnDestroy(){this.destroy$.next()}writeValue(e){this.videoEmbed.set(e),e?.url?this.previewUrl.setValue(e.url,{emitEvent:!1}):this.previewUrl.setValue(null,{emitEvent:!1}),this.processVideoUrl$(e?.url??"").subscribe()}onChanged=dt;registerOnChange(e){this.onChanged=e}onTouched=dt;registerOnTouched(e){this.onTouched=e}setDisabledState(e){e?this.previewUrl.disable({emitEvent:!1}):this.previewUrl.enable({emitEvent:!1})}processVideoUrl$(e){return e?(this.previewUrl.setErrors(null),this.reason.set(null),this.processingVideo.set(!0),this.videoUrlService.getEmbedUrl$(e).pipe($(t=>{throw this.showVideoError(t),t}),_e(t=>{this.previewUrl.setValue(t.link,{emitEvent:!1}),this.videoEmbed.set({url:t.url,previewUrl:t.link,duration:t.duration,videoProviderId:t.videoProviderId})}),_(()=>{}))):(this.videoEmbed()?.url&&this.resetVideoEditor(),F())}showVideoError(e){this.resetVideoEditor(),this.previewUrl.markAsTouched(),this.previewUrl.setErrors({reason:!0}),this.reason.set(e.error?.toString()??e)}resetVideoEditor(){this.processingVideo.set(!1),this.videoEmbed.set(null),this.reason.set(null)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["ih-video-embed-editor"]],features:[Rt([li(()=>n)])],decls:6,vars:3,consts:[["appearance","outline",1,"video-form-field","dark-font-label-focus"],["matInput","","name","url","type","text","data-lpignore","true","autocomplete","off",1,"dark-font-border-color-focus",3,"formControl"]],template:function(t,i){t&1&&(s(0,"mat-form-field",0)(1,"mat-label"),p(2,"Type or paste a YouTube or Vimeo url"),l(),b(3,"input",1),w(4,xo,2,0,"mat-error"),w(5,To,2,1,"mat-error"),l()),t&2&&(c(3),I("formControl",i.previewUrl),c(),P(i.previewUrl.hasError("required")?4:-1),c(),P(i.previewUrl.hasError("reason")?5:-1))},dependencies:[Me,it,et,tt,Se,ot,pe,se,Ne,we,ze],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column}"],changeDetection:0})}return n})();export{Uo as a,Hi as b,Ni as c,Bi as d,Rn as e,zn as f,zi as g,Hr as h,Gr as i,qi as j,Gi as k,Ga as l,rs as m};
2/**i18n:c9e569e2ecdb3e0de183c72d8315eadfdcb9da9e09d5ac2d9fef9056c1853e21*/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.