UNPKG

@rero/rero-ils-ui

Version:

User interface for RERO integrated library system (RERO ILS).

2 lines (1 loc) 16.8 kB
import{a as Xe}from"./chunk-RGBV37UH.js";import{b as et}from"./chunk-4GNSY2S5.js";import{A as fe,Aa as D,Ba as Fe,Ca as je,D as h,Da as ke,E as ge,Ea as Ve,F as ve,Fa as Le,G as A,H as ye,Ha as Ne,I as d,Ia as Be,J as xe,K as Ce,Ka as $e,L as I,La as Ae,M as be,Ma as Ze,N as _e,O as Me,Oa as ze,P as Z,Pa as qe,Ra as Ge,Ta as Ue,V as l,Va as He,W as f,Wa as W,X as g,Xa as F,Y as b,Ya as Ye,_a as We,a as x,aa as z,b as S,ba as q,c as P,cb as Je,d as V,da as v,e as ie,ea as _,eb as Ke,f as L,fa as M,g as u,ga as G,gb as Qe,h as oe,i as N,j as re,ja as U,k as se,ka as H,kb as j,l as ae,m as B,ma as Ie,n as C,na as Se,o as ce,p as E,q as le,qa as R,r as pe,ra as T,s as w,sa as Pe,t as y,ta as Ee,u as $,ua as we,v as ue,va as Oe,w as O,wa as Re,x as he,xa as Te,y as me,ya as De,z as de,za as Y}from"./chunk-SU7KVPJ5.js";var ht={schedule(t,e){let n=setTimeout(t,e);return()=>clearTimeout(n)}};function mt(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function dt(t){return!!t&&t.nodeType===Node.ELEMENT_NODE}var J;function ft(t,e){if(!J){let n=Element.prototype;J=n.matches||n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector}return t.nodeType===Node.ELEMENT_NODE?J.call(t,e):!1}function gt(t){let e={};return t.forEach(({propName:n,templateName:i,transform:o})=>{e[mt(i)]=[n,o]}),e}function vt(t,e){return e.get(A).resolveComponentFactory(t).inputs}function yt(t,e){let n=t.childNodes,i=e.map(()=>[]),o=-1;e.some((r,a)=>r==="*"?(o=a,!0):!1);for(let r=0,a=n.length;r<a;++r){let s=n[r],c=xt(s,e,o);c!==-1&&i[c].push(s)}return i}function xt(t,e,n){let i=n;return dt(t)&&e.some((o,r)=>o!=="*"&&ft(t,o)?(i=r,!0):!1),i}var Ct=10,K=class{componentFactory;inputMap=new Map;constructor(e,n){this.componentFactory=n.get(A).resolveComponentFactory(e);for(let i of this.componentFactory.inputs)this.inputMap.set(i.propName,i.templateName)}create(e){return new Q(this.componentFactory,e,this.inputMap)}},Q=class{componentFactory;injector;inputMap;eventEmitters=new ie(1);events=this.eventEmitters.pipe(C(e=>re(...e)));componentRef=null;scheduledDestroyFn=null;initialInputValues=new Map;ngZone;elementZone;appRef;cdScheduler;constructor(e,n,i){this.componentFactory=e,this.injector=n,this.inputMap=i,this.ngZone=this.injector.get(O),this.appRef=this.injector.get(Me),this.cdScheduler=n.get(me),this.elementZone=typeof Zone>"u"?null:this.ngZone.run(()=>Zone.current)}connect(e){this.runInZone(()=>{if(this.scheduledDestroyFn!==null){this.scheduledDestroyFn(),this.scheduledDestroyFn=null;return}this.componentRef===null&&this.initializeComponent(e)})}disconnect(){this.runInZone(()=>{this.componentRef===null||this.scheduledDestroyFn!==null||(this.scheduledDestroyFn=ht.schedule(()=>{this.componentRef!==null&&(this.componentRef.destroy(),this.componentRef=null)},Ct))})}getInputValue(e){return this.runInZone(()=>this.componentRef===null?this.initialInputValues.get(e):this.componentRef.instance[e])}setInputValue(e,n){if(this.componentRef===null){this.initialInputValues.set(e,n);return}this.runInZone(()=>{this.componentRef.setInput(this.inputMap.get(e)??e,n),ge(this.componentRef.hostView)&&(ve(this.componentRef.changeDetectorRef),this.cdScheduler.notify(6))})}initializeComponent(e){let n=ue.create({providers:[],parent:this.injector}),i=yt(e,this.componentFactory.ngContentSelectors);this.componentRef=this.componentFactory.create(n,i,e),this.initializeInputs(),this.initializeOutputs(this.componentRef),this.appRef.attachView(this.componentRef.hostView),this.componentRef.hostView.detectChanges()}initializeInputs(){for(let[e,n]of this.initialInputValues)this.setInputValue(e,n);this.initialInputValues.clear()}initializeOutputs(e){let n=this.componentFactory.outputs.map(({propName:i,templateName:o})=>{let r=e.instance[i];return new P(a=>{let s=r.subscribe(c=>a.next({name:o,value:c}));return()=>s.unsubscribe()})});this.eventEmitters.next(n)}runInZone(e){return this.elementZone&&Zone.current!==this.elementZone?this.ngZone.run(e):e()}},X=class extends HTMLElement{ngElementEventsSubscription=null};function tt(t,e){let n=vt(t,e.injector),i=e.strategyFactory||new K(t,e.injector),o=gt(n);class r extends X{injector;static observedAttributes=Object.keys(o);get ngElementStrategy(){if(!this._ngElementStrategy){let s=this._ngElementStrategy=i.create(this.injector||e.injector);n.forEach(({propName:c,transform:m})=>{if(!this.hasOwnProperty(c))return;let ne=this[c];delete this[c],s.setInputValue(c,ne,m)})}return this._ngElementStrategy}_ngElementStrategy;constructor(s){super(),this.injector=s}attributeChangedCallback(s,c,m,ne){let[pt,ut]=o[s];this.ngElementStrategy.setInputValue(pt,m,ut)}connectedCallback(){let s=!1;this.ngElementStrategy.events&&(this.subscribeToEvents(),s=!0),this.ngElementStrategy.connect(this),s||this.subscribeToEvents()}disconnectedCallback(){this._ngElementStrategy&&this._ngElementStrategy.disconnect(),this.ngElementEventsSubscription&&(this.ngElementEventsSubscription.unsubscribe(),this.ngElementEventsSubscription=null)}subscribeToEvents(){this.ngElementEventsSubscription=this.ngElementStrategy.events.subscribe(s=>{let c=new CustomEvent(s.name,{detail:s.value});this.dispatchEvent(c)})}}return n.forEach(({propName:a,transform:s,isSignal:c})=>{Object.defineProperty(r.prototype,a,{get(){let m=this.ngElementStrategy.getInputValue(a);return c&&be(m)?m():m},set(m){this.ngElementStrategy.setInputValue(a,m,s)},configurable:!0,enumerable:!0})}),r}function bt(t,e){if(t&1&&(f(0,"div",3),b(1,"div",4),g()),t&2){let n=v(2);h(),_("width",n.diameter)("height",n.diameter)}}function _t(t,e){if(t&1&&b(0,"div",5),t&2){let n=v().ngIf,i=v();_("background",i.color)("height",i.height)("width",n+"%")}}function Mt(t,e){if(t&1&&(z(0),I(1,bt,2,4,"div",1)(2,_t,1,6,"div",2),q()),t&2){let n=v();h(),l("ngIf",n.includeSpinner),h(),l("ngIf",n.includeBar)}}function It(t,e){if(t&1&&(f(0,"div",3),b(1,"div",4),g()),t&2){let n=v(2);h(),_("width",n.diameter)("height",n.diameter)}}function St(t,e){if(t&1&&b(0,"div",5),t&2){let n=v().ngIf,i=v();_("background",i.color)("height",i.height)("width",n+"%")}}function Pt(t,e){if(t&1&&(z(0),I(1,It,2,4,"div",1)(2,St,1,6,"div",2),q()),t&2){let n=v();h(),l("ngIf",n.includeSpinner),h(),l("ngIf",n.includeBar)}}var Et="[_nghost-%COMP%]{position:relative;display:block;pointer-events:none}[_nghost-%COMP%] .ngx-spinner[_ngcontent-%COMP%]{transition:.35s linear all;display:block;position:absolute;top:5px;left:0}[_nghost-%COMP%] .ngx-spinner[_ngcontent-%COMP%] .ngx-spinner-icon[_ngcontent-%COMP%]{width:14px;height:14px;border:solid 2px transparent;border-top-color:inherit;border-left-color:inherit;border-radius:50%;animation:_ngcontent-%COMP%_loading-bar-spinner .4s linear infinite}[_nghost-%COMP%] .ngx-bar[_ngcontent-%COMP%]{transition:width .35s;position:absolute;top:0;left:0;width:100%;height:2px;border-bottom-right-radius:1px;border-top-right-radius:1px}[dir=rtl] [_nghost-%COMP%] .ngx-bar[_ngcontent-%COMP%]{right:0;left:unset}[fixed=true][_nghost-%COMP%]{z-index:10002}[fixed=true][_nghost-%COMP%] .ngx-bar[_ngcontent-%COMP%]{position:fixed}[fixed=true][_nghost-%COMP%] .ngx-spinner[_ngcontent-%COMP%]{position:fixed;top:10px;left:10px}[dir=rtl] [fixed=true][_nghost-%COMP%] .ngx-spinner[_ngcontent-%COMP%]{right:10px;left:unset}@keyframes _ngcontent-%COMP%_loading-bar-spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}",ee=class{constructor(e={}){this.config=e,this.state={action:null,value:0,initialValue:0},this.requests=null,this.disabled=!1,this.stream$=new V,this._value$=null,this.timer$=n=>{let i=L(n);switch(n.action){case"start":case"increment":case"set":{n.action==="start"&&this.config.latencyThreshold===0&&n.value===0&&(n.value=n.initialValue),this.requests>0&&(i=N(this.config.latencyThreshold,250).pipe(u(o=>S(x({},n),{value:o===0?this.state.value||n.initialValue:this._increment()}))));break}case"complete":case"stop":{i=n.value===0?L(x({},n)):N(0,500).pipe(se(2),u(o=>({value:o===0?100:0})));break}}return i.pipe(u(o=>S(x({},o),{action:"set"})),ce(o=>this.next(o,!1)))},this.config=x({latencyThreshold:0},e)}get value$(){return this._value$?this._value$:this._value$=this.stream$.pipe(B(this.state),C(e=>this.timer$(e)),ae(),u(e=>e.value))}start(e=2){this.disabled||this.next({action:"start",initialValue:e})}stop(){this.next({action:"stop"})}complete(){this.next({action:"complete"})}disable(){this.disabled=!0}set(e){this.next({action:"set",value:e})}increment(e=0){this.next({action:"increment",value:e})}next(e,n=!0){switch(e.action){case"start":this.requests=(this.requests||0)+1;break;case"complete":if(this.requests=(this.requests||1)-1,this.requests>0)return;break;case"stop":this.requests=0;break;case"increment":e.value=this._increment(e.value);break}this.state=x(S(x({},this.state),{action:null}),e),n&&this.stream$.next(this.state)}_increment(e=0){let n=this.state.value;return n>=99&&(e=0),e===0&&(n>=0&&n<25?e=Math.random()*3+3:n>=25&&n<65?e=Math.random()*3:n>=65&&n<90?e=Math.random()*2:n>=90&&n<99?e=.5:e=0),e+n}},wt=new pe("LOADING_BAR_CONFIG");var Ot=(()=>{let e=class e{get progress$(){return this.value$}constructor(i,o={},r){this.platformId=i,this.config=o,this.zone=r,this.refs={},this.streams$=new V,this.value$=this.streams$.pipe(B(null),C(()=>oe(Object.keys(this.refs).map(a=>this.refs[a].value$))),Rt(this.zone),u(a=>Math.max(0,...a)))}start(i=2){this.useRef().start(i)}set(i){this.useRef().set(i)}increment(i){this.useRef().increment(i)}complete(){this.useRef().complete()}stop(){this.useRef().stop()}useRef(i="default"){return this.refs[i]||(this.refs[i]=new ee(this.config),this.streams$.next(),Ee(this.platformId)||this.refs[i].disable()),this.refs[i]}};e.\u0275fac=function(o){return new(o||e)(w(fe),w(wt,8),w(O,8))},e.\u0275prov=E({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();function Rt(t){return t?e=>new P(n=>e.subscribe(i=>t.run(()=>n.next(i)),i=>t.run(()=>n.error(i)),()=>t.run(()=>n.complete()))):e=>e}var Tt=(()=>{let e=class e{get value$(){return this.ref?this.loader.useRef(this.ref).value$:this.loader.value$}constructor(i){this.loader=i,this.includeSpinner=!0,this.includeBar=!0,this.fixed=!0,this.color="#29d"}};e.\u0275fac=function(o){return new(o||e)(ye(Ot))},e.\u0275cmp=d({type:e,selectors:[["ngx-loading-bar"]],hostVars:3,hostBindings:function(o,r){o&2&&(Z("fixed",r.fixed),_("color",r.color))},inputs:{includeSpinner:"includeSpinner",includeBar:"includeBar",fixed:"fixed",color:"color",value:"value",ref:"ref",height:"height",diameter:"diameter"},decls:2,vars:3,consts:[[4,"ngIf"],["class","ngx-spinner",4,"ngIf"],["class","ngx-bar",3,"background","height","width",4,"ngIf"],[1,"ngx-spinner"],[1,"ngx-spinner-icon"],[1,"ngx-bar"]],template:function(o,r){o&1&&(I(0,Mt,3,2,"ng-container",0),U(1,"async")),o&2&&l("ngIf",r.value!=null?r.value:H(1,1,r.value$))},dependencies:[T,R],styles:["[_nghost-%COMP%]{position:relative;display:block;pointer-events:none}[_nghost-%COMP%] .ngx-spinner[_ngcontent-%COMP%]{transition:.35s linear all;display:block;position:absolute;top:5px;left:0}[_nghost-%COMP%] .ngx-spinner[_ngcontent-%COMP%] .ngx-spinner-icon[_ngcontent-%COMP%]{width:14px;height:14px;border:solid 2px transparent;border-top-color:inherit;border-left-color:inherit;border-radius:50%;animation:_ngcontent-%COMP%_loading-bar-spinner .4s linear infinite}[_nghost-%COMP%] .ngx-bar[_ngcontent-%COMP%]{transition:width .35s;position:absolute;top:0;left:0;width:100%;height:2px;border-bottom-right-radius:1px;border-top-right-radius:1px}[dir=rtl] [_nghost-%COMP%] .ngx-bar[_ngcontent-%COMP%]{right:0;left:unset}[fixed=true][_nghost-%COMP%]{z-index:10002}[fixed=true][_nghost-%COMP%] .ngx-bar[_ngcontent-%COMP%]{position:fixed}[fixed=true][_nghost-%COMP%] .ngx-spinner[_ngcontent-%COMP%]{position:fixed;top:10px;left:10px}[dir=rtl] [fixed=true][_nghost-%COMP%] .ngx-spinner[_ngcontent-%COMP%]{right:10px;left:unset}@keyframes _ngcontent-%COMP%_loading-bar-spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}"],changeDetection:0});let t=e;return t})(),nt=(()=>{let e=class e extends Tt{};e.\u0275fac=(()=>{let i;return function(r){return(i||(i=de(e)))(r||e)}})(),e.\u0275cmp=d({type:e,selectors:[["ngx-loading-bar"]],hostVars:3,hostBindings:function(o,r){o&2&&(Z("fixed",r.fixed),_("color",r.color))},standalone:!1,features:[Ce],decls:2,vars:3,consts:[[4,"ngIf"],["class","ngx-spinner",4,"ngIf"],["class","ngx-bar",3,"background","height","width",4,"ngIf"],[1,"ngx-spinner"],[1,"ngx-spinner-icon"],[1,"ngx-bar"]],template:function(o,r){o&1&&(I(0,Pt,3,2,"ng-container",0),U(1,"async")),o&2&&l("ngIf",r.value!=null?r.value:H(1,1,r.value$))},dependencies:[R,T],styles:[Et],changeDetection:0});let t=e;return t})(),it=(()=>{let e=class e{};e.\u0275fac=function(o){return new(o||e)},e.\u0275mod=xe({type:e}),e.\u0275inj=le({imports:[Pe]});let t=e;return t})();var ot=(()=>{let e=class e{};e.\u0275fac=function(o){return new(o||e)},e.\u0275cmp=d({type:e,selectors:[["public-search-root"]],decls:2,vars:1,consts:[["height","3px",3,"includeSpinner"]],template:function(o,r){o&1&&b(0,"ngx-loading-bar",0)(1,"router-outlet"),o&2&&l("includeSpinner",!1)},dependencies:[it,nt,Be],encapsulation:2,changeDetection:0});let t=e;return t})();var rt=(()=>{let e=class e{constructor(){this.appStore=y(Ke),this.translateService=y(F),this.appConfigService=y(j)}load(){return this.appStore.load().pipe(C(()=>this.initTranslateService()))}initTranslateService(){let i=this.appStore.settings()?.language;if(i==null){i=this.appConfigService.defaultLanguage;let o=this.translateService.getBrowserLang();o&&(i=o.match(this.appConfigService.languages.join("|"))?o:this.appConfigService.defaultLanguage)}return this.translateService.use(i)}};e.\u0275fac=function(o){return new(o||e)},e.\u0275prov=E({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();function p(t){return t}var te=(()=>{let e=class e{constructor(){this.route=y(Ne),this.statusCode=he(404),this.messages={401:{summary:p("Unauthorized"),detail:p("Access denied due to invalid credentials."),severity:"warn"},403:{summary:p("Forbidden access"),detail:p("You don't have permission to access this page."),severity:"warn"},404:{summary:p("Page not found"),detail:p("Woops. Looks like this page doesn't exists"),severity:"info"},418:{summary:p("I'm a teapot"),detail:[p("The requested entity body is short and stout"),p("Tip me over and pour me out")].join(" "),severity:"success"},500:{summary:p("Internal server error"),detail:p("Oops, Something went wrong !"),severity:"danger"}}}ngOnInit(){this.route.params.pipe(u(i=>i.status_code||404),u(i=>/^\d+$/.test(i)?parseInt(i,10):404),u(i=>i in this.messages?i:404)).subscribe(i=>this.statusCode.set(i))}};e.\u0275fac=function(o){return new(o||e)},e.\u0275cmp=d({type:e,selectors:[["public-search-error-page"]],decls:8,vars:3,consts:[["showTransitionOptions","0ms",3,"severity"],[1,"ui:w-full"],["translate",""]],template:function(o,r){if(o&1&&(f(0,"p-message",0)(1,"div",1)(2,"h3"),M(3),g(),f(4,"p"),M(5),g(),f(6,"em",2),M(7,"For any information please contact system administrator."),g()()()),o&2){l("severity",r.messages[r.statusCode()].severity);let a=r.messages[r.statusCode()];h(3),G(a.summary),h(2),G(a.detail)}},dependencies:[D,qe,ze],encapsulation:2,changeDetection:0});let t=e;return t})();var st=(()=>{let e=class e{};e.\u0275fac=function(o){return new(o||e)},e.\u0275cmp=d({type:e,selectors:[["public-search-main"]],decls:3,vars:0,consts:[[1,"ui:mt-2","ui:p-20","ui:bg-surface-50"],["translate","",1,"ui:text-center"]],template:function(o,r){o&1&&(f(0,"div",0)(1,"h1",1),M(2,"Public search"),g()())},dependencies:[D],encapsulation:2,changeDetection:0});let t=e;return t})();function at(t){return e=>e.length>=3&&e[1].path==="search"&&e[2].path===t?{consumed:e,posParams:{viewcode:e[0],type:new Le(t,{})}}:null}var ct=[{path:"",component:st,pathMatch:"full"},{matcher:at("collections"),loadChildren:()=>import("./chunk-AQBDQOVB.js").then(t=>t.collectionsRoutes),resolve:{types:Xe},data:{adminMode:!1,detailUrl:"/:viewcode/collections/:pid"}},{path:":viewcode/search/:type",loadChildren:()=>import("./chunk-2CN3JBKM.js").then(t=>t.documentsRoutes),resolve:{types:et},data:{showSearchInput:!1,adminMode:!1,detailUrl:"/:viewcode/:type/:pid"}},{path:"errors/:status_code",component:te},{path:"**",component:te}];var lt={providers:[Ie(),$e(ct),Re(Te([Ye])),$(Fe.forRoot({loader:{provide:De,useClass:We,deps:[W,Oe]},isolate:!1})),Ae(He()),$(Ze.forChild({})),Ve(Ue),_e(()=>y(rt).load()),{provide:W,useClass:j},{provide:Y,useExisting:F},{provide:Se,useFactory:t=>t.getCurrentLang(),deps:[Y]},Je,Ge,je,ke]};we(ot,lt).then(t=>{if(!customElements.get("main-search-bar")){let e=t.injector,n=tt(Qe,{injector:e});customElements.define("main-search-bar",n)}}).catch(t=>console.error(t));