Files
rsu-new-site/frontend/chunk-6WIFSKTF.js

2 lines
10 KiB
JavaScript

import{a as q}from"./chunk-MWOEXFYD.js";import{b as N,c as P,f as z,g as $}from"./chunk-ZEULGWAI.js";import"./chunk-MBEC6LK4.js";import{Ca as D,Eb as l,Fa as s,Fb as g,Gb as R,Hc as A,M as v,R as m,S as u,T as w,Ta as I,Tb as C,U as E,Ub as T,Xb as L,Ya as p,Yb as j,ca as _,cb as h,jb as d,kb as r,lb as o,mb as b,nb as S,ob as k,qb as y,qc as V,rb as x,rc as O,sb as a,uc as M,vc as F,zb as U}from"./chunk-TVKQFRWX.js";import"./chunk-DAQOROHW.js";function G(n,i){if(n&1&&(r(0,"p",32),l(1),o()),n&2){let e=a().$implicit;s(),g(e.description)}}function H(n,i){if(n&1){let e=y();r(0,"article",19)(1,"span",20),l(2,"PDF"),o(),r(3,"div",21)(4,"strong",22),l(5),o(),p(6,G,2,1,"p",23),r(7,"small",24),l(8),C(9,"date"),o(),r(10,"div",25)(11,"button",26),x("click",function(){let c=m(e).$implicit,f=a(4);return u(f.preview(c))}),w(),r(12,"svg",27),b(13,"path",28)(14,"path",29),o(),l(15," Voir "),o(),E(),r(16,"button",30),x("click",function(){let c=m(e).$implicit,f=a(4);return u(f.download(c))}),w(),r(17,"svg",27),b(18,"path",31),o(),l(19),o()()()()}if(n&2){let e=i.$implicit,t=a(4);s(5),g(e.title),s(),d("ngIf",e.description),s(2),R("Publi\xE9 le ",L(9,7,e.date,"d MMMM y","","fr")),s(3),h("aria-label","Voir le document "+e.title),s(5),d("disabled",t.downloadingId()===e.id),h("aria-label","T\xE9l\xE9charger le document "+e.title),s(3),R(" ",t.downloadingId()===e.id?"Pr\xE9paration\u2026":"T\xE9l\xE9charger"," ")}}function J(n,i){if(n&1&&(r(0,"div",17),p(1,H,20,12,"article",18),o()),n&2){let e=a().ngIf;s(),d("ngForOf",e)}}function K(n,i){n&1&&(r(0,"div",33),l(1,"Aucun document n\u2019est publi\xE9 dans cette rubrique pour le moment."),o())}function Q(n,i){if(n&1&&(S(0),p(1,J,2,1,"div",16)(2,K,2,0,"ng-template",null,0,j),k()),n&2){let e=i.ngIf,t=U(3);s(),d("ngIf",e.length)("ngIfElse",t)}}function W(n,i){if(n&1&&(r(0,"div",2)(1,"div",12)(2,"h2",13),l(3),o(),r(4,"p",14),l(5),o()(),p(6,Q,4,2,"ng-container",15),o()),n&2){let e=i.ngIf,t=a();s(3),g(t.isFundamentalSection?"Textes fondamentaux":"Rapports et autres textes"),s(2),g(t.isFundamentalSection?"D\xE9crets, arr\xEAt\xE9s et textes constitutifs du Registre Social Unique.":"Rapports, comptes rendus et autres documents utiles du RSU."),s(),d("ngIf",t.documentsForSection(e.documents))}}function X(n,i){n&1&&(r(0,"div",46),l(1,"Chargement du document\u2026"),o())}function Y(n,i){if(n&1){let e=y();r(0,"div",47)(1,"p"),l(2,"L\u2019aper\xE7u ne peut pas \xEAtre charg\xE9."),o(),r(3,"button",48),x("click",function(){m(e);let c=a().ngIf,f=a();return u(f.download(c))}),l(4,"T\xE9l\xE9charger le document"),o()()}}function Z(n,i){if(n&1&&b(0,"iframe",49),n&2){let e=a().ngIf,t=a();d("src",t.previewUrl(),D)("title",e.title)}}function ee(n,i){if(n&1){let e=y();r(0,"div",34),x("click",function(){m(e);let c=a();return u(c.closePreview())}),r(1,"section",35),x("click",function(c){return m(e),u(c.stopPropagation())}),r(2,"header",36)(3,"div",37)(4,"p",38),l(5,"Aper\xE7u du document"),o(),r(6,"h2",39),l(7),o()(),r(8,"div",40)(9,"button",41),x("click",function(){let c=m(e).ngIf,f=a();return u(f.download(c))}),w(),r(10,"svg",27),b(11,"path",31),o(),l(12," T\xE9l\xE9charger "),o(),E(),r(13,"button",42),x("click",function(){m(e);let c=a();return u(c.closePreview())}),l(14,"\xD7"),o()()(),p(15,X,2,0,"div",43)(16,Y,5,0,"div",44)(17,Z,1,2,"iframe",45),o()()}if(n&2){let e=i.ngIf,t=a();s(),h("aria-label",e.title),s(6),g(e.title),s(8),d("ngIf",t.previewLoading()),s(),d("ngIf",t.previewError()),s(),d("ngIf",t.previewUrl())}}var B=class n{contentService=v(q);http=v(A);sanitizer=v(N);route=v(P);isFundamentalSection=this.route.snapshot.data.documentSection!=="reports";previewDocument=_(null);previewUrl=_(null);previewLoading=_(!1);previewError=_(!1);downloadingId=_(null);previewObjectUrl=null;documentsForSection(i){return i.filter(e=>this.isFundamentalDocument(e)===this.isFundamentalSection)}isFundamentalDocument(i){let e=(i.category||"").toUpperCase(),t=i.title.toUpperCase();return["DECRET","ARRETE","LOI","CIRCULAIRE"].includes(e)||/\b(D[ÉE]CRET|ARR[ÊE]T[ÉE]|LOI|CIRCULAIRE|CR[ÉE]ATION)\b/.test(t)}preview(i){this.previewDocument.set(i),this.previewUrl.set(null),this.previewError.set(!1),this.previewLoading.set(!0),this.releasePreviewObjectUrl(),this.http.get(i.file,{responseType:"blob"}).subscribe({next:e=>{this.previewObjectUrl=URL.createObjectURL(e),this.previewUrl.set(this.sanitizer.bypassSecurityTrustResourceUrl(this.previewObjectUrl)),this.previewLoading.set(!1)},error:()=>{this.previewLoading.set(!1),this.previewError.set(!0)}})}closePreview(){this.previewDocument.set(null),this.previewUrl.set(null),this.previewLoading.set(!1),this.previewError.set(!1),this.releasePreviewObjectUrl()}releasePreviewObjectUrl(){this.previewObjectUrl&&URL.revokeObjectURL(this.previewObjectUrl),this.previewObjectUrl=null}download(i){this.downloadingId.set(i.id),this.http.get(i.file,{responseType:"blob"}).subscribe({next:e=>{let t=URL.createObjectURL(e);this.triggerDownload(t,this.downloadName(i)),setTimeout(()=>URL.revokeObjectURL(t),1e3),this.downloadingId.set(null)},error:()=>{this.triggerDownload(i.file,this.downloadName(i)),this.downloadingId.set(null)}})}triggerDownload(i,e){let t=window.document.createElement("a");t.href=i,t.download=e,t.rel="noopener",t.click()}downloadName(i){let t=i.file.split("?")[0].match(/\.[a-z0-9]+$/i)?.[0]??".pdf";return`${i.title.replace(/[\\/:*?"<>|]/g,"-").trim()}${t}`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=I({type:n,selectors:[["app-rsu-documents"]],decls:16,vars:4,consts:[["noDocuments",""],[1,"bg-primary-800","py-14","text-white"],[1,"container-custom"],[1,"text-4xl","font-bold","text-white","md:text-5xl"],[1,"mt-4","max-w-2xl","text-white/75"],["aria-label","Rubriques des ressources",1,"border-b","border-slate-200","bg-slate-50","py-4"],[1,"container-custom","grid","gap-3","md:grid-cols-2"],["routerLink","/ressources/textes-fondamentaux","routerLinkActive","border-primary-600 bg-white text-primary-700 shadow-sm",1,"rounded-2xl","border","border-slate-200","px-6","py-4","text-center","font-bold","text-slate-700","transition","hover:border-primary-300","hover:bg-white"],["routerLink","/ressources/rapports","routerLinkActive","border-primary-600 bg-white text-primary-700 shadow-sm",1,"rounded-2xl","border","border-slate-200","px-6","py-4","text-center","font-bold","text-slate-700","transition","hover:border-primary-300","hover:bg-white"],[1,"section","bg-slate-50"],["class","container-custom",4,"ngIf"],["class","fixed inset-0 z-[100] flex items-center justify-center bg-slate-950/75 p-3 md:p-8",3,"click",4,"ngIf"],[1,"mb-8"],[1,"text-3xl","font-bold","text-primary-950"],[1,"mt-3","text-slate-600"],[4,"ngIf"],["class","grid gap-5 md:grid-cols-2",4,"ngIf","ngIfElse"],[1,"grid","gap-5","md:grid-cols-2"],["class","flex items-start gap-5 rounded-2xl border border-slate-100 bg-white p-6 shadow-card transition hover:border-primary-200 hover:shadow-soft",4,"ngFor","ngForOf"],[1,"flex","items-start","gap-5","rounded-2xl","border","border-slate-100","bg-white","p-6","shadow-card","transition","hover:border-primary-200","hover:shadow-soft"],[1,"flex","h-12","w-12","shrink-0","items-center","justify-center","rounded-xl","bg-red-50","font-bold","text-red-600"],[1,"min-w-0","flex-1"],[1,"block","text-slate-800"],["class","mt-2 text-sm leading-relaxed text-slate-600",4,"ngIf"],[1,"mt-2","block","text-slate-500"],[1,"mt-4","flex","flex-wrap","gap-2"],["type","button",1,"inline-flex","items-center","gap-2","rounded-lg","border","border-primary-200","px-3.5","py-2","text-sm","font-semibold","text-primary-700","transition","hover:bg-primary-50",3,"click"],["fill","none","stroke","currentColor","viewBox","0 0 24 24","aria-hidden","true",1,"h-5","w-5"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M2.46 12C3.73 7.94 7.52 5 12 5c4.48 0 8.27 2.94 9.54 7-1.27 4.06-5.06 7-9.54 7-4.48 0-8.27-2.94-9.54-7z"],["type","button",1,"inline-flex","items-center","gap-2","rounded-lg","bg-primary-700","px-3.5","py-2","text-sm","font-semibold","text-white","transition","hover:bg-primary-800","disabled:cursor-wait","disabled:opacity-60",3,"click","disabled"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1M12 4v12m0 0l-4-4m4 4l4-4"],[1,"mt-2","text-sm","leading-relaxed","text-slate-600"],[1,"rounded-2xl","border","border-dashed","border-slate-300","bg-white","p-10","text-center","text-slate-500"],[1,"fixed","inset-0","z-[100]","flex","items-center","justify-center","bg-slate-950/75","p-3","md:p-8",3,"click"],["role","dialog","aria-modal","true",1,"flex","h-full","w-full","max-w-6xl","flex-col","overflow-hidden","rounded-2xl","bg-white","shadow-2xl",3,"click"],[1,"flex","items-center","justify-between","gap-4","border-b","border-slate-200","px-5","py-4"],[1,"min-w-0"],[1,"text-xs","font-bold","uppercase","tracking-wider","text-primary-700"],[1,"truncate","font-bold","text-slate-900"],[1,"flex","shrink-0","items-center","gap-2"],["type","button",1,"hidden","items-center","gap-2","rounded-lg","bg-primary-700","px-4","py-2","text-sm","font-semibold","text-white","hover:bg-primary-800","sm:inline-flex",3,"click"],["type","button","aria-label","Fermer l'aper\xE7u",1,"flex","h-10","w-10","items-center","justify-center","rounded-full","bg-slate-100","text-2xl","text-slate-700","hover:bg-slate-200",3,"click"],["class","flex min-h-0 flex-1 items-center justify-center bg-slate-100 text-slate-600",4,"ngIf"],["class","flex min-h-0 flex-1 flex-col items-center justify-center gap-4 bg-slate-100 p-8 text-center text-slate-700",4,"ngIf"],["class","min-h-0 flex-1 bg-slate-100",3,"src","title",4,"ngIf"],[1,"flex","min-h-0","flex-1","items-center","justify-center","bg-slate-100","text-slate-600"],[1,"flex","min-h-0","flex-1","flex-col","items-center","justify-center","gap-4","bg-slate-100","p-8","text-center","text-slate-700"],["type","button",1,"rounded-lg","bg-primary-700","px-4","py-2","font-semibold","text-white",3,"click"],[1,"min-h-0","flex-1","bg-slate-100",3,"src","title"]],template:function(e,t){e&1&&(r(0,"section",1)(1,"div",2)(2,"h1",3),l(3,"Ressources"),o(),r(4,"p",4),l(5,"Consultez les textes fondamentaux, les rapports et les documents de r\xE9f\xE9rence du Registre Social Unique."),o()()(),r(6,"nav",5)(7,"div",6)(8,"a",7),l(9," Textes fondamentaux "),o(),r(10,"a",8),l(11," Rapports et autres textes "),o()()(),r(12,"section",9),p(13,W,7,3,"div",10),C(14,"async"),o(),p(15,ee,18,5,"div",11)),e&2&&(s(13),d("ngIf",T(14,2,t.contentService.content$)),s(2),d("ngIf",t.previewDocument()))},dependencies:[V,O,z,$,M,F],encapsulation:2})};export{B as RsuDocumentsComponent};