1"use strict";(self.webpackChunkinitiative_as_a_service=self.webpackChunkinitiative_as_a_service||[]).push([["default-src_app_features_blog_components_post-settings_post-settings_component_ts-src_app_fea-5a2dad"],{50105(O,p,e){e.d(p,{t:()=>rt});var l=e(72200),u=e(29330),i=e(89417),a=e(88834),C=e(32591),P=e(99213),T=e(40100),A=e(86156),d=e(78884),m=e(84412),M=e(25558),g=e(7673),f=e(21413),S=e(983),B=e(99437),_=e(96354),F=e(70152),D=e(56977),$=e(96697),j=e(70980),w=e(21100),V=e(32906),Y=e(69327),z=e(97005),N=e(91708),k=e(71479),H=e(57334),U=e(1835),L=e(15163),X=e(8101),y=e(1345),x=e(72388),h=function(s){return s.TITLE="title",s.SLUG="slug",s.TOPICS="topics",s.INTERNAL_AUTHORS="internalAuthors",s.EXTERNAL_AUTHORS="externalAuthors",s}(h||{}),E=function(s){return s.FULL_NAME="fullName",s.POSITION="position",s}(E||{}),Q=e(26860),R=e(83541),t=e(73664),G=e(2615),W=e(17705),K=e(52582),J=e(79629),Z=e(95416),q=e(16331),tt=e(40455);function et(s,I){if(1&s&&t.nrm(0,"app-url-slug-preview",5),2&s){const n=t.XpG();t.Y8G("siteUrl",n.data.siteUrl)("slug",n.form.controls[n.controlName.SLUG].value)("customIcon","attachment-link")}}function ot(s,I){1&s&&(t.j41(0,"div",15),t.nrm(1,"mat-icon",16),t.j41(2,"div"),t.EFF(3,"Please note, editing URL slug now will result in SEO recalculation."),t.k0s()())}function nt(s,I){if(1&s){const n=t.RV6();t.j41(0,"div",19)(1,"div",20)(2,"lib-icon-button",21),t.bIt("click",function(){const o=G.eBV(n).index,c=t.XpG(2);return G.Njj(c.removeExternalAuthor(o))}),t.nrm(3,"mat-icon",22),t.k0s()(),t.j41(4,"div",23),t.nrm(5,"lib-input",24),t.k0s(),t.j41(6,"div",23),t.nrm(7,"lib-input",25),t.k0s()()}if(2&s){const n=I.index,r=I.last,o=t.XpG(2);t.AVh("mb-2",!r),t.Y8G("formGroupName",n),t.R7$(2),t.Aen(o.buttonStyle.Ghost),t.Y8G("type",o.iconButtonType.Negative),t.R7$(3),t.Y8G("name",o.externalAuthorsControlName.FULL_NAME)("formControlName",o.externalAuthorsControlName.FULL_NAME)("errorMessage",o.authorInputValidationMessages),t.R7$(2),t.Y8G("name",o.externalAuthorsControlName.POSITION)("formControlName",o.externalAuthorsControlName.POSITION)("errorMessage",o.authorInputValidationMessages)}}function at(s,I){if(1&s&&(t.qex(0)(1,17),t.DNE(2,nt,8,12,"div",18),t.bVm()()),2&s){const n=t.XpG();t.R7$(),t.Y8G("formArrayName",n.controlName.EXTERNAL_AUTHORS),t.R7$(),t.Y8G("ngForOf",n.externalAuthors.controls)}}let rt=(()=>{class s{preventReloadIfDirty(n){return this.form.dirty&&(n.preventDefault?.(),delete n.returnValue),n}get externalAuthors(){return this.form.get([h.EXTERNAL_AUTHORS])}constructor(n,r,o,c,v,st,it,lt){this.data=n,this.dialogRef=r,this.dialog=o,this.fb=c,this.projectsService=v,this.blogService=st,this.snackbar=it,this.cdr=lt,this.isLoading=!1,this.maxLength=y.CM,this.minLength=y.mB,this.controlName=h,this.externalAuthorsControlName=E,this.chipSize=d.SbS,this.buttonType=d.VQ,this.iconButtonType=d.isL,this.buttonStyle=d.inm,this.inputValidationMessages=y.BO,this.authorInputValidationMessages=y.t4,this.componentDialogHeight=this.data?.height||"auto",this.topics$=this.projectsService.getTopics("",0,y.C7).pipe((0,_.T)(b=>R.B.mapToTopics(b))),this.authorsQuery$=new m.t(""),this.authors$=this.authorsQuery$.pipe((0,F.B)(300),(0,M.n)(b=>b.length<y.VH?(0,g.of)([]):this.blogService.getAuthors(this.data.siteId,b)),(0,_.T)(b=>b.map(mt=>R.B.mapToUser(mt)))),this.form=this.fb.group({[h.TITLE]:this.fb.control(this.data.post?.title??"",{validators:[i.k0.required,i.k0.minLength(this.minLength),i.k0.maxLength(this.maxLength),(0,L.Q)()]}),[h.SLUG]:this.fb.control(this.data.post?.slug??"",{validators:[i.k0.required,i.k0.minLength(this.minLength),i.k0.maxLength(this.maxLength),i.k0.pattern(H.b),(0,L.Q)()]}),[h.TOPICS]:this.fb.control(this.transformTopicsForForm()),[h.INTERNAL_AUTHORS]:this.fb.control(this.data.post?.internalAuthors.map(b=>R.B.mapToUser(b))??[]),[h.EXTERNAL_AUTHORS]:this.fb.array([])}),this.isConfirmationOpened=!1,this.destroy$=new f.B}ngOnInit(){this.initExternalAuthors()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}onLeave(){this.isConfirmationOpened||(this.form.dirty?(this.dialog.open(z.P,(0,X.sC)()).afterClosed().pipe((0,D.Q)(this.destroy$)).subscribe(r=>{!1===r&&this.dialogRef.close(),this.isConfirmationOpened=!1}),this.isConfirmationOpened=!0):this.dialogRef.close())}
1onSave(){if(!this.validateExternalAuthors())return;this.isLoading=!0;const n={title:this.form.value[h.TITLE],slug:this.form.value[h.SLUG],internalAuthors:this.form.value[h.INTERNAL_AUTHORS].map(r=>r.id),externalAuthors:this.form.value[h.EXTERNAL_AUTHORS].filter(r=>!!r.fullName||!!r.position),topics:this.form.value[h.TOPICS].map(r=>r.id)};this.data.post?.id&&this.form.valid&&this.updatePost(this.data.post.id,n),!this.data.post?.id&&this.form.valid&&this.createPost(n)}addExternalAuthor(n){const r=this.fb.group({[E.FULL_NAME]:this.fb.control(n?.fullName||"",{validators:[i.k0.minLength(y.b4),i.k0.maxLength(this.maxLength),(0,L.Q)()]}),[E.POSITION]:this.fb.control(n?.position||"",{validators:[i.k0.minLength(y.b4),i.k0.maxLength(this.maxLength),(0,L.Q)()]})});this.externalAuthors.push(r),this.form.updateValueAndValidity()}removeExternalAuthor(n){this.externalAuthors.removeAt(n),this.form.markAsDirty()}transformTopicsForForm(){return this.data.post?.topics?.map(n=>({...n,name:n.title||n.name}))??[]}validateExternalAuthors(){let r=!0;return this.form.value[h.EXTERNAL_AUTHORS].forEach((o,c)=>{const v=this.externalAuthors.at(c);!o.fullName&&!o.position||(o.fullName||(v.controls[E.FULL_NAME].setErrors({required:!0}),r=!1),o.position||(v.controls[E.POSITION].setErrors({required:!0}),r=!1))}),w.m.validateAllFormFields(this.externalAuthors),r}initExternalAuthors(){this.data.post?.externalAuthors.forEach(n=>this.addExternalAuthor(n))}handleError(n){return n.status===u.kG.UnprocessableEntity&&n.error[h.SLUG]?.includes("has already been taken")&&this.form.controls[h.SLUG].setErrors({forbiddenSlug:!0}),this.snackbar.openFromComponent(N.Y,U.Bk),S.w}createPost(n){this.handlePost(r=>this.blogService.createPost(this.data.siteId,this.data.blogId,{...r,status:Q.n.DRAFT}),n,x.h.CREATE)}updatePost(n,r){this.handlePost(o=>this.blogService.updatePost(this.data.siteId,this.data.blogId,n,o),r,x.h.UPDATE)}handlePost(n,r,o){n(r).pipe((0,$.s)(1),(0,B.W)(c=>this.handleError(c)),(0,j.j)(()=>{this.isLoading=!1,this.cdr.detectChanges()})).subscribe(c=>{this.dialogRef.close({post:c,action:o}),this.snackbar.openFromComponent(N.Y,U.wj)})}static{this.\u0275fac=function(r){return new(r||s)(t.rXU(C.Vh),t.rXU(C.CP),t.rXU(C.bZ),t.rXU(i.ok),t.rXU(K.i),t.rXU(J.c),t.rXU(Z.UG),t.rXU(W.gRc))}}static{this.\u0275cmp=t.VBU({type:s,selectors:[["app-post-settings"]],hostBindings:function(r,o){1&r&&t.bIt("beforeunload",function(v){return o.preventReloadIfDirty(v)},t.tSv)},decls:26,vars:33,consts:[[3,"leave","modalHeight"],["modalContainerHeader","","headerText","Post settings",3,"closeModal"],[3,"formGroup"],["label","Post title",3,"id","name","formControlName","errorMessage","maxLength","isCharacterCounter"],["label","URL slug","placeholder","post-title",3,"id","name","formControlName","errorMessage","maxLength"],[3,"siteUrl","slug","customIcon"],["class","url-slug-warning",4,"ngIf"],[1,"form-row"],[3,"for"],["type","topics","placeholder","Type to add topics",3,"formControlName","dataSource","isInitaasAdmin","chipSize"],["type","users","placeholder","Type to add author",3,"queryChange","formControlName","dataSource","isInitaasAdmin"],[4,"ngIf"],[1,"mt-2",3,"click","type"],["svgIcon","single-user-add-plus","libIconContent",""],["modalContainerFooter","","primaryButtonLabel","Save","secondaryButtonLabel","Cancel",3,"primaryButtonClick","secondaryButtonClick","isPrimaryButtonDisabled"],[1,"url-slug-warning"],["svgIcon","warning-triangle"],[3,"formArrayName"],["class","author-row",3,"formGroupName","mb-2",4,"ngFor","ngForOf"],[1,"author-row",3,"formGroupName"],[1,"author-col","remove-author"],["matTooltip","Remove author",3,"click","type"],["svgIcon","single-user-minus-delete-remove","libIconContent",""],[1,"author-col"],["placeholder","Author name",3,"name","formControlName","errorMessage"],["placeholder","Author position",3,"name","formControlName","errorMessage"]],template:function(r,o){1&r&&(t.j41(0,"lib-modal-container",0),t.bIt("leave",function(){return o.onLeave()}),t.j41(1,"lib-modal-container-header",1),t.bIt("closeModal",function(){return o.onLeave()}),t.k0s(),t.j41(2,"form",2),t.nrm(3,"lib-input",3),t.j41(4,"div"),t.nrm(5,"lib-input",4),t.nVh(6,et,1,3,"app-url-slug-preview",5),t.k0s(),t.DNE(7,ot,4,0,"div",6),t.j41(8,"div",7)(9,"label",8),t.EFF(10,"Topics"),t.k0s(),t.nrm(11,"app-chips-autocomplete",9),t.nI1(12,"async"),t.k0s(),t.j41(13,"div",7)(14,"label",8),t.EFF(15,"Author(s)"),t.k0s(),t.j41(16,"app-chips-autocomplete",10),t.nI1(17,"async"),t.bIt("queryChange",function(v){return o.authorsQuery$.next(v)}
1),t.k0s()(),t.j41(18,"div",7)(19,"label"),t.EFF(20,"External author(s)"),t.k0s(),t.DNE(21,at,3,2,"ng-container",11),t.j41(22,"lib-button",12),t.bIt("click",function(){return o.addExternalAuthor()}),t.nrm(23,"mat-icon",13),t.EFF(24," Add external author "),t.k0s()()(),t.j41(25,"lib-modal-container-footer",14),t.bIt("primaryButtonClick",function(){return o.onSave()})("secondaryButtonClick",function(){return o.onLeave()}),t.k0s()()),2&r&&(t.Y8G("modalHeight",o.componentDialogHeight),t.R7$(2),t.Y8G("formGroup",o.form),t.R7$(),t.Y8G("id",o.controlName.TITLE)("name",o.controlName.TITLE)("formControlName",o.controlName.TITLE)("errorMessage",o.inputValidationMessages)("maxLength",o.maxLength)("isCharacterCounter",!0),t.R7$(2),t.Y8G("id",o.controlName.SLUG)("name",o.controlName.SLUG)("formControlName",o.controlName.SLUG)("errorMessage",o.inputValidationMessages)("maxLength",o.maxLength),t.R7$(),t.vxM(!o.form.controls[o.controlName.SLUG].touched||o.form.controls[o.controlName.SLUG].valid?6:-1),t.R7$(),t.Y8G("ngIf",o.data.post),t.R7$(2),t.Y8G("for",o.controlName.TOPICS),t.R7$(2),t.Y8G("formControlName",o.controlName.TOPICS)("dataSource",t.bMT(12,29,o.topics$))("isInitaasAdmin",!0)("chipSize",o.chipSize.Small),t.R7$(3),t.Y8G("for",o.controlName.INTERNAL_AUTHORS),t.R7$(2),t.Y8G("formControlName",o.controlName.INTERNAL_AUTHORS)("dataSource",t.bMT(17,31,o.authors$))("isInitaasAdmin",!0),t.R7$(5),t.Y8G("ngIf",o.externalAuthors.value.length),t.R7$(),t.Aen(o.buttonStyle.Ghost),t.Y8G("type",o.buttonType.Primary),t.R7$(3),t.Y8G("isPrimaryButtonDisabled",o.isLoading||!o.form.dirty||o.form.invalid))},dependencies:[Y.$,C.hM,P.m_,P.An,i.YN,i.qT,i.BC,i.cb,l.Sq,i.X1,i.j4,i.JD,i.$R,i.v8,T.fS,k.k,V.a,q.J,a.Hl,l.bT,d.CYR,d.rxf,d.bEy,d.Sjx,d.xBz,d.CR$,d.Qpp,A.u,tt.oV,l.Jj],styles:["@keyframes _ngcontent-%COMP%_shine-lines{to{transform:translate(100%)}}[_nghost-%COMP%] app-configuration-dialog-content[_ngcontent-%COMP%]{position:relative;gap:var(--space-200) 0}[_nghost-%COMP%] form[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-grow:1;gap:var(--space-300)}[_nghost-%COMP%] form[_ngcontent-%COMP%] .form-row[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{font-family:var(--typography-label-regular-font-family);font-weight:var(--typography-label-regular-font-weight);line-height:var(--typography-label-regular-line-height);font-size:var(--typography-label-regular-font-size);letter-spacing:var(--typography-body-regular-letter-spacing);text-transform:var(--typography-body-regular-text-case);display:block;margin-bottom:var(--space-100)}[_nghost-%COMP%] .label-wrapper[_ngcontent-%COMP%]{display:flex;justify-content:space-between;width:100%}[_nghost-%COMP%] app-url-slug-preview .site-url{min-height:auto;gap:var(--space-050);border-radius:var(--border-radius-050);padding:var(--space-100);margin-top:calc(-1 * (var(--border-radius-050) + var(--border-width-hairline) * 2));background:none}[_nghost-%COMP%] app-url-slug-preview .site-url .helper-text{font-family:var(--typography-body-small-font-family);font-weight:var(--typography-body-small-font-weight);line-height:var(--typography-body-small-line-height);font-size:var(--typography-body-small-font-size);letter-spacing:var(--typography-body-regular-letter-spacing);text-transform:var(--typography-body-regular-text-case);color:var(--colour-text-primary)}[_nghost-%COMP%] app-url-slug-preview .site-url .helper-text .site-link{color:var(--colour-text-secondary)}[_nghost-%COMP%] app-url-slug-preview .site-url .mat-icon{height:var(--size-200);width:var(--size-200);font-size:var(--size-200);line-height:var(--size-200);color:var(--colour-icon-neutral-default);flex:0 0 auto;align-self:start}.url-slug-warning[_ngcontent-%COMP%]{font-family:var(--typography-label-bold-small-font-family);font-weight:var(--typography-label-bold-small-font-weight);line-height:var(--typography-label-bold-small-line-height);font-size:var(--typography-label-bold-small-font-size);letter-spacing:var(--typography-body-regular-letter-spacing);text-transform:var(--typography-body-regular-text-case);display:flex;align-items:center;padding:var(--space-150) var(--space-100);color:var(--colour-text-accent-default);background:var(--colour-surface-accent-subtle-default);border-radius:var(--border-radius-050)}.url-slug-warning[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{height:var(--size-250);width:var(--size-250);font-size:var(--size-250);line-height:var(--size-250);margin-right:var(--space-100)}.author-row[_ngcontent-%COMP%]{display:grid;grid-auto-rows:1fr;grid-template-columns:var(--size-500) 1fr 1fr;grid-template-rows:1fr;gap:0 var(--space-100)}@media only screen and (min-width:0)and (max-width:767px){.author-row[_ngcontent-%COMP%]{grid-template-columns:var(--size-500) 1fr;grid-template-rows:auto auto auto}.author-row[_ngcontent-%COMP%] .remove-author[_ngcontent-%COMP%]{align-self:center}}@media(min-width:768px){.author-row[_ngcontent-%COMP%] .remove-author[_ngcontent-%COMP%]{position:relative;top:var(--space-100)}}@media only screen and (min-width:0)and (max-width:767px){.author-row[_ngcontent-%COMP%] .author-col[_ngcontent-%COMP%]:nth-child(2){margin-bottom:var(--space-100)}.author-row[_ngcontent-%COMP%] .author-col[_ngcontent-%COMP%]:nth-child(1){grid-row:span 2;align-self:center}.author-row[_ngcontent-%COMP%] .author-col[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{margin-top:0}}"],changeDetection:0})}}return s})()},72388(O,p,e){e.d(p,{h:()=>l});var l=function(u){return u.CREATE="create",u.UPDATE="update",u}(l||{})},26860(O,p,e){e.d(p,{n:()=>l});var l=function(u){return u.ACTIVE="active",u.ARCHIVED="archived",u.DRAFT="draft",u}(l||{})},20114(O,p,e){e.d(p,{IO:()=>a,bM:()=>i,om:()=>C,p5:()=>P});var l=e(86906),u=e(24228);const i=(T,A,d,m)=>({autoFocus:!1,disableClose:!0,width:"582px",panelClass:l.C,data:{siteId:T,blogId:A,siteUrl:d,...m&&{post:m},height:"786px"}}),a=T=>({disableClose:!0,width:"648px",panelClass:["publish-dialog-wrapper",l.C],data:{postUrl:T}}),C=()=>({disableClose:!0,maxWidth:"424px",data:{title:"Unpublish post?",message:"This post will be unpublished. Would you like to proceed?",buttons:{cancel:{title:"Cancel"},confirm:{title:"Unpublish"}}}}),P=()=>({disableClose:!0,width:"424px",panelClass:l.C,data:{title:"Delete content area?",message:"Content area will be deleted. This action can not be undone. Are you sure?",buttons:{cancel:{title:"No, cancel"},confirm:{title:"Yes, delete",type:u.O.ERROR}}}})},71479(O,p,e){e.d(p,{k:()=>d});var l=e(72200),u=e(99213),i=e(86156),a=e(73664),C=e(40455);function P(m,M){1&m&&(a.j41(0,"mat-icon",6),a.EFF(1,"link"),a.k0s())}function T(m,M){if(1&m&&(a.j41(0,"div",2),a.DNE(1,P,2,0,"mat-icon",3),a.j41(2,"p",4)(3,"span",5),a.EFF(4),a.k0s(),a.j41(5,"span"),a.EFF(6),a.k0s()()()),2&m){const g=a.XpG(),f=a.sdS(2);a.R7$(),a.Y8G("ngIf",!g.customIcon)("ngIfElse",f),a.R7$(3),a.JRh(g.siteUrl),a.R7$(2),a.JRh(g.slug)}}function A(m,M){if(1&m&&a.nrm(0,"mat-icon",7),2&m){const g=a.XpG();a.Y8G("svgIcon",a.mNQ(g.customIcon))}}let d=(()=>{class m{constructor(){this.hostClass="",this.siteUrl="",this.slug="",this.customIcon=""}static{this.\u0275fac=function(f){return new(f||m)}}static{this.\u0275cmp=a.VBU({type:m,selectors:[["app-url-slug-preview"]],hostVars:2,hostBindings:function(f,S){2&f&&a.HbH(S.hostClass)},inputs:{hostClass:"hostClass",siteUrl:"siteUrl",slug:"slug",customIcon:"customIcon"},decls:3,vars:1,consts:[["customSVGIcon",""],["class","site-url","matTooltip","Once the page is published, the below url would be used to access the current page","matTooltipPosition","above",4,"ngIf"],["matTooltip","Once the page is published, the below url would be used to access the current page","matTooltipPosition","above",1,"site-url"],["class","manage-pages__icon",4,"ngIf","ngIfElse"],[1,"helper-text"],[1,"site-link"],[1,"manage-pages__icon"],[1,"manage-pages__icon",3,"svgIcon"]],template:function(f,S){1&f&&a.DNE(0,T,7,4,"div",1)(1,A,1,2,"ng-template",null,0,a.C5r),2&f&&a.Y8G("ngIf",S.siteUrl)},dependencies:[u.m_,u.An,i.u,C.oV,l.bT],styles:["[_nghost-%COMP%]{display:block}.site-url[_ngcontent-%COMP%]{min-height:var(--size-400);background-color:var(--colour-surface-neutral-default);display:flex;gap:var(--space-100);align-items:center;padding-left:var(--space-100)}.site-url[_ngcontent-%COMP%] .site-link[_ngcontent-%COMP%]{color:var(--colour-text-secondary)}.manage-pages__icon[_ngcontent-%COMP%]{overflow:visible}"],changeDetection:0})}}return m})()},57334(O,p,e){e.d(p,{b:()=>l});const l="^([0-9]|[a-z]|-|_)*$"}}]);
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.