1import{a as U}from"./chunk-4RXFJI67.js";import{d as s}from"./chunk-RCUDUYYY.js";import"./chunk-QBKSJLGR.js";import{Vb as r,Ze as x,_e as P,bd as c,f as w,n as A,tc as o}from"./chunk-CQ5D4WCL.js";import{Bc as u,G as f,Ga as _,Gb as n,Ha as S,Mb as T,Sb as D,_ as g,ha as k,ka as m,kc as p,lc as C,mc as y,uc as F,v,x as h,z as M,zc as I}from"./chunk-G2MBAB6T.js";M();function N(l,i){if(l&1){let e=F();C(0,"app-document-view",1),I("redirect",function(){_(e);let a=u();return S(a.onRedirect())}),y()}if(l&2){let e=u();p("task",e.task)("document",e.document)}}var b=class d{constructor(i,e,t,a){this.formDocumentApiService=i,this.translateService=e,this.apiLinkPipe=t,this.redirectTaskService=a,this.languageId$=this.translateService.getCurrentLanguageProperties().pipe(f(L=>L?.id),k(1))}ngOnInit(){this.initActiveTask()}initActiveTask(){this.redirectTaskService.currentTask$.pipe(g(0),P(this)).subscribe(i=>{this.initFormDocument(i)})}initFormDocument(i){this.task=i,this.languageId$.pipe(m(e=>this.formDocumentApiService.getClinicFormDocument(i.clinicUuid,i.actions[0].value[0],e))).subscribe({next:e=>{e.questionnaire?this.navigateToQuestionnaire(e):e.attachment&&this.initDocument(e.attachment)},error:()=>{this.redirectTaskService.navigate([this.redirectTaskService.getBaseQuestionnaireUrl(),"unavailable"])}})}initDocument(i){this.languageId$.pipe(m(e=>this.apiLinkPipe.transform(this.formDocumentApiService.getFormDocumentApiLink(this.task.clinicUuid,this.task.actions[0].value[0],e)))).subscribe(e=>{this.document={src:e,link:i.href,fileName:i.fileName}})}navigateToQuestionnaire(i){this.redirectTaskService.navigate([this.redirectTaskService.getBaseQuestionnaireUrl(),"main",i.questionnaire.id],{queryParams:{appointmentId:this.task.todo.source.appointment_id,clinicUuid:this.task.clinicUuid}})}onRedirect(){this.redirectTaskService.navigate([this.redirectTaskService.getBaseUrl()+"/form-document/sign"],{queryParams:{documentName:this.document?.fileName}})}static{this.\u0275fac=function(e){return new(e||d)(n(c),n(r),n(o),n(s))}}static{this.\u0275cmp=T({type:d,selectors:[["app-form-document"]],decls:1,vars:1,consts:[[3,"task","document","redirect",4,"ngIf"],[3,"redirect","task","document"]],template:function(e,t){e&1&&D(0,N,1,2,"app-document-view",0),e&2&&p("ngIf",t.task&&t.document)},dependencies:[A,w,U],styles:["[_nghost-%COMP%]{height:100%}"]})}};b=v([x(),h("design:paramtypes",[c,r,o,s])],b);export{b as FormDocumentComponent};
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.