1"use strict";(self.webpackChunkiko=self.webpackChunkiko||[]).push([[1312],{79536:(I,S,n)=>{n.d(S,{S:()=>x});var v=n(50292),k=n(65056),m=n(34896),f=n(54844),b=n(61616),y=n(42108),t=n(82440),p=n(99308);let u=(()=>{class g{constructor(){this.statesSearch={}}saveState(c,h){this.statesSearch[c]=h}getState(c){return this.statesSearch[c]?this.statesSearch[c]:null}clearState(c){delete this.statesSearch[c]}static{this.\u0275fac=function(h){return new(h||g)}}static{this.\u0275prov=m.wxM({token:g,factory:g.\u0275fac,providedIn:"root"})}}return g})();class x{constructor(){this.defaultLat=37.4419,this.defaultLon=-38,this.zoom=3,this.isInitialized$=new f.g(!1),this.isRestoringState=!1,this.mapUpdated$=new b.E,this.restoredMap=!1,this.scrollUpdated$=new b.E,this.stateSearchService=(0,m.uUt)(u),this.customService=(0,m.uUt)(t.k),this.locationService=(0,m.uUt)(p.z),this.i18nService=(0,m.uUt)(y.W),this.timeoutScroll=500,this.stateSearchListKey=`${this.constructor.name}`,this.isServer=(0,k.uf)((0,m.uUt)(m.AHE)),this.defaultLat=this.locationService?.currentLocation?this.locationService.currentLocation.lat:this.defaultLat,this.defaultLon=this.locationService?.currentLocation?this.locationService.currentLocation.lon:this.defaultLon}setScroller(s){this.isServer||(this.scrollerElement=s,this.restoreScroll())}setGoogleMap(s){this.map=s,this.restoreMap()}setScrollTimeout(s){this.timeoutScroll=s}resetScrollTimeout(){this.timeoutScroll=500}restoreState(){var s=this;return(0,v.c)(function*(){const c=s.stateSearchService.getState(s.stateSearchListKey);s.isRestoringState=!0,yield s.receiveSearchState(c),s.scrollPositionToRestore=c?.scrollPosition,s.mapToRestore=c?.map,setTimeout(()=>s.isRestoringState=!1,400),s.restoreScroll(),s.restoreMap(),s.stateSearchService.clearState(s.stateSearchListKey)})()}saveState(){let s,c;this.scrollerElement&&(s=this.scrollerElement.nativeElement.scrollTop),this.map&&(c={center:this.map.getCenter(),zoom:this.map.getZoom(),bounds:this.map.getBounds()});const h=this.generateSearchState();h.scrollPosition=s,h.map=c,this.stateSearchService.saveState(this.stateSearchListKey,h)}clear(){this.stateSearchService.clearState(this.stateSearchListKey)}restoreMap(){this.mapToRestore&&this.map&&setTimeout(()=>{this.restoredMap=!0,this.mapToRestore&&(this.map?.panTo(this.mapToRestore?.center),this.map?.setZoom(this.mapToRestore?.zoom),this.defaultLat=this.mapToRestore?.bounds?.getCenter()?.lat(),this.defaultLon=this.mapToRestore?.bounds?.getCenter()?.lng(),delete this.mapToRestore,this.mapUpdated$.next())},200)}restoreScroll(){this.scrollPositionToRestore&&this.scrollerElement&&setTimeout(()=>{this.scrollPositionToRestore&&(this.scrollerElement?.nativeElement.scrollTo(0,this.scrollPositionToRestore),delete this.scrollPositionToRestore,this.resetScrollTimeout())},this.timeoutScroll)}resetScroll(){this.scrollerElement&&this.scrollerElement.nativeElement.scrollTo(0,0)}}},61312:(I,S,n)=>{n.r(S),n.d(S,{EbooksModule:()=>Z});var v=n(65056),k=n(71904),m=n(51008),f=n(24424),b=n(42108),y=n(33464),t=n(34896),p=n(6723),u=n(93072),E=n(13016),x=n(36248),g=n(2172),s=n(72584),c=n(79536),h=n(5892),T=n(54844);let C=(()=>{class e extends c.S{constructor(o,i){super(),this.i18nService=o,this.viewService=i,this.isInloading=!1,this.ebooks$=new T.g([]),this.options={filters:{}},this.seoService=(0,t.uUt)(u.Ef),this.i18nService.changedSelectedLanguage$.subscribe(r=>{r!==this.lastLanguageLoaded&&(this.getEbooks(r),this.clear())})}resolve(o){this.filterId=o.queryParams.ebook,this.restoreState()}getEbooks(o){if(this.isInloading)return;this.isInloading=!0;const i={args:[this.filterId],filters:{langcode:o??this.i18nService.language.toLocaleLowerCase(),langcode_1:o??this.i18nService.language.toLocaleLowerCase()}};this.lastLanguageLoaded=i.filters?.langcode.toString(),this.ebooks$.next([]),this.viewService.get("/api/v1/ebooks.json",i).subscribe({next:r=>{let a=null;r=r.map(l=>(l.file&&(l.file.startsWith("https://")||(l.file=h.So.backEndUrl+l.file),l.url_alias=l.url_alias.replace("/pl/","/").split("?")[0],!a&&l.field_image_multiple_json?.portrait_hd&&(a=l.field_image_multiple_json.portrait_hd)),l)),a&&this.seoService.setImage(a,{width:1024,height:1448}),this.ebooks$.next(r),this.isInloading=!1},error:()=>this.isInloading=!1})}receiveSearchState(o){o&&o.filters===this.filterId?(this.ebooks$.next(o.elements.ebooks),this.filterId=o.filters):this.getEbooks()}generateSearchState(){return{elements:{ebooks:this.ebooks$.value},filters:this.filterId}}static{this.\u0275fac=function(i){return new(i||e)(t.CoB(u.WY),t.CoB(h._M))}}static{this.\u0275prov=t.wxM({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();var G=n(86400),w=n(63520),_=n(28828),O=n(33768),R=n(10148),$=n(14260);const L=["scroller"];function P(e,d){1&e&&(t.I0R(0,"div",9),t.wR5(1,"div",10),t.C$Y())}const Y=()=>[1,2,3,4,5,6];function M(e,d){1&e&&(t.I0R(0,"div",7),t.yuY(1,P,2,0,"div",8),t.C$Y()),2&e&&(t.yG2(),t.E7m("ngForOf",t.q4q(1,Y)))}function j(e,d){1&e&&(t.I0R(0,"div",18)(1,"div",19),t.wR5(2,"i",20)(3,"br"),t.I0R(4,"button",21),t.OEk(5," UNLOCK "),t.C$Y()()())}function D(e,d){1&e&&(t.SAx(0),t.wR5(1,"i",24),t.k70())}function U(e,d){if(1&e&&(t.SAx(0),t.OEk(1),t.k70()),2&e){const o=t.GaO(3).$implicit,i=t.GaO(3);t.yG2(),t.oRS(" ",null==i.downloadedEbooks?null:i.downloadedEbooks[o.nid],"% ")}}function A(e,d){if(1&e&&(t.SAx(0),t.yuY(1,D,2,0,"ng-container",23)(2,U,2,1,"ng-container",23),t.k70()),2&e){const o=t.GaO(2).$implicit,i=t.GaO(3);t.yG2(),t.E7m("ngIf",100===(null==i.downloadedEbooks?null:i.downloadedEbooks[o.nid])),t.yG2(),t.E7m("ngIf",(null==i.downloadedEbooks?null:i.downloadedEbooks[o.nid])<100)}}function F(e,d){1&e&&(t.SAx(0),t.wR5(1,"i",25),t.k70())}const K=e=>({"bg-secondary":e});function Q(e,d){if(1&e){const o=t.KQA();t.I0R(0,"div",22),t.qCj("click",function(r){t.usT(o);
1const a=t.GaO().$implicit,l=t.GaO(3);return t.CGJ(null!=l.downloadedEbooks&&l.downloadedEbooks[a.nid]?l.openEbook(a):l.downloadOrOpenEbook(r,a))}),t.yuY(1,A,3,2,"ng-container",23)(2,F,2,0,"ng-container",23),t.C$Y()}if(2&e){const o=t.GaO().$implicit,i=t.GaO(3);t.E7m("ngClass",t.S45(3,K,null==i.downloadedEbooks?null:i.downloadedEbooks[o.nid])),t.yG2(),t.E7m("ngIf",null==i.downloadedEbooks?null:i.downloadedEbooks[o.nid]),t.yG2(),t.E7m("ngIf",!(null!=i.downloadedEbooks&&i.downloadedEbooks[o.nid]))}}function B(e,d){if(1&e){const o=t.KQA();t.I0R(0,"div",13),t.qCj("click",function(){const a=t.usT(o).$implicit,l=t.GaO(3);return t.CGJ(l.openEbook(a))}),t.I0R(1,"div",14),t.yuY(2,j,6,0,"div",15),t.wR5(3,"image-srcset",16),t.yuY(4,Q,3,5,"div",17),t.C$Y()()}if(2&e){const o=d.$implicit;t.yG2(2),t.E7m("ngIf",!o.file),t.yG2(),t.E7m("width",265)("height",375)("item",o.field_image_multiple_json),t.yG2(),t.E7m("ngIf",o.file)}}function z(e,d){if(1&e&&(t.I0R(0,"div",7),t.yuY(1,B,5,5,"div",12),t.C$Y()),2&e){const o=t.GaO().appNgVar;t.yG2(),t.E7m("ngForOf",o)}}function N(e,d){if(1&e&&(t.SAx(0),t.yuY(1,z,2,1,"div",11),t.k70()),2&e){const o=d.appNgVar;t.GaO();const i=t.Gew(8);t.yG2(),t.E7m("ngIf",o.length>0)("ngIfElse",i)}}function V(e,d){if(1&e){const o=t.KQA();t.I0R(0,"error-content",27),t.qCj("reloadClick",function(){t.usT(o);const r=t.GaO(2);return t.CGJ(r.service.getEbooks())}),t.C$Y()}}function J(e,d){if(1&e&&t.yuY(0,V,1,0,"error-content",26),2&e){const o=t.GaO();t.E7m("ngIf",!o.service.isInloading)}}const W=[{path:"",component:(()=>{class e{constructor(o,i,r,a,l,q,tt){this.navDataService=o,this.i18nService=i,this.service=r,this.customService=a,this.dbService=l,this.commonService=q,this.router=tt,this.downloadedEbooks={},this.contentProtectionService=(0,t.uUt)(E.a),this.trackingService=(0,t.uUt)(x.y),this.seoService=(0,t.uUt)(u.Ef),this.translateService=(0,t.uUt)(s.qS)}set scroller(o){this.service.setScroller(o)}ngOnInit(){this.navDataService.setPageTitle({title:this.translateService.instant("seo_ebooks_title")}),this.seoService.setDescription(this.translateService.instant("seo_ebooks_description")),this.navDataService.currentPageTitle.set("eBooks"),this.i18nService.setPage(g.M.Ebook),this.getAllDownloadedEbooks()}ngOnDestroy(){this.i18nService.setPage()}openEbook(o){o.file?(this.navDataService.storage=o,this.service.saveState(),this.trackingService.trackEvent({event:"ebook_open",dl_name:"ebook_title",dl_value:o.title}),this.customService.activityTracking({activity_type:"view",entity_type:"node",id:o.nid}).subscribe(),this.router.navigateByUrl(`${o.file?o.url_alias:null}?langcode=${this.i18nService.language}`)):this.contentProtectionService.protect(`${o.url_alias}?langcode=${this.i18nService.language}`,!1)}downloadOrOpenEbook(o,i){o.stopPropagation(),o.preventDefault(),this.dbService.getByKey(p.Q.indexDb.ebooks,i.nid).subscribe(r=>{r?.nid?this.openEbook(i):this.commonService.downloadFile(i.file).subscribe(a=>{"DONE"===a.state&&a.content?this.dbService.add(p.Q.indexDb.ebooks,{nid:i.nid,blob:a.content}).subscribe(()=>{this.getAllDownloadedEbooks()}):this.downloadedEbooks[i.nid]=a.progress})})}getAllDownloadedEbooks(){this.dbService.getAll(p.Q.indexDb.ebooks).subscribe(o=>{this.downloadedEbooks=o.reduce((i,r)=>(r?.nid&&(i[r?.nid]=100),i),{})})}static{this.\u0275fac=function(i){return new(i||e)(t.GI1(u.G0),t.GI1(u.WY),t.GI1(C),t.GI1(u.kP),t.GI1(G.aQ),t.GI1(w.G),t.GI1(f.E5))}}static{this.\u0275cmp=t.In1({type:e,selectors:[["app-ebooks"]],viewQuery:function(i,r){if(1&i&&t.CC$(L,5),2&i){let a;t.wto(a=t.Gqi())&&(r.scroller=a.first)}},decls:9,vars:4,consts:[[1,"h-100","container-fluid","overflow-scroll","display-scroll"],["scroller",""],[1,"row","d-block","d-lg-none","sticky-top"],[1,"col-12","p-0"],["class","row max-width-body mx-auto",4,"ngIf"],[4,"appNgVar"],["noContent",""],[1,"row","max-width-body","mx-auto"],["class","col-6 col-md-3 col-lg-3 p-2 d-flex justify-content-center",4,"ngFor","ngForOf"],[1,"col-6","col-md-3","col-lg-3","p-2","d-flex","justify-content-center"],[1,"card","h-100","loading","min-height-thumbnail","mb-4","shadow-none","rounded-1"],["class","row max-width-body mx-auto",4,"ngIf","ngIfElse"],["class","col-6 d-block col-md-3 col-lg-3 p-2 d-flex min-height-thumbnail justify-content-center",3,"click",4,"ngFor","ngForOf"],[1,"col-6","d-block","col-md-3","col-lg-3","p-2","d-flex","min-height-thumbnail","justify-content-center",3,"click"],[1,"card","h-100","m-0","rounded-1"],["class","border border-warning bg-dark-trans
1parent rounded-1 text-white text-center d-flex align-items-center top-0 bottom-0 lr-0 position-absolute",4,"ngIf"],["imgClass","card-img-top rounded-1",3,"width","height","item"],["class","m-3 position-absolute r-0 d-flex justify-content-center align-items-center btn btn-download",3,"ngClass","click",4,"ngIf"],[1,"border","border-warning","bg-dark-transparent","rounded-1","text-white","text-center","d-flex","align-items-center","top-0","bottom-0","lr-0","position-absolute"],[1,"col-12"],[1,"icon","icon-unlock-alt","icon-64","m-auto"],["translate","",1,"btn","btn-warning","m-auto","rounded-4","text-white","text-center","btn-sm","extra-small"],[1,"m-3","position-absolute","r-0","d-flex","justify-content-center","align-items-center","btn","btn-download",3,"ngClass","click"],[4,"ngIf"],[1,"fw-bold","icon","icon-24","icon-book-open"],[1,"fw-bold","icon","icon-24","icon-cloud-download"],["class","col-12 col-md-6 pt-2 overflow-scroll h-100",3,"reloadClick",4,"ngIf"],[1,"col-12","col-md-6","pt-2","overflow-scroll","h-100",3,"reloadClick"]],template:function(i,r){1&i&&(t.I0R(0,"div",0,1)(2,"div",2),t.wR5(3,"app-preferred-language",3),t.C$Y(),t.yuY(4,M,2,2,"div",4)(5,N,2,2,"ng-container",5),t.wVc(6,"async"),t.C$Y(),t.yuY(7,J,1,1,"ng-template",null,6,t.gJz)),2&i&&(t.yG2(4),t.E7m("ngIf",r.service.isInloading),t.yG2(),t.E7m("appNgVar",t.kDX(6,2,r.service.ebooks$)))},dependencies:[v.QF,v.ay,v.u_,s.eM,_.S,O.i,R.s,$.A,v.a],styles:["[_ngcontent-%COMP%]:root{--bar-fixed-message-height: 25px}.min-height-thumbnail[_ngcontent-%COMP%]{min-height:208px}@media only screen and (min-width: 1224px){.loading[_ngcontent-%COMP%]{min-height:295px}}.btn-download[_ngcontent-%COMP%]{width:72px;height:52px;color:#fff;background-color:#6c757d;border-color:#6c757d;opacity:.8;border-radius:12px;font-size:1.2em;transition:ease-in-out .2s;bottom:0}.btn-download[_ngcontent-%COMP%]:hover{opacity:1}"]})}}return e})(),data:{title:(0,b.A)("eBooks"),discriminantPathKey:"EBOOKS"},resolve:{data:C}},{path:"ebook",loadChildren:()=>Promise.all([n.e(6144),n.e(8456)]).then(n.bind(n,8456)).then(e=>e.EbookModule)},{path:":alias",loadChildren:()=>Promise.all([n.e(6144),n.e(8456)]).then(n.bind(n,8456)).then(e=>e.EbookModule)}];let X=(()=>{class e{static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275mod=t.a4G({type:e})}static{this.\u0275inj=t.s3X({imports:[f.qQ.forChild(W),f.qQ,y.Yv]})}}return e})();var H=n(41752);let Z=(()=>{class e{static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275mod=t.a4G({type:e})}static{this.\u0275inj=t.s3X({imports:[v.MD,k.y,m.k,X,H.Y]})}}return e})()}}]); 2//# sourceMappingURL=1312.e4c900654b937e5b.js.map
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.