PageSourceSearch

https://foodsafe.cloud/chunk-AVNWCPQI.js

js foodsafe.cloud collected 2026-10-02 01:22:19 UTC 7,395 bytes, 1 lines download raw bytes

1import{d as S}from"./chunk-WZXLMGQU.js";import{k as q}from"./chunk-JXX46AET.js";import{d as X}from"./chunk-SX6ERPNW.js";import{B,Ba as P,Bb as U,Cd as Y,Fa as H,P as z,W as L,Y as W,a as k,ca as G,d as I,e as V,ea as w,ja as l,k as C,l as u,mb as M,p as j,r as d,rb as K,s as N,t as $,xa as F,yb as _}from"./chunk-LTJHT5NU.js";import{a as m,b as y,s as E}from"./chunk-KTBBAXUL.js";function c(i){return typeof i=="function"}function te(i){if(Object.prototype.toString.call(i)!=="[object Object]")return!1;let e=Object.getPrototypeOf(i);return e===null||e===Object.prototype}function h(i){return typeof i=="string"}function g(i){return typeof i=="boolean"}function p(i){return Array.isArray(i)}function R(i){return p(i)?i:[i]}function b(i){return h(i)?[i]:i??[]}function T(i){return te(i)&&(!!i.navigationCommands||!!i.navigationExtras)}function J(i,e,t){let s=c(i.allow)?i.allow(e,t):b(i.allow),r=i.redirectTo;return{allow:s,redirectTo:r}}var f=class i{#e=P({});permissions=this.#e.asReadonly();permissions$;constructor(){this.permissions$=S(this.#e)}clear(){this.#e.set({})}has(e){return this.hasAll(R(e))}hasAll(e){return this.#t(e).every(t=>t)}hasAny(e){return this.#t(e).some(t=>t)}load(e){return this.#i(e)}add(e){let t=h(e)?{[e]:()=>!0}:e;return this.#i(t,this.#e())}remove(e){this.#e.update(t=>(delete t[e],m({},t)))}get(e){let t=this.#e();return e?t[e]:t}has$(e){return!e||e.length===0?u(!0):this.permissions$.pipe(d(s=>b(e).map(r=>s[r]?.(r,s)??!1)),d(s=>s.every(r=>r)))}#t(e){let t=R(e).filter(o=>!!o.trim());if(!e||e.length===0)return[!0];let r=this.#e();return t.map(o=>r[o]?.(o,r)??!1)}#i(e,t={}){return p(e)?this.#e.set(this.#r(e,t)):this.#e.set(this.#s(e,t))}#s(e,t={}){return Object.entries(e).reduce((s,[r,o])=>y(m({},s),{[r]:o}),t)}#r(e,t={}){return e.reduce((s,r)=>y(m({},s),{[r]:()=>!0}),t)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=w({token:i,factory:i.\u0275fac,providedIn:"root"})};var v=class i{#e=P({});roles=this.#e.asReadonly();roles$;#t=l(f);constructor(){this.roles$=S(this.#e)}add(e){let t=h(e)?{[e]:()=>!0}:e;this.#r(t,this.#e())}load(e){this.#r(e)}clear(){this.#e.set({})}remove(e){this.#e.update(t=>(delete t[e],m({},t)))}get(e){let t=this.#e();return e?t[e]:t}has(e){return this.hasAll(e)}hasAll(e){let t=R(e);return this.#i(t).every(r=>g(r)?r:r.every(o=>o))}hasAny(e){let t=R(e);return this.#i(t).some(r=>g(r)?r:r.every(o=>o))}#i(e){return!e||e.length===0?[!0]:b(e).map(s=>this.#s(s))}#s(e){if(!e)return!0;let t=this.#e(),s=t[e];return p(s)?this.#t.has(s):s?.(e,t)??!1}#r(e,t={}){let s=p(e)?this.#o(e,t):this.#n(e,t);return this.#e.set(s)}#n(e,t={}){return Object.entries(e).reduce((s,[r,o])=>(p(o)&&this.#t.add(o),y(m({},s),{[r]:o})),t)}#o(e,t={}){return e.reduce((s,r)=>y(m({},s),{[r]:()=>!0}),t)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=w({token:i,factory:i.\u0275fac,providedIn:"root"})};var Q="default";var O=class i{#e=l(f);#t=l(v);#i=l(q);#s=l(X);checkPermissions(e,t,s){if(!s)return Promise.resolve(!0);let r=J(s,e,t);return!r.allow||r.allow?.length===0?Promise.resolve(!0):c(r.redirectTo)||!T(r.redirectTo)?this.#n(r,e,t):this.#l(r,e,t)}#r(e,t,s,r){let o=c(e)?e(s,t,r):e;if(T(o)){let n=o.navigationCommands;n=c(n)?n(t,r):n;let a=o.navigationExtras??{};return a=c(a)?a(t,r):a,this.#s.warn("Could not activate route ",t," because of missing permission ",s,". Redirecting to ",n," with extras ",a),this.#i.navigate(n,a)}return Array.isArray(o)?(this.#s.warn("Could not activate route ",t," because of missing permission ",s,". Redirecting to ",o),this.#i.navigate(o)):(this.#s.warn("Could not activate route ",t," because of missing permission ",s,". Redirecting to ",o),this.#i.navigate([o]))}#n(e,t,s){let r="",o=C(e.allow).pipe(d(n=>{let a=[this.#e.has(n),this.#t.has(n)];return a.every(ee=>!ee)&&(r=n),a}),z(n=>c(e.redirectTo)?n.some(a=>a===!0):n.every(a=>a===!1),!1),$(n=>c(e.redirectTo)?n?u(!0):this.#o(e,r,t,s).then(()=>!1):r?this.#o(e,r,t,s).then(()=>!n):u(!n)));return j(o)}#o(e,t,s,r){let o=this.#a(e.redirectTo,t);if(o)return this.#r(o,s,t,r);if(c(e.redirectTo)||h(e.redirectTo)||p(e.redirectTo))return this.#r(e.redirectTo,s,t,r);if(e.redirectTo&&!T(e.redirectTo)){let n=e.redirectTo[Q];return n?this.#r(n,s,t,r):Promise.resolve(!1)}return Promise.resolve(!1)}#a(e,t){if(e&&!c(e)&&!h(e)&&!T(e)&&!p(e))return e[t]}
1#l(e,t,s){return E(this,null,function*(){let r=this.#e.has(e.allow)||this.#t.has(e.allow);return!r&&e.redirectTo?this.#r(e.redirectTo,t,e.allow[0],s).then(()=>!1):Promise.resolve(r)})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=w({token:i,factory:i.\u0275fac,providedIn:"root"})};function We(i){return(e,t)=>l(O).checkPermissions(e,t,i)}var A=class i{_permissionsService=l(f);_rolesService=l(v);_viewContainer=l(K);_changeDetector=l(Y);_permissions;_thenTemplateRef=l(M);_elseTemplateRef;_thenViewRef=!1;_elseViewRef=!1;_updateView=new I;_subscription=new k;_if=new V(u(!0));authorized=new F;unauthorized=new F;constructor(){let e=this._if.pipe(L(t=>t));this._subscription=N([e,this._updateView]).pipe(L(([t])=>this._validateRolesAndPermissions().pipe(d(s=>t&&s))),W(t=>t?this._showThenBlock():this._showElseBlock()),W(()=>this._changeDetector.markForCheck())).subscribe()}ngOnInit(){this._updateView.next()}ngOnDestroy(){this._subscription.unsubscribe()}setPermissions(e){this._permissions=e,this._updateView.next()}setThenTemplateRef(e){this._thenTemplateRef=e,this._thenViewRef=!1,this._updateView.next()}setElseTemplateRef(e){this._elseTemplateRef=e,this._elseViewRef=!1,this._updateView.next()}setIf(e){g(e)?this._if.next(u(e)):this._if.next(e)}_validateRolesAndPermissions(){return B(this._permissionsService.permissions$,this._rolesService.roles$).pipe(d(()=>this._validate()))}_validate(){return this._permissions?this._permissionsService.has(this._permissions)||this._rolesService.has(this._permissions):!0}_showElseBlock(){this._elseViewRef||(this.unauthorized.emit(),this._thenViewRef=!1,this._elseViewRef=this._showTemplate(this._elseTemplateRef))}_showThenBlock(){this._thenViewRef||(this.authorized.emit(),this._elseViewRef=!1,this._thenViewRef=this._showTemplate(this._thenTemplateRef))}_showTemplate(e){return this._viewContainer.clear(),e?this._viewContainer.createEmbeddedView(e):!0}static \u0275fac=function(t){return new(t||i)};static \u0275dir=_({type:i,outputs:{authorized:"authorized",unauthorized:"unauthorized"}})};function D(i,e){if(!!!(!e||e.createEmbeddedView))throw new Error(`${i} must be a TemplateRef, but received '${G(e)}'.`)}var Z=class i extends A{static ngTemplateGuard_allow;#e;set watAllow(e){this.setPermissions(e)}set watAllowThen(e){D("watAllowThen",e),this.setThenTemplateRef(e)}set watAllowElse(e){D("watAllowElse",e),this.setElseTemplateRef(e)}set watAllowDeny(e){this.#e=e,this._updateView.next()}set watAllowIf(e){this.setIf(e)}get#t(){return this.#e?this._permissionsService.hasAny(this.#e)||this._rolesService.hasAny(this.#e):!1}_validate(){let e=this.#t;return this._permissions?e?!1:this._permissionsService.has(this._permissions)||this._rolesService.has(this._permissions):!e}static \u0275fac=(()=>{let e;return function(s){return(e||(e=H(i)))(s||i)}})();static \u0275dir=_({type:i,selectors:[["","watAllow",""]],inputs:{watAllow:"watAllow",watAllowThen:"watAllowThen",watAllowElse:"watAllowElse",watAllowDeny:"watAllowDeny",watAllowIf:"watAllowIf"},features:[U]})};export{R as a,f as b,v as c,We as d,Z as e};

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.