@ws-ui/roles-editor 1.11.12-rc11 → 1.11.12-rc13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import { FC } from 'react';
2
2
  import { IContainerProps } from '../Container';
3
3
  interface IStandaloneProps extends IContainerProps {
4
4
  initialValue?: string;
5
+ catalog?: datasources.ICatalog;
5
6
  onChange?: (newValue: string) => void;
6
7
  }
7
8
  declare const StandaloneWithReducerAdapter: FC<IStandaloneProps>;
@@ -66,9 +66,11 @@ type ReducerAction = {
66
66
  interface IExternalData {
67
67
  catalog?: datasources.IEnhancedCatalog | null;
68
68
  qodly?: boolean;
69
- catalogMethods?: catalog.IMethod[];
70
- dataclasses?: datasources.IDataClasses;
71
- singletons?: datasources.ISingletons;
69
+ onSetTabFlags?: (path: string, flags: ITabFlags) => void;
70
+ }
71
+ interface IReducerAdapterExternalProps {
72
+ catalog?: datasources.ICatalog | null;
73
+ qodly?: boolean;
72
74
  onSetTabFlags?: (path: string, flags: ITabFlags) => void;
73
75
  }
74
76
  /**
@@ -82,7 +84,7 @@ interface IReducerValue {
82
84
  /**
83
85
  * External data interface for props
84
86
  */
85
- export interface IReducerAdapterProps extends IExternalData {
87
+ export interface IReducerAdapterProps extends IReducerAdapterExternalProps {
86
88
  children: ReactNode;
87
89
  initialState?: Partial<IReducerState>;
88
90
  }
package/dist/index.cjs.js CHANGED
@@ -85,7 +85,7 @@ function print() { __p += __j.call(arguments, '') }
85
85
  `)+be+`return __p
86
86
  }`;var $e=dO(function(){return rt(V,Ne+"return "+be).apply(r,Z)});if($e.source=be,ip($e))throw $e;return $e}function IV(l){return at(l).toLowerCase()}function RV(l){return at(l).toUpperCase()}function NV(l,f,g){if(l=at(l),l&&(g||f===r))return xE(l);if(!l||!(f=Hr(f)))return l;var R=xn(l),M=xn(f),V=wE(R,M),Z=_E(R,M)+1;return _i(R,V,Z).join("")}function TV(l,f,g){if(l=at(l),l&&(g||f===r))return l.slice(0,SE(l)+1);if(!l||!(f=Hr(f)))return l;var R=xn(l),M=_E(R,xn(f))+1;return _i(R,0,M).join("")}function PV(l,f,g){if(l=at(l),l&&(g||f===r))return l.replace(Rr,"");if(!l||!(f=Hr(f)))return l;var R=xn(l),M=wE(R,xn(f));return _i(R,M).join("")}function kV(l,f){var g=B,R=L;if(Tt(f)){var M="separator"in f?f.separator:M;g="length"in f?Fe(f.length):g,R="omission"in f?Hr(f.omission):R}l=at(l);var V=l.length;if(Io(l)){var Z=xn(l);V=Z.length}if(g>=V)return l;var ie=g-Ro(R);if(ie<1)return R;var ae=Z?_i(Z,0,ie).join(""):l.slice(0,ie);if(M===r)return ae+R;if(Z&&(ie+=ae.length-ie),op(M)){if(l.slice(ie).search(M)){var he,ve=ae;for(M.global||(M=wf(M.source,at(vl.exec(M))+"g")),M.lastIndex=0;he=M.exec(ve);)var be=he.index;ae=ae.slice(0,be===r?ie:be)}}else if(l.indexOf(Hr(M),ie)!=ie){var Ee=ae.lastIndexOf(M);Ee>-1&&(ae=ae.slice(0,Ee))}return ae+R}function AV(l){return l=at(l),l&&Pt.test(l)?l.replace(et,l3):l}var MV=Do(function(l,f,g){return l+(g?" ":"")+f.toUpperCase()}),lp=fS("toUpperCase");function uO(l,f,g){return l=at(l),f=g?r:f,f===r?n3(l)?d3(l):KF(l):l.match(f)||[]}var dO=He(function(l,f){try{return Fr(l,r,f)}catch(g){return ip(g)?g:new Le(g)}}),DV=Qn(function(l,f){return en(f,function(g){g=jn(g),Zn(l,g,rp(l[g],l))}),l});function jV(l){var f=l==null?0:l.length,g=Pe();return l=f?It(l,function(R){if(typeof R[1]!="function")throw new tn(a);return[g(R[0]),R[1]]}):[],He(function(R){for(var M=-1;++M<f;){var V=l[M];if(Fr(V[0],this,R))return Fr(V[1],this,R)}})}function qV(l){return l4(nn(l,p))}function cp(l){return function(){return l}}function LV(l,f){return l==null||l!==l?f:l}var zV=hS(),BV=hS(!0);function kr(l){return l}function up(l){return VE(typeof l=="function"?l:nn(l,p))}function FV(l){return UE(nn(l,p))}function $V(l,f){return GE(l,nn(f,p))}var HV=He(function(l,f){return function(g){return Ba(g,l,f)}}),VV=He(function(l,f){return function(g){return Ba(l,g,f)}});function dp(l,f,g){var R=er(f),M=Gl(f,R);g==null&&!(Tt(f)&&(M.length||!R.length))&&(g=f,f=l,l=this,M=Gl(f,er(f)));var V=!(Tt(g)&&"chain"in g)||!!g.chain,Z=ti(l);return en(M,function(ie){var ae=f[ie];l[ie]=ae,Z&&(l.prototype[ie]=function(){var he=this.__chain__;if(V||he){var ve=l(this.__wrapped__),be=ve.__actions__=Nr(this.__actions__);return be.push({func:ae,args:arguments,thisArg:l}),ve.__chain__=he,ve}return ae.apply(l,gi([this.value()],arguments))})}),l}function WV(){return nr._===this&&(nr._=m3),this}function fp(){}function UV(l){return l=Fe(l),He(function(f){return KE(f,l)})}var GV=Hf(It),KV=Hf(vE),YV=Hf(hf);function fO(l){return Xf(l)?vf(jn(l)):O4(l)}function XV(l){return function(f){return l==null?r:Yi(l,f)}}var ZV=gS(),JV=gS(!0);function pp(){return[]}function hp(){return!1}function QV(){return{}}function eW(){return""}function tW(){return!0}function rW(l,f){if(l=Fe(l),l<1||l>U)return[];var g=W,R=cr(l,W);f=Pe(f),l-=W;for(var M=bf(R,f);++g<l;)f(g);return M}function nW(l){return ze(l)?It(l,jn):Vr(l)?[l]:Nr(kS(at(l)))}function iW(l){var f=++v3;return at(l)+f}var oW=Ql(function(l,f){return l+f},0),aW=Vf("ceil"),sW=Ql(function(l,f){return l/f},1),lW=Vf("floor");function cW(l){return l&&l.length?Ul(l,kr,Nf):r}function uW(l,f){return l&&l.length?Ul(l,Pe(f,2),Nf):r}function dW(l){return bE(l,kr)}function fW(l,f){return bE(l,Pe(f,2))}function pW(l){return l&&l.length?Ul(l,kr,Af):r}function hW(l,f){return l&&l.length?Ul(l,Pe(f,2),Af):r}var vW=Ql(function(l,f){return l*f},1),gW=Vf("round"),mW=Ql(function(l,f){return l-f},0);function bW(l){return l&&l.length?mf(l,kr):0}function yW(l,f){return l&&l.length?mf(l,Pe(f,2)):0}return F.after=F6,F.ary=HS,F.assign=RH,F.assignIn=nO,F.assignInWith=fc,F.assignWith=NH,F.at=TH,F.before=VS,F.bind=rp,F.bindAll=DV,F.bindKey=WS,F.castArray=Q6,F.chain=BS,F.chunk=l$,F.compact=c$,F.concat=u$,F.cond=jV,F.conforms=qV,F.constant=cp,F.countBy=b6,F.create=PH,F.curry=US,F.curryRight=GS,F.debounce=KS,F.defaults=kH,F.defaultsDeep=AH,F.defer=$6,F.delay=H6,F.difference=d$,F.differenceBy=f$,F.differenceWith=p$,F.drop=h$,F.dropRight=v$,F.dropRightWhile=g$,F.dropWhile=m$,F.fill=b$,F.filter=x6,F.flatMap=E6,F.flatMapDeep=S6,F.flatMapDepth=O6,F.flatten=jS,F.flattenDeep=y$,F.flattenDepth=x$,F.flip=V6,F.flow=zV,F.flowRight=BV,F.fromPairs=w$,F.functions=BH,F.functionsIn=FH,F.groupBy=C6,F.initial=E$,F.intersection=S$,F.intersectionBy=O$,F.intersectionWith=C$,F.invert=HH,F.invertBy=VH,F.invokeMap=R6,F.iteratee=up,F.keyBy=N6,F.keys=er,F.keysIn=Pr,F.map=ac,F.mapKeys=UH,F.mapValues=GH,F.matches=FV,F.matchesProperty=$V,F.memoize=lc,F.merge=KH,F.mergeWith=iO,F.method=HV,F.methodOf=VV,F.mixin=dp,F.negate=cc,F.nthArg=UV,F.omit=YH,F.omitBy=XH,F.once=W6,F.orderBy=T6,F.over=GV,F.overArgs=U6,F.overEvery=KV,F.overSome=YV,F.partial=np,F.partialRight=YS,F.partition=P6,F.pick=ZH,F.pickBy=oO,F.property=fO,F.propertyOf=XV,F.pull=T$,F.pullAll=LS,F.pullAllBy=P$,F.pullAllWith=k$,F.pullAt=A$,F.range=ZV,F.rangeRight=JV,F.rearg=G6,F.reject=M6,F.remove=M$,F.rest=K6,F.reverse=ep,F.sampleSize=j6,F.set=QH,F.setWith=eV,F.shuffle=q6,F.slice=D$,F.sortBy=B6,F.sortedUniq=$$,F.sortedUniqBy=H$,F.split=EV,F.spread=Y6,F.tail=V$,F.take=W$,F.takeRight=U$,F.takeRightWhile=G$,F.takeWhile=K$,F.tap=c6,F.throttle=X6,F.thru=oc,F.toArray=eO,F.toPairs=aO,F.toPairsIn=sO,F.toPath=nW,F.toPlainObject=rO,F.transform=tV,F.unary=Z6,F.union=Y$,F.unionBy=X$,F.unionWith=Z$,F.uniq=J$,F.uniqBy=Q$,F.uniqWith=e6,F.unset=rV,F.unzip=tp,F.unzipWith=zS,F.update=nV,F.updateWith=iV,F.values=Lo,F.valuesIn=oV,F.without=t6,F.words=uO,F.wrap=J6,F.xor=r6,F.xorBy=n6,F.xorWith=i6,F.zip=o6,F.zipObject=a6,F.zipObjectDeep=s6,F.zipWith=l6,F.entries=aO,F.entriesIn=sO,F.extend=nO,F.extendWith=fc,dp(F,F),F.add=oW,F.attempt=dO,F.camelCase=cV,F.capitalize=lO,F.ceil=aW,F.clamp=aV,F.clone=eH,F.cloneDeep=rH,F.cloneDeepWith=nH,F.cloneWith=tH,F.conformsTo=iH,F.deburr=cO,F.defaultTo=LV,F.divide=sW,F.endsWith=uV,F.eq=_n,F.escape=dV,F.escapeRegExp=fV,F.every=y6,F.find=w6,F.findIndex=MS,F.findKey=MH,F.findLast=_6,F.findLastIndex=DS,F.findLastKey=DH,F.floor=lW,F.forEach=FS,F.forEachRight=$S,F.forIn=jH,F.forInRight=qH,F.forOwn=LH,F.forOwnRight=zH,F.get=ap,F.gt=oH,F.gte=aH,F.has=$H,F.hasIn=sp,F.head=qS,F.identity=kr,F.includes=I6,F.indexOf=_$,F.inRange=sV,F.invoke=WH,F.isArguments=Ji,F.isArray=ze,F.isArrayBuffer=sH,F.isArrayLike=Tr,F.isArrayLikeObject=zt,F.isBoolean=lH,F.isBuffer=Ei,F.isDate=cH,F.isElement=uH,F.isEmpty=dH,F.isEqual=fH,F.isEqualWith=pH,F.isError=ip,F.isFinite=hH,F.isFunction=ti,F.isInteger=XS,F.isLength=uc,F.isMap=ZS,F.isMatch=vH,F.isMatchWith=gH,F.isNaN=mH,F.isNative=bH,F.isNil=xH,F.isNull=yH,F.isNumber=JS,F.isObject=Tt,F.isObjectLike=kt,F.isPlainObject=Ua,F.isRegExp=op,F.isSafeInteger=wH,F.isSet=QS,F.isString=dc,F.isSymbol=Vr,F.isTypedArray=qo,F.isUndefined=_H,F.isWeakMap=EH,F.isWeakSet=SH,F.join=I$,F.kebabCase=pV,F.last=an,F.lastIndexOf=R$,F.lowerCase=hV,F.lowerFirst=vV,F.lt=OH,F.lte=CH,F.max=cW,F.maxBy=uW,F.mean=dW,F.meanBy=fW,F.min=pW,F.minBy=hW,F.stubArray=pp,F.stubFalse=hp,F.stubObject=QV,F.stubString=eW,F.stubTrue=tW,F.multiply=vW,F.nth=N$,F.noConflict=WV,F.noop=fp,F.now=sc,F.pad=gV,F.padEnd=mV,F.padStart=bV,F.parseInt=yV,F.random=lV,F.reduce=k6,F.reduceRight=A6,F.repeat=xV,F.replace=wV,F.result=JH,F.round=gW,F.runInContext=oe,F.sample=D6,F.size=L6,F.snakeCase=_V,F.some=z6,F.sortedIndex=j$,F.sortedIndexBy=q$,F.sortedIndexOf=L$,F.sortedLastIndex=z$,F.sortedLastIndexBy=B$,F.sortedLastIndexOf=F$,F.startCase=SV,F.startsWith=OV,F.subtract=mW,F.sum=bW,F.sumBy=yW,F.template=CV,F.times=rW,F.toFinite=ri,F.toInteger=Fe,F.toLength=tO,F.toLower=IV,F.toNumber=sn,F.toSafeInteger=IH,F.toString=at,F.toUpper=RV,F.trim=NV,F.trimEnd=TV,F.trimStart=PV,F.truncate=kV,F.unescape=AV,F.uniqueId=iW,F.upperCase=MV,F.upperFirst=lp,F.each=FS,F.eachRight=$S,F.first=qS,dp(F,(function(){var l={};return Mn(F,function(f,g){ft.call(F.prototype,g)||(l[g]=f)}),l})(),{chain:!1}),F.VERSION=n,en(["bind","bindKey","curry","curryRight","partial","partialRight"],function(l){F[l].placeholder=F}),en(["drop","take"],function(l,f){Ye.prototype[l]=function(g){g=g===r?1:Kt(Fe(g),0);var R=this.__filtered__&&!f?new Ye(this):this.clone();return R.__filtered__?R.__takeCount__=cr(g,R.__takeCount__):R.__views__.push({size:cr(g,W),type:l+(R.__dir__<0?"Right":"")}),R},Ye.prototype[l+"Right"]=function(g){return this.reverse()[l](g).reverse()}}),en(["filter","map","takeWhile"],function(l,f){var g=f+1,R=g==P||g==$;Ye.prototype[l]=function(M){var V=this.clone();return V.__iteratees__.push({iteratee:Pe(M,3),type:g}),V.__filtered__=V.__filtered__||R,V}}),en(["head","last"],function(l,f){var g="take"+(f?"Right":"");Ye.prototype[l]=function(){return this[g](1).value()[0]}}),en(["initial","tail"],function(l,f){var g="drop"+(f?"":"Right");Ye.prototype[l]=function(){return this.__filtered__?new Ye(this):this[g](1)}}),Ye.prototype.compact=function(){return this.filter(kr)},Ye.prototype.find=function(l){return this.filter(l).head()},Ye.prototype.findLast=function(l){return this.reverse().find(l)},Ye.prototype.invokeMap=He(function(l,f){return typeof l=="function"?new Ye(this):this.map(function(g){return Ba(g,l,f)})}),Ye.prototype.reject=function(l){return this.filter(cc(Pe(l)))},Ye.prototype.slice=function(l,f){l=Fe(l);var g=this;return g.__filtered__&&(l>0||f<0)?new Ye(g):(l<0?g=g.takeRight(-l):l&&(g=g.drop(l)),f!==r&&(f=Fe(f),g=f<0?g.dropRight(-f):g.take(f-l)),g)},Ye.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse()},Ye.prototype.toArray=function(){return this.take(W)},Mn(Ye.prototype,function(l,f){var g=/^(?:filter|find|map|reject)|While$/.test(f),R=/^(?:head|last)$/.test(f),M=F[R?"take"+(f=="last"?"Right":""):f],V=R||/^find/.test(f);M&&(F.prototype[f]=function(){var Z=this.__wrapped__,ie=R?[1]:arguments,ae=Z instanceof Ye,he=ie[0],ve=ae||ze(Z),be=function(Ge){var Ze=M.apply(F,gi([Ge],ie));return R&&Ee?Ze[0]:Ze};ve&&g&&typeof he=="function"&&he.length!=1&&(ae=ve=!1);var Ee=this.__chain__,Ne=!!this.__actions__.length,Ae=V&&!Ee,$e=ae&&!Ne;if(!V&&ve){Z=$e?Z:new Ye(this);var Me=l.apply(Z,ie);return Me.__actions__.push({func:oc,args:[be],thisArg:r}),new rn(Me,Ee)}return Ae&&$e?l.apply(this,ie):(Me=this.thru(be),Ae?R?Me.value()[0]:Me.value():Me)})}),en(["pop","push","shift","sort","splice","unshift"],function(l){var f=Pl[l],g=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",R=/^(?:pop|shift)$/.test(l);F.prototype[l]=function(){var M=arguments;if(R&&!this.__chain__){var V=this.value();return f.apply(ze(V)?V:[],M)}return this[g](function(Z){return f.apply(ze(Z)?Z:[],M)})}}),Mn(Ye.prototype,function(l,f){var g=F[f];if(g){var R=g.name+"";ft.call(ko,R)||(ko[R]=[]),ko[R].push({name:f,func:g})}}),ko[Jl(r,w).name]=[{name:"wrapper",func:r}],Ye.prototype.clone=A3,Ye.prototype.reverse=M3,Ye.prototype.value=D3,F.prototype.at=u6,F.prototype.chain=d6,F.prototype.commit=f6,F.prototype.next=p6,F.prototype.plant=v6,F.prototype.reverse=g6,F.prototype.toJSON=F.prototype.valueOf=F.prototype.value=m6,F.prototype.first=F.prototype.head,Aa&&(F.prototype[Aa]=h6),F}),No=f3();Vi?((Vi.exports=No)._=No,uf._=No):nr._=No}).call(Gie)})(Es,Es.exports)),Es.exports}var lo=Kie();function Yie(){const e=Je.useAppDispatch(),t=Je.useAppSelector(Je.selectRoles),r=Je.useAppSelector(Je.selectPrivileges),n=Je.useAppSelector(Je.selectRolesFlags),i=Je.useAppSelector(Je.selectRolesAndPrivileges,(x,m)=>lo.isEqual(x,m)),o=Je.useAppSelector(Je.selectCatalog),a=Je.useAppSelector(Je.selectQodly),s=Je.useAppSelector(Je.selectSelectedTab),c=Je.useAppSelector(Je.selectForceLogin),u=Je.useAppSelector(Je.selectRestrictedByDefault),d=Je.useAppSelector(Je.selectGuestPrivilege),p=Je.useAppSelector(Je.selectCatalogMethods),v=Je.useAppSelector(Je.selectDataclasses),h=Je.useAppSelector(Je.selectSingletons);return{getRoles:()=>t,getPrivileges:()=>r,getRolesFlags:()=>n,getRolesAndPrivileges:()=>i,getCatalog:()=>o,getQodly:()=>a,getSelectedTab:()=>s,getForceLogin:()=>c??!1,getRestrictedByDefault:()=>u??!1,getGuestPrivilege:()=>d??null,getCatalogMethods:()=>p,getDataclasses:()=>v,getSingletons:()=>h,actions:{updateRoles:x=>{e(Je.updateRoles(x))},updatePrivileges:x=>{e(Je.updatePrivileges(x))},setRolesContent:x=>{e(Je.setRolesContent(x))},toggleTab:x=>{e(Je.toggleTab(x))},toggleForceLogin:x=>{e(Je.toggleForceLogin(x))},toggleRestrictedByDefault:x=>{e(Je.toggleRestrictedByDefault(x))},setTabFlags:(x,m)=>{e(Je.setTabFlags({path:x,flags:m}))},openModal:async x=>await e(Je.openModal(x)).unwrap()}}}const hB=O.createContext(null),vB=({children:e,adapter:t})=>C.jsx(hB.Provider,{value:t,children:e});function pr(){const e=O.useContext(hB);if(!e)throw new Error("useEditorStateAdapter must be used within an EditorStateAdapterProvider");return e}var jw=function(e,t){return jw=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},jw(e,t)};function cl(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");jw(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function qw(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Lw(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function zw(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function Vn(e){return typeof e=="function"}function gB(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var by=gB(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
87
87
  `+r.map(function(n,i){return i+1+") "+n.toString()}).join(`
88
- `):"",this.name="UnsubscriptionError",this.errors=r}});function Bw(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Id=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,i,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=qw(a),c=s.next();!c.done;c=s.next()){var u=c.value;u.remove(this)}}catch(m){t={error:m}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var d=this.initialTeardown;if(Vn(d))try{d()}catch(m){o=m instanceof by?m.errors:[m]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var v=qw(p),h=v.next();!h.done;h=v.next()){var x=h.value;try{yA(x)}catch(m){o=o??[],m instanceof by?o=zw(zw([],Lw(o)),Lw(m.errors)):o.push(m)}}}catch(m){n={error:m}}finally{try{h&&!h.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}}if(o)throw new by(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)yA(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Bw(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Bw(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),mB=Id.EMPTY;function bB(e){return e instanceof Id||e&&"closed"in e&&Vn(e.remove)&&Vn(e.add)&&Vn(e.unsubscribe)}function yA(e){Vn(e)?e():e.unsubscribe()}var Xie={Promise:void 0},Zie={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,zw([e,t],Lw(r)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function Jie(e){Zie.setTimeout(function(){throw e})}function xA(){}function lu(e){e()}var A_=(function(e){cl(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,bB(r)&&r.add(n)):n.destination=toe,n}return t.create=function(r,n,i){return new Fw(r,n,i)},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(Id),Qie=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Bc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Bc(n)}else Bc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Bc(r)}},e})(),Fw=(function(e){cl(t,e);function t(r,n,i){var o=e.call(this)||this,a;return Vn(r)||!r?a={next:r??void 0,error:n??void 0,complete:i??void 0}:a=r,o.destination=new Qie(a),o}return t})(A_);function Bc(e){Jie(e)}function eoe(e){throw e}var toe={closed:!0,next:xA,error:eoe,complete:xA},roe=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function noe(e){return e}function ioe(e){return e.length===0?noe:e.length===1?e[0]:function(r){return e.reduce(function(n,i){return i(n)},r)}}var wA=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var i=this,o=aoe(t)?t:new Fw(t,r,n);return lu(function(){var a=i,s=a.operator,c=a.source;o.add(s?s.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=_A(r),new r(function(i,o){var a=new Fw({next:function(s){try{t(s)}catch(c){o(c),a.unsubscribe()}},error:o,complete:i});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[roe]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ioe(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=_A(t),new t(function(n,i){var o;r.subscribe(function(a){return o=a},function(a){return i(a)},function(){return n(o)})})},e.create=function(t){return new e(t)},e})();function _A(e){var t;return(t=e??Xie.Promise)!==null&&t!==void 0?t:Promise}function ooe(e){return e&&Vn(e.next)&&Vn(e.error)&&Vn(e.complete)}function aoe(e){return e&&e instanceof A_||ooe(e)&&bB(e)}function soe(e){return Vn(e==null?void 0:e.lift)}function loe(e){return function(t){if(soe(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function coe(e,t,r,n,i){return new uoe(e,t,r,n,i)}var uoe=(function(e){cl(t,e);function t(r,n,i,o,a,s){var c=e.call(this,r)||this;return c.onFinalize=a,c.shouldUnsubscribe=s,c._next=n?function(u){try{n(u)}catch(d){r.error(d)}}:e.prototype._next,c._error=o?function(u){try{o(u)}catch(d){r.error(d)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=i?function(){try{i()}catch(u){r.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t})(A_),doe=gB(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),yB=(function(e){cl(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new EA(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new doe},t.prototype.next=function(r){var n=this;lu(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=qw(n.currentObservers),s=a.next();!s.done;s=a.next()){var c=s.value;c.next(r)}}catch(u){i={error:u}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}}})},t.prototype.error=function(r){var n=this;lu(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},t.prototype.complete=function(){var r=this;lu(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,i=this,o=i.hasError,a=i.isStopped,s=i.observers;return o||a?mB:(this.currentObservers=null,s.push(r),new Id(function(){n.currentObservers=null,Bw(s,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,o=n.thrownError,a=n.isStopped;i?r.error(o):a&&r.complete()},t.prototype.asObservable=function(){var r=new wA;return r.source=this,r},t.create=function(r,n){return new EA(r,n)},t})(wA),EA=(function(e){cl(t,e);function t(r,n){var i=e.call(this)||this;return i.destination=r,i.source=n,i}return t.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},t.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:mB},t})(yB);function foe(e,t){return loe(function(r,n){var i=0;r.subscribe(coe(n,function(o){return e.call(t,o,i++)&&n.next(o)}))})}var yy={},rs={},Fc={},SA;function xB(){if(SA)return Fc;SA=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.default=r;let e;const t=new Uint8Array(16);function r(){if(!e&&(e=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!e))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(t)}return Fc}var Wo={},ns={},is={},OA;function poe(){if(OA)return is;OA=1,Object.defineProperty(is,"__esModule",{value:!0}),is.default=void 0;var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;return is.default=e,is}var CA;function Rd(){if(CA)return ns;CA=1,Object.defineProperty(ns,"__esModule",{value:!0}),ns.default=void 0;var e=t(poe());function t(i){return i&&i.__esModule?i:{default:i}}function r(i){return typeof i=="string"&&e.default.test(i)}var n=r;return ns.default=n,ns}var IA;function Nd(){if(IA)return Wo;IA=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.default=void 0,Wo.unsafeStringify=n;var e=t(Rd());function t(a){return a&&a.__esModule?a:{default:a}}const r=[];for(let a=0;a<256;++a)r.push((a+256).toString(16).slice(1));function n(a,s=0){return r[a[s+0]]+r[a[s+1]]+r[a[s+2]]+r[a[s+3]]+"-"+r[a[s+4]]+r[a[s+5]]+"-"+r[a[s+6]]+r[a[s+7]]+"-"+r[a[s+8]]+r[a[s+9]]+"-"+r[a[s+10]]+r[a[s+11]]+r[a[s+12]]+r[a[s+13]]+r[a[s+14]]+r[a[s+15]]}function i(a,s=0){const c=n(a,s);if(!(0,e.default)(c))throw TypeError("Stringified UUID is invalid");return c}var o=i;return Wo.default=o,Wo}var RA;function hoe(){if(RA)return rs;RA=1,Object.defineProperty(rs,"__esModule",{value:!0}),rs.default=void 0;var e=r(xB()),t=Nd();function r(u){return u&&u.__esModule?u:{default:u}}let n,i,o=0,a=0;function s(u,d,p){let v=d&&p||0;const h=d||new Array(16);u=u||{};let x=u.node||n,m=u.clockseq!==void 0?u.clockseq:i;if(x==null||m==null){const E=u.random||(u.rng||e.default)();x==null&&(x=n=[E[0]|1,E[1],E[2],E[3],E[4],E[5]]),m==null&&(m=i=(E[6]<<8|E[7])&16383)}let b=u.msecs!==void 0?u.msecs:Date.now(),w=u.nsecs!==void 0?u.nsecs:a+1;const y=b-o+(w-a)/1e4;if(y<0&&u.clockseq===void 0&&(m=m+1&16383),(y<0||b>o)&&u.nsecs===void 0&&(w=0),w>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");o=b,a=w,i=m,b+=122192928e5;const _=((b&268435455)*1e4+w)%4294967296;h[v++]=_>>>24&255,h[v++]=_>>>16&255,h[v++]=_>>>8&255,h[v++]=_&255;const S=b/4294967296*1e4&268435455;h[v++]=S>>>8&255,h[v++]=S&255,h[v++]=S>>>24&15|16,h[v++]=S>>>16&255,h[v++]=m>>>8|128,h[v++]=m&255;for(let E=0;E<6;++E)h[v+E]=x[E];return d||(0,t.unsafeStringify)(h)}var c=s;return rs.default=c,rs}var os={},Ni={},as={},NA;function wB(){if(NA)return as;NA=1,Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var e=t(Rd());function t(i){return i&&i.__esModule?i:{default:i}}function r(i){if(!(0,e.default)(i))throw TypeError("Invalid UUID");let o;const a=new Uint8Array(16);return a[0]=(o=parseInt(i.slice(0,8),16))>>>24,a[1]=o>>>16&255,a[2]=o>>>8&255,a[3]=o&255,a[4]=(o=parseInt(i.slice(9,13),16))>>>8,a[5]=o&255,a[6]=(o=parseInt(i.slice(14,18),16))>>>8,a[7]=o&255,a[8]=(o=parseInt(i.slice(19,23),16))>>>8,a[9]=o&255,a[10]=(o=parseInt(i.slice(24,36),16))/1099511627776&255,a[11]=o/4294967296&255,a[12]=o>>>24&255,a[13]=o>>>16&255,a[14]=o>>>8&255,a[15]=o&255,a}var n=r;return as.default=n,as}var TA;function _B(){if(TA)return Ni;TA=1,Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.URL=Ni.DNS=void 0,Ni.default=a;var e=Nd(),t=r(wB());function r(s){return s&&s.__esModule?s:{default:s}}function n(s){s=unescape(encodeURIComponent(s));const c=[];for(let u=0;u<s.length;++u)c.push(s.charCodeAt(u));return c}const i="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Ni.DNS=i;const o="6ba7b811-9dad-11d1-80b4-00c04fd430c8";Ni.URL=o;function a(s,c,u){function d(p,v,h,x){var m;if(typeof p=="string"&&(p=n(p)),typeof v=="string"&&(v=(0,t.default)(v)),((m=v)===null||m===void 0?void 0:m.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let b=new Uint8Array(16+p.length);if(b.set(v),b.set(p,v.length),b=u(b),b[6]=b[6]&15|c,b[8]=b[8]&63|128,h){x=x||0;for(let w=0;w<16;++w)h[x+w]=b[w];return h}return(0,e.unsafeStringify)(b)}try{d.name=s}catch{}return d.DNS=i,d.URL=o,d}return Ni}var ss={},PA;function voe(){if(PA)return ss;PA=1,Object.defineProperty(ss,"__esModule",{value:!0}),ss.default=void 0;function e(h){if(typeof h=="string"){const x=unescape(encodeURIComponent(h));h=new Uint8Array(x.length);for(let m=0;m<x.length;++m)h[m]=x.charCodeAt(m)}return t(n(i(h),h.length*8))}function t(h){const x=[],m=h.length*32,b="0123456789abcdef";for(let w=0;w<m;w+=8){const y=h[w>>5]>>>w%32&255,_=parseInt(b.charAt(y>>>4&15)+b.charAt(y&15),16);x.push(_)}return x}function r(h){return(h+64>>>9<<4)+14+1}function n(h,x){h[x>>5]|=128<<x%32,h[r(x)-1]=x;let m=1732584193,b=-271733879,w=-1732584194,y=271733878;for(let _=0;_<h.length;_+=16){const S=m,E=b,I=w,N=y;m=c(m,b,w,y,h[_],7,-680876936),y=c(y,m,b,w,h[_+1],12,-389564586),w=c(w,y,m,b,h[_+2],17,606105819),b=c(b,w,y,m,h[_+3],22,-1044525330),m=c(m,b,w,y,h[_+4],7,-176418897),y=c(y,m,b,w,h[_+5],12,1200080426),w=c(w,y,m,b,h[_+6],17,-1473231341),b=c(b,w,y,m,h[_+7],22,-45705983),m=c(m,b,w,y,h[_+8],7,1770035416),y=c(y,m,b,w,h[_+9],12,-1958414417),w=c(w,y,m,b,h[_+10],17,-42063),b=c(b,w,y,m,h[_+11],22,-1990404162),m=c(m,b,w,y,h[_+12],7,1804603682),y=c(y,m,b,w,h[_+13],12,-40341101),w=c(w,y,m,b,h[_+14],17,-1502002290),b=c(b,w,y,m,h[_+15],22,1236535329),m=u(m,b,w,y,h[_+1],5,-165796510),y=u(y,m,b,w,h[_+6],9,-1069501632),w=u(w,y,m,b,h[_+11],14,643717713),b=u(b,w,y,m,h[_],20,-373897302),m=u(m,b,w,y,h[_+5],5,-701558691),y=u(y,m,b,w,h[_+10],9,38016083),w=u(w,y,m,b,h[_+15],14,-660478335),b=u(b,w,y,m,h[_+4],20,-405537848),m=u(m,b,w,y,h[_+9],5,568446438),y=u(y,m,b,w,h[_+14],9,-1019803690),w=u(w,y,m,b,h[_+3],14,-187363961),b=u(b,w,y,m,h[_+8],20,1163531501),m=u(m,b,w,y,h[_+13],5,-1444681467),y=u(y,m,b,w,h[_+2],9,-51403784),w=u(w,y,m,b,h[_+7],14,1735328473),b=u(b,w,y,m,h[_+12],20,-1926607734),m=d(m,b,w,y,h[_+5],4,-378558),y=d(y,m,b,w,h[_+8],11,-2022574463),w=d(w,y,m,b,h[_+11],16,1839030562),b=d(b,w,y,m,h[_+14],23,-35309556),m=d(m,b,w,y,h[_+1],4,-1530992060),y=d(y,m,b,w,h[_+4],11,1272893353),w=d(w,y,m,b,h[_+7],16,-155497632),b=d(b,w,y,m,h[_+10],23,-1094730640),m=d(m,b,w,y,h[_+13],4,681279174),y=d(y,m,b,w,h[_],11,-358537222),w=d(w,y,m,b,h[_+3],16,-722521979),b=d(b,w,y,m,h[_+6],23,76029189),m=d(m,b,w,y,h[_+9],4,-640364487),y=d(y,m,b,w,h[_+12],11,-421815835),w=d(w,y,m,b,h[_+15],16,530742520),b=d(b,w,y,m,h[_+2],23,-995338651),m=p(m,b,w,y,h[_],6,-198630844),y=p(y,m,b,w,h[_+7],10,1126891415),w=p(w,y,m,b,h[_+14],15,-1416354905),b=p(b,w,y,m,h[_+5],21,-57434055),m=p(m,b,w,y,h[_+12],6,1700485571),y=p(y,m,b,w,h[_+3],10,-1894986606),w=p(w,y,m,b,h[_+10],15,-1051523),b=p(b,w,y,m,h[_+1],21,-2054922799),m=p(m,b,w,y,h[_+8],6,1873313359),y=p(y,m,b,w,h[_+15],10,-30611744),w=p(w,y,m,b,h[_+6],15,-1560198380),b=p(b,w,y,m,h[_+13],21,1309151649),m=p(m,b,w,y,h[_+4],6,-145523070),y=p(y,m,b,w,h[_+11],10,-1120210379),w=p(w,y,m,b,h[_+2],15,718787259),b=p(b,w,y,m,h[_+9],21,-343485551),m=o(m,S),b=o(b,E),w=o(w,I),y=o(y,N)}return[m,b,w,y]}function i(h){if(h.length===0)return[];const x=h.length*8,m=new Uint32Array(r(x));for(let b=0;b<x;b+=8)m[b>>5]|=(h[b/8]&255)<<b%32;return m}function o(h,x){const m=(h&65535)+(x&65535);return(h>>16)+(x>>16)+(m>>16)<<16|m&65535}function a(h,x){return h<<x|h>>>32-x}function s(h,x,m,b,w,y){return o(a(o(o(x,h),o(b,y)),w),m)}function c(h,x,m,b,w,y,_){return s(x&m|~x&b,h,x,w,y,_)}function u(h,x,m,b,w,y,_){return s(x&b|m&~b,h,x,w,y,_)}function d(h,x,m,b,w,y,_){return s(x^m^b,h,x,w,y,_)}function p(h,x,m,b,w,y,_){return s(m^(x|~b),h,x,w,y,_)}var v=e;return ss.default=v,ss}var kA;function goe(){if(kA)return os;kA=1,Object.defineProperty(os,"__esModule",{value:!0}),os.default=void 0;var e=r(_B()),t=r(voe());function r(o){return o&&o.__esModule?o:{default:o}}var i=(0,e.default)("v3",48,t.default);return os.default=i,os}var ls={},cs={},AA;function moe(){if(AA)return cs;AA=1,Object.defineProperty(cs,"__esModule",{value:!0}),cs.default=void 0;var t={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};return cs.default=t,cs}var MA;function boe(){if(MA)return ls;MA=1,Object.defineProperty(ls,"__esModule",{value:!0}),ls.default=void 0;var e=n(moe()),t=n(xB()),r=Nd();function n(a){return a&&a.__esModule?a:{default:a}}function i(a,s,c){if(e.default.randomUUID&&!s&&!a)return e.default.randomUUID();a=a||{};const u=a.random||(a.rng||t.default)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,s){c=c||0;for(let d=0;d<16;++d)s[c+d]=u[d];return s}return(0,r.unsafeStringify)(u)}var o=i;return ls.default=o,ls}var us={},ds={},DA;function yoe(){if(DA)return ds;DA=1,Object.defineProperty(ds,"__esModule",{value:!0}),ds.default=void 0;function e(i,o,a,s){switch(i){case 0:return o&a^~o&s;case 1:return o^a^s;case 2:return o&a^o&s^a&s;case 3:return o^a^s}}function t(i,o){return i<<o|i>>>32-o}function r(i){const o=[1518500249,1859775393,2400959708,3395469782],a=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof i=="string"){const d=unescape(encodeURIComponent(i));i=[];for(let p=0;p<d.length;++p)i.push(d.charCodeAt(p))}else Array.isArray(i)||(i=Array.prototype.slice.call(i));i.push(128);const s=i.length/4+2,c=Math.ceil(s/16),u=new Array(c);for(let d=0;d<c;++d){const p=new Uint32Array(16);for(let v=0;v<16;++v)p[v]=i[d*64+v*4]<<24|i[d*64+v*4+1]<<16|i[d*64+v*4+2]<<8|i[d*64+v*4+3];u[d]=p}u[c-1][14]=(i.length-1)*8/Math.pow(2,32),u[c-1][14]=Math.floor(u[c-1][14]),u[c-1][15]=(i.length-1)*8&4294967295;for(let d=0;d<c;++d){const p=new Uint32Array(80);for(let w=0;w<16;++w)p[w]=u[d][w];for(let w=16;w<80;++w)p[w]=t(p[w-3]^p[w-8]^p[w-14]^p[w-16],1);let v=a[0],h=a[1],x=a[2],m=a[3],b=a[4];for(let w=0;w<80;++w){const y=Math.floor(w/20),_=t(v,5)+e(y,h,x,m)+b+o[y]+p[w]>>>0;b=m,m=x,x=t(h,30)>>>0,h=v,v=_}a[0]=a[0]+v>>>0,a[1]=a[1]+h>>>0,a[2]=a[2]+x>>>0,a[3]=a[3]+m>>>0,a[4]=a[4]+b>>>0}return[a[0]>>24&255,a[0]>>16&255,a[0]>>8&255,a[0]&255,a[1]>>24&255,a[1]>>16&255,a[1]>>8&255,a[1]&255,a[2]>>24&255,a[2]>>16&255,a[2]>>8&255,a[2]&255,a[3]>>24&255,a[3]>>16&255,a[3]>>8&255,a[3]&255,a[4]>>24&255,a[4]>>16&255,a[4]>>8&255,a[4]&255]}var n=r;return ds.default=n,ds}var jA;function xoe(){if(jA)return us;jA=1,Object.defineProperty(us,"__esModule",{value:!0}),us.default=void 0;var e=r(_B()),t=r(yoe());function r(o){return o&&o.__esModule?o:{default:o}}var i=(0,e.default)("v5",80,t.default);return us.default=i,us}var fs={},qA;function woe(){if(qA)return fs;qA=1,Object.defineProperty(fs,"__esModule",{value:!0}),fs.default=void 0;var e="00000000-0000-0000-0000-000000000000";return fs.default=e,fs}var ps={},LA;function _oe(){if(LA)return ps;LA=1,Object.defineProperty(ps,"__esModule",{value:!0}),ps.default=void 0;var e=t(Rd());function t(i){return i&&i.__esModule?i:{default:i}}function r(i){if(!(0,e.default)(i))throw TypeError("Invalid UUID");return parseInt(i.slice(14,15),16)}var n=r;return ps.default=n,ps}var zA;function Eoe(){return zA||(zA=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NIL",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"v1",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"v3",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"v4",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"v5",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"validate",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return a.default}});var t=d(hoe()),r=d(goe()),n=d(boe()),i=d(xoe()),o=d(woe()),a=d(_oe()),s=d(Rd()),c=d(Nd()),u=d(wB());function d(p){return p&&p.__esModule?p:{default:p}}})(yy)),yy}var xy,BA;function Soe(){if(BA)return xy;BA=1;function e(t,r){if(!t||!r||!t.length||!r.length)throw new Error("Bad alphabet");this.srcAlphabet=t,this.dstAlphabet=r}return e.prototype.convert=function(t){var r,n,i,o={},a=this.srcAlphabet.length,s=this.dstAlphabet.length,c=t.length,u=typeof t=="string"?"":[];if(!this.isValid(t))throw new Error('Number "'+t+'" contains of non-alphabetic digits ('+this.srcAlphabet+")");if(this.srcAlphabet===this.dstAlphabet)return t;for(r=0;r<c;r++)o[r]=this.srcAlphabet.indexOf(t[r]);do{for(n=0,i=0,r=0;r<c;r++)n=n*a+o[r],n>=s?(o[i++]=parseInt(n/s,10),n=n%s):i>0&&(o[i++]=0);c=i,u=this.dstAlphabet.slice(n,n+1).concat(u)}while(i!==0);return u},e.prototype.isValid=function(t){for(var r=0;r<t.length;++r)if(this.srcAlphabet.indexOf(t[r])===-1)return!1;return!0},xy=e,xy}var wy,FA;function Ooe(){if(FA)return wy;FA=1;var e=Soe();function t(r,n){var i=new e(r,n);return function(o){return i.convert(o)}}return t.BIN="01",t.OCT="01234567",t.DEC="0123456789",t.HEX="0123456789abcdef",wy=t,wy}var _y,$A;function Coe(){if($A)return _y;$A=1;const{v4:e,validate:t}=Eoe(),r=Ooe(),n={cookieBase90:"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&'()*+-./:<=>?@[]^_`{|}~",flickrBase58:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ",uuid25Base36:"0123456789abcdefghijklmnopqrstuvwxyz"},i={consistentLength:!0};let o;const a=(u,d,p)=>{const v=d(u.toLowerCase().replace(/-/g,""));return!p||!p.consistentLength?v:v.padStart(p.shortIdLength,p.paddingChar)},s=(u,d)=>{const v=d(u).padStart(32,"0").match(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/);return[v[1],v[2],v[3],v[4],v[5]].join("-")},c=u=>Math.ceil(Math.log(2**128)/Math.log(u));return _y=(()=>{const u=(d,p)=>{const v=d||n.flickrBase58,h={...i,...p};if([...new Set(Array.from(v))].length!==v.length)throw new Error("The provided Alphabet has duplicate characters resulting in unreliable results");const x=c(v.length),m={shortIdLength:x,consistentLength:h.consistentLength,paddingChar:v[0]},b=r(r.HEX,v),w=r(v,r.HEX),y=()=>a(e(),b,m),S={alphabet:v,fromUUID:E=>a(E,b,m),maxLength:x,generate:y,new:y,toUUID:E=>s(E,w),uuid:e,validate:(E,I=!1)=>{if(!E||typeof E!="string")return!1;const N=h.consistentLength?E.length===x:E.length<=x,T=E.split("").every(A=>v.includes(A));return I===!1?N&&T:N&&T&&t(s(E,w))}};return Object.freeze(S),S};return u.constants=n,u.uuid=e,u.generate=()=>(o||(o=u(n.flickrBase58).generate),o()),u})(),_y}var EB=Coe();const SB=new yB;function Ioe(e,t){switch(t.type){case"UPDATE_ROLES":return{...e,roles:t.payload,flags:{...e.flags,touched:!0}};case"UPDATE_PRIVILEGES":return{...e,privileges:t.payload,flags:{...e.flags,touched:!0}};case"SET_ROLES_CONTENT":{const{content:r,flags:n={},...i}=t.payload,o=fe.sanitizeRoles(r),a={...e.flags,...n};return{...e,...o,...i,flags:a}}case"TOGGLE_TAB":return{...e,selectedTab:t.payload};case"TOGGLE_FORCE_LOGIN":return e.forceLogin===t.payload?e:{...e,forceLogin:t.payload,flags:{...e.flags,touched:!0}};case"TOGGLE_RESTRICTED_BY_DEFAULT":return e.restrictedByDefault===t.payload?e:{...e,restrictedByDefault:t.payload,flags:{...e.flags,touched:!0}};case"SET_FLAGS":return{...e,flags:{...e.flags,...t.payload}};case"CREATE_MODAL":return{...e,modals:{...e.modals,list:[...e.modals.list,t.payload]}};case"REMOVE_MODAL":return{...e,modals:{...e.modals,list:e.modals.list.filter(r=>r.id!==t.payload)}};case"CLOSE_MODAL":{const{id:r,reason:n}=t.payload;let i;if(n)if(e.modals.list.find(a=>a.id===r))i={...e,modals:{...e.modals,list:e.modals.list.map(a=>a.id===r?{...a,closeReason:n,isOpen:!1}:a)}};else return e;else i={...e,modals:{...e.modals,list:e.modals.list.filter(o=>o.id!==r)}};return SB.next(i.modals),i}case"EDIT_MODAL":{const{id:r,...n}=t.payload;return e.modals.list.find(o=>o.id===r)?{...e,modals:{...e.modals,list:e.modals.list.map(o=>o.id===r?{...o,...n}:o)}}:e}default:return e}}const M_=O.createContext(null),Roe=()=>({roles:{},privileges:{},flags:{touched:!1},date:void 0,selectedTab:"roles",forceLogin:!1,restrictedByDefault:!1,modals:{list:[]}}),Noe=({children:e,catalog:t=null,qodly:r=!1,catalogMethods:n=[],dataclasses:i={},singletons:o={},onSetTabFlags:a,initialState:s})=>{const[c,u]=O.useReducer(Ioe,{...Roe(),...s}),d=O.useMemo(()=>({catalog:t,qodly:r,catalogMethods:n,dataclasses:i,singletons:o,onSetTabFlags:a}),[t,r,n,i,o,a]);return C.jsx(M_.Provider,{value:{state:c,dispatch:u,external:d},children:e})};function Toe(){const e=O.useContext(M_);if(!e)throw new Error("useReducerAdapter must be used within a ReducerAdapterProvider");const{state:t,dispatch:r,external:n}=e,i=O.useMemo(()=>fe.rolesToAPI({roles:t.roles,privileges:t.privileges,forceLogin:t.forceLogin,restrictedByDefault:t.restrictedByDefault}),[t.roles,t.privileges,t.forceLogin,t.restrictedByDefault]);return{getRoles:O.useCallback(()=>t.roles,[t.roles]),getPrivileges:O.useCallback(()=>t.privileges,[t.privileges]),getRolesFlags:O.useCallback(()=>t.flags,[t.flags]),getRolesAndPrivileges:O.useCallback(()=>i,[i]),getCatalog:O.useCallback(()=>n.catalog??null,[n.catalog]),getQodly:O.useCallback(()=>n.qodly??!1,[n.qodly]),getSelectedTab:O.useCallback(()=>t.selectedTab,[t.selectedTab]),getForceLogin:O.useCallback(()=>t.forceLogin??!1,[t.forceLogin]),getRestrictedByDefault:O.useCallback(()=>t.restrictedByDefault??!1,[t.restrictedByDefault]),getGuestPrivilege:O.useCallback(()=>Object.values(t.privileges).find(({privilege:o})=>o==="guest")??null,[t.privileges]),getCatalogMethods:O.useCallback(()=>n.catalogMethods??[],[n.catalogMethods]),getDataclasses:O.useCallback(()=>n.dataclasses??{},[n.dataclasses]),getSingletons:O.useCallback(()=>n.singletons??{},[n.singletons]),actions:{updateRoles:O.useCallback(o=>{r({type:"UPDATE_ROLES",payload:o})},[]),updatePrivileges:O.useCallback(o=>{r({type:"UPDATE_PRIVILEGES",payload:o})},[]),setRolesContent:O.useCallback(o=>{r({type:"SET_ROLES_CONTENT",payload:o})},[]),toggleTab:O.useCallback(o=>{r({type:"TOGGLE_TAB",payload:o})},[]),toggleForceLogin:O.useCallback(o=>{r({type:"TOGGLE_FORCE_LOGIN",payload:o})},[]),toggleRestrictedByDefault:O.useCallback(o=>{r({type:"TOGGLE_RESTRICTED_BY_DEFAULT",payload:o})},[]),setTabFlags:O.useCallback((o,a)=>{n.onSetTabFlags&&n.onSetTabFlags(o,a)},[n.onSetTabFlags]),openModal:O.useCallback(async o=>{const{type:a=fe.ModalType.ALERT}=o,s=EB.generate();return r({type:"CREATE_MODAL",payload:{id:s,type:a,isOpen:!0,...o}}),a===fe.ModalType.CONFIRM?new Promise(c=>{const u=SB.pipe(foe(d=>{const p=d.list.find(v=>v.id===s);return p!==void 0&&!p.isOpen})).subscribe(d=>{var v;const p=d.list.find(h=>h.id===s);if(p){const h=p.closeReason===fe.ModalCloseReason.CONFIRMED,x=lo.entries(((v=p.views)==null?void 0:v.toggles)||{}).reduce((m,b)=>({...m,[b[0]]:b[1].value}),{});r({type:"REMOVE_MODAL",payload:s}),u.unsubscribe(),c({confirmed:h,options:x})}})}):{confirmed:!1}},[r])}}}function Poe(){const e=O.useContext(M_);if(!e)throw new Error("useModals must be used within a ReducerAdapterProvider");const{state:t,dispatch:r}=e;return{modals:t.modals.list,closeModal:O.useCallback(n=>{r({type:"CLOSE_MODAL",payload:n})},[r]),editModal:O.useCallback(n=>{r({type:"EDIT_MODAL",payload:n})},[r]),removeModal:O.useCallback(n=>{r({type:"REMOVE_MODAL",payload:n})},[r])}}const Ey=({child:e,parent:t,status:r,onSelect:n,currentPrivilegeId:i})=>{const o=pr(),a=o.getPrivileges();function s(){const u=fe.addPrivilegeIn(t.id,e.id,a);o.actions.updatePrivileges(u)}function c(){const u=fe.removePrivilegeFrom(t.id,e.id,a);o.actions.updatePrivileges(u)}return C.jsxs(Zc,{color:r==="included"?"primary":"dark",onClick:r==="included"?c:s,disabled:r==="disabled",children:[e.privilege,C.jsx(_e.FdPlus,{className:Yr("transform transition-transform",{"rotate-45":r==="included"})})]})},koe=({selectedPrivilege:e,privileges:t,onSelect:r,setShowIncluded:n,showIncluded:i})=>{const o=Object.values(t),a=fe.getPrivilegeById(e.id,t);let s=a?fe.populateShallow(a.includes,t):[],c=a?fe.populateShallow(fe.parents(a.id,t),t):[],u=a?fe.populateShallow(fe.allowed(a.id,t),t):[];return[s,c,u]=[s,c,u].map(d=>d.filter(p=>(p==null?void 0:p.privilege)!=="guest")),o.length<2&&s.length+c.length+u.length===0?null:C.jsxs(dr,{depth:1,className:"w-full border-b p-4",children:[C.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[" ",o.length>2?C.jsx("h4",{className:"text-[13px] font-semibold",children:"Include a privilege"}):C.jsx("div",{}),C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx(xu,{onChange:()=>n(!i),checked:i}),C.jsx("label",{className:"text-xs",children:" Show inherited permissions"})]})]}),C.jsxs("div",{className:"flex flex-wrap items-start justify-start gap-1",children:[s.map(d=>C.jsx(Ey,{child:d,parent:e,status:"included",onSelect:r,currentPrivilegeId:d.id},d.id)),u.map(d=>C.jsx(Ey,{child:d,parent:e,status:"available",onSelect:r,currentPrivilegeId:d.id},d.id)),c.map(d=>C.jsx(Ey,{child:d,parent:e,status:"disabled",onSelect:r,currentPrivilegeId:d.id},d.id))]})]})},Aoe=({item:e,depth:t})=>{const r=pr(),[n,i]=O.useState(!1),o=r.getPrivileges(),a=fe.populateShallow(e.includes,o);return C.jsxs("div",{className:"py-1 text-xs text-white",children:[C.jsxs("div",{className:"flex items-center",children:[C.jsx("button",{className:"-ml-1",onClick:s=>{s.stopPropagation(),i(!n)},children:C.jsx(_e.FdRight,{className:Yr("h-4 w-4",{"tranform rotate-90":n})})})," ",C.jsx("div",{children:e.privilege})]}),C.jsx("div",{className:"border-l pl-2",style:{marginLeft:t?t*4:3},children:n&&C.jsx(OB,{depth:t+1,data:a})})]})},OB=({data:e,depth:t=0})=>e.map(r=>r.includes.length?C.jsx(Aoe,{item:r,depth:t},r.id):C.jsx("div",{className:Yr("py-1 text-xs",{}),children:r.privilege},r.id)),xr=()=>document.querySelector(`.${w2.ROLES_EDITOR_SCOPE_CLASS}`)||document.body,Td=({container:e,...t})=>C.jsx(fe.Portal,{...t,container:e||xr()}),HA=({privilege:e,selectedPrivilege:t,onSelect:r,isGuest:n=!1})=>{const i=pr(),o=i.getPrivileges(),a=fe.populateShallow(e.includes,o),[s,c]=O.useState(!1),[u,d]=O.useState(e.privilege),[p,v]=O.useState(null),h=fe.useOutsideClick(()=>{s&&b()});fe.useDidMountEffect(()=>{e.privilege!==u&&d(e.privilege)},[e.privilege]);function x(){c(!0),v(null)}function m(){c(!1),d(e.privilege)}function b(){v(null);try{fe.validateName(u);const _=fe.renamePrivilege(u,e.id,o);i.actions.updatePrivileges(_),c(!1)}catch(_){v(_.message)}}const w=async _=>{_.stopPropagation();const{confirmed:S}=await i.actions.openModal({title:"Delete Privilege",type:fe.ModalType.CONFIRM,color:fe.ModalColor.DANGER,message:"Are you sure you want to remove this Privilege?",icon:"FdWarningDanger"});if(S){const E=fe.removePrivilege(e.id,o);if((t==null?void 0:t.id)!==e.id){i.actions.updatePrivileges(E);return}const I=Object.keys(E).filter(N=>E[N].privilege!=="guest");if(I.length===0)r(null);else{const N=Object.keys(o).filter(L=>o[L].privilege!=="guest"),T=N.indexOf(e.id),A=Math.max(0,T-1),B=N[A];T===0?r(E[I[0]]):E[B]?r(E[B]):r(E[I[0]])}i.actions.updatePrivileges(E)}},y=O.useMemo(()=>e.resources.some(_=>_.exists===!1),[e]);return C.jsxs(Kr,{container:xr(),color:"negative",icon:C.jsx(_e.FdBulb,{}),label:"This privilege uses non-existing resources",isHidden:!y,children:[C.jsxs(dr,{depth:4,borderType:(t==null?void 0:t.id)===e.id?"primary":(t==null?void 0:t.id)!==e.id?"light":"default",className:Yr("w-full rounded border p-2",{"border-red-400":y&&(t==null?void 0:t.id)!==e.id}),role:"button","data-cy":"privilegeCard",onClick:()=>{r(e)},ref:h,children:[C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsxs("div",{className:"flex flex-1 items-center",children:[C.jsx("span",{className:"mr-4",children:n?C.jsx(_e.FdGuest,{className:"h-6 w-6"}):C.jsx(_e.FdGroup,{className:"h-6 w-6"})}),s?C.jsxs(wt.Root,{color:p?"negative":"primary",className:"flex-1 mr-2",children:[C.jsx(wt.Group,{children:C.jsx(wt.Field,{autoFocus:!0,value:u,onChange:_=>d(_.target.value),onKeyDown:_=>{_.key==="Enter"&&b(),_.key==="Escape"&&m()},onBlur:m,type:"text"})}),p&&C.jsx(wt.Message,{children:p})]}):C.jsx("span",{className:"inline-block grow overflow-hidden truncate whitespace-nowrap text-xs font-bold",children:u})]}),n?C.jsx("div",{className:"flex items-center justify-center",children:C.jsx(Kr,{icon:C.jsx(_e.FdBulb,{}),label:C.jsx("div",{className:"max-w-xs flex-1 min-w-0 break-words whitespace-normal py-1",children:"Guest privileges are used to indicate resources accessible without any permission required (e.g. an authenticate function)"}),container:xr(),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4"})})}):C.jsx("div",{className:"flex items-center space-x-2",children:s?C.jsxs(C.Fragment,{children:[C.jsx(Zt,{variant:"ghost",color:"white",onClick:m,children:C.jsx("span",{children:C.jsx(_e.FdClose,{className:"h-4 w-4"})})}),C.jsx(Zt,{variant:"ghost",color:"white",onClick:b,children:C.jsx("span",{children:C.jsx(_e.FdCheckCircle,{className:"h-4 w-4"})})})]}):C.jsxs(C.Fragment,{children:[C.jsx(Zt,{variant:"ghost",color:"white",onClick:x,children:C.jsx(_e.FdPen,{className:"h-4 w-4"})}),C.jsx(Zt,{variant:"ghost",color:"white",onClick:w,children:C.jsx(_e.FdTrash,{className:"h-4 w-4"})})]})})]}),a.length?C.jsx("div",{className:"ml-[43px]",children:C.jsx(OB,{data:a})}):null]})," "]})},Moe=({privileges:e,selectPrivilege:t,selectedPrivilege:r})=>{const n=pr(),i=n.getGuestPrivilege(),o=n.getCatalog(),a=O.useMemo(()=>{if(o===null||!i)return i;const s=fB({guest:i},Object.values((o==null?void 0:o.dataClasses)??{}));return pB(s,o).guest},[e,o]);return C.jsxs("div",{className:"flex flex-1 flex-col gap-y-4 overflow-auto p-4 pb-10 pt-1",children:[a?C.jsx(HA,{privilege:a,onSelect:t,selectedPrivilege:r,isGuest:!0}):null,Object.entries(e).length?Object.entries(e).filter(([,s])=>s.privilege!=="guest").sort(([,s],[,c])=>fe.localeCompare(s.privilege,c.privilege)).map(([s,c])=>C.jsx(HA,{privilege:c,onSelect:t,selectedPrivilege:r},s)):C.jsx("div",{className:"flex h-full items-center justify-center",children:C.jsx("div",{className:"flex flex-1 items-center justify-center",children:C.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 text-inactive-text",children:[C.jsx(_e.FdInfoBold,{className:"h-10 w-10"}),C.jsx("div",{className:"font-semibold",children:"There are no privileges"}),C.jsxs("div",{className:"flex items-center text-sm",children:["Create a new Privilege by clicking on the"," ",C.jsx(_e.FdPlus,{className:"ml-2 inline h-4 w-4"})]})]})})})]})};var $c={exports:{}},Hc={exports:{}},ct={};/** @license React v16.13.1
88
+ `):"",this.name="UnsubscriptionError",this.errors=r}});function Bw(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Id=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,i,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=qw(a),c=s.next();!c.done;c=s.next()){var u=c.value;u.remove(this)}}catch(m){t={error:m}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var d=this.initialTeardown;if(Vn(d))try{d()}catch(m){o=m instanceof by?m.errors:[m]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var v=qw(p),h=v.next();!h.done;h=v.next()){var x=h.value;try{yA(x)}catch(m){o=o??[],m instanceof by?o=zw(zw([],Lw(o)),Lw(m.errors)):o.push(m)}}}catch(m){n={error:m}}finally{try{h&&!h.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}}if(o)throw new by(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)yA(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Bw(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Bw(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),mB=Id.EMPTY;function bB(e){return e instanceof Id||e&&"closed"in e&&Vn(e.remove)&&Vn(e.add)&&Vn(e.unsubscribe)}function yA(e){Vn(e)?e():e.unsubscribe()}var Xie={Promise:void 0},Zie={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,zw([e,t],Lw(r)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function Jie(e){Zie.setTimeout(function(){throw e})}function xA(){}function lu(e){e()}var A_=(function(e){cl(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,bB(r)&&r.add(n)):n.destination=toe,n}return t.create=function(r,n,i){return new Fw(r,n,i)},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(Id),Qie=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Bc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Bc(n)}else Bc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Bc(r)}},e})(),Fw=(function(e){cl(t,e);function t(r,n,i){var o=e.call(this)||this,a;return Vn(r)||!r?a={next:r??void 0,error:n??void 0,complete:i??void 0}:a=r,o.destination=new Qie(a),o}return t})(A_);function Bc(e){Jie(e)}function eoe(e){throw e}var toe={closed:!0,next:xA,error:eoe,complete:xA},roe=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function noe(e){return e}function ioe(e){return e.length===0?noe:e.length===1?e[0]:function(r){return e.reduce(function(n,i){return i(n)},r)}}var wA=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var i=this,o=aoe(t)?t:new Fw(t,r,n);return lu(function(){var a=i,s=a.operator,c=a.source;o.add(s?s.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=_A(r),new r(function(i,o){var a=new Fw({next:function(s){try{t(s)}catch(c){o(c),a.unsubscribe()}},error:o,complete:i});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[roe]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ioe(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=_A(t),new t(function(n,i){var o;r.subscribe(function(a){return o=a},function(a){return i(a)},function(){return n(o)})})},e.create=function(t){return new e(t)},e})();function _A(e){var t;return(t=e??Xie.Promise)!==null&&t!==void 0?t:Promise}function ooe(e){return e&&Vn(e.next)&&Vn(e.error)&&Vn(e.complete)}function aoe(e){return e&&e instanceof A_||ooe(e)&&bB(e)}function soe(e){return Vn(e==null?void 0:e.lift)}function loe(e){return function(t){if(soe(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function coe(e,t,r,n,i){return new uoe(e,t,r,n,i)}var uoe=(function(e){cl(t,e);function t(r,n,i,o,a,s){var c=e.call(this,r)||this;return c.onFinalize=a,c.shouldUnsubscribe=s,c._next=n?function(u){try{n(u)}catch(d){r.error(d)}}:e.prototype._next,c._error=o?function(u){try{o(u)}catch(d){r.error(d)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=i?function(){try{i()}catch(u){r.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t})(A_),doe=gB(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),yB=(function(e){cl(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new EA(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new doe},t.prototype.next=function(r){var n=this;lu(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=qw(n.currentObservers),s=a.next();!s.done;s=a.next()){var c=s.value;c.next(r)}}catch(u){i={error:u}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}}})},t.prototype.error=function(r){var n=this;lu(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},t.prototype.complete=function(){var r=this;lu(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,i=this,o=i.hasError,a=i.isStopped,s=i.observers;return o||a?mB:(this.currentObservers=null,s.push(r),new Id(function(){n.currentObservers=null,Bw(s,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,o=n.thrownError,a=n.isStopped;i?r.error(o):a&&r.complete()},t.prototype.asObservable=function(){var r=new wA;return r.source=this,r},t.create=function(r,n){return new EA(r,n)},t})(wA),EA=(function(e){cl(t,e);function t(r,n){var i=e.call(this)||this;return i.destination=r,i.source=n,i}return t.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},t.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:mB},t})(yB);function foe(e,t){return loe(function(r,n){var i=0;r.subscribe(coe(n,function(o){return e.call(t,o,i++)&&n.next(o)}))})}var yy={},rs={},Fc={},SA;function xB(){if(SA)return Fc;SA=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.default=r;let e;const t=new Uint8Array(16);function r(){if(!e&&(e=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!e))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(t)}return Fc}var Wo={},ns={},is={},OA;function poe(){if(OA)return is;OA=1,Object.defineProperty(is,"__esModule",{value:!0}),is.default=void 0;var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;return is.default=e,is}var CA;function Rd(){if(CA)return ns;CA=1,Object.defineProperty(ns,"__esModule",{value:!0}),ns.default=void 0;var e=t(poe());function t(i){return i&&i.__esModule?i:{default:i}}function r(i){return typeof i=="string"&&e.default.test(i)}var n=r;return ns.default=n,ns}var IA;function Nd(){if(IA)return Wo;IA=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.default=void 0,Wo.unsafeStringify=n;var e=t(Rd());function t(a){return a&&a.__esModule?a:{default:a}}const r=[];for(let a=0;a<256;++a)r.push((a+256).toString(16).slice(1));function n(a,s=0){return r[a[s+0]]+r[a[s+1]]+r[a[s+2]]+r[a[s+3]]+"-"+r[a[s+4]]+r[a[s+5]]+"-"+r[a[s+6]]+r[a[s+7]]+"-"+r[a[s+8]]+r[a[s+9]]+"-"+r[a[s+10]]+r[a[s+11]]+r[a[s+12]]+r[a[s+13]]+r[a[s+14]]+r[a[s+15]]}function i(a,s=0){const c=n(a,s);if(!(0,e.default)(c))throw TypeError("Stringified UUID is invalid");return c}var o=i;return Wo.default=o,Wo}var RA;function hoe(){if(RA)return rs;RA=1,Object.defineProperty(rs,"__esModule",{value:!0}),rs.default=void 0;var e=r(xB()),t=Nd();function r(u){return u&&u.__esModule?u:{default:u}}let n,i,o=0,a=0;function s(u,d,p){let v=d&&p||0;const h=d||new Array(16);u=u||{};let x=u.node||n,m=u.clockseq!==void 0?u.clockseq:i;if(x==null||m==null){const E=u.random||(u.rng||e.default)();x==null&&(x=n=[E[0]|1,E[1],E[2],E[3],E[4],E[5]]),m==null&&(m=i=(E[6]<<8|E[7])&16383)}let b=u.msecs!==void 0?u.msecs:Date.now(),w=u.nsecs!==void 0?u.nsecs:a+1;const y=b-o+(w-a)/1e4;if(y<0&&u.clockseq===void 0&&(m=m+1&16383),(y<0||b>o)&&u.nsecs===void 0&&(w=0),w>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");o=b,a=w,i=m,b+=122192928e5;const _=((b&268435455)*1e4+w)%4294967296;h[v++]=_>>>24&255,h[v++]=_>>>16&255,h[v++]=_>>>8&255,h[v++]=_&255;const S=b/4294967296*1e4&268435455;h[v++]=S>>>8&255,h[v++]=S&255,h[v++]=S>>>24&15|16,h[v++]=S>>>16&255,h[v++]=m>>>8|128,h[v++]=m&255;for(let E=0;E<6;++E)h[v+E]=x[E];return d||(0,t.unsafeStringify)(h)}var c=s;return rs.default=c,rs}var os={},Ni={},as={},NA;function wB(){if(NA)return as;NA=1,Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var e=t(Rd());function t(i){return i&&i.__esModule?i:{default:i}}function r(i){if(!(0,e.default)(i))throw TypeError("Invalid UUID");let o;const a=new Uint8Array(16);return a[0]=(o=parseInt(i.slice(0,8),16))>>>24,a[1]=o>>>16&255,a[2]=o>>>8&255,a[3]=o&255,a[4]=(o=parseInt(i.slice(9,13),16))>>>8,a[5]=o&255,a[6]=(o=parseInt(i.slice(14,18),16))>>>8,a[7]=o&255,a[8]=(o=parseInt(i.slice(19,23),16))>>>8,a[9]=o&255,a[10]=(o=parseInt(i.slice(24,36),16))/1099511627776&255,a[11]=o/4294967296&255,a[12]=o>>>24&255,a[13]=o>>>16&255,a[14]=o>>>8&255,a[15]=o&255,a}var n=r;return as.default=n,as}var TA;function _B(){if(TA)return Ni;TA=1,Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.URL=Ni.DNS=void 0,Ni.default=a;var e=Nd(),t=r(wB());function r(s){return s&&s.__esModule?s:{default:s}}function n(s){s=unescape(encodeURIComponent(s));const c=[];for(let u=0;u<s.length;++u)c.push(s.charCodeAt(u));return c}const i="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Ni.DNS=i;const o="6ba7b811-9dad-11d1-80b4-00c04fd430c8";Ni.URL=o;function a(s,c,u){function d(p,v,h,x){var m;if(typeof p=="string"&&(p=n(p)),typeof v=="string"&&(v=(0,t.default)(v)),((m=v)===null||m===void 0?void 0:m.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let b=new Uint8Array(16+p.length);if(b.set(v),b.set(p,v.length),b=u(b),b[6]=b[6]&15|c,b[8]=b[8]&63|128,h){x=x||0;for(let w=0;w<16;++w)h[x+w]=b[w];return h}return(0,e.unsafeStringify)(b)}try{d.name=s}catch{}return d.DNS=i,d.URL=o,d}return Ni}var ss={},PA;function voe(){if(PA)return ss;PA=1,Object.defineProperty(ss,"__esModule",{value:!0}),ss.default=void 0;function e(h){if(typeof h=="string"){const x=unescape(encodeURIComponent(h));h=new Uint8Array(x.length);for(let m=0;m<x.length;++m)h[m]=x.charCodeAt(m)}return t(n(i(h),h.length*8))}function t(h){const x=[],m=h.length*32,b="0123456789abcdef";for(let w=0;w<m;w+=8){const y=h[w>>5]>>>w%32&255,_=parseInt(b.charAt(y>>>4&15)+b.charAt(y&15),16);x.push(_)}return x}function r(h){return(h+64>>>9<<4)+14+1}function n(h,x){h[x>>5]|=128<<x%32,h[r(x)-1]=x;let m=1732584193,b=-271733879,w=-1732584194,y=271733878;for(let _=0;_<h.length;_+=16){const S=m,E=b,I=w,N=y;m=c(m,b,w,y,h[_],7,-680876936),y=c(y,m,b,w,h[_+1],12,-389564586),w=c(w,y,m,b,h[_+2],17,606105819),b=c(b,w,y,m,h[_+3],22,-1044525330),m=c(m,b,w,y,h[_+4],7,-176418897),y=c(y,m,b,w,h[_+5],12,1200080426),w=c(w,y,m,b,h[_+6],17,-1473231341),b=c(b,w,y,m,h[_+7],22,-45705983),m=c(m,b,w,y,h[_+8],7,1770035416),y=c(y,m,b,w,h[_+9],12,-1958414417),w=c(w,y,m,b,h[_+10],17,-42063),b=c(b,w,y,m,h[_+11],22,-1990404162),m=c(m,b,w,y,h[_+12],7,1804603682),y=c(y,m,b,w,h[_+13],12,-40341101),w=c(w,y,m,b,h[_+14],17,-1502002290),b=c(b,w,y,m,h[_+15],22,1236535329),m=u(m,b,w,y,h[_+1],5,-165796510),y=u(y,m,b,w,h[_+6],9,-1069501632),w=u(w,y,m,b,h[_+11],14,643717713),b=u(b,w,y,m,h[_],20,-373897302),m=u(m,b,w,y,h[_+5],5,-701558691),y=u(y,m,b,w,h[_+10],9,38016083),w=u(w,y,m,b,h[_+15],14,-660478335),b=u(b,w,y,m,h[_+4],20,-405537848),m=u(m,b,w,y,h[_+9],5,568446438),y=u(y,m,b,w,h[_+14],9,-1019803690),w=u(w,y,m,b,h[_+3],14,-187363961),b=u(b,w,y,m,h[_+8],20,1163531501),m=u(m,b,w,y,h[_+13],5,-1444681467),y=u(y,m,b,w,h[_+2],9,-51403784),w=u(w,y,m,b,h[_+7],14,1735328473),b=u(b,w,y,m,h[_+12],20,-1926607734),m=d(m,b,w,y,h[_+5],4,-378558),y=d(y,m,b,w,h[_+8],11,-2022574463),w=d(w,y,m,b,h[_+11],16,1839030562),b=d(b,w,y,m,h[_+14],23,-35309556),m=d(m,b,w,y,h[_+1],4,-1530992060),y=d(y,m,b,w,h[_+4],11,1272893353),w=d(w,y,m,b,h[_+7],16,-155497632),b=d(b,w,y,m,h[_+10],23,-1094730640),m=d(m,b,w,y,h[_+13],4,681279174),y=d(y,m,b,w,h[_],11,-358537222),w=d(w,y,m,b,h[_+3],16,-722521979),b=d(b,w,y,m,h[_+6],23,76029189),m=d(m,b,w,y,h[_+9],4,-640364487),y=d(y,m,b,w,h[_+12],11,-421815835),w=d(w,y,m,b,h[_+15],16,530742520),b=d(b,w,y,m,h[_+2],23,-995338651),m=p(m,b,w,y,h[_],6,-198630844),y=p(y,m,b,w,h[_+7],10,1126891415),w=p(w,y,m,b,h[_+14],15,-1416354905),b=p(b,w,y,m,h[_+5],21,-57434055),m=p(m,b,w,y,h[_+12],6,1700485571),y=p(y,m,b,w,h[_+3],10,-1894986606),w=p(w,y,m,b,h[_+10],15,-1051523),b=p(b,w,y,m,h[_+1],21,-2054922799),m=p(m,b,w,y,h[_+8],6,1873313359),y=p(y,m,b,w,h[_+15],10,-30611744),w=p(w,y,m,b,h[_+6],15,-1560198380),b=p(b,w,y,m,h[_+13],21,1309151649),m=p(m,b,w,y,h[_+4],6,-145523070),y=p(y,m,b,w,h[_+11],10,-1120210379),w=p(w,y,m,b,h[_+2],15,718787259),b=p(b,w,y,m,h[_+9],21,-343485551),m=o(m,S),b=o(b,E),w=o(w,I),y=o(y,N)}return[m,b,w,y]}function i(h){if(h.length===0)return[];const x=h.length*8,m=new Uint32Array(r(x));for(let b=0;b<x;b+=8)m[b>>5]|=(h[b/8]&255)<<b%32;return m}function o(h,x){const m=(h&65535)+(x&65535);return(h>>16)+(x>>16)+(m>>16)<<16|m&65535}function a(h,x){return h<<x|h>>>32-x}function s(h,x,m,b,w,y){return o(a(o(o(x,h),o(b,y)),w),m)}function c(h,x,m,b,w,y,_){return s(x&m|~x&b,h,x,w,y,_)}function u(h,x,m,b,w,y,_){return s(x&b|m&~b,h,x,w,y,_)}function d(h,x,m,b,w,y,_){return s(x^m^b,h,x,w,y,_)}function p(h,x,m,b,w,y,_){return s(m^(x|~b),h,x,w,y,_)}var v=e;return ss.default=v,ss}var kA;function goe(){if(kA)return os;kA=1,Object.defineProperty(os,"__esModule",{value:!0}),os.default=void 0;var e=r(_B()),t=r(voe());function r(o){return o&&o.__esModule?o:{default:o}}var i=(0,e.default)("v3",48,t.default);return os.default=i,os}var ls={},cs={},AA;function moe(){if(AA)return cs;AA=1,Object.defineProperty(cs,"__esModule",{value:!0}),cs.default=void 0;var t={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};return cs.default=t,cs}var MA;function boe(){if(MA)return ls;MA=1,Object.defineProperty(ls,"__esModule",{value:!0}),ls.default=void 0;var e=n(moe()),t=n(xB()),r=Nd();function n(a){return a&&a.__esModule?a:{default:a}}function i(a,s,c){if(e.default.randomUUID&&!s&&!a)return e.default.randomUUID();a=a||{};const u=a.random||(a.rng||t.default)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,s){c=c||0;for(let d=0;d<16;++d)s[c+d]=u[d];return s}return(0,r.unsafeStringify)(u)}var o=i;return ls.default=o,ls}var us={},ds={},DA;function yoe(){if(DA)return ds;DA=1,Object.defineProperty(ds,"__esModule",{value:!0}),ds.default=void 0;function e(i,o,a,s){switch(i){case 0:return o&a^~o&s;case 1:return o^a^s;case 2:return o&a^o&s^a&s;case 3:return o^a^s}}function t(i,o){return i<<o|i>>>32-o}function r(i){const o=[1518500249,1859775393,2400959708,3395469782],a=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof i=="string"){const d=unescape(encodeURIComponent(i));i=[];for(let p=0;p<d.length;++p)i.push(d.charCodeAt(p))}else Array.isArray(i)||(i=Array.prototype.slice.call(i));i.push(128);const s=i.length/4+2,c=Math.ceil(s/16),u=new Array(c);for(let d=0;d<c;++d){const p=new Uint32Array(16);for(let v=0;v<16;++v)p[v]=i[d*64+v*4]<<24|i[d*64+v*4+1]<<16|i[d*64+v*4+2]<<8|i[d*64+v*4+3];u[d]=p}u[c-1][14]=(i.length-1)*8/Math.pow(2,32),u[c-1][14]=Math.floor(u[c-1][14]),u[c-1][15]=(i.length-1)*8&4294967295;for(let d=0;d<c;++d){const p=new Uint32Array(80);for(let w=0;w<16;++w)p[w]=u[d][w];for(let w=16;w<80;++w)p[w]=t(p[w-3]^p[w-8]^p[w-14]^p[w-16],1);let v=a[0],h=a[1],x=a[2],m=a[3],b=a[4];for(let w=0;w<80;++w){const y=Math.floor(w/20),_=t(v,5)+e(y,h,x,m)+b+o[y]+p[w]>>>0;b=m,m=x,x=t(h,30)>>>0,h=v,v=_}a[0]=a[0]+v>>>0,a[1]=a[1]+h>>>0,a[2]=a[2]+x>>>0,a[3]=a[3]+m>>>0,a[4]=a[4]+b>>>0}return[a[0]>>24&255,a[0]>>16&255,a[0]>>8&255,a[0]&255,a[1]>>24&255,a[1]>>16&255,a[1]>>8&255,a[1]&255,a[2]>>24&255,a[2]>>16&255,a[2]>>8&255,a[2]&255,a[3]>>24&255,a[3]>>16&255,a[3]>>8&255,a[3]&255,a[4]>>24&255,a[4]>>16&255,a[4]>>8&255,a[4]&255]}var n=r;return ds.default=n,ds}var jA;function xoe(){if(jA)return us;jA=1,Object.defineProperty(us,"__esModule",{value:!0}),us.default=void 0;var e=r(_B()),t=r(yoe());function r(o){return o&&o.__esModule?o:{default:o}}var i=(0,e.default)("v5",80,t.default);return us.default=i,us}var fs={},qA;function woe(){if(qA)return fs;qA=1,Object.defineProperty(fs,"__esModule",{value:!0}),fs.default=void 0;var e="00000000-0000-0000-0000-000000000000";return fs.default=e,fs}var ps={},LA;function _oe(){if(LA)return ps;LA=1,Object.defineProperty(ps,"__esModule",{value:!0}),ps.default=void 0;var e=t(Rd());function t(i){return i&&i.__esModule?i:{default:i}}function r(i){if(!(0,e.default)(i))throw TypeError("Invalid UUID");return parseInt(i.slice(14,15),16)}var n=r;return ps.default=n,ps}var zA;function Eoe(){return zA||(zA=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NIL",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"v1",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"v3",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"v4",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"v5",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"validate",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return a.default}});var t=d(hoe()),r=d(goe()),n=d(boe()),i=d(xoe()),o=d(woe()),a=d(_oe()),s=d(Rd()),c=d(Nd()),u=d(wB());function d(p){return p&&p.__esModule?p:{default:p}}})(yy)),yy}var xy,BA;function Soe(){if(BA)return xy;BA=1;function e(t,r){if(!t||!r||!t.length||!r.length)throw new Error("Bad alphabet");this.srcAlphabet=t,this.dstAlphabet=r}return e.prototype.convert=function(t){var r,n,i,o={},a=this.srcAlphabet.length,s=this.dstAlphabet.length,c=t.length,u=typeof t=="string"?"":[];if(!this.isValid(t))throw new Error('Number "'+t+'" contains of non-alphabetic digits ('+this.srcAlphabet+")");if(this.srcAlphabet===this.dstAlphabet)return t;for(r=0;r<c;r++)o[r]=this.srcAlphabet.indexOf(t[r]);do{for(n=0,i=0,r=0;r<c;r++)n=n*a+o[r],n>=s?(o[i++]=parseInt(n/s,10),n=n%s):i>0&&(o[i++]=0);c=i,u=this.dstAlphabet.slice(n,n+1).concat(u)}while(i!==0);return u},e.prototype.isValid=function(t){for(var r=0;r<t.length;++r)if(this.srcAlphabet.indexOf(t[r])===-1)return!1;return!0},xy=e,xy}var wy,FA;function Ooe(){if(FA)return wy;FA=1;var e=Soe();function t(r,n){var i=new e(r,n);return function(o){return i.convert(o)}}return t.BIN="01",t.OCT="01234567",t.DEC="0123456789",t.HEX="0123456789abcdef",wy=t,wy}var _y,$A;function Coe(){if($A)return _y;$A=1;const{v4:e,validate:t}=Eoe(),r=Ooe(),n={cookieBase90:"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&'()*+-./:<=>?@[]^_`{|}~",flickrBase58:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ",uuid25Base36:"0123456789abcdefghijklmnopqrstuvwxyz"},i={consistentLength:!0};let o;const a=(u,d,p)=>{const v=d(u.toLowerCase().replace(/-/g,""));return!p||!p.consistentLength?v:v.padStart(p.shortIdLength,p.paddingChar)},s=(u,d)=>{const v=d(u).padStart(32,"0").match(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/);return[v[1],v[2],v[3],v[4],v[5]].join("-")},c=u=>Math.ceil(Math.log(2**128)/Math.log(u));return _y=(()=>{const u=(d,p)=>{const v=d||n.flickrBase58,h={...i,...p};if([...new Set(Array.from(v))].length!==v.length)throw new Error("The provided Alphabet has duplicate characters resulting in unreliable results");const x=c(v.length),m={shortIdLength:x,consistentLength:h.consistentLength,paddingChar:v[0]},b=r(r.HEX,v),w=r(v,r.HEX),y=()=>a(e(),b,m),S={alphabet:v,fromUUID:E=>a(E,b,m),maxLength:x,generate:y,new:y,toUUID:E=>s(E,w),uuid:e,validate:(E,I=!1)=>{if(!E||typeof E!="string")return!1;const N=h.consistentLength?E.length===x:E.length<=x,T=E.split("").every(A=>v.includes(A));return I===!1?N&&T:N&&T&&t(s(E,w))}};return Object.freeze(S),S};return u.constants=n,u.uuid=e,u.generate=()=>(o||(o=u(n.flickrBase58).generate),o()),u})(),_y}var EB=Coe();const SB=new yB;function Ioe(e,t){switch(t.type){case"UPDATE_ROLES":return{...e,roles:t.payload,flags:{...e.flags,touched:!0}};case"UPDATE_PRIVILEGES":return{...e,privileges:t.payload,flags:{...e.flags,touched:!0}};case"SET_ROLES_CONTENT":{const{content:r,flags:n={},...i}=t.payload,o=fe.sanitizeRoles(r),a={...e.flags,...n};return{...e,...o,...i,flags:a}}case"TOGGLE_TAB":return{...e,selectedTab:t.payload};case"TOGGLE_FORCE_LOGIN":return e.forceLogin===t.payload?e:{...e,forceLogin:t.payload,flags:{...e.flags,touched:!0}};case"TOGGLE_RESTRICTED_BY_DEFAULT":return e.restrictedByDefault===t.payload?e:{...e,restrictedByDefault:t.payload,flags:{...e.flags,touched:!0}};case"SET_FLAGS":return{...e,flags:{...e.flags,...t.payload}};case"CREATE_MODAL":return{...e,modals:{...e.modals,list:[...e.modals.list,t.payload]}};case"REMOVE_MODAL":return{...e,modals:{...e.modals,list:e.modals.list.filter(r=>r.id!==t.payload)}};case"CLOSE_MODAL":{const{id:r,reason:n}=t.payload;let i;if(n)if(e.modals.list.find(a=>a.id===r))i={...e,modals:{...e.modals,list:e.modals.list.map(a=>a.id===r?{...a,closeReason:n,isOpen:!1}:a)}};else return e;else i={...e,modals:{...e.modals,list:e.modals.list.filter(o=>o.id!==r)}};return SB.next(i.modals),i}case"EDIT_MODAL":{const{id:r,...n}=t.payload;return e.modals.list.find(o=>o.id===r)?{...e,modals:{...e.modals,list:e.modals.list.map(o=>o.id===r?{...o,...n}:o)}}:e}default:return e}}const M_=O.createContext(null),Roe=()=>({roles:{},privileges:{},flags:{touched:!1},date:void 0,selectedTab:"roles",forceLogin:!1,restrictedByDefault:!1,modals:{list:[]}}),Noe=({children:e,catalog:t=null,qodly:r=!1,onSetTabFlags:n,initialState:i})=>{const[o,a]=O.useReducer(Ioe,{...Roe(),...i}),s=O.useMemo(()=>t?fe.parseCatalog(t):null,[t]),c=O.useMemo(()=>({catalog:s,qodly:r,onSetTabFlags:n}),[s,r,n]);return C.jsx(M_.Provider,{value:{state:o,dispatch:a,external:c},children:e})};function Toe(){const e=O.useContext(M_);if(!e)throw new Error("useReducerAdapter must be used within a ReducerAdapterProvider");const{state:t,dispatch:r,external:n}=e,i=O.useMemo(()=>fe.rolesToAPI({roles:t.roles,privileges:t.privileges,forceLogin:t.forceLogin,restrictedByDefault:t.restrictedByDefault}),[t.roles,t.privileges,t.forceLogin,t.restrictedByDefault]);return{getRoles:O.useCallback(()=>t.roles,[t.roles]),getPrivileges:O.useCallback(()=>t.privileges,[t.privileges]),getRolesFlags:O.useCallback(()=>t.flags,[t.flags]),getRolesAndPrivileges:O.useCallback(()=>i,[i]),getCatalog:O.useCallback(()=>n.catalog??null,[n.catalog]),getQodly:O.useCallback(()=>n.qodly??!1,[n.qodly]),getSelectedTab:O.useCallback(()=>t.selectedTab,[t.selectedTab]),getForceLogin:O.useCallback(()=>t.forceLogin??!1,[t.forceLogin]),getRestrictedByDefault:O.useCallback(()=>t.restrictedByDefault??!1,[t.restrictedByDefault]),getGuestPrivilege:O.useCallback(()=>Object.values(t.privileges).find(({privilege:o})=>o==="guest")??null,[t.privileges]),getCatalogMethods:O.useCallback(()=>{var o;return((o=n.catalog)==null?void 0:o.methods)??[]},[n.catalog]),getDataclasses:O.useCallback(()=>{var o;return((o=n.catalog)==null?void 0:o.dataClasses)??{}},[n.catalog]),getSingletons:O.useCallback(()=>{var o;return((o=n.catalog)==null?void 0:o.singletons)??{}},[n.catalog]),actions:{updateRoles:O.useCallback(o=>{r({type:"UPDATE_ROLES",payload:o})},[]),updatePrivileges:O.useCallback(o=>{r({type:"UPDATE_PRIVILEGES",payload:o})},[]),setRolesContent:O.useCallback(o=>{r({type:"SET_ROLES_CONTENT",payload:o})},[]),toggleTab:O.useCallback(o=>{r({type:"TOGGLE_TAB",payload:o})},[]),toggleForceLogin:O.useCallback(o=>{r({type:"TOGGLE_FORCE_LOGIN",payload:o})},[]),toggleRestrictedByDefault:O.useCallback(o=>{r({type:"TOGGLE_RESTRICTED_BY_DEFAULT",payload:o})},[]),setTabFlags:O.useCallback((o,a)=>{n.onSetTabFlags&&n.onSetTabFlags(o,a)},[n.onSetTabFlags]),openModal:O.useCallback(async o=>{const{type:a=fe.ModalType.ALERT}=o,s=EB.generate();return r({type:"CREATE_MODAL",payload:{id:s,type:a,isOpen:!0,...o}}),a===fe.ModalType.CONFIRM?new Promise(c=>{const u=SB.pipe(foe(d=>{const p=d.list.find(v=>v.id===s);return p!==void 0&&!p.isOpen})).subscribe(d=>{var v;const p=d.list.find(h=>h.id===s);if(p){const h=p.closeReason===fe.ModalCloseReason.CONFIRMED,x=lo.entries(((v=p.views)==null?void 0:v.toggles)||{}).reduce((m,b)=>({...m,[b[0]]:b[1].value}),{});r({type:"REMOVE_MODAL",payload:s}),u.unsubscribe(),c({confirmed:h,options:x})}})}):{confirmed:!1}},[r])}}}function Poe(){const e=O.useContext(M_);if(!e)throw new Error("useModals must be used within a ReducerAdapterProvider");const{state:t,dispatch:r}=e;return{modals:t.modals.list,closeModal:O.useCallback(n=>{r({type:"CLOSE_MODAL",payload:n})},[r]),editModal:O.useCallback(n=>{r({type:"EDIT_MODAL",payload:n})},[r]),removeModal:O.useCallback(n=>{r({type:"REMOVE_MODAL",payload:n})},[r])}}const Ey=({child:e,parent:t,status:r,onSelect:n,currentPrivilegeId:i})=>{const o=pr(),a=o.getPrivileges();function s(){const u=fe.addPrivilegeIn(t.id,e.id,a);o.actions.updatePrivileges(u)}function c(){const u=fe.removePrivilegeFrom(t.id,e.id,a);o.actions.updatePrivileges(u)}return C.jsxs(Zc,{color:r==="included"?"primary":"dark",onClick:r==="included"?c:s,disabled:r==="disabled",children:[e.privilege,C.jsx(_e.FdPlus,{className:Yr("transform transition-transform",{"rotate-45":r==="included"})})]})},koe=({selectedPrivilege:e,privileges:t,onSelect:r,setShowIncluded:n,showIncluded:i})=>{const o=Object.values(t),a=fe.getPrivilegeById(e.id,t);let s=a?fe.populateShallow(a.includes,t):[],c=a?fe.populateShallow(fe.parents(a.id,t),t):[],u=a?fe.populateShallow(fe.allowed(a.id,t),t):[];return[s,c,u]=[s,c,u].map(d=>d.filter(p=>(p==null?void 0:p.privilege)!=="guest")),o.length<2&&s.length+c.length+u.length===0?null:C.jsxs(dr,{depth:1,className:"w-full border-b p-4",children:[C.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[" ",o.length>2?C.jsx("h4",{className:"text-[13px] font-semibold",children:"Include a privilege"}):C.jsx("div",{}),C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx(xu,{onChange:()=>n(!i),checked:i}),C.jsx("label",{className:"text-xs",children:" Show inherited permissions"})]})]}),C.jsxs("div",{className:"flex flex-wrap items-start justify-start gap-1",children:[s.map(d=>C.jsx(Ey,{child:d,parent:e,status:"included",onSelect:r,currentPrivilegeId:d.id},d.id)),u.map(d=>C.jsx(Ey,{child:d,parent:e,status:"available",onSelect:r,currentPrivilegeId:d.id},d.id)),c.map(d=>C.jsx(Ey,{child:d,parent:e,status:"disabled",onSelect:r,currentPrivilegeId:d.id},d.id))]})]})},Aoe=({item:e,depth:t})=>{const r=pr(),[n,i]=O.useState(!1),o=r.getPrivileges(),a=fe.populateShallow(e.includes,o);return C.jsxs("div",{className:"py-1 text-xs text-white",children:[C.jsxs("div",{className:"flex items-center",children:[C.jsx("button",{className:"-ml-1",onClick:s=>{s.stopPropagation(),i(!n)},children:C.jsx(_e.FdRight,{className:Yr("h-4 w-4",{"tranform rotate-90":n})})})," ",C.jsx("div",{children:e.privilege})]}),C.jsx("div",{className:"border-l pl-2",style:{marginLeft:t?t*4:3},children:n&&C.jsx(OB,{depth:t+1,data:a})})]})},OB=({data:e,depth:t=0})=>e.map(r=>r.includes.length?C.jsx(Aoe,{item:r,depth:t},r.id):C.jsx("div",{className:Yr("py-1 text-xs",{}),children:r.privilege},r.id)),xr=()=>document.querySelector(`.${w2.ROLES_EDITOR_SCOPE_CLASS}`)||document.body,Td=({container:e,...t})=>C.jsx(fe.Portal,{...t,container:e||xr()}),HA=({privilege:e,selectedPrivilege:t,onSelect:r,isGuest:n=!1})=>{const i=pr(),o=i.getPrivileges(),a=fe.populateShallow(e.includes,o),[s,c]=O.useState(!1),[u,d]=O.useState(e.privilege),[p,v]=O.useState(null),h=fe.useOutsideClick(()=>{s&&b()});fe.useDidMountEffect(()=>{e.privilege!==u&&d(e.privilege)},[e.privilege]);function x(){c(!0),v(null)}function m(){c(!1),d(e.privilege)}function b(){v(null);try{fe.validateName(u);const _=fe.renamePrivilege(u,e.id,o);i.actions.updatePrivileges(_),c(!1)}catch(_){v(_.message)}}const w=async _=>{_.stopPropagation();const{confirmed:S}=await i.actions.openModal({title:"Delete Privilege",type:fe.ModalType.CONFIRM,color:fe.ModalColor.DANGER,message:"Are you sure you want to remove this Privilege?",icon:"FdWarningDanger"});if(S){const E=fe.removePrivilege(e.id,o);if((t==null?void 0:t.id)!==e.id){i.actions.updatePrivileges(E);return}const I=Object.keys(E).filter(N=>E[N].privilege!=="guest");if(I.length===0)r(null);else{const N=Object.keys(o).filter(L=>o[L].privilege!=="guest"),T=N.indexOf(e.id),A=Math.max(0,T-1),B=N[A];T===0?r(E[I[0]]):E[B]?r(E[B]):r(E[I[0]])}i.actions.updatePrivileges(E)}},y=O.useMemo(()=>e.resources.some(_=>_.exists===!1),[e]);return C.jsxs(Kr,{container:xr(),color:"negative",icon:C.jsx(_e.FdBulb,{}),label:"This privilege uses non-existing resources",isHidden:!y,children:[C.jsxs(dr,{depth:4,borderType:(t==null?void 0:t.id)===e.id?"primary":(t==null?void 0:t.id)!==e.id?"light":"default",className:Yr("w-full rounded border p-2",{"border-red-400":y&&(t==null?void 0:t.id)!==e.id}),role:"button","data-cy":"privilegeCard",onClick:()=>{r(e)},ref:h,children:[C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsxs("div",{className:"flex flex-1 items-center",children:[C.jsx("span",{className:"mr-4",children:n?C.jsx(_e.FdGuest,{className:"h-6 w-6"}):C.jsx(_e.FdGroup,{className:"h-6 w-6"})}),s?C.jsxs(wt.Root,{color:p?"negative":"primary",className:"flex-1 mr-2",children:[C.jsx(wt.Group,{children:C.jsx(wt.Field,{autoFocus:!0,value:u,onChange:_=>d(_.target.value),onKeyDown:_=>{_.key==="Enter"&&b(),_.key==="Escape"&&m()},onBlur:m,type:"text"})}),p&&C.jsx(wt.Message,{children:p})]}):C.jsx("span",{className:"inline-block grow overflow-hidden truncate whitespace-nowrap text-xs font-bold",children:u})]}),n?C.jsx("div",{className:"flex items-center justify-center",children:C.jsx(Kr,{icon:C.jsx(_e.FdBulb,{}),label:C.jsx("div",{className:"max-w-xs flex-1 min-w-0 break-words whitespace-normal py-1",children:"Guest privileges are used to indicate resources accessible without any permission required (e.g. an authenticate function)"}),container:xr(),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4"})})}):C.jsx("div",{className:"flex items-center space-x-2",children:s?C.jsxs(C.Fragment,{children:[C.jsx(Zt,{variant:"ghost",color:"white",onClick:m,children:C.jsx("span",{children:C.jsx(_e.FdClose,{className:"h-4 w-4"})})}),C.jsx(Zt,{variant:"ghost",color:"white",onClick:b,children:C.jsx("span",{children:C.jsx(_e.FdCheckCircle,{className:"h-4 w-4"})})})]}):C.jsxs(C.Fragment,{children:[C.jsx(Zt,{variant:"ghost",color:"white",onClick:x,children:C.jsx(_e.FdPen,{className:"h-4 w-4"})}),C.jsx(Zt,{variant:"ghost",color:"white",onClick:w,children:C.jsx(_e.FdTrash,{className:"h-4 w-4"})})]})})]}),a.length?C.jsx("div",{className:"ml-[43px]",children:C.jsx(OB,{data:a})}):null]})," "]})},Moe=({privileges:e,selectPrivilege:t,selectedPrivilege:r})=>{const n=pr(),i=n.getGuestPrivilege(),o=n.getCatalog(),a=O.useMemo(()=>{if(o===null||!i)return i;const s=fB({guest:i},Object.values((o==null?void 0:o.dataClasses)??{}));return pB(s,o).guest},[e,o]);return C.jsxs("div",{className:"flex flex-1 flex-col gap-y-4 overflow-auto p-4 pb-10 pt-1",children:[a?C.jsx(HA,{privilege:a,onSelect:t,selectedPrivilege:r,isGuest:!0}):null,Object.entries(e).length?Object.entries(e).filter(([,s])=>s.privilege!=="guest").sort(([,s],[,c])=>fe.localeCompare(s.privilege,c.privilege)).map(([s,c])=>C.jsx(HA,{privilege:c,onSelect:t,selectedPrivilege:r},s)):C.jsx("div",{className:"flex h-full items-center justify-center",children:C.jsx("div",{className:"flex flex-1 items-center justify-center",children:C.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 text-inactive-text",children:[C.jsx(_e.FdInfoBold,{className:"h-10 w-10"}),C.jsx("div",{className:"font-semibold",children:"There are no privileges"}),C.jsxs("div",{className:"flex items-center text-sm",children:["Create a new Privilege by clicking on the"," ",C.jsx(_e.FdPlus,{className:"ml-2 inline h-4 w-4"})]})]})})})]})};var $c={exports:{}},Hc={exports:{}},ct={};/** @license React v16.13.1
89
89
  * react-is.production.min.js
90
90
  *
91
91
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -110,5 +110,5 @@ Valid keys: `+JSON.stringify(Object.keys(k),null," "));var re=ue(q,te,j,G,H+"."
110
110
  `)&&(W="(?: "+W+")",ee=" "+ee,J++),D=new RegExp("^(?:"+W+")",k)),_&&(D=new RegExp("^"+W+"$(?!\\s)",k)),w&&(z=N.lastIndex),P=e(p,Q?D:N,ee),Q?P?(P.input=b(P.input,J),P[0]=b(P[0],J),P.index=N.lastIndex,N.lastIndex+=P[0].length):N.lastIndex=0:w&&P&&(N.lastIndex=N.global?P.index+P[0].length:z),_&&P&&P.length>1&&e(d,P[0],D,function(){for(K=1;K<arguments.length-2;K++)arguments[K]===void 0&&(P[K]=void 0)}),P&&U)for(P.groups=$=a(null),K=0;K<U.length;K++)Y=U[K],$[Y[0]]=P[Y[1]];return P}),ew=v,ew}var e2;function pF(){if(e2)return Kj;e2=1;var e=Fi(),t=J_();return e({target:"RegExp",proto:!0,forced:/./.exec!==t},{exec:t}),Kj}pF();var t2={},tw,r2;function hF(){if(r2)return tw;r2=1,pF();var e=zr(),t=xo(),r=J_(),n=_t(),i=Sr(),o=pl(),a=i("species"),s=RegExp.prototype;return tw=function(c,u,d,p){var v=i(c),h=!n(function(){var w={};return w[v]=function(){return 7},""[c](w)!==7}),x=h&&!n(function(){var w=!1,y=/a/;return c==="split"&&(y={},y.constructor={},y.constructor[a]=function(){return y},y.flags="",y[v]=/./[v]),y.exec=function(){return w=!0,null},y[v](""),!w});if(!h||!x||d){var m=/./[v],b=u(v,""[c],function(w,y,_,S,E){var I=y.exec;return I===r||I===s.exec?h&&!E?{done:!0,value:e(m,y,_,S)}:{done:!0,value:e(w,_,y,S)}:{done:!1}});t(String.prototype,c,b[0]),t(s,v,b[1])}p&&o(s[v],"sham",!0)},tw}var rw,n2;function vF(){if(n2)return rw;n2=1;var e=QB().charAt;return rw=function(t,r,n){return r+(n?e(t,r).length:1)},rw}var nw,i2;function yse(){if(i2)return nw;i2=1;var e=Wt(),t=_t(),r=e.RegExp,n=!t(function(){var i=!0;try{r(".","d")}catch{i=!1}var o={},a="",s=i?"dgimsy":"gimsy",c=function(v,h){Object.defineProperty(o,v,{get:function(){return a+=h,!0}})},u={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};i&&(u.hasIndices="d");for(var d in u)c(d,u[d]);var p=Object.getOwnPropertyDescriptor(r.prototype,"flags").get.call(o);return p!==s||a!==s});return nw={correct:n},nw}var iw,o2;function gF(){if(o2)return iw;o2=1;var e=zr(),t=gn(),r=Md(),n=yse(),i=fF(),o=RegExp.prototype;return iw=n.correct?function(a){return a.flags}:function(a){return!n.correct&&r(o,a)&&!t(a,"flags")?e(i,a):a.flags},iw}var ow,a2;function mF(){if(a2)return ow;a2=1;var e=zr(),t=mn(),r=Jt(),n=Bi(),i=J_(),o=TypeError;return ow=function(a,s){var c=a.exec;if(r(c)){var u=e(c,a,s);return u!==null&&t(u),u}if(n(a)==="RegExp")return e(i,a,s);throw new o("RegExp#exec called on incompatible receiver")},ow}var s2;function xse(){if(s2)return t2;s2=1;var e=zr(),t=bt(),r=hF(),n=mn(),i=sr(),o=U_(),a=wo(),s=yo(),c=fl(),u=vF(),d=gF(),p=mF(),v=t("".indexOf);return r("match",function(h,x,m){return[function(w){var y=s(this),_=i(w)?c(w,h):void 0;return _?e(_,w,y):new RegExp(w)[h](a(y))},function(b){var w=n(this),y=a(b),_=m(x,w,y);if(_.done)return _.value;var S=a(d(w));if(v(S,"g")===-1)return p(w,y);var E=v(S,"u")!==-1;w.lastIndex=0;for(var I=[],N=0,T;(T=p(w,y))!==null;){var A=a(T[0]);I[N]=A,A===""&&(w.lastIndex=u(y,o(w.lastIndex),E)),N++}return N===0?null:I}]}),t2}xse();var l2={},aw,c2;function wse(){if(c2)return aw;c2=1;var e=zB(),t=hi();return aw=function(r,n,i){return i.get&&e(i.get,n,{getter:!0}),i.set&&e(i.set,n,{setter:!0}),t.f(r,n,i)},aw}var u2;function _se(){if(u2)return l2;u2=1;var e=An(),t=V_().EXISTS,r=bt(),n=wse(),i=Function.prototype,o=r(i.toString),a=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,s=r(a.exec),c="name";return e&&!t&&n(i,c,{configurable:!0,get:function(){try{return s(a,o(this))[1]}catch{return""}}}),l2}_se();var d2={},sw,f2;function Ese(){if(f2)return sw;f2=1;var e=Pd(),t=Function.prototype,r=t.apply,n=t.call;return sw=typeof Reflect=="object"&&Reflect.apply||(e?n.bind(r):function(){return n.apply(r,arguments)}),sw}var lw,p2;function Sse(){if(p2)return lw;p2=1;var e=bt(),t=Ia(),r=Math.floor,n=e("".charAt),i=e("".replace),o=e("".slice),a=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,s=/\$([$&'`]|\d{1,2})/g;return lw=function(c,u,d,p,v,h){var x=d+c.length,m=p.length,b=s;return v!==void 0&&(v=t(v),b=a),i(h,b,function(w,y){var _;switch(n(y,0)){case"$":return"$";case"&":return c;case"`":return o(u,0,d);case"'":return o(u,x);case"<":_=v[o(y,1,-1)];break;default:var S=+y;if(S===0)return w;if(S>m){var E=r(S/10);return E===0?w:E<=m?p[E-1]===void 0?n(y,1):p[E-1]+n(y,1):w}_=p[S-1]}return _===void 0?"":_})},lw}var h2;function Ose(){if(h2)return d2;h2=1;var e=Ese(),t=zr(),r=bt(),n=hF(),i=_t(),o=mn(),a=Jt(),s=sr(),c=qd(),u=U_(),d=wo(),p=yo(),v=vF(),h=fl(),x=Sse(),m=gF(),b=mF(),w=Sr(),y=w("replace"),_=Math.max,S=Math.min,E=r([].concat),I=r([].push),N=r("".indexOf),T=r("".slice),A=function(z){return z===void 0?z:String(z)},B=(function(){return"a".replace(/./,"$0")==="$0"})(),L=(function(){return/./[y]?/./[y]("a","$0")==="":!1})(),D=!i(function(){var z=/./;return z.exec=function(){var P=[];return P.groups={a:"7"},P},"".replace(z,"$<a>")!=="7"});return n("replace",function(z,P,K){var $=L?"$":"$0";return[function(U,Q){var k=p(this),W=s(U)?h(U,y):void 0;return W?t(W,U,k,Q):t(P,d(k),U,Q)},function(Y,U){var Q=o(this),k=d(Y);if(typeof U=="string"&&N(U,$)===-1&&N(U,"$<")===-1){var W=K(P,Q,k,U);if(W.done)return W.value}var J=a(U);J||(U=d(U));var ee=d(m(Q)),j=N(ee,"g")!==-1,G;j&&(G=N(ee,"u")!==-1,Q.lastIndex=0);for(var H=[],q;q=b(Q,k),!(q===null||(I(H,q),!j));){var X=d(q[0]);X===""&&(Q.lastIndex=v(k,u(Q.lastIndex),G))}for(var ne="",te=0,ue=0;ue<H.length;ue++){q=H[ue];for(var re=d(q[0]),ge=_(S(c(q.index),k.length),0),de=[],xe,se=1;se<q.length;se++)I(de,A(q[se]));var le=q.groups;if(J){var we=E([re],de,ge,k);le!==void 0&&I(we,le),xe=d(e(U,void 0,we))}else xe=x(re,k,ge,de,le,U);ge>=te&&(ne+=T(k,te,ge)+xe,te=ge+re.length)}return ne+T(k,te)}]},!D||!B||L),d2}Ose();function Ti(e){return!e||!e.ownerDocument||!e.ownerDocument.defaultView?window:e.ownerDocument.defaultView}function uu(e){return!e||!e.ownerDocument?document:e.ownerDocument}var Ko=null,v2=null;dF&&window.addEventListener("resize",function(){v2!==window.devicePixelRatio&&(v2=window.devicePixelRatio,Ko=null)});function g2(e){if(Ko===null){var t=uu(e);if(typeof t>"u")return Ko=0,Ko;var r=t.body,n=t.createElement("div");n.classList.add("simplebar-hide-scrollbar"),r.appendChild(n);var i=n.getBoundingClientRect().right;r.removeChild(n),Ko=i}return Ko}var $u=(function(){function e(r,n){var i=this;this.onScroll=function(){var o=Ti(i.el);i.scrollXTicking||(o.requestAnimationFrame(i.scrollX),i.scrollXTicking=!0),i.scrollYTicking||(o.requestAnimationFrame(i.scrollY),i.scrollYTicking=!0)},this.scrollX=function(){i.axis.x.isOverflowing&&(i.showScrollbar("x"),i.positionScrollbar("x")),i.scrollXTicking=!1},this.scrollY=function(){i.axis.y.isOverflowing&&(i.showScrollbar("y"),i.positionScrollbar("y")),i.scrollYTicking=!1},this.onMouseEnter=function(){i.showScrollbar("x"),i.showScrollbar("y")},this.onMouseMove=function(o){i.mouseX=o.clientX,i.mouseY=o.clientY,(i.axis.x.isOverflowing||i.axis.x.forceVisible)&&i.onMouseMoveForAxis("x"),(i.axis.y.isOverflowing||i.axis.y.forceVisible)&&i.onMouseMoveForAxis("y")},this.onMouseLeave=function(){i.onMouseMove.cancel(),(i.axis.x.isOverflowing||i.axis.x.forceVisible)&&i.onMouseLeaveForAxis("x"),(i.axis.y.isOverflowing||i.axis.y.forceVisible)&&i.onMouseLeaveForAxis("y"),i.mouseX=-1,i.mouseY=-1},this.onWindowResize=function(){i.scrollbarWidth=i.getScrollbarWidth(),i.hideNativeScrollbar()},this.hideScrollbars=function(){i.axis.x.track.rect=i.axis.x.track.el.getBoundingClientRect(),i.axis.y.track.rect=i.axis.y.track.el.getBoundingClientRect(),i.isWithinBounds(i.axis.y.track.rect)||(i.axis.y.scrollbar.el.classList.remove(i.classNames.visible),i.axis.y.isVisible=!1),i.isWithinBounds(i.axis.x.track.rect)||(i.axis.x.scrollbar.el.classList.remove(i.classNames.visible),i.axis.x.isVisible=!1)},this.onPointerEvent=function(o){var a,s;i.axis.x.track.rect=i.axis.x.track.el.getBoundingClientRect(),i.axis.y.track.rect=i.axis.y.track.el.getBoundingClientRect(),(i.axis.x.isOverflowing||i.axis.x.forceVisible)&&(a=i.isWithinBounds(i.axis.x.track.rect)),(i.axis.y.isOverflowing||i.axis.y.forceVisible)&&(s=i.isWithinBounds(i.axis.y.track.rect)),(a||s)&&(o.preventDefault(),o.stopPropagation(),o.type==="mousedown"&&(a&&(i.axis.x.scrollbar.rect=i.axis.x.scrollbar.el.getBoundingClientRect(),i.isWithinBounds(i.axis.x.scrollbar.rect)?i.onDragStart(o,"x"):i.onTrackClick(o,"x")),s&&(i.axis.y.scrollbar.rect=i.axis.y.scrollbar.el.getBoundingClientRect(),i.isWithinBounds(i.axis.y.scrollbar.rect)?i.onDragStart(o,"y"):i.onTrackClick(o,"y"))))},this.drag=function(o){var a,s=i.axis[i.draggedAxis].track,c=s.rect[i.axis[i.draggedAxis].sizeAttr],u=i.axis[i.draggedAxis].scrollbar,d=i.contentWrapperEl[i.axis[i.draggedAxis].scrollSizeAttr],p=parseInt(i.elStyles[i.axis[i.draggedAxis].sizeAttr],10);o.preventDefault(),o.stopPropagation(),i.draggedAxis==="y"?a=o.pageY:a=o.pageX;var v=a-s.rect[i.axis[i.draggedAxis].offsetAttr]-i.axis[i.draggedAxis].dragOffset,h=v/(c-u.size),x=h*(d-p);i.draggedAxis==="x"&&(x=i.isRtl&&e.getRtlHelpers().isRtlScrollbarInverted?x-(c+u.size):x,x=i.isRtl&&e.getRtlHelpers().isRtlScrollingInverted?-x:x),i.contentWrapperEl[i.axis[i.draggedAxis].scrollOffsetAttr]=x},this.onEndDrag=function(o){var a=uu(i.el),s=Ti(i.el);o.preventDefault(),o.stopPropagation(),i.el.classList.remove(i.classNames.dragging),a.removeEventListener("mousemove",i.drag,!0),a.removeEventListener("mouseup",i.onEndDrag,!0),i.removePreventClickId=s.setTimeout(function(){a.removeEventListener("click",i.preventClick,!0),a.removeEventListener("dblclick",i.preventClick,!0),i.removePreventClickId=null})},this.preventClick=function(o){o.preventDefault(),o.stopPropagation()},this.el=r,this.minScrollbarWidth=20,this.options=Object.assign({},e.defaultOptions,n),this.classNames=Object.assign({},e.defaultOptions.classNames,this.options.classNames),this.axis={x:{scrollOffsetAttr:"scrollLeft",sizeAttr:"width",scrollSizeAttr:"scrollWidth",offsetSizeAttr:"offsetWidth",offsetAttr:"left",overflowAttr:"overflowX",dragOffset:0,isOverflowing:!0,isVisible:!1,forceVisible:!1,track:{},scrollbar:{}},y:{scrollOffsetAttr:"scrollTop",sizeAttr:"height",scrollSizeAttr:"scrollHeight",offsetSizeAttr:"offsetHeight",offsetAttr:"top",overflowAttr:"overflowY",dragOffset:0,isOverflowing:!0,isVisible:!1,forceVisible:!1,track:{},scrollbar:{}}},this.removePreventClickId=null,!e.instances.has(this.el)&&(this.recalculate=Rj(this.recalculate.bind(this),64),this.onMouseMove=Rj(this.onMouseMove.bind(this),64),this.hideScrollbars=Tj(this.hideScrollbars.bind(this),this.options.timeout),this.onWindowResize=Tj(this.onWindowResize.bind(this),64,{leading:!0}),e.getRtlHelpers=Fae(e.getRtlHelpers),this.init())}e.getRtlHelpers=function(){var n=document.createElement("div");n.innerHTML='<div class="hs-dummy-scrollbar-size"><div style="height: 200%; width: 200%; margin: 10px 0;"></div></div>';var i=n.firstElementChild;document.body.appendChild(i);var o=i.firstElementChild;i.scrollLeft=0;var a=e.getOffset(i),s=e.getOffset(o);i.scrollLeft=999;var c=e.getOffset(o);return{isRtlScrollingInverted:a.left!==s.left&&s.left-c.left!==0,isRtlScrollbarInverted:a.left!==s.left}},e.getOffset=function(n){var i=n.getBoundingClientRect(),o=uu(n),a=Ti(n);return{top:i.top+(a.pageYOffset||o.documentElement.scrollTop),left:i.left+(a.pageXOffset||o.documentElement.scrollLeft)}};var t=e.prototype;return t.init=function(){e.instances.set(this.el,this),dF&&(this.initDOM(),this.setAccessibilityAttributes(),this.scrollbarWidth=this.getScrollbarWidth(),this.recalculate(),this.initListeners())},t.initDOM=function(){var n=this;if(Array.prototype.filter.call(this.el.children,function(a){return a.classList.contains(n.classNames.wrapper)}).length)this.wrapperEl=this.el.querySelector("."+this.classNames.wrapper),this.contentWrapperEl=this.options.scrollableNode||this.el.querySelector("."+this.classNames.contentWrapper),this.contentEl=this.options.contentNode||this.el.querySelector("."+this.classNames.contentEl),this.offsetEl=this.el.querySelector("."+this.classNames.offset),this.maskEl=this.el.querySelector("."+this.classNames.mask),this.placeholderEl=this.findChild(this.wrapperEl,"."+this.classNames.placeholder),this.heightAutoObserverWrapperEl=this.el.querySelector("."+this.classNames.heightAutoObserverWrapperEl),this.heightAutoObserverEl=this.el.querySelector("."+this.classNames.heightAutoObserverEl),this.axis.x.track.el=this.findChild(this.el,"."+this.classNames.track+"."+this.classNames.horizontal),this.axis.y.track.el=this.findChild(this.el,"."+this.classNames.track+"."+this.classNames.vertical);else{for(this.wrapperEl=document.createElement("div"),this.contentWrapperEl=document.createElement("div"),this.offsetEl=document.createElement("div"),this.maskEl=document.createElement("div"),this.contentEl=document.createElement("div"),this.placeholderEl=document.createElement("div"),this.heightAutoObserverWrapperEl=document.createElement("div"),this.heightAutoObserverEl=document.createElement("div"),this.wrapperEl.classList.add(this.classNames.wrapper),this.contentWrapperEl.classList.add(this.classNames.contentWrapper),this.offsetEl.classList.add(this.classNames.offset),this.maskEl.classList.add(this.classNames.mask),this.contentEl.classList.add(this.classNames.contentEl),this.placeholderEl.classList.add(this.classNames.placeholder),this.heightAutoObserverWrapperEl.classList.add(this.classNames.heightAutoObserverWrapperEl),this.heightAutoObserverEl.classList.add(this.classNames.heightAutoObserverEl);this.el.firstChild;)this.contentEl.appendChild(this.el.firstChild);this.contentWrapperEl.appendChild(this.contentEl),this.offsetEl.appendChild(this.contentWrapperEl),this.maskEl.appendChild(this.offsetEl),this.heightAutoObserverWrapperEl.appendChild(this.heightAutoObserverEl),this.wrapperEl.appendChild(this.heightAutoObserverWrapperEl),this.wrapperEl.appendChild(this.maskEl),this.wrapperEl.appendChild(this.placeholderEl),this.el.appendChild(this.wrapperEl)}if(!this.axis.x.track.el||!this.axis.y.track.el){var i=document.createElement("div"),o=document.createElement("div");i.classList.add(this.classNames.track),o.classList.add(this.classNames.scrollbar),i.appendChild(o),this.axis.x.track.el=i.cloneNode(!0),this.axis.x.track.el.classList.add(this.classNames.horizontal),this.axis.y.track.el=i.cloneNode(!0),this.axis.y.track.el.classList.add(this.classNames.vertical),this.el.appendChild(this.axis.x.track.el),this.el.appendChild(this.axis.y.track.el)}this.axis.x.scrollbar.el=this.axis.x.track.el.querySelector("."+this.classNames.scrollbar),this.axis.y.scrollbar.el=this.axis.y.track.el.querySelector("."+this.classNames.scrollbar),this.options.autoHide||(this.axis.x.scrollbar.el.classList.add(this.classNames.visible),this.axis.y.scrollbar.el.classList.add(this.classNames.visible)),this.el.setAttribute("data-simplebar","init")},t.setAccessibilityAttributes=function(){var n=this.options.ariaLabel||"scrollable content";this.contentWrapperEl.setAttribute("tabindex","0"),this.contentWrapperEl.setAttribute("role","region"),this.contentWrapperEl.setAttribute("aria-label",n)},t.initListeners=function(){var n=this,i=Ti(this.el);this.options.autoHide&&this.el.addEventListener("mouseenter",this.onMouseEnter),["mousedown","click","dblclick"].forEach(function(c){n.el.addEventListener(c,n.onPointerEvent,!0)}),["touchstart","touchend","touchmove"].forEach(function(c){n.el.addEventListener(c,n.onPointerEvent,{capture:!0,passive:!0})}),this.el.addEventListener("mousemove",this.onMouseMove),this.el.addEventListener("mouseleave",this.onMouseLeave),this.contentWrapperEl.addEventListener("scroll",this.onScroll),i.addEventListener("resize",this.onWindowResize);var o=!1,a=null,s=i.ResizeObserver||lse;this.resizeObserver=new s(function(){!o||a!==null||(a=i.requestAnimationFrame(function(){n.recalculate(),a=null}))}),this.resizeObserver.observe(this.el),this.resizeObserver.observe(this.contentEl),i.requestAnimationFrame(function(){o=!0}),this.mutationObserver=new i.MutationObserver(this.recalculate),this.mutationObserver.observe(this.contentEl,{childList:!0,subtree:!0,characterData:!0})},t.recalculate=function(){var n=Ti(this.el);this.elStyles=n.getComputedStyle(this.el),this.isRtl=this.elStyles.direction==="rtl";var i=this.heightAutoObserverEl.offsetHeight<=1,o=this.heightAutoObserverEl.offsetWidth<=1,a=this.contentEl.offsetWidth,s=this.contentWrapperEl.offsetWidth,c=this.elStyles.overflowX,u=this.elStyles.overflowY;this.contentEl.style.padding=this.elStyles.paddingTop+" "+this.elStyles.paddingRight+" "+this.elStyles.paddingBottom+" "+this.elStyles.paddingLeft,this.wrapperEl.style.margin="-"+this.elStyles.paddingTop+" -"+this.elStyles.paddingRight+" -"+this.elStyles.paddingBottom+" -"+this.elStyles.paddingLeft;var d=this.contentEl.scrollHeight,p=this.contentEl.scrollWidth;this.contentWrapperEl.style.height=i?"auto":"100%",this.placeholderEl.style.width=o?a+"px":"auto",this.placeholderEl.style.height=d+"px";var v=this.contentWrapperEl.offsetHeight;this.axis.x.isOverflowing=p>a,this.axis.y.isOverflowing=d>v,this.axis.x.isOverflowing=c==="hidden"?!1:this.axis.x.isOverflowing,this.axis.y.isOverflowing=u==="hidden"?!1:this.axis.y.isOverflowing,this.axis.x.forceVisible=this.options.forceVisible==="x"||this.options.forceVisible===!0,this.axis.y.forceVisible=this.options.forceVisible==="y"||this.options.forceVisible===!0,this.hideNativeScrollbar();var h=this.axis.x.isOverflowing?this.scrollbarWidth:0,x=this.axis.y.isOverflowing?this.scrollbarWidth:0;this.axis.x.isOverflowing=this.axis.x.isOverflowing&&p>s-x,this.axis.y.isOverflowing=this.axis.y.isOverflowing&&d>v-h,this.axis.x.scrollbar.size=this.getScrollbarSize("x"),this.axis.y.scrollbar.size=this.getScrollbarSize("y"),this.axis.x.scrollbar.el.style.width=this.axis.x.scrollbar.size+"px",this.axis.y.scrollbar.el.style.height=this.axis.y.scrollbar.size+"px",this.positionScrollbar("x"),this.positionScrollbar("y"),this.toggleTrackVisibility("x"),this.toggleTrackVisibility("y")},t.getScrollbarSize=function(n){if(n===void 0&&(n="y"),!this.axis[n].isOverflowing)return 0;var i=this.contentEl[this.axis[n].scrollSizeAttr],o=this.axis[n].track.el[this.axis[n].offsetSizeAttr],a,s=o/i;return a=Math.max(~~(s*o),this.options.scrollbarMinSize),this.options.scrollbarMaxSize&&(a=Math.min(a,this.options.scrollbarMaxSize)),a},t.positionScrollbar=function(n){if(n===void 0&&(n="y"),!!this.axis[n].isOverflowing){var i=this.contentWrapperEl[this.axis[n].scrollSizeAttr],o=this.axis[n].track.el[this.axis[n].offsetSizeAttr],a=parseInt(this.elStyles[this.axis[n].sizeAttr],10),s=this.axis[n].scrollbar,c=this.contentWrapperEl[this.axis[n].scrollOffsetAttr];c=n==="x"&&this.isRtl&&e.getRtlHelpers().isRtlScrollingInverted?-c:c;var u=c/(i-a),d=~~((o-s.size)*u);d=n==="x"&&this.isRtl&&e.getRtlHelpers().isRtlScrollbarInverted?d+(o-s.size):d,s.el.style.transform=n==="x"?"translate3d("+d+"px, 0, 0)":"translate3d(0, "+d+"px, 0)"}},t.toggleTrackVisibility=function(n){n===void 0&&(n="y");var i=this.axis[n].track.el,o=this.axis[n].scrollbar.el;this.axis[n].isOverflowing||this.axis[n].forceVisible?(i.style.visibility="visible",this.contentWrapperEl.style[this.axis[n].overflowAttr]="scroll"):(i.style.visibility="hidden",this.contentWrapperEl.style[this.axis[n].overflowAttr]="hidden"),this.axis[n].isOverflowing?o.style.display="block":o.style.display="none"},t.hideNativeScrollbar=function(){this.offsetEl.style[this.isRtl?"left":"right"]=this.axis.y.isOverflowing||this.axis.y.forceVisible?"-"+this.scrollbarWidth+"px":0,this.offsetEl.style.bottom=this.axis.x.isOverflowing||this.axis.x.forceVisible?"-"+this.scrollbarWidth+"px":0},t.onMouseMoveForAxis=function(n){n===void 0&&(n="y"),this.axis[n].track.rect=this.axis[n].track.el.getBoundingClientRect(),this.axis[n].scrollbar.rect=this.axis[n].scrollbar.el.getBoundingClientRect();var i=this.isWithinBounds(this.axis[n].scrollbar.rect);i?this.axis[n].scrollbar.el.classList.add(this.classNames.hover):this.axis[n].scrollbar.el.classList.remove(this.classNames.hover),this.isWithinBounds(this.axis[n].track.rect)?(this.showScrollbar(n),this.axis[n].track.el.classList.add(this.classNames.hover)):this.axis[n].track.el.classList.remove(this.classNames.hover)},t.onMouseLeaveForAxis=function(n){n===void 0&&(n="y"),this.axis[n].track.el.classList.remove(this.classNames.hover),this.axis[n].scrollbar.el.classList.remove(this.classNames.hover)},t.showScrollbar=function(n){n===void 0&&(n="y");var i=this.axis[n].scrollbar.el;this.axis[n].isVisible||(i.classList.add(this.classNames.visible),this.axis[n].isVisible=!0),this.options.autoHide&&this.hideScrollbars()},t.onDragStart=function(n,i){i===void 0&&(i="y");var o=uu(this.el),a=Ti(this.el),s=this.axis[i].scrollbar,c=i==="y"?n.pageY:n.pageX;this.axis[i].dragOffset=c-s.rect[this.axis[i].offsetAttr],this.draggedAxis=i,this.el.classList.add(this.classNames.dragging),o.addEventListener("mousemove",this.drag,!0),o.addEventListener("mouseup",this.onEndDrag,!0),this.removePreventClickId===null?(o.addEventListener("click",this.preventClick,!0),o.addEventListener("dblclick",this.preventClick,!0)):(a.clearTimeout(this.removePreventClickId),this.removePreventClickId=null)},t.onTrackClick=function(n,i){var o=this;if(i===void 0&&(i="y"),!!this.options.clickOnTrack){var a=Ti(this.el);this.axis[i].scrollbar.rect=this.axis[i].scrollbar.el.getBoundingClientRect();var s=this.axis[i].scrollbar,c=s.rect[this.axis[i].offsetAttr],u=parseInt(this.elStyles[this.axis[i].sizeAttr],10),d=this.contentWrapperEl[this.axis[i].scrollOffsetAttr],p=i==="y"?this.mouseY-c:this.mouseX-c,v=p<0?-1:1,h=v===-1?d-u:d+u,x=function m(){if(v===-1){if(d>h){var b;d-=o.options.clickOnTrackSpeed,o.contentWrapperEl.scrollTo((b={},b[o.axis[i].offsetAttr]=d,b)),a.requestAnimationFrame(m)}}else if(d<h){var w;d+=o.options.clickOnTrackSpeed,o.contentWrapperEl.scrollTo((w={},w[o.axis[i].offsetAttr]=d,w)),a.requestAnimationFrame(m)}};x()}},t.getContentElement=function(){return this.contentEl},t.getScrollElement=function(){return this.contentWrapperEl},t.getScrollbarWidth=function(){try{return getComputedStyle(this.contentWrapperEl,"::-webkit-scrollbar").display==="none"||"scrollbarWidth"in document.documentElement.style||"-ms-overflow-style"in document.documentElement.style?0:g2(this.el)}catch{return g2(this.el)}},t.removeListeners=function(){var n=this,i=Ti(this.el);this.options.autoHide&&this.el.removeEventListener("mouseenter",this.onMouseEnter),["mousedown","click","dblclick"].forEach(function(o){n.el.removeEventListener(o,n.onPointerEvent,!0)}),["touchstart","touchend","touchmove"].forEach(function(o){n.el.removeEventListener(o,n.onPointerEvent,{capture:!0,passive:!0})}),this.el.removeEventListener("mousemove",this.onMouseMove),this.el.removeEventListener("mouseleave",this.onMouseLeave),this.contentWrapperEl&&this.contentWrapperEl.removeEventListener("scroll",this.onScroll),i.removeEventListener("resize",this.onWindowResize),this.mutationObserver&&this.mutationObserver.disconnect(),this.resizeObserver&&this.resizeObserver.disconnect(),this.recalculate.cancel(),this.onMouseMove.cancel(),this.hideScrollbars.cancel(),this.onWindowResize.cancel()},t.unMount=function(){this.removeListeners(),e.instances.delete(this.el)},t.isWithinBounds=function(n){return this.mouseX>=n.left&&this.mouseX<=n.left+n.width&&this.mouseY>=n.top&&this.mouseY<=n.top+n.height},t.findChild=function(n,i){var o=n.matches||n.webkitMatchesSelector||n.mozMatchesSelector||n.msMatchesSelector;return Array.prototype.filter.call(n.children,function(a){return o.call(a,i)})[0]},e})();$u.defaultOptions={autoHide:!0,forceVisible:!1,clickOnTrack:!0,clickOnTrackSpeed:40,classNames:{contentEl:"simplebar-content",contentWrapper:"simplebar-content-wrapper",offset:"simplebar-offset",mask:"simplebar-mask",wrapper:"simplebar-wrapper",placeholder:"simplebar-placeholder",scrollbar:"simplebar-scrollbar",track:"simplebar-track",heightAutoObserverWrapperEl:"simplebar-height-auto-observer-wrapper",heightAutoObserverEl:"simplebar-height-auto-observer",visible:"simplebar-visible",horizontal:"simplebar-horizontal",vertical:"simplebar-vertical",hover:"simplebar-hover",dragging:"simplebar-dragging"},scrollbarMinSize:25,scrollbarMaxSize:0,timeout:1e3};$u.instances=new WeakMap;function m2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Gc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?m2(Object(r),!0).forEach(function(n){Cse(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Cse(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hu(){return Hu=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Hu.apply(this,arguments)}function Ise(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,o;for(o=0;o<n.length;o++)i=n[o],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function Rse(e,t){if(e==null)return{};var r=Ise(e,t),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var Nse=["children","scrollableNodeProps","tag"],Tse=function(t){var r=Array.prototype.reduce.call(t,function(n,i){var o=i.name.match(/data-simplebar-(.+)/);if(o){var a=o[1].replace(/\W+(.)/g,function(s,c){return c.toUpperCase()});switch(i.value){case"true":n[a]=!0;break;case"false":n[a]=!1;break;case void 0:n[a]=!0;break;default:n[a]=i.value}}return n},{});return r},$d=O.forwardRef(function(e,t){var r=e.children,n=e.scrollableNodeProps,i=n===void 0?{}:n,o=e.tag,a=o===void 0?"div":o,s=Rse(e,Nse),c=a,u,d=O.useRef(),p=O.useRef(),v=O.useRef(),h={},x={},m=[];return Object.keys(s).forEach(function(b){Object.prototype.hasOwnProperty.call($u.defaultOptions,b)?h[b]=s[b]:b.match(/data-simplebar-(.+)/)&&b!=="data-simplebar-direction"?m.push({name:b,value:s[b]}):x[b]=s[b]}),m.length&&console.warn(`simplebar-react: this way of passing options is deprecated. Pass it like normal props instead:
111
111
  'data-simplebar-auto-hide="false"' —> 'autoHide="false"'
112
112
  `),O.useEffect(function(){return d=i.ref||d,p.current&&(u=new $u(p.current,Gc(Gc(Gc(Gc({},Tse(m)),h),d&&{scrollableNode:d.current}),v.current&&{contentNode:v.current})),typeof t=="function"?t(u):t&&(t.current=u)),function(){u.unMount(),u=null,typeof t=="function"&&t(null)}},[]),O.createElement(c,Hu({ref:p,"data-simplebar":!0},x),O.createElement("div",{className:"simplebar-wrapper"},O.createElement("div",{className:"simplebar-height-auto-observer-wrapper"},O.createElement("div",{className:"simplebar-height-auto-observer"})),O.createElement("div",{className:"simplebar-mask"},O.createElement("div",{className:"simplebar-offset"},typeof r=="function"?r({scrollableNodeRef:d,contentNodeRef:v}):O.createElement("div",Hu({},i,{className:"simplebar-content-wrapper".concat(i.className?" ".concat(i.className):"")}),O.createElement("div",{className:"simplebar-content"},r)))),O.createElement("div",{className:"simplebar-placeholder"})),O.createElement("div",{className:"simplebar-track simplebar-horizontal"},O.createElement("div",{className:"simplebar-scrollbar"})),O.createElement("div",{className:"simplebar-track simplebar-vertical"},O.createElement("div",{className:"simplebar-scrollbar"})))});$d.displayName="SimpleBar";$d.propTypes={children:hs.oneOfType([hs.node,hs.func]),scrollableNodeProps:hs.object,tag:hs.string};const bF=e=>{switch(e){case fe.EPermissionType.DATACLASS:return C.jsx(_e.FdTableHeader,{className:"h-6 w-6"});case fe.EPermissionType.SINGLETON:return C.jsx(_e.FdSingleton,{className:"h-6 w-6"});case fe.EPermissionType.DATASTORE:return C.jsx(_e.FdModel3,{className:"h-6 w-6"});case fe.EPermissionType.ATTRIBUTE:return C.jsx(_e.FdTableColumn,{className:"h-6 w-6"});case fe.EPermissionType.METHOD:return C.jsx(_e.FdCode,{className:"h-6 w-6"});case fe.EPermissionType.SINGLETON_METHOD:return C.jsx(_e.FdFunctionSingleton,{className:"h-6 w-6"});case fe.ESubPermissionType.ENTITY_SEL_METHOD:return C.jsx(_e.FdFunctionSelection,{className:"h-6 w-6"});case fe.ESubPermissionType.ENTITY_METHOD:return C.jsx(_e.FdFunctionEntity,{className:"h-6 w-6"});case fe.ESubPermissionType.DS_METHOD:return C.jsx(_e.FdFunctionDatastore,{className:"h-6 w-6"});case fe.ESubPermissionType.DATACLASS_METHOD:return C.jsx(_e.FdFunctionDataclass,{className:"h-6 w-6"});default:return C.jsx(_e.FdTableHeader,{className:"h-6 w-6"})}},b2=({children:e})=>C.jsx("div",{className:"h-full w-full",children:C.jsx("div",{className:"flex h-full w-full flex-1 items-center justify-center",children:C.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 py-4 text-inactive-text",children:[C.jsx(_e.FdInfoBold,{className:"h-10 w-10"}),C.jsx("div",{className:"text-center text-sm",children:e})]})})}),Uo=({permissions:e,label:t,onToggle:r,onSelect:n,promoted:i,showIncluded:o,privileges:a,exists:s})=>{const c=e.find(u=>u.name===t);return c?C.jsxs("div",{className:"relative mx-auto flex w-fit items-center",children:[C.jsx(or,{value:c.checked||c.from.length===0||t==="promote"?c.checked:o&&c.from.length>0?null:!1,onChange:()=>r&&r(c),isInvalid:s===!1}),C.jsxs("div",{className:"absolute left-full translate-x-1/4 top-1/2 -translate-y-1/2 flex cursor-pointer items-center space-x-1",children:[t!=="promote"&&(c.checked&&(c.info||c.from.length>0)||!c.checked&&c.from.length>0)&&C.jsx(C.Fragment,{children:C.jsx(Kr,{container:xr(),delay:100,label:C.jsxs("div",{className:"max-w-xs h-fit flex flex-col gap-y-3 p-1.5 text-sm font-semibold",children:[c.from.length?C.jsxs("div",{className:"flex items-start",children:[C.jsx(_e.FdBulb,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"}),C.jsxs("p",{className:"flex flex-col gap-y-2",children:[C.jsx("span",{className:"mr-1",children:"Permission inherited from:"}),C.jsx("ul",{children:c.from.map(u=>C.jsx("li",{className:"cursor-pointer list-disc font-bold hover:underline",onClick:()=>n(a[u].id),children:a[u].privilege}))})]})]}):null,c.info&&C.jsxs("div",{className:"flex items-start",children:[C.jsx(_e.FdInfoCircle,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"})," ",C.jsx("span",{className:"flex-1 min-w-0 break-words whitespace-normal text-left",children:c.info})]})]}),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4 "})})}),(c.checked||c.from.length>0)&&["execute"].includes(t)&&!!(i!=null&&i.length)&&C.jsx(Kr,{container:xr(),delay:100,label:C.jsx("div",{className:"space-y-1 p-1",children:C.jsxs("div",{className:"flex items-start text-s",children:[C.jsx(_e.FdInfoCircle,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"}),C.jsxs("p",{children:[C.jsx("span",{className:"mr-1",children:"Function is promoted with: "}),i==null?void 0:i.map(u=>C.jsx("li",{className:"cursor-pointer list-disc font-bold hover:underline",onClick:()=>n(a[u].id),children:a[u].privilege}))]})]})}),children:C.jsx(_e.FdCrown,{className:"h-3 w-3 "})})]})]}):null},Pse=({privilegeId:e,privileges:t})=>{const r=pr(),n=r.getCatalogMethods(),i=r.getDataclasses(),o=r.getSingletons(),a=t[e],[s,c]=O.useState([]),[u,d]=O.useState("");O.useEffect(()=>{d("")},[e]),O.useEffect(()=>{const h=a.resources.map(({resource:m,type:b,subType:w})=>({type:b,applyTo:m,subType:w})),x=k_(u.toLowerCase(),n,Object.values(i),Object.values(o));c(x.filter(({applyTo:m,type:b,subType:w})=>!lo.find(h,{applyTo:m,type:b,subType:w})))},[u,a.resources]);const[p,v]=O.useState(!1);return C.jsx(xC.Root,{className:"w-56",onInputChange:h=>d(h||""),onOpenChange:v,isOpen:p,isSearchable:!0,options:s,getOptionLabel:h=>h?h.applyTo:"",getOptionValue:h=>h?h.applyTo:"",value:null,onChange:h=>{if(!h)return;const x=fe.addPermission(e,h,t);r.actions.updatePrivileges(x),d("")},children:C.jsx(xC.Field,{formatOptionLabel:h=>C.jsxs("div",{className:"flex items-center space-x-2",children:[bF(h.type),C.jsx("span",{children:h.applyTo})]}),placeholder:"Create a permission"})})};function kse(e){const t=["datastore","singleton","dataclass","attribute","dsMethod","dataclassMethod","entityMethod","entityselMethod","singletonMethod"],r=e.reduce((n,i)=>{const[o]=i.resource.split("."),a=n.find(s=>s.prefix===o.toLowerCase());return a?(a.resources.push(i),n):[...n,{prefix:o.toLowerCase(),type:i.type,resources:[i]}]},[]);return r.sort((n,i)=>n.prefix==="ds"?-1:i.prefix==="ds"||n.prefix>i.prefix?1:-1),r.map(n=>({...n,resources:n.resources.sort((i,o)=>{const a=t.indexOf(i.type),s=t.indexOf(o.type);return a!==s?a-s:i.resource.toLowerCase()>o.resource.toLowerCase()?1:-1})})).reduce((n,i)=>[...n,...i.resources],[])}const Ase=({selectedPrivilege:e,onSelect:t,showIncluded:r,privileges:n})=>{const[i,o]=O.useState(null),[a,s]=O.useState(null),{styles:c,attributes:u}=rd(i,a,{modifiers:[{name:"offset",options:{offset:[0,10]}}]}),d=pr(),[p,v]=O.useState([]),[h,x]=O.useState(""),{id:m}=e,b=O.useMemo(()=>fe.getInheritedResources(m,n),[m,n[m].includes,n[m].resources]),w=O.useMemo(()=>fe.getPromotions(m,n),[n[m]]);function y(D){v(z=>z.some(P=>D.includes(P))?z.filter(P=>!D.includes(P)):[...z,...D])}const _=async D=>{const{confirmed:z}=await d.actions.openModal({title:"Delete Privilege",type:fe.ModalType.CONFIRM,color:fe.ModalColor.DANGER,message:"Are you sure you want to remove this Privilege?",icon:"FdWarningDanger"});if(z){const P=fe.removePermission(e.id,D,n);d.actions.updatePrivileges(P)}},S=async()=>{const{confirmed:D}=await d.actions.openModal({title:"Reset Permissions",type:fe.ModalType.CONFIRM,color:fe.ModalColor.DANGER,message:"Are you sure you want to reset permissions for this Privilege?",icon:"FdWarningDanger"});if(D){const z=fe.resetResources(e.id,n);d.actions.updatePrivileges(z)}},I=b.filter(D=>p.length===0?!0:p.includes(D.type)).filter(({resource:D})=>h?new RegExp(lo.escapeRegExp(h),"i").test(D):!0),N=kse(I),T=N.filter(D=>{const z=D.permissions.every(P=>!P.checked)&&D.permissions.some(P=>P.from.length>0);return r||!z}),A=(D,z)=>{const P=fe.togglePermission(e.id,D,z,n);d.actions.updatePrivileges(P)},B=O.useMemo(()=>T.some(D=>D.exists===!1),[T]),L=async()=>{const{confirmed:D}=await d.actions.openModal({title:"Delete Privilege",type:fe.ModalType.CONFIRM,color:fe.ModalColor.DANGER,message:"Are you sure you want to remove these permissions?",views:{tips:[{type:"warning",message:"This action will remove all permissions that don't exist in the catalog for all privileges"}]},icon:"FdWarningDanger"}),z=Object.entries(n).map(([P,K])=>{const $=K.resources.filter(Y=>!Y.exists);return{[P]:$.map(Y=>({applyTo:Y.resource,type:Y.type}))}}).reduce((P,K)=>({...P,...K}),{});if(D){const P=fe.removeMultiplePermissions(z,n);d.actions.updatePrivileges(P)}};return C.jsxs($d,{className:"z-20 h-full flex-1 overflow-auto p-[15px] pt-0",style:{maxHeight:"calc(100vh - 5.5rem - 85px - 20px)"},children:[C.jsxs("table",{className:"relative h-full w-full border-collapse",children:[C.jsx("thead",{className:"sticky top-0 z-20 bg-panel-1",children:C.jsxs("tr",{className:"border-b border-grey-100",children:[C.jsx("td",{className:"py-2",children:C.jsxs("div",{className:"flex items-center space-x-2",children:[C.jsx("div",{className:"relative w-56",children:C.jsx(wt.Root,{children:C.jsxs(wt.Group,{children:[C.jsx(wt.Icon,{children:C.jsx(_e.FdSearch,{})}),C.jsx(wt.Field,{type:"text",placeholder:"Search available permissions",value:h,onChange:D=>{x(D.target.value)}}),C.jsx(un.Popover,{className:"flex items-center",children:({open:D})=>C.jsxs(C.Fragment,{children:[C.jsx(un.Popover.Button,{ref:o,children:C.jsx(wt.Icon,{isAction:!0,children:C.jsx(_e.FdAdjust,{})})}),D&&C.jsx(Td,{children:C.jsx(un.Popover.Panel,{ref:s,style:c.popper,...u.popper,className:"z-50",static:!0,children:C.jsxs(dr,{depth:3,borderType:"light",className:"rounded-md border px-4 py-2.5",children:[C.jsx("h5",{className:"mb-2 text-sm",children:"Filter"}),C.jsxs("div",{className:"space-y-2 text-s",children:[C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:p.includes("datastore"),onChange:()=>{y(["datastore"])},label:"Datastore",size:"sm"})}),C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:p.includes("dataclass"),onChange:()=>{y(["dataclass"])},label:"Dataclass",size:"sm"})}),C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:p.includes("singleton"),onChange:()=>{y(["singleton"])},label:"Singleton",size:"sm"})}),C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:p.some(z=>["method","singletonMethod","dsMethod","dataclassMethod","entityMethod","entityselMethod"].includes(z)),onChange:()=>{y(["method","singletonMethod","dsMethod","dataclassMethod","entityMethod","entityselMethod"])},label:"Functions",size:"sm"})}),C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:p.includes("attribute"),onChange:()=>{y(["attribute"])},label:"Attribute",size:"sm"})})]})]})})})]})})]})})}),C.jsx(Pse,{privilegeId:m,privileges:n}),C.jsx("div",{children:C.jsx(Kr,{label:`Resetting the privilege will remove all configured\r
113
- ressources`,container:xr(),children:C.jsx(Zt,{color:"white",variant:"ghost",onClick:S,children:C.jsx(_e.FdReload,{})})})}),C.jsx(Kr,{icon:C.jsx(_e.FdBulb,{}),label:"Delete all the non existing resources from privileges",container:xr(),children:C.jsx(Zt,{color:"white",variant:"ghost",onClick:L,disabled:!B,children:C.jsx(_e.FdClean,{className:"h-4 w-4"})})})]})}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Read"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Create"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Update"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Delete"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Execute"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Promote"})]})}),T.length?C.jsx("tbody",{children:T.map((D,z)=>{const P=D.permissions.some(K=>K.from.length>0);return C.jsxs("tr",{className:Yr("group even:bg-white/5 hover:bg-input-bg",{"opacity-60":D.exists===!1}),children:[C.jsxs("td",{className:Yr("group flex items-center gap-3 py-2 text-xs group-hover:rounded-l group-hover:bg-input-bg ",D.exists===!1?"text-negative-text":""),children:[bF(D.type),D.resource,C.jsx(Kr,{label:"Remove Permission",container:xr(),children:C.jsx(Zt,{color:"white",variant:"ghost",disabled:P,onClick:()=>{P?fe.toastSubject.next({kind:"info",markdown:!0,message:`<div className="flex gap-x-3"><h3 className="font-bold">Info:</h3><p className="font-normal">Inherited permissions can't be removed</p></div>`,customIcon:_e.FdInfoBold}):_({applyTo:D.resource,type:D.type})},className:"opacity-0 group-hover:opacity-100",children:C.jsx(_e.FdPlus,{className:"h-4 w-4 rotate-45 transform"})})})]}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg ",children:C.jsx(Uo,{permissions:D.permissions,showIncluded:r,label:"read",onToggle:K=>A(D,K),onSelect:t,privileges:n,exists:D.exists})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg ",children:C.jsx(Uo,{permissions:D.permissions,showIncluded:r,label:"create",onToggle:K=>A(D,K),onSelect:t,privileges:n,exists:D.exists})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg ",children:C.jsx(Uo,{permissions:D.permissions,showIncluded:r,label:"update",onToggle:K=>A(D,K),onSelect:t,privileges:n,exists:D.exists})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg",children:C.jsx(Uo,{permissions:D.permissions,showIncluded:r,label:"drop",onToggle:K=>A(D,K),onSelect:t,privileges:n,exists:D.exists})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg",children:C.jsx(Uo,{promoted:w[D.resource],permissions:D.permissions,showIncluded:r,label:"execute",onToggle:K=>A(D,K),onSelect:t,privileges:n,exists:D.exists})}),C.jsx("td",{className:"py-2 text-center group-hover:rounded-r group-hover:bg-input-bg",children:C.jsx(Uo,{permissions:D.permissions,showIncluded:r,label:"promote",onToggle:K=>A(D,K),onSelect:t,privileges:n,exists:D.exists})})]},z)})}):null]}),!N.length&&h?C.jsx(b2,{children:"The Permission you're looking for can't be found "}):null,!N.length&&!h?C.jsxs(b2,{children:["This Privilege has no Permissions configured yet ",C.jsx("br",{}),'Add a new permission by using the "Create a permission" input above']}):null]})},Mse=({onCreate:e})=>{const t=pr(),r=t.getPrivileges(),[n,i]=O.useState(null),[o,a]=O.useState(null),[s,c]=O.useState(""),[u,d]=O.useState(null),{styles:p,attributes:v}=rd(n,o,{modifiers:[{name:"offset",options:{offset:[-10,10]}}],placement:"right-start"});O.useEffect(()=>{c(""),d(null)},[o]);const h=x=>{d(null);try{const m=fe.createPrivilege(s,r),b=Object.values(m).find(w=>w.privilege===s);t.actions.updatePrivileges(m),b&&e(b),setTimeout(()=>{x()},0)}catch(m){d(m.message)}};return C.jsx(un.Popover,{children:({open:x,close:m})=>C.jsxs(C.Fragment,{children:[C.jsx(un.Popover.Button,{className:"rounded","data-cy":"New-priv-btn",ref:i,children:C.jsx(Zt,{variant:"ghost",color:"white",children:C.jsx(_e.FdPlus,{className:"h-4 w-4"})})}),x&&C.jsx(Td,{children:C.jsx(un.Popover.Panel,{ref:a,style:p.popper,...v.popper,"data-cy":"New-priv-pop-up",className:"z-50",static:!0,children:C.jsxs(dr,{className:"min-w-[256px] border rounded px-4 py-2 text-xs shadow-md",depth:3,borderType:"light",children:[C.jsx("h5",{className:"mb-2 text-xs font-semibold",children:"Create New Privilege"}),C.jsx("div",{className:"mt-2",children:C.jsxs("label",{className:"flex items-center space-x-4",children:[C.jsx("span",{children:"Name"}),C.jsxs(wt.Root,{className:"w-full",color:u?"negative":"primary",children:[C.jsx(wt.Group,{children:C.jsx(wt.Field,{autoFocus:!0,value:s,onChange:b=>c(b.target.value),onKeyDown:b=>{b.key==="Enter"&&h(m)},type:"text"})}),u&&C.jsx(wt.Message,{children:u})]})]})}),C.jsxs("div",{className:"mt-4 flex items-center justify-center space-x-2",children:[C.jsx(Zt,{onClick:()=>{h(m)},children:"Create"}),C.jsx(Zt,{color:"white",variant:"outline",onClick:()=>m(),children:"Cancel"})]})]})})})]})})},Dse=()=>{const e=pr(),t=e.getCatalog(),r=e.getPrivileges(),n=O.useMemo(()=>{if(t===null)return r;const u=fB(r,Object.values((t==null?void 0:t.dataClasses)??{}));return pB(u,t)},[r,t]),[i,o]=O.useState(null),a=O.useMemo(()=>Object.keys(n),[n]);O.useEffect(()=>{i&&n[i.id]||!a.length||o(n[a[0]])},[n]),O.useEffect(()=>{a.length<2&&c(!0)},[a.length]);const[s,c]=O.useState(!0);return C.jsxs("div",{className:"flex flex-1 h-full",children:[C.jsxs(dr,{depth:1,className:"flex h-full w-[356px] flex-col",children:[C.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between px-3.5 py-[10px]",children:[C.jsxs("div",{className:"flex items-center space-x-1",children:[C.jsx("span",{children:C.jsx(_e.FdGroup,{className:"h-[14px] w-[14px]"})}),C.jsx("span",{className:"text-[11px] font-semibold",children:"Privileges"})]}),C.jsx(Mse,{onCreate:u=>{o(u)}})]}),C.jsx(Moe,{privileges:n,selectedPrivilege:i,selectPrivilege:u=>{o(u)}})]}),i&&n[i.id]?C.jsxs(dr,{depth:1,className:"privileges-container relative flex flex-1 flex-col overflow-x-auto border-l-[0.5px]",children:[C.jsxs("div",{className:"mb-1 flex h-full w-full flex-col items-stretch",children:[i.privilege!=="guest"?C.jsx(koe,{privileges:n,selectedPrivilege:i,onSelect:u=>o(r[u]),setShowIncluded:c,showIncluded:s}):null,C.jsx(Ase,{privileges:n,selectedPrivilege:i,onSelect:u=>o(r[u]),showIncluded:s})]}),C.jsx(jse,{privileges:n,selectedPrivilege:i,setSelectedPrivilege:o})]}):C.jsx(ZL,{tab:"Privilege"})]})},jse=({privileges:e,selectedPrivilege:t,setSelectedPrivilege:r})=>{const[n,i]=O.useState(!1);return C.jsx(fe.Panel,{path:fe.ROLES_TAB_PATH,isOpen:n,onOpen:()=>i(!0),onClose:()=>i(!1),children:C.jsx("div",{className:"h-full w-full px-3 pb-3",children:C.jsx(dr,{depth:2,className:"h-full w-full rounded",children:C.jsx($ie,{dict:e,data:fe.getGraphData(t.id,e),onSelect:o=>r(e[o])})})})})},qse=({role:e})=>{var E;const t=pr(),[r,n]=O.useState(e),[i,o]=O.useState(e.role),[a,s]=O.useState(null),c=t.getPrivileges(),u=((E=r.privileges)==null?void 0:E.filter(I=>c[I]&&c[I].privilege!=="guest").length)||0,d=t.getRoles(),{selectedRole:p,selectRole:v}=Y1(),[h,x]=O.useState(!1),m=fe.useOutsideClick(()=>{h&&w()});fe.useDidMountEffect(()=>{i!==e.role&&o(e.role)},[e.role]),O.useEffect(()=>{e.role||x(!0)},[]),O.useEffect(()=>{n(e)},[e]);const b=()=>{s(null),x(!0)},w=()=>{s(null),e.role&&e.role===i&&x(!1);try{const I=fe.saveRole({...r,role:i},d);t.actions.updateRoles(I),x(!1)}catch(I){s(I.message)}},y=async I=>{I.stopPropagation();const{confirmed:N}=await t.actions.openModal({title:"Delete Role",type:fe.ModalType.CONFIRM,color:fe.ModalColor.DANGER,message:"Are you sure you want to remove this Role?",icon:"FdWarningDanger"});N&&_()},_=()=>{const I=fe.removeRole(r.id,d),N=Object.keys(I);if(p!==r.id){t.actions.updateRoles(I);return}if(N.length===0)v(null);else{const T=Object.keys(d),A=T.indexOf(r.id),B=Math.max(0,A-1),L=T[B];A===0?v(N[0]):I[L]?v(L):v(N[0])}t.actions.updateRoles(I)},S=(I=null)=>{if(I&&I.stopPropagation(),!e.role){_();return}x(!1),o(e.role)};return C.jsx(C.Fragment,{children:C.jsxs(dr,{depth:4,borderType:p===r.id?"primary":p!==r.id?"light":"default",className:Yr("rounded border p-2"),role:"button","data-cy":"privilegeCard",onClick:()=>{v(r.id)},ref:m,children:[C.jsx("div",{className:"flex items-center justify-between",children:C.jsxs("div",{className:"flex flex-1 items-center",children:[C.jsx("span",{className:"mr-4",children:C.jsx(_e.FdGroup,{className:"h-6 w-6"})}),h?C.jsxs(wt.Root,{color:a?"negative":"primary",className:"flex-1 mr-2",children:[C.jsx(wt.Group,{children:C.jsx(wt.Field,{type:"text",value:i,onChange:({target:{value:I}})=>{o(I)},onKeyDown:I=>{I.key==="Enter"&&w(),I.key==="Escape"&&S()},onBlur:()=>S(),placeholder:"role",autoComplete:"off",autoFocus:!0})}),a&&C.jsx(wt.Message,{children:a})]}):C.jsx("span",{className:"inline-block grow overflow-hidden truncate whitespace-nowrap text-xs font-bold",title:i,children:r.role}),C.jsx("div",{className:Yr("justify-between ml-auto flex w-fit items-center gap-x-2"),children:h?C.jsxs(C.Fragment,{children:[C.jsx(Zt,{color:"white",variant:"ghost",onClick:w,children:C.jsx(_e.FdSave,{className:"h-4 w-4"})}),C.jsx(Zt,{color:"white",variant:"ghost",onClick:S,children:C.jsx(_e.FdClose,{className:"h-4 w-4"})})]}):C.jsxs(C.Fragment,{children:[C.jsx(Zt,{color:"white",variant:"ghost",onClick:b,children:C.jsx(_e.FdPen,{className:"h-4 w-4"})}),C.jsx(Zt,{color:"white",variant:"ghost",onClick:I=>y(I),children:C.jsx(_e.FdTrash,{className:"h-4 w-4"})})]})})]})}),C.jsxs("span",{className:Yr("ml-[43px] py-1 text-xs"),children:[u," Privilege",u>1?"s":""]})]})})},yF=(e,t)=>e?t[e]:null,y2=(e,t,r)=>{const n=yF(e,r);return n?Object.values(r).reduce((i,o)=>o.id===e?n.privileges.includes(t)?{...i,[n.id]:{...n,privileges:n.privileges.filter(a=>a!==t)}}:{...i,[n.id]:{...n,privileges:[...n.privileges,t]}}:{...i,[o.id]:o},{}):r},Lse=()=>{const e=pr(),t=e.getPrivileges(),r=e.getRoles(),{selectedRole:n}=Y1(),i=yF(n,r),o=(a,s)=>s&&s.privileges.includes(a.id);return C.jsxs(dr,{depth:1,className:"w-full border-b p-4 ",children:[C.jsx("div",{className:"mb-4 flex items-center gap-x-5",children:C.jsx("h4",{className:"text-[13px] font-semibold ",children:"Privileges"})}),C.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[C.jsx(Zc,{"data-cy":"item=>Permisions",className:"italic opacity-90",children:"guest"}),Object.values(t).filter(a=>o(a,i)&&a.privilege!=="guest").map((a,s)=>C.jsxs(Zc,{"data-cy":"item=>Permisions",color:"primary",onClick:()=>{const c=y2(i.id,a.id,r);e.actions.updateRoles(c)},children:[a.privilege,C.jsx(_e.FdPlus,{className:"rotate-45 transform"})]},s)),Object.values(t).filter(a=>!o(a,i)&&a.privilege!=="guest").map((a,s)=>C.jsxs(Zc,{"data-cy":"item=>Permisions",color:"dark",onClick:()=>{const c=y2(i.id,a.id,r);e.actions.updateRoles(c)},children:[a.privilege,C.jsx(_e.FdPlus,{})]},s))]})]})},zse=({children:e})=>C.jsx("div",{className:"h-full w-full",children:C.jsx("div",{className:"flex h-full w-full flex-1 items-center justify-center",children:C.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 py-4 text-inactive-text",children:[C.jsx(_e.FdInfoBold,{className:"absolute -right-full h-10 w-10 translate-x-1"}),C.jsx("div",{className:"text-center text-sm",children:e})]})})}),Hw=(e,t,r,n=!1)=>{const i=e.applyTo,o=e.type===fe.EPermissionType.DATACLASS?"ds":i.split(".")[0],a={...t,...r},s=()=>({value:!n,inherited:!1,from:[],explicitly:!1}),c={read:s(),create:s(),update:s(),drop:s(),execute:s(),promote:s()},u=p=>{p.forEach(v=>{a[v]&&(a[v].resources.forEach(h=>{if(h.resource===i||h.resource===o){const x=Hw(e,t,{[v]:a[v]},n);Object.values(h.permissions).forEach(m=>{c[m.name].explicitly||(!c[m.name].from.includes(a[v].privilege)&&m.checked&&c[m.name].from.push(a[v].privilege),c[m.name].inherited=c[m.name].inherited||x[m.name].value||x[m.name].inherited)})}}),a[v].includes.length>0&&u(a[v].includes))})};if(Object.values(r).forEach(p=>{p.resources.forEach(v=>{v.resource===i&&Object.values(v.permissions).forEach(h=>{h.checked&&(c[h.name].explicitly=!0,n&&(c[h.name].value=!0))})}),(p.includes.length>0||p.privilege==="guest")&&u(p.includes)}),Object.values(t).forEach(p=>{p.resources.forEach(v=>{v.resource===i&&(p.privilege==="guest"?Object.values(v.permissions).forEach(h=>{h.checked&&(c[h.name].explicitly=!0,n&&(c[h.name].value=!0))}):Object.values(v.permissions).forEach(h=>{!c[h.name].explicitly&&h.checked&&(n?c[h.name].value=!0:c[h.name].value=!1)}))})}),(n?Object.entries(c).some(([p,v])=>p!=="promote"&&!v.value&&!v.explicitly):Object.entries(c).some(([p,v])=>p!=="promote"&&v.value&&!v.explicitly))&&![fe.EPermissionType.DATASTORE,fe.EPermissionType.SINGLETON].includes(e.type)){const p={applyTo:o,type:e.type===fe.EPermissionType.DATACLASS?fe.EPermissionType.DATASTORE:e.type===fe.EPermissionType.SINGLETON_METHOD?fe.EPermissionType.SINGLETON:fe.EPermissionType.DATACLASS},v=Hw(p,t,r,n),h=x=>{let m=c[x].value;return n?!c[x].value&&!c[x].explicitly&&(m=v[x].value):c[x].value&&!c[x].explicitly&&(m=v[x].value),{value:m,inherited:c[x].inherited||v[x].inherited,from:c[x].from.length>0?c[x].from:v[x].from,explicitly:c[x].explicitly}};return{read:h("read"),create:h("create"),update:h("update"),drop:h("drop"),execute:h("execute"),promote:h("promote")}}return{read:c.read,create:c.create,update:c.update,drop:c.drop,execute:c.execute,promote:c.promote}},Bse=e=>{switch(e){case"dataclass":return C.jsx(_e.FdTableHeader,{className:"h-6 w-6"});case"singleton":return C.jsx(_e.FdSingleton,{className:"h-6 w-6"});case"datastore":return C.jsx(_e.FdModel3,{className:"h-6 w-6"});case"attribute":return C.jsx(_e.FdTableColumn,{className:"h-6 w-6"});case"method":return C.jsx(_e.FdCode,{className:"h-6 w-6"});case"singletonMethod":return C.jsx(_e.FdFunctionSingleton,{className:"h-6 w-6"});case"entityselMethod":return C.jsx(_e.FdFunctionSelection,{className:"h-6 w-6"});case"entityMethod":return C.jsx(_e.FdFunctionEntity,{className:"h-6 w-6"});case"dsMethod":return C.jsx(_e.FdFunctionDatastore,{className:"h-6 w-6"});case"dataclassMethod":return C.jsx(_e.FdFunctionDataclass,{className:"h-6 w-6"});default:return C.jsx(_e.FdTableHeader,{className:"h-6 w-6"})}},oa=({privileges:e,permission:t,hasChild:r,depth:n,isChild:i=!1,className:o,inSearch:a,toggleCollapse:s,collapsed:c,isRestrictedByDefault:u,toastMessageCallback:d})=>{const[p,v]=t.applyTo.split("."),h=O.useMemo(()=>Hw(t,e.otherPrivs,e.rolePrivs,u),[e,t,u]);return C.jsxs("tr",{className:Yr("group even:bg-white/5 hover:bg-input-bg",o),children:[C.jsxs("td",{className:Yr("flex h-full w-full items-stretch gap-3 p-0 text-xs group-hover:rounded-l group-hover:bg-input-bg",{"px-1":a}),children:[Array(n).fill("").map((x,m)=>C.jsx("div",{className:Yr("ml-1.5 mr-1 w-[2px] bg-grey-100",{"mr-0.5":i})},m)),C.jsxs("div",{className:"flex items-center gap-3 py-2",children:[r&&C.jsx("button",{onClick:s,className:"w-3",children:c?C.jsx(_e.FdRight,{className:"inline h-4 w-4"}):C.jsx(_e.FdDown,{className:"inline h-4 w-4"})}),Bse(t.type),a?t.applyTo:v||p]})]}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg",children:[fe.EPermissionType.ATTRIBUTE,fe.EPermissionType.DATASTORE,fe.EPermissionType.DATACLASS].includes(t.type)&&C.jsxs("div",{className:"relative mx-auto flex w-fit items-center justify-center gap-x-1",children:[C.jsx(or,{value:h.read.value||h.read.inherited,onClick:d,isDisabled:!0}),C.jsx("div",{className:"absolute left-full top-1/2 flex -translate-y-1/2 translate-x-1/2 cursor-pointer items-center",children:!h.read.value&&h.read.inherited?C.jsx(Kr,{container:xr(),delay:100,label:C.jsx("div",{className:"space-y-1 p-1",children:h.read.from.length?C.jsxs("div",{className:"flex items-start",children:[C.jsx(_e.FdBulb,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"}),C.jsxs("p",{className:"flex flex-col gap-y-2",children:[C.jsx("span",{className:"mr-1",children:"Permission inherited from:"}),C.jsx("ul",{children:h.read.from.map((x,m)=>C.jsx("li",{className:"cursor-pointer list-disc font-bold",children:x},m))})]})]}):null}),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4"})}):""})]})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg",children:[fe.EPermissionType.ATTRIBUTE,fe.EPermissionType.DATASTORE,fe.EPermissionType.DATACLASS].includes(t.type)&&C.jsxs("div",{className:"relative mx-auto flex w-fit items-center justify-center gap-x-1",children:[C.jsx(or,{value:h.create.value||h.create.inherited,onClick:d,isDisabled:!0}),C.jsx("div",{className:"absolute left-full top-1/2 flex -translate-y-1/2 translate-x-1/2 cursor-pointer items-center",children:!h.create.value&&h.create.inherited?C.jsx(Kr,{container:xr(),delay:100,label:C.jsx("div",{className:"space-y-1 p-1",children:h.read.from.length?C.jsxs("div",{className:"flex items-start",children:[C.jsx(_e.FdBulb,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"}),C.jsxs("p",{className:"flex flex-col gap-y-2",children:[C.jsx("span",{className:"mr-1",children:"Permission inherited from:"}),C.jsx("ul",{children:h.read.from.map((x,m)=>C.jsx("li",{className:"cursor-pointer list-disc font-bold",children:x},m))})]})]}):null}),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4"})}):""})]})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg",children:[fe.EPermissionType.ATTRIBUTE,fe.EPermissionType.DATASTORE,fe.EPermissionType.DATACLASS].includes(t.type)&&C.jsxs("div",{className:"relative mx-auto flex w-fit items-center justify-center gap-x-1",children:[C.jsx(or,{value:h.update.value||h.update.inherited,onClick:d,isDisabled:!0}),C.jsx("div",{className:"absolute left-full top-1/2 flex -translate-y-1/2 translate-x-1/2 cursor-pointer items-center",children:!h.update.value&&h.update.inherited?C.jsx(Kr,{container:xr(),delay:100,label:C.jsx("div",{className:"space-y-1 p-1",children:h.update.from.length?C.jsxs("div",{className:"flex items-start",children:[C.jsx(_e.FdBulb,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"}),C.jsxs("p",{className:"flex flex-col gap-y-2",children:[C.jsx("span",{className:"mr-1",children:"Permission inherited from:"}),C.jsx("ul",{children:h.update.from.map((x,m)=>C.jsx("li",{className:"cursor-pointer list-disc font-bold",children:x},m))})]})]}):null}),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4"})}):""})]})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg",children:[fe.EPermissionType.ATTRIBUTE,fe.EPermissionType.DATASTORE,fe.EPermissionType.DATACLASS].includes(t.type)&&C.jsxs("div",{className:"relative mx-auto flex w-fit items-center justify-center gap-x-1",children:[C.jsx(or,{value:h.drop.value||h.drop.inherited,onClick:d,isDisabled:!0}),C.jsx("div",{className:"absolute left-full top-1/2 flex -translate-y-1/2 translate-x-1/2 cursor-pointer items-center",children:!h.drop.value&&h.drop.inherited?C.jsx(Kr,{container:xr(),delay:100,label:C.jsx("div",{className:"space-y-1 p-1",children:h.drop.from.length?C.jsxs("div",{className:"flex items-start",children:[C.jsx(_e.FdBulb,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"}),C.jsxs("p",{className:"flex flex-col gap-y-2",children:[C.jsx("span",{className:"mr-1",children:"Permission inherited from:"}),C.jsx("ul",{children:h.drop.from.map((x,m)=>C.jsx("li",{className:"cursor-pointer list-disc font-bold",children:x},m))})]})]}):null}),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4"})}):""})]})}),C.jsx("td",{className:"py-2 text-center group-hover:rounded-r group-hover:bg-input-bg",children:t.type!=="attribute"&&C.jsxs("div",{className:"relative mx-auto flex w-fit items-center justify-center gap-x-1",children:[C.jsx(or,{value:h.execute.value||h.execute.inherited,onClick:d,isDisabled:!0}),C.jsx("div",{className:"absolute left-full top-1/2 flex -translate-y-1/2 translate-x-1/2 cursor-pointer items-center",children:!h.execute.value&&h.execute.inherited?C.jsx(Kr,{container:xr(),delay:100,label:C.jsx("div",{className:"space-y-1 p-1",children:h.execute.from.length?C.jsxs("div",{className:"flex items-start",children:[C.jsx(_e.FdBulb,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"}),C.jsxs("p",{className:"flex flex-col gap-y-2",children:[C.jsx("span",{className:"mr-1",children:"Permission inherited from:"}),C.jsx("ul",{children:h.execute.from.map((x,m)=>C.jsx("li",{className:"cursor-pointer list-disc font-bold",children:x},m))})]})]}):null}),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4"})}):""})]})})]})},x2=({depth:e,permission:t,privileges:r,childCollapsed:n,didChildCollapsed:i,toastMessageCallback:o})=>{const[a,s]=O.useState(n),c=pr(),u=c.getRestrictedByDefault(),d=c.getPrivileges();return O.useEffect(()=>{n===!0&&s(!0)},[n]),C.jsxs(C.Fragment,{children:[C.jsx(oa,{privileges:r,permission:t,isChild:!0,depth:e,hasChild:!0,toggleCollapse:()=>{const p=!a;s(p),i==null||i(p)},isRestrictedByDefault:u,allPrivileges:d,collapsed:a,toastMessageCallback:o}),!a&&C.jsxs(C.Fragment,{children:[t.attributes.map((p,v)=>C.jsx(oa,{privileges:r,permission:p,depth:e+1,isRestrictedByDefault:u,allPrivileges:d,toastMessageCallback:o},`${p.type}-${v}`)),t.methods.map((p,v)=>C.jsx(oa,{privileges:r,permission:p,depth:e+1,isRestrictedByDefault:u,allPrivileges:d,toastMessageCallback:o},`${p.type}-${v}`))]})]})},Fse=({selectedRole:e})=>{const[t,r]=O.useState(null),[n,i]=O.useState(null),{styles:o,attributes:a}=rd(t,n,{modifiers:[{name:"offset",options:{offset:[0,10]}}]}),s=pr(),c=s.getRestrictedByDefault(),u=s.getPrivileges(),[d,p]=O.useState([]),[v,h]=O.useState(""),x=s.getCatalogMethods(),m=s.getDataclasses(),b=s.getSingletons(),[w,y]=O.useState({}),[_,S]=O.useState([]);O.useEffect(()=>{const $=Vie(x,Object.values(m),Object.values(b));y($)},[e]);function E($){const Y=["datastore","singleton","dataclass","attribute","dsMethod","dataclassMethod","entityMethod","entityselMethod","singletonMethod"];return $.sort((U,Q)=>{const k=Y.indexOf(U.type),W=Y.indexOf(Q.type);return k!==W?k-W:U.applyTo.toLowerCase()>Q.applyTo.toLowerCase()?1:-1})}O.useEffect(()=>{S(E(k_(v,x,Object.values(m),Object.values(b)).filter($=>d.length?d.includes($.type):!0)))},[d,v]);const[I,N]=O.useState(!1),T=$=>{p(Y=>Y.some(U=>$.includes(U))?Y.filter(U=>!$.includes(U)):[...Y,...$])},A=s.getRoles(),B={toggleAllCollapsed:$=>{$.allCollapsed=!$.allCollapsed},toggleChildCollapsed:$=>{$.childCollapsed=!$.childCollapsed},setAllCollapsed:($,Y)=>{$.allCollapsed=Y},setChildCollapsed:($,Y)=>{$.childCollapsed=Y}},L=O.useMemo(()=>{const $=Object.values(u).find(W=>W.privilege==="guest"),Y=A[e],U=Y?Object.fromEntries(Y.privileges.map(W=>[W,u[W]]).filter(([,W])=>!!W)):{};if(c)return{rolePrivs:U,otherPrivs:$?{[$.id]:$}:{}};const Q=$?{[$.id]:{...$,active:!0}}:{},k=Object.fromEntries(Object.entries(u).filter(([W])=>W!==($==null?void 0:$.id)&&!(Y!=null&&Y.privileges.includes(W))).map(([W,J])=>[W,{...J,active:!1}]));return{rolePrivs:U,otherPrivs:{...Q,...k}}},[u,A,e,c]),{state:{allCollapsed:D,childCollapsed:z},dispatch:P}=fe.useEnhancedState({allCollapsed:!1,childCollapsed:!1},B,"Table Collapse Store"),K=()=>{fe.toastSubject.next({kind:"info",markdown:!0,message:"**Info:** You can add or modify permissions only in the Privilege section.",customIcon:_e.FdInfoCircle})};return C.jsxs($d,{className:"z-20 h-full flex-1 overflow-auto p-[15px] pt-0",style:{maxHeight:"calc(100vh - 5.5rem - 85px - 20px)"},children:[C.jsxs("table",{className:"relative h-full w-full border-collapse",children:[C.jsx("thead",{className:"sticky top-0 z-20 bg-panel-1",children:C.jsxs("tr",{className:"border-b border-grey-100",children:[C.jsx("td",{className:"py-2",children:C.jsxs("div",{className:"flex items-center space-x-2",children:[C.jsx(fe.Tooltip,{label:"Collapse All",placement:"top",container:xr(),children:C.jsx(Zt,{color:"white",variant:"ghost",disabled:D,onClick:()=>{z?(P.setAllCollapsed(!0),N(!0)):P.setChildCollapsed(!0)},children:C.jsx(_e.FdCollapseAll,{})})}),C.jsx("div",{className:"relative w-56",children:C.jsx(wt.Root,{children:C.jsxs(wt.Group,{children:[C.jsx(wt.Icon,{children:C.jsx(_e.FdSearch,{})}),C.jsx(wt.Field,{type:"text",placeholder:"Search",value:v,onChange:$=>{h($.target.value)}}),C.jsx(un.Popover,{className:"flex items-center",children:({open:$})=>C.jsxs(C.Fragment,{children:[C.jsx(un.Popover.Button,{ref:r,children:C.jsx(wt.Icon,{isAction:!0,children:C.jsx(_e.FdAdjust,{})})}),$&&C.jsx(Td,{children:C.jsx(un.Popover.Panel,{ref:i,style:o.popper,...a.popper,className:"z-50",static:!0,children:C.jsxs(dr,{depth:3,borderType:"light",className:"rounded-md border px-4 py-2.5 text-xs",children:[C.jsx("h5",{className:"mb-2 text-sm",children:"Filter"}),C.jsxs("div",{className:"space-y-2 text-s",children:[C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:d.includes("datastore"),onChange:()=>{T(["datastore"])},label:"Datastore",size:"sm"})}),C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:d.includes("dataclass"),onChange:()=>{T(["dataclass"])},label:"Dataclass",size:"sm"})}),C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:d.includes("singleton"),onChange:()=>{T(["singleton"])},label:"Singleton",size:"sm"})}),C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:d.some(Y=>["method","singletonMethod","dsMethod","dataclassMethod","entityMethod","entityselMethod"].includes(Y)),onChange:()=>{T(["method","singletonMethod","dsMethod","dataclassMethod","entityMethod","entityselMethod"])},label:"Functions",size:"sm"})}),C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:d.includes("attribute"),onChange:()=>{T(["attribute"])},label:"Attribute",size:"sm"})})]})]})})})]})})]})})})]})}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"read"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Create"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Update"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Delete"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Execute"})]})}),C.jsx("tbody",{className:"relative",children:d.length||v?_.map(($,Y)=>C.jsx(oa,{privileges:L,permission:$,depth:0,inSearch:!0,isRestrictedByDefault:c,allPrivileges:u,toastMessageCallback:K},`${$.type}-${Y}`)):Object.values(w).map(($,Y)=>C.jsxs(O.Fragment,{children:[C.jsx(oa,{privileges:L,permission:$,isRestrictedByDefault:c,allPrivileges:u,hasChild:!0,depth:0,toggleCollapse:()=>{const U=!I;N(U),P.setAllCollapsed(!U&&D?!1:D)},collapsed:I,toastMessageCallback:K}),$.type==="datastore"&&!I?C.jsxs(C.Fragment,{children:[$.methods.map((U,Q)=>C.jsx(oa,{privileges:L,isRestrictedByDefault:c,allPrivileges:u,permission:U,depth:1,collapsed:D||!1,toastMessageCallback:K},`${U.type}-${Q}`)),$.dataClasses.map((U,Q)=>C.jsx(x2,{depth:1,privileges:L,permission:U,childCollapsed:z,didChildCollapsed:k=>{P.setChildCollapsed(k?z:!1)},toastMessageCallback:K},`${U.type}-${Q}`))]}):null,$.singletons.map((U,Q)=>C.jsx(x2,{depth:0,privileges:L,permission:U,childCollapsed:D,didChildCollapsed:k=>{P.setAllCollapsed(k?D:!1)},toastMessageCallback:K},`${U.type}-${Q}`))]},`${$.type}-${Y}`))})]}),(v||d.length)&&!_.length?C.jsx(zse,{children:"The Permission you're looking for can't be found "}):null]})},$se=()=>{const e=pr(),t=e.getRoles(),[r,n]=O.useState(null),[i,o]=O.useState(null),[a,s]=O.useState(""),[c,u]=O.useState(null),{styles:d,attributes:p}=rd(r,i,{modifiers:[{name:"offset",options:{offset:[-10,10]}}],placement:"right-start"});O.useEffect(()=>{s(""),u(null)},[i]);const v=()=>{if(!a)throw new Error("Please enter a valid name");if(Object.values(t).find(b=>b.role.toLowerCase()===a.toLowerCase()))throw new Error(`A role with the name ${a} already exists`);const x=EB.generate(),m=fe.createRole(x,a,t);e.actions.updateRoles(m)};return C.jsx(un.Popover,{children:({open:h,close:x})=>{const m=()=>{u(null);try{fe.validateName(a),v(),x()}catch(b){u(b.message)}};return C.jsxs(C.Fragment,{children:[C.jsx(un.Popover.Button,{className:"rounded","data-cy":"New-priv-btn",ref:n,children:C.jsx(Zt,{variant:"ghost",color:"white",children:C.jsx(_e.FdPlus,{className:"h-4 w-4"})})}),h&&C.jsx(Td,{children:C.jsx(un.Popover.Panel,{ref:o,style:d.popper,...p.popper,"data-cy":"New-priv-pop-up",className:"z-50",static:!0,children:C.jsxs(dr,{className:"min-w-[256px] border rounded px-4 py-2 text-xs shadow-md",depth:3,borderType:"light",children:[C.jsx("h5",{className:"mb-2 text-xs font-semibold",children:"Create New Role"}),C.jsx("div",{className:"mt-2",children:C.jsxs("label",{className:"flex items-center space-x-4",children:[C.jsx("span",{children:"Name"}),C.jsxs(wt.Root,{color:c?"negative":"primary",className:"w-full",children:[C.jsx(wt.Group,{children:C.jsx(wt.Field,{autoFocus:!0,value:a,onChange:b=>s(b.target.value),onKeyDown:b=>{b.key==="Enter"&&m()},type:"text"})}),c&&C.jsx(wt.Message,{children:c})]})]})}),C.jsxs("div",{className:"mt-4 flex items-center justify-center space-x-2",children:[C.jsx(Zt,{onClick:()=>{m()},children:"Create"}),C.jsx(Zt,{color:"white",variant:"outline",onClick:()=>x(),children:"Cancel"})]})]})})})]})}})},Hse=()=>{const t=pr().getRoles(),{selectedRole:r}=Y1();return C.jsxs("div",{className:"flex flex-1 h-full",children:[C.jsxs(dr,{depth:1,className:"flex h-full w-[356px] flex-col",children:[C.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between px-3.5 py-[10px]",children:[C.jsxs("div",{className:"flex items-center space-x-1",children:[C.jsx("span",{children:C.jsx(_e.FdGroup,{className:"h-[14px] w-[14px]"})}),C.jsx("span",{className:"text-[11px] font-semibold",children:"Roles"})]}),C.jsx($se,{})]}),C.jsx("div",{className:"flex-1 space-y-4 overflow-auto p-4 pb-10 pt-1",children:Object.values(t).length>0?Object.values(t).sort((n,i)=>fe.localeCompare(n.role,i.role)).map((n,i)=>C.jsx(qse,{role:n},i)):C.jsx("div",{className:"flex h-full items-center justify-center",children:C.jsx("div",{className:"flex flex-1 items-center justify-center text-inactive-text",children:C.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4",children:[C.jsx(_e.FdInfoBold,{className:"h-10 w-10"}),C.jsx("div",{className:"font-semibold",children:"There are no roles"}),C.jsxs("div",{className:"flex items-center text-sm",children:["Create a new role by clicking on the"," ",C.jsx(_e.FdPlus,{className:"ml-2 inline h-4 w-4"})]})]})})})})]}),C.jsx(dr,{depth:1,className:Yr("relative flex h-full w-full flex-1 flex-col items-stretch overflow-x-auto",{"border-l-[0.5px]":r}),children:C.jsx("div",{className:"flex h-full w-full select-none flex-col",children:r?C.jsxs(C.Fragment,{children:[C.jsx(Lse,{}),C.jsx(Fse,{selectedRole:r})]}):C.jsx(ZL,{tab:"Role"})})})]})},xF=()=>{const e=pr(),t=e.getQodly(),r=e.getSelectedTab(),n=e.getForceLogin(),i=e.getRestrictedByDefault(),o=O.useRef();return C.jsx("div",{className:"absolute inset-0 flex flex-1 overflow-hidden",children:C.jsx("div",{className:"relative flex flex-1 overflow-x-auto","data-cy":"Roles&Privileges-editor-cy",ref:a=>o.current=a,children:C.jsxs("div",{className:"flex w-full flex-col",children:[C.jsx(OK,{activeTab:r,forceLogin:n,restrictedByDefault:i,onTabChange:a=>{e.actions.toggleTab(a)},onForceLoginChange:a=>{e.actions.toggleForceLogin(a)},onRestrictedByDefaultChange:a=>{e.actions.toggleRestrictedByDefault(a)},qodly:t}),r==="roles"?C.jsx(CK,{children:C.jsx(Hse,{})}):C.jsx(Dse,{})]})})})},Vse=()=>{const{modals:e,closeModal:t,editModal:r}=Poe();return C.jsx(C.Fragment,{children:e.map((n,i)=>C.jsx(fe.Modal,{hasOverlay:i===0,...n,onClose:t,onEdit:r,container:xr()},n.id))})},wF=e=>{if(!e)return fe.rolesToAPI(fe.sanitizeRoles({}));try{return fe.rolesToAPI(fe.sanitizeRoles(JSON.parse(e)))}catch{return fe.rolesToAPI(fe.sanitizeRoles({}))}},Wse=({initialValue:e,onChange:t,...r})=>{const n=pr(),i=n.getRolesFlags(),o=n.getRolesAndPrivileges(),a=O.useMemo(()=>wF(e),[e]),s=O.useRef(o),c=O.useRef(a),u=O.useRef(a);return O.useEffect(()=>{s.current=o},[o]),O.useEffect(()=>{lo.isEqual(a,u.current)||(u.current=a,c.current=a,!lo.isEqual(a,s.current)&&n.actions.setRolesContent({content:a,flags:{touched:!1}}))},[n,a]),fe.useDidMountEffect(()=>{if(!(!t||!i.touched)&&!lo.isEqual(o,c.current))try{const d=JSON.stringify(o,null,2);t(d),c.current=o}catch(d){console.error("[Roles Editor Standalone] Error on value stringify:",d)}},[o,i.touched,t]),C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"relative h-screen z-10 overflow-hidden",children:C.jsx(xF,{...r})}),C.jsx(Vse,{})]})},Use=e=>{const t=Toe();return C.jsx(vB,{adapter:t,children:C.jsx(fe.TipsProvider,{children:C.jsx(Wse,{...e})})})},Gse=({initialValue:e,...t})=>{const r=O.useMemo(()=>({...fe.sanitizeRoles(wF(e)),flags:{touched:!1}}),[e]);return C.jsx(Noe,{initialState:r,children:C.jsx(Use,{initialValue:e,...t})})};exports.ROLES_EDITOR_SCOPE_CLASS=w2.ROLES_EDITOR_SCOPE_CLASS;exports.EditorStateAdapterProvider=vB;exports.Roles=xF;exports.Standalone=Gse;exports.useReduxAdapter=Yie;
113
+ ressources`,container:xr(),children:C.jsx(Zt,{color:"white",variant:"ghost",onClick:S,children:C.jsx(_e.FdReload,{})})})}),C.jsx(Kr,{icon:C.jsx(_e.FdBulb,{}),label:"Delete all the non existing resources from privileges",container:xr(),children:C.jsx(Zt,{color:"white",variant:"ghost",onClick:L,disabled:!B,children:C.jsx(_e.FdClean,{className:"h-4 w-4"})})})]})}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Read"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Create"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Update"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Delete"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Execute"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Promote"})]})}),T.length?C.jsx("tbody",{children:T.map((D,z)=>{const P=D.permissions.some(K=>K.from.length>0);return C.jsxs("tr",{className:Yr("group even:bg-white/5 hover:bg-input-bg",{"opacity-60":D.exists===!1}),children:[C.jsxs("td",{className:Yr("group flex items-center gap-3 py-2 text-xs group-hover:rounded-l group-hover:bg-input-bg ",D.exists===!1?"text-negative-text":""),children:[bF(D.type),D.resource,C.jsx(Kr,{label:"Remove Permission",container:xr(),children:C.jsx(Zt,{color:"white",variant:"ghost",disabled:P,onClick:()=>{P?fe.toastSubject.next({kind:"info",markdown:!0,message:`<div className="flex gap-x-3"><h3 className="font-bold">Info:</h3><p className="font-normal">Inherited permissions can't be removed</p></div>`,customIcon:_e.FdInfoBold}):_({applyTo:D.resource,type:D.type})},className:"opacity-0 group-hover:opacity-100",children:C.jsx(_e.FdPlus,{className:"h-4 w-4 rotate-45 transform"})})})]}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg ",children:C.jsx(Uo,{permissions:D.permissions,showIncluded:r,label:"read",onToggle:K=>A(D,K),onSelect:t,privileges:n,exists:D.exists})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg ",children:C.jsx(Uo,{permissions:D.permissions,showIncluded:r,label:"create",onToggle:K=>A(D,K),onSelect:t,privileges:n,exists:D.exists})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg ",children:C.jsx(Uo,{permissions:D.permissions,showIncluded:r,label:"update",onToggle:K=>A(D,K),onSelect:t,privileges:n,exists:D.exists})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg",children:C.jsx(Uo,{permissions:D.permissions,showIncluded:r,label:"drop",onToggle:K=>A(D,K),onSelect:t,privileges:n,exists:D.exists})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg",children:C.jsx(Uo,{promoted:w[D.resource],permissions:D.permissions,showIncluded:r,label:"execute",onToggle:K=>A(D,K),onSelect:t,privileges:n,exists:D.exists})}),C.jsx("td",{className:"py-2 text-center group-hover:rounded-r group-hover:bg-input-bg",children:C.jsx(Uo,{permissions:D.permissions,showIncluded:r,label:"promote",onToggle:K=>A(D,K),onSelect:t,privileges:n,exists:D.exists})})]},z)})}):null]}),!N.length&&h?C.jsx(b2,{children:"The Permission you're looking for can't be found "}):null,!N.length&&!h?C.jsxs(b2,{children:["This Privilege has no Permissions configured yet ",C.jsx("br",{}),'Add a new permission by using the "Create a permission" input above']}):null]})},Mse=({onCreate:e})=>{const t=pr(),r=t.getPrivileges(),[n,i]=O.useState(null),[o,a]=O.useState(null),[s,c]=O.useState(""),[u,d]=O.useState(null),{styles:p,attributes:v}=rd(n,o,{modifiers:[{name:"offset",options:{offset:[-10,10]}}],placement:"right-start"});O.useEffect(()=>{c(""),d(null)},[o]);const h=x=>{d(null);try{const m=fe.createPrivilege(s,r),b=Object.values(m).find(w=>w.privilege===s);t.actions.updatePrivileges(m),b&&e(b),setTimeout(()=>{x()},0)}catch(m){d(m.message)}};return C.jsx(un.Popover,{children:({open:x,close:m})=>C.jsxs(C.Fragment,{children:[C.jsx(un.Popover.Button,{className:"rounded","data-cy":"New-priv-btn",ref:i,children:C.jsx(Zt,{variant:"ghost",color:"white",children:C.jsx(_e.FdPlus,{className:"h-4 w-4"})})}),x&&C.jsx(Td,{children:C.jsx(un.Popover.Panel,{ref:a,style:p.popper,...v.popper,"data-cy":"New-priv-pop-up",className:"z-50",static:!0,children:C.jsxs(dr,{className:"min-w-[256px] border rounded px-4 py-2 text-xs shadow-md",depth:3,borderType:"light",children:[C.jsx("h5",{className:"mb-2 text-xs font-semibold",children:"Create New Privilege"}),C.jsx("div",{className:"mt-2",children:C.jsxs("label",{className:"flex items-center space-x-4",children:[C.jsx("span",{children:"Name"}),C.jsxs(wt.Root,{className:"w-full",color:u?"negative":"primary",children:[C.jsx(wt.Group,{children:C.jsx(wt.Field,{autoFocus:!0,value:s,onChange:b=>c(b.target.value),onKeyDown:b=>{b.key==="Enter"&&h(m)},type:"text"})}),u&&C.jsx(wt.Message,{children:u})]})]})}),C.jsxs("div",{className:"mt-4 flex items-center justify-center space-x-2",children:[C.jsx(Zt,{onClick:()=>{h(m)},children:"Create"}),C.jsx(Zt,{color:"white",variant:"outline",onClick:()=>m(),children:"Cancel"})]})]})})})]})})},Dse=()=>{const e=pr(),t=e.getCatalog(),r=e.getPrivileges(),n=O.useMemo(()=>{if(t===null)return r;const u=fB(r,Object.values((t==null?void 0:t.dataClasses)??{}));return pB(u,t)},[r,t]),[i,o]=O.useState(null),a=O.useMemo(()=>Object.keys(n),[n]);O.useEffect(()=>{i&&n[i.id]||!a.length||o(n[a[0]])},[n]),O.useEffect(()=>{a.length<2&&c(!0)},[a.length]);const[s,c]=O.useState(!0);return C.jsxs("div",{className:"flex flex-1 h-full",children:[C.jsxs(dr,{depth:1,className:"flex h-full w-[356px] flex-col",children:[C.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between px-3.5 py-[10px]",children:[C.jsxs("div",{className:"flex items-center space-x-1",children:[C.jsx("span",{children:C.jsx(_e.FdGroup,{className:"h-[14px] w-[14px]"})}),C.jsx("span",{className:"text-[11px] font-semibold",children:"Privileges"})]}),C.jsx(Mse,{onCreate:u=>{o(u)}})]}),C.jsx(Moe,{privileges:n,selectedPrivilege:i,selectPrivilege:u=>{o(u)}})]}),i&&n[i.id]?C.jsxs(dr,{depth:1,className:"privileges-container relative flex flex-1 flex-col overflow-x-auto border-l-[0.5px]",children:[C.jsxs("div",{className:"mb-1 flex h-full w-full flex-col items-stretch",children:[i.privilege!=="guest"?C.jsx(koe,{privileges:n,selectedPrivilege:i,onSelect:u=>o(r[u]),setShowIncluded:c,showIncluded:s}):null,C.jsx(Ase,{privileges:n,selectedPrivilege:i,onSelect:u=>o(r[u]),showIncluded:s})]}),C.jsx(jse,{privileges:n,selectedPrivilege:i,setSelectedPrivilege:o})]}):C.jsx(ZL,{tab:"Privilege"})]})},jse=({privileges:e,selectedPrivilege:t,setSelectedPrivilege:r})=>{const[n,i]=O.useState(!1);return C.jsx(fe.Panel,{path:fe.ROLES_TAB_PATH,isOpen:n,onOpen:()=>i(!0),onClose:()=>i(!1),children:C.jsx("div",{className:"h-full w-full px-3 pb-3",children:C.jsx(dr,{depth:2,className:"h-full w-full rounded",children:C.jsx($ie,{dict:e,data:fe.getGraphData(t.id,e),onSelect:o=>r(e[o])})})})})},qse=({role:e})=>{var E;const t=pr(),[r,n]=O.useState(e),[i,o]=O.useState(e.role),[a,s]=O.useState(null),c=t.getPrivileges(),u=((E=r.privileges)==null?void 0:E.filter(I=>c[I]&&c[I].privilege!=="guest").length)||0,d=t.getRoles(),{selectedRole:p,selectRole:v}=Y1(),[h,x]=O.useState(!1),m=fe.useOutsideClick(()=>{h&&w()});fe.useDidMountEffect(()=>{i!==e.role&&o(e.role)},[e.role]),O.useEffect(()=>{e.role||x(!0)},[]),O.useEffect(()=>{n(e)},[e]);const b=()=>{s(null),x(!0)},w=()=>{s(null),e.role&&e.role===i&&x(!1);try{const I=fe.saveRole({...r,role:i},d);t.actions.updateRoles(I),x(!1)}catch(I){s(I.message)}},y=async I=>{I.stopPropagation();const{confirmed:N}=await t.actions.openModal({title:"Delete Role",type:fe.ModalType.CONFIRM,color:fe.ModalColor.DANGER,message:"Are you sure you want to remove this Role?",icon:"FdWarningDanger"});N&&_()},_=()=>{const I=fe.removeRole(r.id,d),N=Object.keys(I);if(p!==r.id){t.actions.updateRoles(I);return}if(N.length===0)v(null);else{const T=Object.keys(d),A=T.indexOf(r.id),B=Math.max(0,A-1),L=T[B];A===0?v(N[0]):I[L]?v(L):v(N[0])}t.actions.updateRoles(I)},S=(I=null)=>{if(I&&I.stopPropagation(),!e.role){_();return}x(!1),o(e.role)};return C.jsx(C.Fragment,{children:C.jsxs(dr,{depth:4,borderType:p===r.id?"primary":p!==r.id?"light":"default",className:Yr("rounded border p-2"),role:"button","data-cy":"privilegeCard",onClick:()=>{v(r.id)},ref:m,children:[C.jsx("div",{className:"flex items-center justify-between",children:C.jsxs("div",{className:"flex flex-1 items-center",children:[C.jsx("span",{className:"mr-4",children:C.jsx(_e.FdGroup,{className:"h-6 w-6"})}),h?C.jsxs(wt.Root,{color:a?"negative":"primary",className:"flex-1 mr-2",children:[C.jsx(wt.Group,{children:C.jsx(wt.Field,{type:"text",value:i,onChange:({target:{value:I}})=>{o(I)},onKeyDown:I=>{I.key==="Enter"&&w(),I.key==="Escape"&&S()},onBlur:()=>S(),placeholder:"role",autoComplete:"off",autoFocus:!0})}),a&&C.jsx(wt.Message,{children:a})]}):C.jsx("span",{className:"inline-block grow overflow-hidden truncate whitespace-nowrap text-xs font-bold",title:i,children:r.role}),C.jsx("div",{className:Yr("justify-between ml-auto flex w-fit items-center gap-x-2"),children:h?C.jsxs(C.Fragment,{children:[C.jsx(Zt,{color:"white",variant:"ghost",onClick:w,children:C.jsx(_e.FdSave,{className:"h-4 w-4"})}),C.jsx(Zt,{color:"white",variant:"ghost",onClick:S,children:C.jsx(_e.FdClose,{className:"h-4 w-4"})})]}):C.jsxs(C.Fragment,{children:[C.jsx(Zt,{color:"white",variant:"ghost",onClick:b,children:C.jsx(_e.FdPen,{className:"h-4 w-4"})}),C.jsx(Zt,{color:"white",variant:"ghost",onClick:I=>y(I),children:C.jsx(_e.FdTrash,{className:"h-4 w-4"})})]})})]})}),C.jsxs("span",{className:Yr("ml-[43px] py-1 text-xs"),children:[u," Privilege",u>1?"s":""]})]})})},yF=(e,t)=>e?t[e]:null,y2=(e,t,r)=>{const n=yF(e,r);return n?Object.values(r).reduce((i,o)=>o.id===e?n.privileges.includes(t)?{...i,[n.id]:{...n,privileges:n.privileges.filter(a=>a!==t)}}:{...i,[n.id]:{...n,privileges:[...n.privileges,t]}}:{...i,[o.id]:o},{}):r},Lse=()=>{const e=pr(),t=e.getPrivileges(),r=e.getRoles(),{selectedRole:n}=Y1(),i=yF(n,r),o=(a,s)=>s&&s.privileges.includes(a.id);return C.jsxs(dr,{depth:1,className:"w-full border-b p-4 ",children:[C.jsx("div",{className:"mb-4 flex items-center gap-x-5",children:C.jsx("h4",{className:"text-[13px] font-semibold ",children:"Privileges"})}),C.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[C.jsx(Zc,{"data-cy":"item=>Permisions",className:"italic opacity-90",children:"guest"}),Object.values(t).filter(a=>o(a,i)&&a.privilege!=="guest").map((a,s)=>C.jsxs(Zc,{"data-cy":"item=>Permisions",color:"primary",onClick:()=>{const c=y2(i.id,a.id,r);e.actions.updateRoles(c)},children:[a.privilege,C.jsx(_e.FdPlus,{className:"rotate-45 transform"})]},s)),Object.values(t).filter(a=>!o(a,i)&&a.privilege!=="guest").map((a,s)=>C.jsxs(Zc,{"data-cy":"item=>Permisions",color:"dark",onClick:()=>{const c=y2(i.id,a.id,r);e.actions.updateRoles(c)},children:[a.privilege,C.jsx(_e.FdPlus,{})]},s))]})]})},zse=({children:e})=>C.jsx("div",{className:"h-full w-full",children:C.jsx("div",{className:"flex h-full w-full flex-1 items-center justify-center",children:C.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 py-4 text-inactive-text",children:[C.jsx(_e.FdInfoBold,{className:"absolute -right-full h-10 w-10 translate-x-1"}),C.jsx("div",{className:"text-center text-sm",children:e})]})})}),Hw=(e,t,r,n=!1)=>{const i=e.applyTo,o=e.type===fe.EPermissionType.DATACLASS?"ds":i.split(".")[0],a={...t,...r},s=()=>({value:!n,inherited:!1,from:[],explicitly:!1}),c={read:s(),create:s(),update:s(),drop:s(),execute:s(),promote:s()},u=p=>{p.forEach(v=>{a[v]&&(a[v].resources.forEach(h=>{if(h.resource===i||h.resource===o){const x=Hw(e,t,{[v]:a[v]},n);Object.values(h.permissions).forEach(m=>{c[m.name].explicitly||(!c[m.name].from.includes(a[v].privilege)&&m.checked&&c[m.name].from.push(a[v].privilege),c[m.name].inherited=c[m.name].inherited||x[m.name].value||x[m.name].inherited)})}}),a[v].includes.length>0&&u(a[v].includes))})};if(Object.values(r).forEach(p=>{p.resources.forEach(v=>{v.resource===i&&Object.values(v.permissions).forEach(h=>{h.checked&&(c[h.name].explicitly=!0,n&&(c[h.name].value=!0))})}),(p.includes.length>0||p.privilege==="guest")&&u(p.includes)}),Object.values(t).forEach(p=>{p.resources.forEach(v=>{v.resource===i&&(p.privilege==="guest"?Object.values(v.permissions).forEach(h=>{h.checked&&(c[h.name].explicitly=!0,n&&(c[h.name].value=!0))}):Object.values(v.permissions).forEach(h=>{!c[h.name].explicitly&&h.checked&&(n?c[h.name].value=!0:c[h.name].value=!1)}))})}),(n?Object.entries(c).some(([p,v])=>p!=="promote"&&!v.value&&!v.explicitly):Object.entries(c).some(([p,v])=>p!=="promote"&&v.value&&!v.explicitly))&&![fe.EPermissionType.DATASTORE,fe.EPermissionType.SINGLETON].includes(e.type)){const p={applyTo:o,type:e.type===fe.EPermissionType.DATACLASS?fe.EPermissionType.DATASTORE:e.type===fe.EPermissionType.SINGLETON_METHOD?fe.EPermissionType.SINGLETON:fe.EPermissionType.DATACLASS},v=Hw(p,t,r,n),h=x=>{let m=c[x].value;return n?!c[x].value&&!c[x].explicitly&&(m=v[x].value):c[x].value&&!c[x].explicitly&&(m=v[x].value),{value:m,inherited:c[x].inherited||v[x].inherited,from:c[x].from.length>0?c[x].from:v[x].from,explicitly:c[x].explicitly}};return{read:h("read"),create:h("create"),update:h("update"),drop:h("drop"),execute:h("execute"),promote:h("promote")}}return{read:c.read,create:c.create,update:c.update,drop:c.drop,execute:c.execute,promote:c.promote}},Bse=e=>{switch(e){case"dataclass":return C.jsx(_e.FdTableHeader,{className:"h-6 w-6"});case"singleton":return C.jsx(_e.FdSingleton,{className:"h-6 w-6"});case"datastore":return C.jsx(_e.FdModel3,{className:"h-6 w-6"});case"attribute":return C.jsx(_e.FdTableColumn,{className:"h-6 w-6"});case"method":return C.jsx(_e.FdCode,{className:"h-6 w-6"});case"singletonMethod":return C.jsx(_e.FdFunctionSingleton,{className:"h-6 w-6"});case"entityselMethod":return C.jsx(_e.FdFunctionSelection,{className:"h-6 w-6"});case"entityMethod":return C.jsx(_e.FdFunctionEntity,{className:"h-6 w-6"});case"dsMethod":return C.jsx(_e.FdFunctionDatastore,{className:"h-6 w-6"});case"dataclassMethod":return C.jsx(_e.FdFunctionDataclass,{className:"h-6 w-6"});default:return C.jsx(_e.FdTableHeader,{className:"h-6 w-6"})}},oa=({privileges:e,permission:t,hasChild:r,depth:n,isChild:i=!1,className:o,inSearch:a,toggleCollapse:s,collapsed:c,isRestrictedByDefault:u,toastMessageCallback:d})=>{const[p,v]=t.applyTo.split("."),h=O.useMemo(()=>Hw(t,e.otherPrivs,e.rolePrivs,u),[e,t,u]);return C.jsxs("tr",{className:Yr("group even:bg-white/5 hover:bg-input-bg",o),children:[C.jsxs("td",{className:Yr("flex h-full w-full items-stretch gap-3 p-0 text-xs group-hover:rounded-l group-hover:bg-input-bg",{"px-1":a}),children:[Array(n).fill("").map((x,m)=>C.jsx("div",{className:Yr("ml-1.5 mr-1 w-[2px] bg-grey-100",{"mr-0.5":i})},m)),C.jsxs("div",{className:"flex items-center gap-3 py-2",children:[r&&C.jsx("button",{onClick:s,className:"w-3",children:c?C.jsx(_e.FdRight,{className:"inline h-4 w-4"}):C.jsx(_e.FdDown,{className:"inline h-4 w-4"})}),Bse(t.type),a?t.applyTo:v||p]})]}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg",children:[fe.EPermissionType.ATTRIBUTE,fe.EPermissionType.DATASTORE,fe.EPermissionType.DATACLASS].includes(t.type)&&C.jsxs("div",{className:"relative mx-auto flex w-fit items-center justify-center gap-x-1",children:[C.jsx(or,{value:h.read.value||h.read.inherited,onClick:d,isDisabled:!0}),C.jsx("div",{className:"absolute left-full top-1/2 flex -translate-y-1/2 translate-x-1/2 cursor-pointer items-center",children:!h.read.value&&h.read.inherited?C.jsx(Kr,{container:xr(),delay:100,label:C.jsx("div",{className:"space-y-1 p-1",children:h.read.from.length?C.jsxs("div",{className:"flex items-start",children:[C.jsx(_e.FdBulb,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"}),C.jsxs("p",{className:"flex flex-col gap-y-2",children:[C.jsx("span",{className:"mr-1",children:"Permission inherited from:"}),C.jsx("ul",{children:h.read.from.map((x,m)=>C.jsx("li",{className:"cursor-pointer list-disc font-bold",children:x},m))})]})]}):null}),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4"})}):""})]})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg",children:[fe.EPermissionType.ATTRIBUTE,fe.EPermissionType.DATASTORE,fe.EPermissionType.DATACLASS].includes(t.type)&&C.jsxs("div",{className:"relative mx-auto flex w-fit items-center justify-center gap-x-1",children:[C.jsx(or,{value:h.create.value||h.create.inherited,onClick:d,isDisabled:!0}),C.jsx("div",{className:"absolute left-full top-1/2 flex -translate-y-1/2 translate-x-1/2 cursor-pointer items-center",children:!h.create.value&&h.create.inherited?C.jsx(Kr,{container:xr(),delay:100,label:C.jsx("div",{className:"space-y-1 p-1",children:h.read.from.length?C.jsxs("div",{className:"flex items-start",children:[C.jsx(_e.FdBulb,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"}),C.jsxs("p",{className:"flex flex-col gap-y-2",children:[C.jsx("span",{className:"mr-1",children:"Permission inherited from:"}),C.jsx("ul",{children:h.read.from.map((x,m)=>C.jsx("li",{className:"cursor-pointer list-disc font-bold",children:x},m))})]})]}):null}),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4"})}):""})]})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg",children:[fe.EPermissionType.ATTRIBUTE,fe.EPermissionType.DATASTORE,fe.EPermissionType.DATACLASS].includes(t.type)&&C.jsxs("div",{className:"relative mx-auto flex w-fit items-center justify-center gap-x-1",children:[C.jsx(or,{value:h.update.value||h.update.inherited,onClick:d,isDisabled:!0}),C.jsx("div",{className:"absolute left-full top-1/2 flex -translate-y-1/2 translate-x-1/2 cursor-pointer items-center",children:!h.update.value&&h.update.inherited?C.jsx(Kr,{container:xr(),delay:100,label:C.jsx("div",{className:"space-y-1 p-1",children:h.update.from.length?C.jsxs("div",{className:"flex items-start",children:[C.jsx(_e.FdBulb,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"}),C.jsxs("p",{className:"flex flex-col gap-y-2",children:[C.jsx("span",{className:"mr-1",children:"Permission inherited from:"}),C.jsx("ul",{children:h.update.from.map((x,m)=>C.jsx("li",{className:"cursor-pointer list-disc font-bold",children:x},m))})]})]}):null}),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4"})}):""})]})}),C.jsx("td",{className:"py-2 text-center group-hover:bg-input-bg",children:[fe.EPermissionType.ATTRIBUTE,fe.EPermissionType.DATASTORE,fe.EPermissionType.DATACLASS].includes(t.type)&&C.jsxs("div",{className:"relative mx-auto flex w-fit items-center justify-center gap-x-1",children:[C.jsx(or,{value:h.drop.value||h.drop.inherited,onClick:d,isDisabled:!0}),C.jsx("div",{className:"absolute left-full top-1/2 flex -translate-y-1/2 translate-x-1/2 cursor-pointer items-center",children:!h.drop.value&&h.drop.inherited?C.jsx(Kr,{container:xr(),delay:100,label:C.jsx("div",{className:"space-y-1 p-1",children:h.drop.from.length?C.jsxs("div",{className:"flex items-start",children:[C.jsx(_e.FdBulb,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"}),C.jsxs("p",{className:"flex flex-col gap-y-2",children:[C.jsx("span",{className:"mr-1",children:"Permission inherited from:"}),C.jsx("ul",{children:h.drop.from.map((x,m)=>C.jsx("li",{className:"cursor-pointer list-disc font-bold",children:x},m))})]})]}):null}),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4"})}):""})]})}),C.jsx("td",{className:"py-2 text-center group-hover:rounded-r group-hover:bg-input-bg",children:t.type!=="attribute"&&C.jsxs("div",{className:"relative mx-auto flex w-fit items-center justify-center gap-x-1",children:[C.jsx(or,{value:h.execute.value||h.execute.inherited,onClick:d,isDisabled:!0}),C.jsx("div",{className:"absolute left-full top-1/2 flex -translate-y-1/2 translate-x-1/2 cursor-pointer items-center",children:!h.execute.value&&h.execute.inherited?C.jsx(Kr,{container:xr(),delay:100,label:C.jsx("div",{className:"space-y-1 p-1",children:h.execute.from.length?C.jsxs("div",{className:"flex items-start",children:[C.jsx(_e.FdBulb,{className:"mr-2 mt-0.5 h-4 w-4 flex-shrink-0"}),C.jsxs("p",{className:"flex flex-col gap-y-2",children:[C.jsx("span",{className:"mr-1",children:"Permission inherited from:"}),C.jsx("ul",{children:h.execute.from.map((x,m)=>C.jsx("li",{className:"cursor-pointer list-disc font-bold",children:x},m))})]})]}):null}),children:C.jsx(_e.FdInfoBold,{className:"h-4 w-4"})}):""})]})})]})},x2=({depth:e,permission:t,privileges:r,childCollapsed:n,didChildCollapsed:i,toastMessageCallback:o})=>{const[a,s]=O.useState(n),c=pr(),u=c.getRestrictedByDefault(),d=c.getPrivileges();return O.useEffect(()=>{n===!0&&s(!0)},[n]),C.jsxs(C.Fragment,{children:[C.jsx(oa,{privileges:r,permission:t,isChild:!0,depth:e,hasChild:!0,toggleCollapse:()=>{const p=!a;s(p),i==null||i(p)},isRestrictedByDefault:u,allPrivileges:d,collapsed:a,toastMessageCallback:o}),!a&&C.jsxs(C.Fragment,{children:[t.attributes.map((p,v)=>C.jsx(oa,{privileges:r,permission:p,depth:e+1,isRestrictedByDefault:u,allPrivileges:d,toastMessageCallback:o},`${p.type}-${v}`)),t.methods.map((p,v)=>C.jsx(oa,{privileges:r,permission:p,depth:e+1,isRestrictedByDefault:u,allPrivileges:d,toastMessageCallback:o},`${p.type}-${v}`))]})]})},Fse=({selectedRole:e})=>{const[t,r]=O.useState(null),[n,i]=O.useState(null),{styles:o,attributes:a}=rd(t,n,{modifiers:[{name:"offset",options:{offset:[0,10]}}]}),s=pr(),c=s.getRestrictedByDefault(),u=s.getPrivileges(),[d,p]=O.useState([]),[v,h]=O.useState(""),x=s.getCatalogMethods(),m=s.getDataclasses(),b=s.getSingletons(),[w,y]=O.useState({}),[_,S]=O.useState([]);O.useEffect(()=>{const $=Vie(x,Object.values(m),Object.values(b));y($)},[e]);function E($){const Y=["datastore","singleton","dataclass","attribute","dsMethod","dataclassMethod","entityMethod","entityselMethod","singletonMethod"];return $.sort((U,Q)=>{const k=Y.indexOf(U.type),W=Y.indexOf(Q.type);return k!==W?k-W:U.applyTo.toLowerCase()>Q.applyTo.toLowerCase()?1:-1})}O.useEffect(()=>{S(E(k_(v,x,Object.values(m),Object.values(b)).filter($=>d.length?d.includes($.type):!0)))},[d,v]);const[I,N]=O.useState(!1),T=$=>{p(Y=>Y.some(U=>$.includes(U))?Y.filter(U=>!$.includes(U)):[...Y,...$])},A=s.getRoles(),B={toggleAllCollapsed:$=>{$.allCollapsed=!$.allCollapsed},toggleChildCollapsed:$=>{$.childCollapsed=!$.childCollapsed},setAllCollapsed:($,Y)=>{$.allCollapsed=Y},setChildCollapsed:($,Y)=>{$.childCollapsed=Y}},L=O.useMemo(()=>{const $=Object.values(u).find(W=>W.privilege==="guest"),Y=A[e],U=Y?Object.fromEntries(Y.privileges.map(W=>[W,u[W]]).filter(([,W])=>!!W)):{};if(c)return{rolePrivs:U,otherPrivs:$?{[$.id]:$}:{}};const Q=$?{[$.id]:{...$,active:!0}}:{},k=Object.fromEntries(Object.entries(u).filter(([W])=>W!==($==null?void 0:$.id)&&!(Y!=null&&Y.privileges.includes(W))).map(([W,J])=>[W,{...J,active:!1}]));return{rolePrivs:U,otherPrivs:{...Q,...k}}},[u,A,e,c]),{state:{allCollapsed:D,childCollapsed:z},dispatch:P}=fe.useEnhancedState({allCollapsed:!1,childCollapsed:!1},B,"Table Collapse Store"),K=()=>{fe.toastSubject.next({kind:"info",markdown:!0,message:"**Info:** You can add or modify permissions only in the Privilege section.",customIcon:_e.FdInfoCircle})};return C.jsxs($d,{className:"z-20 h-full flex-1 overflow-auto p-[15px] pt-0",style:{maxHeight:"calc(100vh - 5.5rem - 85px - 20px)"},children:[C.jsxs("table",{className:"relative h-full w-full border-collapse",children:[C.jsx("thead",{className:"sticky top-0 z-20 bg-panel-1",children:C.jsxs("tr",{className:"border-b border-grey-100",children:[C.jsx("td",{className:"py-2",children:C.jsxs("div",{className:"flex items-center space-x-2",children:[C.jsx(fe.Tooltip,{label:"Collapse All",placement:"top",container:xr(),children:C.jsx(Zt,{color:"white",variant:"ghost",disabled:D,onClick:()=>{z?(P.setAllCollapsed(!0),N(!0)):P.setChildCollapsed(!0)},children:C.jsx(_e.FdCollapseAll,{})})}),C.jsx("div",{className:"relative w-56",children:C.jsx(wt.Root,{children:C.jsxs(wt.Group,{children:[C.jsx(wt.Icon,{children:C.jsx(_e.FdSearch,{})}),C.jsx(wt.Field,{type:"text",placeholder:"Search",value:v,onChange:$=>{h($.target.value)}}),C.jsx(un.Popover,{className:"flex items-center",children:({open:$})=>C.jsxs(C.Fragment,{children:[C.jsx(un.Popover.Button,{ref:r,children:C.jsx(wt.Icon,{isAction:!0,children:C.jsx(_e.FdAdjust,{})})}),$&&C.jsx(Td,{children:C.jsx(un.Popover.Panel,{ref:i,style:o.popper,...a.popper,className:"z-50",static:!0,children:C.jsxs(dr,{depth:3,borderType:"light",className:"rounded-md border px-4 py-2.5 text-xs",children:[C.jsx("h5",{className:"mb-2 text-sm",children:"Filter"}),C.jsxs("div",{className:"space-y-2 text-s",children:[C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:d.includes("datastore"),onChange:()=>{T(["datastore"])},label:"Datastore",size:"sm"})}),C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:d.includes("dataclass"),onChange:()=>{T(["dataclass"])},label:"Dataclass",size:"sm"})}),C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:d.includes("singleton"),onChange:()=>{T(["singleton"])},label:"Singleton",size:"sm"})}),C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:d.some(Y=>["method","singletonMethod","dsMethod","dataclassMethod","entityMethod","entityselMethod"].includes(Y)),onChange:()=>{T(["method","singletonMethod","dsMethod","dataclassMethod","entityMethod","entityselMethod"])},label:"Functions",size:"sm"})}),C.jsx("div",{className:"flex items-center",children:C.jsx(or,{value:d.includes("attribute"),onChange:()=>{T(["attribute"])},label:"Attribute",size:"sm"})})]})]})})})]})})]})})})]})}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"read"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Create"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Update"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Delete"}),C.jsx("td",{className:"px-4 py-2 text-center text-[12px]",children:"Execute"})]})}),C.jsx("tbody",{className:"relative",children:d.length||v?_.map(($,Y)=>C.jsx(oa,{privileges:L,permission:$,depth:0,inSearch:!0,isRestrictedByDefault:c,allPrivileges:u,toastMessageCallback:K},`${$.type}-${Y}`)):Object.values(w).map(($,Y)=>C.jsxs(O.Fragment,{children:[C.jsx(oa,{privileges:L,permission:$,isRestrictedByDefault:c,allPrivileges:u,hasChild:!0,depth:0,toggleCollapse:()=>{const U=!I;N(U),P.setAllCollapsed(!U&&D?!1:D)},collapsed:I,toastMessageCallback:K}),$.type==="datastore"&&!I?C.jsxs(C.Fragment,{children:[$.methods.map((U,Q)=>C.jsx(oa,{privileges:L,isRestrictedByDefault:c,allPrivileges:u,permission:U,depth:1,collapsed:D||!1,toastMessageCallback:K},`${U.type}-${Q}`)),$.dataClasses.map((U,Q)=>C.jsx(x2,{depth:1,privileges:L,permission:U,childCollapsed:z,didChildCollapsed:k=>{P.setChildCollapsed(k?z:!1)},toastMessageCallback:K},`${U.type}-${Q}`))]}):null,$.singletons.map((U,Q)=>C.jsx(x2,{depth:0,privileges:L,permission:U,childCollapsed:D,didChildCollapsed:k=>{P.setAllCollapsed(k?D:!1)},toastMessageCallback:K},`${U.type}-${Q}`))]},`${$.type}-${Y}`))})]}),(v||d.length)&&!_.length?C.jsx(zse,{children:"The Permission you're looking for can't be found "}):null]})},$se=()=>{const e=pr(),t=e.getRoles(),[r,n]=O.useState(null),[i,o]=O.useState(null),[a,s]=O.useState(""),[c,u]=O.useState(null),{styles:d,attributes:p}=rd(r,i,{modifiers:[{name:"offset",options:{offset:[-10,10]}}],placement:"right-start"});O.useEffect(()=>{s(""),u(null)},[i]);const v=()=>{if(!a)throw new Error("Please enter a valid name");if(Object.values(t).find(b=>b.role.toLowerCase()===a.toLowerCase()))throw new Error(`A role with the name ${a} already exists`);const x=EB.generate(),m=fe.createRole(x,a,t);e.actions.updateRoles(m)};return C.jsx(un.Popover,{children:({open:h,close:x})=>{const m=()=>{u(null);try{fe.validateName(a),v(),x()}catch(b){u(b.message)}};return C.jsxs(C.Fragment,{children:[C.jsx(un.Popover.Button,{className:"rounded","data-cy":"New-priv-btn",ref:n,children:C.jsx(Zt,{variant:"ghost",color:"white",children:C.jsx(_e.FdPlus,{className:"h-4 w-4"})})}),h&&C.jsx(Td,{children:C.jsx(un.Popover.Panel,{ref:o,style:d.popper,...p.popper,"data-cy":"New-priv-pop-up",className:"z-50",static:!0,children:C.jsxs(dr,{className:"min-w-[256px] border rounded px-4 py-2 text-xs shadow-md",depth:3,borderType:"light",children:[C.jsx("h5",{className:"mb-2 text-xs font-semibold",children:"Create New Role"}),C.jsx("div",{className:"mt-2",children:C.jsxs("label",{className:"flex items-center space-x-4",children:[C.jsx("span",{children:"Name"}),C.jsxs(wt.Root,{color:c?"negative":"primary",className:"w-full",children:[C.jsx(wt.Group,{children:C.jsx(wt.Field,{autoFocus:!0,value:a,onChange:b=>s(b.target.value),onKeyDown:b=>{b.key==="Enter"&&m()},type:"text"})}),c&&C.jsx(wt.Message,{children:c})]})]})}),C.jsxs("div",{className:"mt-4 flex items-center justify-center space-x-2",children:[C.jsx(Zt,{onClick:()=>{m()},children:"Create"}),C.jsx(Zt,{color:"white",variant:"outline",onClick:()=>x(),children:"Cancel"})]})]})})})]})}})},Hse=()=>{const t=pr().getRoles(),{selectedRole:r}=Y1();return C.jsxs("div",{className:"flex flex-1 h-full",children:[C.jsxs(dr,{depth:1,className:"flex h-full w-[356px] flex-col",children:[C.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between px-3.5 py-[10px]",children:[C.jsxs("div",{className:"flex items-center space-x-1",children:[C.jsx("span",{children:C.jsx(_e.FdGroup,{className:"h-[14px] w-[14px]"})}),C.jsx("span",{className:"text-[11px] font-semibold",children:"Roles"})]}),C.jsx($se,{})]}),C.jsx("div",{className:"flex-1 space-y-4 overflow-auto p-4 pb-10 pt-1",children:Object.values(t).length>0?Object.values(t).sort((n,i)=>fe.localeCompare(n.role,i.role)).map((n,i)=>C.jsx(qse,{role:n},i)):C.jsx("div",{className:"flex h-full items-center justify-center",children:C.jsx("div",{className:"flex flex-1 items-center justify-center text-inactive-text",children:C.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4",children:[C.jsx(_e.FdInfoBold,{className:"h-10 w-10"}),C.jsx("div",{className:"font-semibold",children:"There are no roles"}),C.jsxs("div",{className:"flex items-center text-sm",children:["Create a new role by clicking on the"," ",C.jsx(_e.FdPlus,{className:"ml-2 inline h-4 w-4"})]})]})})})})]}),C.jsx(dr,{depth:1,className:Yr("relative flex h-full w-full flex-1 flex-col items-stretch overflow-x-auto",{"border-l-[0.5px]":r}),children:C.jsx("div",{className:"flex h-full w-full select-none flex-col",children:r?C.jsxs(C.Fragment,{children:[C.jsx(Lse,{}),C.jsx(Fse,{selectedRole:r})]}):C.jsx(ZL,{tab:"Role"})})})]})},xF=()=>{const e=pr(),t=e.getQodly(),r=e.getSelectedTab(),n=e.getForceLogin(),i=e.getRestrictedByDefault(),o=O.useRef();return C.jsx("div",{className:"absolute inset-0 flex flex-1 overflow-hidden",children:C.jsx("div",{className:"relative flex flex-1 overflow-x-auto","data-cy":"Roles&Privileges-editor-cy",ref:a=>o.current=a,children:C.jsxs("div",{className:"flex w-full flex-col",children:[C.jsx(OK,{activeTab:r,forceLogin:n,restrictedByDefault:i,onTabChange:a=>{e.actions.toggleTab(a)},onForceLoginChange:a=>{e.actions.toggleForceLogin(a)},onRestrictedByDefaultChange:a=>{e.actions.toggleRestrictedByDefault(a)},qodly:t}),r==="roles"?C.jsx(CK,{children:C.jsx(Hse,{})}):C.jsx(Dse,{})]})})})},Vse="object",Wse={forceLogin:{type:"boolean"},restrictedByDefault:{type:"boolean"},privileges:{type:"array",items:{$ref:"#/definitions/Privilege"}},roles:{type:"array",items:{$ref:"#/definitions/Role"}},permissions:{type:"object",properties:{allowed:{type:"array",items:{$ref:"#/definitions/Permission"}}}}},Use={Privilege:{type:"object",properties:{id:{type:"string"},privilege:{type:"string"},includes:{type:"array",items:{type:"string"}}},required:["privilege"]},Role:{type:"object",properties:{id:{type:"string"},role:{type:"string"},privileges:{type:"array",items:{type:"string"}}},required:["role"]},Permission:{type:"object",properties:{applyTo:{type:"string"},type:{enum:["dataclass","method","attribute","datastore","singleton","singletonMethod","dsMethod","dataclassMethod","entityMethod","entityselMethod"]},subType:{enum:["dsMethod","dataclassMethod","entityMethod","entityselMethod"]},read:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},create:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},update:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},drop:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},execute:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},promote:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},required:["applyTo","type"]}},Gse={type:Vse,properties:Wse,definitions:Use},Kse=()=>{const{modals:e,closeModal:t,editModal:r}=Poe();return C.jsx(C.Fragment,{children:e.map((n,i)=>C.jsx(fe.Modal,{hasOverlay:i===0,...n,onClose:t,onEdit:r,container:xr()},n.id))})},wF=e=>{if(!e)return fe.rolesToAPI(fe.sanitizeRoles({}));try{return fe.rolesToAPI(fe.sanitizeRoles(JSON.parse(e)))}catch{return fe.rolesToAPI(fe.sanitizeRoles({}))}},Yse=({initialValue:e,onChange:t,...r})=>{const n=pr(),i=n.getRolesFlags(),o=n.getRolesAndPrivileges(),a=O.useMemo(()=>wF(e),[e]),s=O.useRef(o),c=O.useRef(a),u=O.useRef(a);return O.useEffect(()=>{s.current=o},[o]),O.useEffect(()=>{lo.isEqual(a,u.current)||(u.current=a,c.current=a,!lo.isEqual(a,s.current)&&n.actions.setRolesContent({content:a,flags:{touched:!1}}))},[n,a]),fe.useDidMountEffect(()=>{if(!(!t||!i.touched)&&!lo.isEqual(o,c.current))try{const d=JSON.stringify(o,null,2);t(d),c.current=o}catch(d){console.error("[Roles Editor Standalone] Error on value stringify:",d)}},[o,i.touched,t]),C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"relative h-screen z-10 overflow-hidden",children:C.jsx(xF,{...r})}),C.jsx(Kse,{})]})},Xse=e=>{const t=Toe();return C.jsx(vB,{adapter:t,children:C.jsx(fe.TipsProvider,{children:C.jsx(Yse,{...e})})})},Zse=({initialValue:e,catalog:t,...r})=>{const n=O.useMemo(()=>({...fe.sanitizeRoles(wF(e)),flags:{touched:!1}}),[e]);return C.jsx(Noe,{initialState:n,catalog:t,children:C.jsx(Xse,{initialValue:e,...r})})};exports.ROLES_EDITOR_SCOPE_CLASS=w2.ROLES_EDITOR_SCOPE_CLASS;exports.EditorStateAdapterProvider=vB;exports.Roles=xF;exports.Standalone=Zse;exports.jsonSchema=Gse;exports.useReduxAdapter=Yie;
114
114
  //# sourceMappingURL=index.cjs.js.map