jplan-pack 0.6.722 → 0.6.724
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.
- package/dist/{AuthRoute-C1EDXO2a.js → AuthRoute-B-o0KMOq.js} +1 -1
- package/dist/{AuthRoute-CVQfjani.mjs → AuthRoute-DGdpQ2lN.mjs} +1 -1
- package/dist/{WidgetLabel-oFxVJDqY.mjs → WidgetLabel-BYCzRz10.mjs} +1 -1
- package/dist/{WidgetLabel-OgfRhxrv.js → WidgetLabel-CVusUB7j.js} +1 -1
- package/dist/{WidgetShortcut-D7-hA53B.mjs → WidgetShortcut-BuGHlPVm.mjs} +1 -1
- package/dist/{WidgetShortcut-DGMMiSLS.js → WidgetShortcut-Dii5WJRf.js} +1 -1
- package/dist/{WidgetSpacer-CejYIJcP.mjs → WidgetSpacer-Cyh8b_86.mjs} +1 -1
- package/dist/{WidgetSpacer-DPXCTR7X.js → WidgetSpacer-vOrBACiY.js} +1 -1
- package/dist/{WidgetTask-Di3HKP7W.mjs → WidgetTask-CnHV-VOJ.mjs} +1 -1
- package/dist/{WidgetTask-BSyenrFJ.js → WidgetTask-DBOPJn8Y.js} +1 -1
- package/dist/{index-BJ8o3enS.js → index-CaR0ar18.js} +8 -8
- package/dist/{index-DFm4XXK3.mjs → index-Y9MZ-5Qn.mjs} +497 -495
- package/dist/jplan-pack.cjs.js +1 -1
- package/dist/jplan-pack.es.js +1 -1
- package/package.json +1 -1
@@ -69,7 +69,7 @@ __p += '`),Pe&&(j+=`' +
|
|
69
69
|
function print() { __p += __j.call(arguments, '') }
|
70
70
|
`:`;
|
71
71
|
`)+j+`return __p
|
72
|
-
}`;var Ie=o_(function(){return Fe(E,se+"return "+j).apply(t,b)});if(Ie.source=j,Td(Ie))throw Ie;return Ie}function kR(i){return He(i).toLowerCase()}function NR(i){return He(i).toUpperCase()}function RR(i,s,u){if(i=He(i),i&&(u||s===t))return fg(i);if(!i||!(s=In(s)))return i;var f=cr(i),_=cr(s),E=mg(f,_),b=gg(f,_)+1;return ko(f,E,b).join("")}function OR(i,s,u){if(i=He(i),i&&(u||s===t))return i.slice(0,_g(i)+1);if(!i||!(s=In(s)))return i;var f=cr(i),_=gg(f,cr(s))+1;return ko(f,0,_).join("")}function PR(i,s,u){if(i=He(i),i&&(u||s===t))return i.replace(Tu,"");if(!i||!(s=In(s)))return i;var f=cr(i),_=mg(f,cr(s));return ko(f,_).join("")}function MR(i,s){var u=X,f=ee;if(ut(s)){var _="separator"in s?s.separator:_;u="length"in s?be(s.length):u,f="omission"in s?In(s.omission):f}i=He(i);var E=i.length;if(Oi(i)){var b=cr(i);E=b.length}if(u>=E)return i;var S=u-Pi(f);if(S<1)return f;var P=b?ko(b,0,S).join(""):i.slice(0,S);if(_===t)return P+f;if(b&&(S+=P.length-S),bd(_)){if(i.slice(S).search(_)){var W,z=P;for(_.global||(_=Vu(_.source,He(Lm.exec(_))+"g")),_.lastIndex=0;W=_.exec(z);)var j=W.index;P=P.slice(0,j===t?S:j)}}else if(i.indexOf(In(_),S)!=S){var te=P.lastIndexOf(_);te>-1&&(P=P.slice(0,te))}return P+f}function DR(i){return i=He(i),i&&zT.test(i)?i.replace(Pm,lI):i}var LR=Fi(function(i,s,u){return i+(u?" ":"")+s.toUpperCase()}),Ad=ip("toUpperCase");function r_(i,s,u){return i=He(i),s=u?t:s,s===t?oI(i)?hI(i):Yb(i):i.match(s)||[]}var o_=Se(function(i,s){try{return Tn(i,t,s)}catch(u){return Td(u)?u:new Ce(u)}}),xR=Xr(function(i,s){return Hn(s,function(u){u=Or(u),Jr(i,u,Ed(i[u],i))}),i});function UR(i){var s=i==null?0:i.length,u=de();return i=s?st(i,function(f){if(typeof f[1]!="function")throw new $n(c);return[u(f[0]),f[1]]}):[],Se(function(f){for(var _=-1;++_<s;){var E=i[_];if(Tn(E[0],this,f))return Tn(E[1],this,f)}})}function BR(i){return lS(Wn(i,v))}function kd(i){return function(){return i}}function FR(i,s){return i==null||i!==i?s:i}var VR=sp(),HR=sp(!0);function gn(i){return i}function Nd(i){return Ug(typeof i=="function"?i:Wn(i,v))}function $R(i){return Fg(Wn(i,v))}function KR(i,s){return Vg(i,Wn(s,v))}var WR=Se(function(i,s){return function(u){return ja(u,i,s)}}),zR=Se(function(i,s){return function(u){return ja(i,u,s)}});function Rd(i,s,u){var f=Dt(s),_=fc(s,f);u==null&&!(ut(s)&&(_.length||!f.length))&&(u=s,s=i,i=this,_=fc(s,Dt(s)));var E=!(ut(u)&&"chain"in u)||!!u.chain,b=eo(i);return Hn(_,function(S){var P=s[S];i[S]=P,b&&(i.prototype[S]=function(){var W=this.__chain__;if(E||W){var z=i(this.__wrapped__),j=z.__actions__=hn(this.__actions__);return j.push({func:P,args:arguments,thisArg:i}),z.__chain__=W,z}return P.apply(i,wo([this.value()],arguments))})}),i}function GR(){return Vt._===this&&(Vt._=vI),this}function Od(){}function qR(i){return i=be(i),Se(function(s){return Hg(s,i)})}var jR=cd(st),YR=cd(cg),JR=cd(Mu);function i_(i){return gd(i)?Du(Or(i)):SS(i)}function QR(i){return function(s){return i==null?t:ni(i,s)}}var XR=lp(),ZR=lp(!0);function Pd(){return[]}function Md(){return!1}function eO(){return{}}function tO(){return""}function nO(){return!0}function rO(i,s){if(i=be(i),i<1||i>at)return[];var u=St,f=jt(i,St);s=de(s),i-=St;for(var _=Uu(f,s);++u<i;)s(u);return _}function oO(i){return Ee(i)?st(i,Or):Sn(i)?[i]:hn(Ip(He(i)))}function iO(i){var s=++pI;return He(i)+s}var aO=yc(function(i,s){return i+s},0),sO=ld("ceil"),cO=yc(function(i,s){return i/s},1),lO=ld("floor");function uO(i){return i&&i.length?hc(i,gn,ju):t}function dO(i,s){return i&&i.length?hc(i,de(s,2),ju):t}function hO(i){return dg(i,gn)}function fO(i,s){return dg(i,de(s,2))}function mO(i){return i&&i.length?hc(i,gn,Xu):t}function gO(i,s){return i&&i.length?hc(i,de(s,2),Xu):t}var pO=yc(function(i,s){return i*s},1),_O=ld("round"),vO=yc(function(i,s){return i-s},0);function yO(i){return i&&i.length?xu(i,gn):0}function CO(i,s){return i&&i.length?xu(i,de(s,2)):0}return y.after=$k,y.ary=xp,y.assign=NN,y.assignIn=Jp,y.assignInWith=Pc,y.assignWith=RN,y.at=ON,y.before=Up,y.bind=Ed,y.bindAll=xR,y.bindKey=Bp,y.castArray=eN,y.chain=Mp,y.chunk=lA,y.compact=uA,y.concat=dA,y.cond=UR,y.conforms=BR,y.constant=kd,y.countBy=yk,y.create=PN,y.curry=Fp,y.curryRight=Vp,y.debounce=Hp,y.defaults=MN,y.defaultsDeep=DN,y.defer=Kk,y.delay=Wk,y.difference=hA,y.differenceBy=fA,y.differenceWith=mA,y.drop=gA,y.dropRight=pA,y.dropRightWhile=_A,y.dropWhile=vA,y.fill=yA,y.filter=Ek,y.flatMap=bk,y.flatMapDeep=Ik,y.flatMapDepth=Sk,y.flatten=Np,y.flattenDeep=CA,y.flattenDepth=EA,y.flip=zk,y.flow=VR,y.flowRight=HR,y.fromPairs=wA,y.functions=HN,y.functionsIn=$N,y.groupBy=Ak,y.initial=bA,y.intersection=IA,y.intersectionBy=SA,y.intersectionWith=AA,y.invert=WN,y.invertBy=zN,y.invokeMap=Nk,y.iteratee=Nd,y.keyBy=Rk,y.keys=Dt,y.keysIn=mn,y.map=Sc,y.mapKeys=qN,y.mapValues=jN,y.matches=$R,y.matchesProperty=KR,y.memoize=kc,y.merge=YN,y.mergeWith=Qp,y.method=WR,y.methodOf=zR,y.mixin=Rd,y.negate=Nc,y.nthArg=qR,y.omit=JN,y.omitBy=QN,y.once=Gk,y.orderBy=Ok,y.over=jR,y.overArgs=qk,y.overEvery=YR,y.overSome=JR,y.partial=wd,y.partialRight=$p,y.partition=Pk,y.pick=XN,y.pickBy=Xp,y.property=i_,y.propertyOf=QR,y.pull=OA,y.pullAll=Op,y.pullAllBy=PA,y.pullAllWith=MA,y.pullAt=DA,y.range=XR,y.rangeRight=ZR,y.rearg=jk,y.reject=Lk,y.remove=LA,y.rest=Yk,y.reverse=yd,y.sampleSize=Uk,y.set=eR,y.setWith=tR,y.shuffle=Bk,y.slice=xA,y.sortBy=Hk,y.sortedUniq=KA,y.sortedUniqBy=WA,y.split=bR,y.spread=Jk,y.tail=zA,y.take=GA,y.takeRight=qA,y.takeRightWhile=jA,y.takeWhile=YA,y.tap=uk,y.throttle=Qk,y.thru=Ic,y.toArray=qp,y.toPairs=Zp,y.toPairsIn=e_,y.toPath=oO,y.toPlainObject=Yp,y.transform=nR,y.unary=Xk,y.union=JA,y.unionBy=QA,y.unionWith=XA,y.uniq=ZA,y.uniqBy=ek,y.uniqWith=tk,y.unset=rR,y.unzip=Cd,y.unzipWith=Pp,y.update=oR,y.updateWith=iR,y.values=$i,y.valuesIn=aR,y.without=nk,y.words=r_,y.wrap=Zk,y.xor=rk,y.xorBy=ok,y.xorWith=ik,y.zip=ak,y.zipObject=sk,y.zipObjectDeep=ck,y.zipWith=lk,y.entries=Zp,y.entriesIn=e_,y.extend=Jp,y.extendWith=Pc,Rd(y,y),y.add=aO,y.attempt=o_,y.camelCase=uR,y.capitalize=t_,y.ceil=sO,y.clamp=sR,y.clone=tN,y.cloneDeep=rN,y.cloneDeepWith=oN,y.cloneWith=nN,y.conformsTo=iN,y.deburr=n_,y.defaultTo=FR,y.divide=cO,y.endsWith=dR,y.eq=ur,y.escape=hR,y.escapeRegExp=fR,y.every=Ck,y.find=wk,y.findIndex=Ap,y.findKey=LN,y.findLast=Tk,y.findLastIndex=kp,y.findLastKey=xN,y.floor=lO,y.forEach=Dp,y.forEachRight=Lp,y.forIn=UN,y.forInRight=BN,y.forOwn=FN,y.forOwnRight=VN,y.get=Id,y.gt=aN,y.gte=sN,y.has=KN,y.hasIn=Sd,y.head=Rp,y.identity=gn,y.includes=kk,y.indexOf=TA,y.inRange=cR,y.invoke=GN,y.isArguments=ii,y.isArray=Ee,y.isArrayBuffer=cN,y.isArrayLike=fn,y.isArrayLikeObject=pt,y.isBoolean=lN,y.isBuffer=No,y.isDate=uN,y.isElement=dN,y.isEmpty=hN,y.isEqual=fN,y.isEqualWith=mN,y.isError=Td,y.isFinite=gN,y.isFunction=eo,y.isInteger=Kp,y.isLength=Rc,y.isMap=Wp,y.isMatch=pN,y.isMatchWith=_N,y.isNaN=vN,y.isNative=yN,y.isNil=EN,y.isNull=CN,y.isNumber=zp,y.isObject=ut,y.isObjectLike=ht,y.isPlainObject=es,y.isRegExp=bd,y.isSafeInteger=wN,y.isSet=Gp,y.isString=Oc,y.isSymbol=Sn,y.isTypedArray=Hi,y.isUndefined=TN,y.isWeakMap=bN,y.isWeakSet=IN,y.join=kA,y.kebabCase=mR,y.last=Gn,y.lastIndexOf=NA,y.lowerCase=gR,y.lowerFirst=pR,y.lt=SN,y.lte=AN,y.max=uO,y.maxBy=dO,y.mean=hO,y.meanBy=fO,y.min=mO,y.minBy=gO,y.stubArray=Pd,y.stubFalse=Md,y.stubObject=eO,y.stubString=tO,y.stubTrue=nO,y.multiply=pO,y.nth=RA,y.noConflict=GR,y.noop=Od,y.now=Ac,y.pad=_R,y.padEnd=vR,y.padStart=yR,y.parseInt=CR,y.random=lR,y.reduce=Mk,y.reduceRight=Dk,y.repeat=ER,y.replace=wR,y.result=ZN,y.round=_O,y.runInContext=O,y.sample=xk,y.size=Fk,y.snakeCase=TR,y.some=Vk,y.sortedIndex=UA,y.sortedIndexBy=BA,y.sortedIndexOf=FA,y.sortedLastIndex=VA,y.sortedLastIndexBy=HA,y.sortedLastIndexOf=$A,y.startCase=IR,y.startsWith=SR,y.subtract=vO,y.sum=yO,y.sumBy=CO,y.template=AR,y.times=rO,y.toFinite=to,y.toInteger=be,y.toLength=jp,y.toLower=kR,y.toNumber=qn,y.toSafeInteger=kN,y.toString=He,y.toUpper=NR,y.trim=RR,y.trimEnd=OR,y.trimStart=PR,y.truncate=MR,y.unescape=DR,y.uniqueId=iO,y.upperCase=LR,y.upperFirst=Ad,y.each=Dp,y.eachRight=Lp,y.first=Rp,Rd(y,function(){var i={};return Nr(y,function(s,u){$e.call(y.prototype,u)||(i[u]=s)}),i}(),{chain:!1}),y.VERSION=r,Hn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(i){y[i].placeholder=y}),Hn(["drop","take"],function(i,s){Oe.prototype[i]=function(u){u=u===t?1:kt(be(u),0);var f=this.__filtered__&&!s?new Oe(this):this.clone();return f.__filtered__?f.__takeCount__=jt(u,f.__takeCount__):f.__views__.push({size:jt(u,St),type:i+(f.__dir__<0?"Right":"")}),f},Oe.prototype[i+"Right"]=function(u){return this.reverse()[i](u).reverse()}}),Hn(["filter","map","takeWhile"],function(i,s){var u=s+1,f=u==Ct||u==qt;Oe.prototype[i]=function(_){var E=this.clone();return E.__iteratees__.push({iteratee:de(_,3),type:u}),E.__filtered__=E.__filtered__||f,E}}),Hn(["head","last"],function(i,s){var u="take"+(s?"Right":"");Oe.prototype[i]=function(){return this[u](1).value()[0]}}),Hn(["initial","tail"],function(i,s){var u="drop"+(s?"":"Right");Oe.prototype[i]=function(){return this.__filtered__?new Oe(this):this[u](1)}}),Oe.prototype.compact=function(){return this.filter(gn)},Oe.prototype.find=function(i){return this.filter(i).head()},Oe.prototype.findLast=function(i){return this.reverse().find(i)},Oe.prototype.invokeMap=Se(function(i,s){return typeof i=="function"?new Oe(this):this.map(function(u){return ja(u,i,s)})}),Oe.prototype.reject=function(i){return this.filter(Nc(de(i)))},Oe.prototype.slice=function(i,s){i=be(i);var u=this;return u.__filtered__&&(i>0||s<0)?new Oe(u):(i<0?u=u.takeRight(-i):i&&(u=u.drop(i)),s!==t&&(s=be(s),u=s<0?u.dropRight(-s):u.take(s-i)),u)},Oe.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},Oe.prototype.toArray=function(){return this.take(St)},Nr(Oe.prototype,function(i,s){var u=/^(?:filter|find|map|reject)|While$/.test(s),f=/^(?:head|last)$/.test(s),_=y[f?"take"+(s=="last"?"Right":""):s],E=f||/^find/.test(s);_&&(y.prototype[s]=function(){var b=this.__wrapped__,S=f?[1]:arguments,P=b instanceof Oe,W=S[0],z=P||Ee(b),j=function(Re){var Pe=_.apply(y,wo([Re],S));return f&&te?Pe[0]:Pe};z&&u&&typeof W=="function"&&W.length!=1&&(P=z=!1);var te=this.__chain__,se=!!this.__actions__.length,he=E&&!te,Ie=P&&!se;if(!E&&z){b=Ie?b:new Oe(this);var fe=i.apply(b,S);return fe.__actions__.push({func:Ic,args:[j],thisArg:t}),new Kn(fe,te)}return he&&Ie?i.apply(this,S):(fe=this.thru(j),he?f?fe.value()[0]:fe.value():fe)})}),Hn(["pop","push","shift","sort","splice","unshift"],function(i){var s=Qs[i],u=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",f=/^(?:pop|shift)$/.test(i);y.prototype[i]=function(){var _=arguments;if(f&&!this.__chain__){var E=this.value();return s.apply(Ee(E)?E:[],_)}return this[u](function(b){return s.apply(Ee(b)?b:[],_)})}}),Nr(Oe.prototype,function(i,s){var u=y[s];if(u){var f=u.name+"";$e.call(xi,f)||(xi[f]=[]),xi[f].push({name:s,func:u})}}),xi[vc(t,I).name]=[{name:"wrapper",func:t}],Oe.prototype.clone=DI,Oe.prototype.reverse=LI,Oe.prototype.value=xI,y.prototype.at=dk,y.prototype.chain=hk,y.prototype.commit=fk,y.prototype.next=mk,y.prototype.plant=pk,y.prototype.reverse=_k,y.prototype.toJSON=y.prototype.valueOf=y.prototype.value=vk,y.prototype.first=y.prototype.head,Ha&&(y.prototype[Ha]=gk),y},Mi=fI();Qo?((Qo.exports=Mi)._=Mi,Nu._=Mi):Vt._=Mi}).call(uF)}(ss,ss.exports)),ss.exports}var Ra=dF();const ml=lF(Ra);function Oa(n,e,t=[]){const r=fF(e);if(!r)return n;const o=r.split(" ");return n.filter(a=>hF(a,o,t))}function hF(n,e,t){return t.some(r=>{const o=ml.get(n,r);if(ml.isNil(o))return!1;const a=ml.toString(o).toLowerCase();return e.every(c=>a.includes(c))})}function fF(n){return ml.trim(n).toLowerCase().replace(/\s+/g," ")}const mF={class:"text-faded mt-7"},gF={key:0,class:"d-flex align-baseline mb-1"},pF={class:"me-1"},_F={class:"max-w-_form-metadataJ"},vF={key:0,class:"mb-1"},yF={key:1,class:"mb-1"},CF={class:"mb-1"},ou=l.defineComponent({__name:"FormMetadata",props:{meta:{},id:{}},setup(n){const{t:e}=br();return(t,r)=>(l.openBlock(),l.createElementBlock("div",mF,[l.createVNode(Qe.VRow,{"no-gutters":"",class:"align-end ga-3",align:"center"},{default:l.withCtx(()=>[l.renderSlot(t.$slots,"default"),l.createVNode(Qe.VCol,{cols:"auto",class:"pa-2"},{default:l.withCtx(()=>[t.id?(l.openBlock(),l.createElementBlock("p",gF,[l.createElementVNode("b",pF,l.toDisplayString(t.id.title)+": ",1),l.createElementVNode("span",_F,l.toDisplayString(t.id.key||"-"),1),l.createElementVNode("span",null,[l.createVNode(Bl,{"content-to-copy":t.id.key,size:15},null,8,["content-to-copy"])])])):l.createCommentVNode("",!0),l.createElementVNode("p",null,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.created"))+": ",1),l.createTextVNode(l.toDisplayString(l.unref(us)(t.meta.created_at))+" - "+l.toDisplayString(t.meta.created_by),1)])]),_:1}),l.createVNode(Qe.VCol,{cols:"auto",class:"d-flex flex-column align-baseline px-2 mt-1"},{default:l.withCtx(()=>[t.meta.updated_at&&t.meta.updated_by?(l.openBlock(),l.createElementBlock("p",vF,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.updated"))+": ",1),l.createTextVNode(l.toDisplayString(l.unref(us)(t.meta.updated_at))+" - "+l.toDisplayString(t.meta.updated_by),1)])):(l.openBlock(),l.createElementBlock("p",yF,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.modified"))+": ",1),l.createTextVNode(l.toDisplayString(l.unref(us)(t.meta.modified_at))+" - "+l.toDisplayString(t.meta.modified_by),1)])),l.createElementVNode("p",CF,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.delegated"))+": ",1),l.createTextVNode(l.toDisplayString(t.meta.delegated_at)+" - "+l.toDisplayString(t.meta.delegated_by),1)])]),_:1})]),_:3})]))}}),EF={key:0,class:"mb-2 ms-1"},VE=l.defineComponent({__name:"JSelect",props:{modelValue:{},name:{},label:{},placeholder:{},readonly:{type:Boolean},items:{},itemTitle:{},itemValue:{},density:{},loading:{type:Boolean},clearable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=l.computed(()=>t.readonly?"solo":"solo-filled"),a=l.computed(()=>{if(Array.isArray(t.items)&&t.items.length>0)if(typeof t.items[0]=="object"&&t.itemValue&&t.itemTitle){const d=t.items.find(h=>h[t.itemValue]===t.modelValue);return d?d[t.itemTitle]:""}else{const d=t.items.indexOf(t.modelValue);return d!==-1?t.items[d]:""}return""}),c=d=>{r("update:modelValue",d)};return(d,h)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[d.name?(l.openBlock(),l.createElementBlock("p",EF,l.toDisplayString(d.name),1)):l.createCommentVNode("",!0),d.label?(l.openBlock(),l.createBlock(ys.VLabel,{key:1,class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(d.label),1)]),_:1})):l.createCommentVNode("",!0),d.readonly?(l.openBlock(),l.createBlock(mE,{key:3,value:a.value},null,8,["value"])):(l.openBlock(),l.createBlock(l.unref(Vo.VSelect),{key:2,modelValue:t.modelValue,"onUpdate:modelValue":[h[0]||(h[0]=m=>t.modelValue=m),c],variant:o.value,items:d.items,"item-title":d.itemTitle,"item-value":d.itemValue,loading:d.loading,placeholder:d.placeholder,density:d.density,"bg-color":"containerBg",rounded:"false","hide-details":"",class:"j-field",clearable:d.clearable},null,8,["modelValue","variant","items","item-title","item-value","loading","placeholder","density","clearable"]))],64))}}),wF={key:0,class:"mb-2 ms-1"},TF={key:3,class:"j-textarea px-4 py-3 rounded-sm bg-containerBg"},HE=l.defineComponent({__name:"JTextArea",props:{modelValue:{},name:{},label:{},readonly:{type:Boolean},rows:{},hideDetails:{type:Boolean}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=l.computed(()=>t.readonly?"solo":"solo-filled");return(a,c)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[a.name?(l.openBlock(),l.createElementBlock("p",wF,l.toDisplayString(a.name),1)):l.createCommentVNode("",!0),a.label?(l.openBlock(),l.createBlock(ys.VLabel,{key:1,class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(a.label),1)]),_:1})):l.createCommentVNode("",!0),a.readonly?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(bO.VTextarea,{key:2,variant:o.value,"bg-color":"containerBg",rounded:"false",rows:a.rows,hideDetails:a.hideDetails,value:a.modelValue,"onUpdate:modelValue":c[0]||(c[0]=d=>r("update:modelValue",d)),"no-resize":""},null,8,["variant","rows","hideDetails","value"])),a.readonly?(l.openBlock(),l.createElementBlock("div",TF,l.toDisplayString(a.modelValue),1)):l.createCommentVNode("",!0)],64))}}),$E=l.defineComponent({__name:"CancelButton",props:{title:{}},emits:["cancel"],setup(n,{emit:e}){const t=e,{t:r}=br();return(o,a)=>(l.openBlock(),l.createBlock(it.VBtn,{color:"secondary",variant:"outlined",onClick:a[0]||(a[0]=c=>t("cancel")),class:"me-2 j-btn-form"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(o.title?l.unref(r)("actions.cancel"):l.unref(r)("actions.back")),1)]),_:1}))}}),KE=l.defineComponent({__name:"SaveButton",props:{disabled:{type:Boolean}},emits:["onSave"],setup(n,{emit:e}){const t=e,r=l.ref(!1);async function o(){r.value=!0,await t("onSave"),r.value=!1}const{t:a}=br();return(c,d)=>(l.openBlock(),l.createBlock(it.VBtn,{disabled:c.disabled,loading:r.value,color:"secondary",onClick:o,onKeydown:l.withKeys(o,["enter"]),class:"j-btn-form"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(a)("actions.save")),1)]),_:1},8,["disabled","loading"]))}}),bF={class:"mt-4"},WE=l.defineComponent({__name:"JForm",props:{title:{},metadata:{},id:{},cancelReturn:{type:Boolean}},emits:["onSave","onCancel"],setup(n,{emit:e}){const t=e;return(r,o)=>(l.openBlock(),l.createBlock(Kl,{title:r.title,class:"d-flex flex-column ma-0"},{default:l.withCtx(()=>[r.title?(l.openBlock(),l.createBlock(pi.VDivider,{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",bF,[l.renderSlot(r.$slots,"default")]),l.createVNode(xt.VCardText,{class:"pa-0 mx-0 align-content-end"},{default:l.withCtx(()=>[l.createVNode(Qe.VRow,{justify:"space-between",class:"mt-4"},{default:l.withCtx(()=>[l.createVNode(Qe.VCol,{cols:"auto",class:"text-sm-subtitle-2 text-medium-emphasis"},{default:l.withCtx(()=>[l.createVNode(ou,{id:r.id,meta:r.metadata},null,8,["id","meta"])]),_:1}),l.createVNode(Qe.VSpacer),l.createVNode(Qe.VCol,{cols:"auto",class:"align-content-end"},{default:l.withCtx(()=>[l.createVNode($E,{"cancel-return":r.cancelReturn,onCancel:o[0]||(o[0]=a=>t("onCancel"))},null,8,["cancel-return"]),l.createVNode(KE,{onOnSave:o[1]||(o[1]=a=>t("onSave"))})]),_:1})]),_:1})]),_:1})]),_:3},8,["title"]))}}),IF={class:"d-flex align-items-center"},SF={key:0,class:"d-flex align-center"},AF={class:"ms-1"},kF={class:"d-flex"},NF={class:"d-flex mb-1 align-center"},RF={class:"min-w-100 relative"},zE=l.defineComponent({__name:"TabFormHeader",props:{id:{},readonly:{type:Boolean,default:!1}},emits:["update:isEdition","save","cancel","delete","disable"],setup(n,{emit:e}){var v;const t=n,r=e,o=l.getCurrentInstance(),a=((v=o==null?void 0:o.vnode.props)==null?void 0:v.onDisable)!==void 0,c=l.ref(t.readonly);function d(){r("cancel"),c.value=!1,r("update:isEdition",c.value)}function h(){c.value=!c.value,r("update:isEdition",c.value)}async function m(){r("delete"),r("disable")}const{t:g}=br();return(p,w)=>(l.openBlock(),l.createElementBlock("div",IF,[p.id?(l.openBlock(),l.createElementBlock("div",SF,[w[0]||(w[0]=l.createElementVNode("b",null,"ID:",-1)),l.createElementVNode("span",AF,l.toDisplayString(p.id),1),l.createVNode(Bl,{"content-to-copy":p.id,size:20},null,8,["content-to-copy"])])):l.createCommentVNode("",!0),l.createVNode(Qe.VSpacer),l.createElementVNode("div",kF,[l.createVNode(it.VBtn,{onClick:m,variant:"text"},{default:l.withCtx(()=>[a?(l.openBlock(),l.createBlock(l.unref(rP),{key:0,size:"11",class:"me-2"})):(l.openBlock(),l.createBlock(pl.VIcon,{key:1,class:"me-2"},{default:l.withCtx(()=>w[1]||(w[1]=[l.createTextVNode("mdi-delete-outline")])),_:1})),l.createTextVNode(" "+l.toDisplayString(a?l.unref(g)("actions.disable"):l.unref(g)("actions.delete")),1)]),_:1}),l.createElementVNode("div",NF,[l.createVNode(pi.VDivider,{class:"mx-2 my-1",vertical:""}),l.createElementVNode("div",RF,[l.withDirectives(l.createVNode(it.VBtn,{onClick:h,variant:"text",color:"secondary","prepend-icon":"mdi-pencil",width:"95"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(g)("actions.edit")),1)]),_:1},512),[[l.vShow,!c.value]]),l.withDirectives(l.createVNode(it.VBtn,{onClick:d,variant:"text",color:"secondary",width:"95"},{default:l.withCtx(()=>[l.createVNode(pl.VIcon,{class:"pt-1 pe-2"},{default:l.withCtx(()=>w[2]||(w[2]=[l.createTextVNode("mdi-close")])),_:1}),l.createTextVNode(" "+l.toDisplayString(l.unref(g)("actions.cancel")),1)]),_:1},512),[[l.vShow,c.value]])])])])]))}}),OF={class:"d-flex flex-column"},PF={class:"height d-flex flex-column"},MF={class:"d-flex justify-between align-end"},DF=l.defineComponent({__name:"FormHeadless",props:{id:{},metadata:{},readonly:{type:Boolean,default:!1}},emits:["save","cancel"],setup(n,{emit:e}){const t=e,r=l.getCurrentInstance(),o=l.computed(()=>{var c;return!!((c=r==null?void 0:r.vnode.props)!=null&&c.onSave)}),a=l.computed(()=>{var c;return!!((c=r==null?void 0:r.vnode.props)!=null&&c.onCancel)});return(c,d)=>(l.openBlock(),l.createBlock(Kl,null,{default:l.withCtx(()=>[l.createElementVNode("div",OF,[l.createElementVNode("div",PF,[l.renderSlot(c.$slots,"default",{},void 0,!0)])]),l.createElementVNode("div",MF,[l.createVNode(Qe.VRow,{"no-gutters":"",justify:"space-between",class:"w-100"},{default:l.withCtx(()=>[l.createVNode(Qe.VCol,{cols:"auto",class:"text-sm-subtitle-2 text-medium-emphasis"},{default:l.withCtx(()=>[l.createVNode(ou,{id:c.id,meta:c.metadata},null,8,["id","meta"])]),_:1}),c.readonly?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(Qe.VCol,{key:0,class:"d-flex align-end",cols:"auto"},{default:l.withCtx(()=>[a.value?(l.openBlock(),l.createBlock($E,{key:0,title:"Back",onCancel:d[0]||(d[0]=h=>t("cancel"))})):l.createCommentVNode("",!0),o.value?(l.openBlock(),l.createBlock(KE,{key:1,onOnSave:d[1]||(d[1]=h=>t("save"))})):l.createCommentVNode("",!0)]),_:1}))]),_:1})])]),_:3}))}}),GE=Sa(DF,[["__scopeId","data-v-e7e4d99c"]]);/**
|
72
|
+
}`;var Ie=o_(function(){return Fe(E,se+"return "+j).apply(t,b)});if(Ie.source=j,Td(Ie))throw Ie;return Ie}function kR(i){return He(i).toLowerCase()}function NR(i){return He(i).toUpperCase()}function RR(i,s,u){if(i=He(i),i&&(u||s===t))return fg(i);if(!i||!(s=In(s)))return i;var f=cr(i),_=cr(s),E=mg(f,_),b=gg(f,_)+1;return ko(f,E,b).join("")}function OR(i,s,u){if(i=He(i),i&&(u||s===t))return i.slice(0,_g(i)+1);if(!i||!(s=In(s)))return i;var f=cr(i),_=gg(f,cr(s))+1;return ko(f,0,_).join("")}function PR(i,s,u){if(i=He(i),i&&(u||s===t))return i.replace(Tu,"");if(!i||!(s=In(s)))return i;var f=cr(i),_=mg(f,cr(s));return ko(f,_).join("")}function MR(i,s){var u=X,f=ee;if(ut(s)){var _="separator"in s?s.separator:_;u="length"in s?be(s.length):u,f="omission"in s?In(s.omission):f}i=He(i);var E=i.length;if(Oi(i)){var b=cr(i);E=b.length}if(u>=E)return i;var S=u-Pi(f);if(S<1)return f;var P=b?ko(b,0,S).join(""):i.slice(0,S);if(_===t)return P+f;if(b&&(S+=P.length-S),bd(_)){if(i.slice(S).search(_)){var W,z=P;for(_.global||(_=Vu(_.source,He(Lm.exec(_))+"g")),_.lastIndex=0;W=_.exec(z);)var j=W.index;P=P.slice(0,j===t?S:j)}}else if(i.indexOf(In(_),S)!=S){var te=P.lastIndexOf(_);te>-1&&(P=P.slice(0,te))}return P+f}function DR(i){return i=He(i),i&&zT.test(i)?i.replace(Pm,lI):i}var LR=Fi(function(i,s,u){return i+(u?" ":"")+s.toUpperCase()}),Ad=ip("toUpperCase");function r_(i,s,u){return i=He(i),s=u?t:s,s===t?oI(i)?hI(i):Yb(i):i.match(s)||[]}var o_=Se(function(i,s){try{return Tn(i,t,s)}catch(u){return Td(u)?u:new Ce(u)}}),xR=Xr(function(i,s){return Hn(s,function(u){u=Or(u),Jr(i,u,Ed(i[u],i))}),i});function UR(i){var s=i==null?0:i.length,u=de();return i=s?st(i,function(f){if(typeof f[1]!="function")throw new $n(c);return[u(f[0]),f[1]]}):[],Se(function(f){for(var _=-1;++_<s;){var E=i[_];if(Tn(E[0],this,f))return Tn(E[1],this,f)}})}function BR(i){return lS(Wn(i,v))}function kd(i){return function(){return i}}function FR(i,s){return i==null||i!==i?s:i}var VR=sp(),HR=sp(!0);function gn(i){return i}function Nd(i){return Ug(typeof i=="function"?i:Wn(i,v))}function $R(i){return Fg(Wn(i,v))}function KR(i,s){return Vg(i,Wn(s,v))}var WR=Se(function(i,s){return function(u){return ja(u,i,s)}}),zR=Se(function(i,s){return function(u){return ja(i,u,s)}});function Rd(i,s,u){var f=Dt(s),_=fc(s,f);u==null&&!(ut(s)&&(_.length||!f.length))&&(u=s,s=i,i=this,_=fc(s,Dt(s)));var E=!(ut(u)&&"chain"in u)||!!u.chain,b=eo(i);return Hn(_,function(S){var P=s[S];i[S]=P,b&&(i.prototype[S]=function(){var W=this.__chain__;if(E||W){var z=i(this.__wrapped__),j=z.__actions__=hn(this.__actions__);return j.push({func:P,args:arguments,thisArg:i}),z.__chain__=W,z}return P.apply(i,wo([this.value()],arguments))})}),i}function GR(){return Vt._===this&&(Vt._=vI),this}function Od(){}function qR(i){return i=be(i),Se(function(s){return Hg(s,i)})}var jR=cd(st),YR=cd(cg),JR=cd(Mu);function i_(i){return gd(i)?Du(Or(i)):SS(i)}function QR(i){return function(s){return i==null?t:ni(i,s)}}var XR=lp(),ZR=lp(!0);function Pd(){return[]}function Md(){return!1}function eO(){return{}}function tO(){return""}function nO(){return!0}function rO(i,s){if(i=be(i),i<1||i>at)return[];var u=St,f=jt(i,St);s=de(s),i-=St;for(var _=Uu(f,s);++u<i;)s(u);return _}function oO(i){return Ee(i)?st(i,Or):Sn(i)?[i]:hn(Ip(He(i)))}function iO(i){var s=++pI;return He(i)+s}var aO=yc(function(i,s){return i+s},0),sO=ld("ceil"),cO=yc(function(i,s){return i/s},1),lO=ld("floor");function uO(i){return i&&i.length?hc(i,gn,ju):t}function dO(i,s){return i&&i.length?hc(i,de(s,2),ju):t}function hO(i){return dg(i,gn)}function fO(i,s){return dg(i,de(s,2))}function mO(i){return i&&i.length?hc(i,gn,Xu):t}function gO(i,s){return i&&i.length?hc(i,de(s,2),Xu):t}var pO=yc(function(i,s){return i*s},1),_O=ld("round"),vO=yc(function(i,s){return i-s},0);function yO(i){return i&&i.length?xu(i,gn):0}function CO(i,s){return i&&i.length?xu(i,de(s,2)):0}return y.after=$k,y.ary=xp,y.assign=NN,y.assignIn=Jp,y.assignInWith=Pc,y.assignWith=RN,y.at=ON,y.before=Up,y.bind=Ed,y.bindAll=xR,y.bindKey=Bp,y.castArray=eN,y.chain=Mp,y.chunk=lA,y.compact=uA,y.concat=dA,y.cond=UR,y.conforms=BR,y.constant=kd,y.countBy=yk,y.create=PN,y.curry=Fp,y.curryRight=Vp,y.debounce=Hp,y.defaults=MN,y.defaultsDeep=DN,y.defer=Kk,y.delay=Wk,y.difference=hA,y.differenceBy=fA,y.differenceWith=mA,y.drop=gA,y.dropRight=pA,y.dropRightWhile=_A,y.dropWhile=vA,y.fill=yA,y.filter=Ek,y.flatMap=bk,y.flatMapDeep=Ik,y.flatMapDepth=Sk,y.flatten=Np,y.flattenDeep=CA,y.flattenDepth=EA,y.flip=zk,y.flow=VR,y.flowRight=HR,y.fromPairs=wA,y.functions=HN,y.functionsIn=$N,y.groupBy=Ak,y.initial=bA,y.intersection=IA,y.intersectionBy=SA,y.intersectionWith=AA,y.invert=WN,y.invertBy=zN,y.invokeMap=Nk,y.iteratee=Nd,y.keyBy=Rk,y.keys=Dt,y.keysIn=mn,y.map=Sc,y.mapKeys=qN,y.mapValues=jN,y.matches=$R,y.matchesProperty=KR,y.memoize=kc,y.merge=YN,y.mergeWith=Qp,y.method=WR,y.methodOf=zR,y.mixin=Rd,y.negate=Nc,y.nthArg=qR,y.omit=JN,y.omitBy=QN,y.once=Gk,y.orderBy=Ok,y.over=jR,y.overArgs=qk,y.overEvery=YR,y.overSome=JR,y.partial=wd,y.partialRight=$p,y.partition=Pk,y.pick=XN,y.pickBy=Xp,y.property=i_,y.propertyOf=QR,y.pull=OA,y.pullAll=Op,y.pullAllBy=PA,y.pullAllWith=MA,y.pullAt=DA,y.range=XR,y.rangeRight=ZR,y.rearg=jk,y.reject=Lk,y.remove=LA,y.rest=Yk,y.reverse=yd,y.sampleSize=Uk,y.set=eR,y.setWith=tR,y.shuffle=Bk,y.slice=xA,y.sortBy=Hk,y.sortedUniq=KA,y.sortedUniqBy=WA,y.split=bR,y.spread=Jk,y.tail=zA,y.take=GA,y.takeRight=qA,y.takeRightWhile=jA,y.takeWhile=YA,y.tap=uk,y.throttle=Qk,y.thru=Ic,y.toArray=qp,y.toPairs=Zp,y.toPairsIn=e_,y.toPath=oO,y.toPlainObject=Yp,y.transform=nR,y.unary=Xk,y.union=JA,y.unionBy=QA,y.unionWith=XA,y.uniq=ZA,y.uniqBy=ek,y.uniqWith=tk,y.unset=rR,y.unzip=Cd,y.unzipWith=Pp,y.update=oR,y.updateWith=iR,y.values=$i,y.valuesIn=aR,y.without=nk,y.words=r_,y.wrap=Zk,y.xor=rk,y.xorBy=ok,y.xorWith=ik,y.zip=ak,y.zipObject=sk,y.zipObjectDeep=ck,y.zipWith=lk,y.entries=Zp,y.entriesIn=e_,y.extend=Jp,y.extendWith=Pc,Rd(y,y),y.add=aO,y.attempt=o_,y.camelCase=uR,y.capitalize=t_,y.ceil=sO,y.clamp=sR,y.clone=tN,y.cloneDeep=rN,y.cloneDeepWith=oN,y.cloneWith=nN,y.conformsTo=iN,y.deburr=n_,y.defaultTo=FR,y.divide=cO,y.endsWith=dR,y.eq=ur,y.escape=hR,y.escapeRegExp=fR,y.every=Ck,y.find=wk,y.findIndex=Ap,y.findKey=LN,y.findLast=Tk,y.findLastIndex=kp,y.findLastKey=xN,y.floor=lO,y.forEach=Dp,y.forEachRight=Lp,y.forIn=UN,y.forInRight=BN,y.forOwn=FN,y.forOwnRight=VN,y.get=Id,y.gt=aN,y.gte=sN,y.has=KN,y.hasIn=Sd,y.head=Rp,y.identity=gn,y.includes=kk,y.indexOf=TA,y.inRange=cR,y.invoke=GN,y.isArguments=ii,y.isArray=Ee,y.isArrayBuffer=cN,y.isArrayLike=fn,y.isArrayLikeObject=pt,y.isBoolean=lN,y.isBuffer=No,y.isDate=uN,y.isElement=dN,y.isEmpty=hN,y.isEqual=fN,y.isEqualWith=mN,y.isError=Td,y.isFinite=gN,y.isFunction=eo,y.isInteger=Kp,y.isLength=Rc,y.isMap=Wp,y.isMatch=pN,y.isMatchWith=_N,y.isNaN=vN,y.isNative=yN,y.isNil=EN,y.isNull=CN,y.isNumber=zp,y.isObject=ut,y.isObjectLike=ht,y.isPlainObject=es,y.isRegExp=bd,y.isSafeInteger=wN,y.isSet=Gp,y.isString=Oc,y.isSymbol=Sn,y.isTypedArray=Hi,y.isUndefined=TN,y.isWeakMap=bN,y.isWeakSet=IN,y.join=kA,y.kebabCase=mR,y.last=Gn,y.lastIndexOf=NA,y.lowerCase=gR,y.lowerFirst=pR,y.lt=SN,y.lte=AN,y.max=uO,y.maxBy=dO,y.mean=hO,y.meanBy=fO,y.min=mO,y.minBy=gO,y.stubArray=Pd,y.stubFalse=Md,y.stubObject=eO,y.stubString=tO,y.stubTrue=nO,y.multiply=pO,y.nth=RA,y.noConflict=GR,y.noop=Od,y.now=Ac,y.pad=_R,y.padEnd=vR,y.padStart=yR,y.parseInt=CR,y.random=lR,y.reduce=Mk,y.reduceRight=Dk,y.repeat=ER,y.replace=wR,y.result=ZN,y.round=_O,y.runInContext=O,y.sample=xk,y.size=Fk,y.snakeCase=TR,y.some=Vk,y.sortedIndex=UA,y.sortedIndexBy=BA,y.sortedIndexOf=FA,y.sortedLastIndex=VA,y.sortedLastIndexBy=HA,y.sortedLastIndexOf=$A,y.startCase=IR,y.startsWith=SR,y.subtract=vO,y.sum=yO,y.sumBy=CO,y.template=AR,y.times=rO,y.toFinite=to,y.toInteger=be,y.toLength=jp,y.toLower=kR,y.toNumber=qn,y.toSafeInteger=kN,y.toString=He,y.toUpper=NR,y.trim=RR,y.trimEnd=OR,y.trimStart=PR,y.truncate=MR,y.unescape=DR,y.uniqueId=iO,y.upperCase=LR,y.upperFirst=Ad,y.each=Dp,y.eachRight=Lp,y.first=Rp,Rd(y,function(){var i={};return Nr(y,function(s,u){$e.call(y.prototype,u)||(i[u]=s)}),i}(),{chain:!1}),y.VERSION=r,Hn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(i){y[i].placeholder=y}),Hn(["drop","take"],function(i,s){Oe.prototype[i]=function(u){u=u===t?1:kt(be(u),0);var f=this.__filtered__&&!s?new Oe(this):this.clone();return f.__filtered__?f.__takeCount__=jt(u,f.__takeCount__):f.__views__.push({size:jt(u,St),type:i+(f.__dir__<0?"Right":"")}),f},Oe.prototype[i+"Right"]=function(u){return this.reverse()[i](u).reverse()}}),Hn(["filter","map","takeWhile"],function(i,s){var u=s+1,f=u==Ct||u==qt;Oe.prototype[i]=function(_){var E=this.clone();return E.__iteratees__.push({iteratee:de(_,3),type:u}),E.__filtered__=E.__filtered__||f,E}}),Hn(["head","last"],function(i,s){var u="take"+(s?"Right":"");Oe.prototype[i]=function(){return this[u](1).value()[0]}}),Hn(["initial","tail"],function(i,s){var u="drop"+(s?"":"Right");Oe.prototype[i]=function(){return this.__filtered__?new Oe(this):this[u](1)}}),Oe.prototype.compact=function(){return this.filter(gn)},Oe.prototype.find=function(i){return this.filter(i).head()},Oe.prototype.findLast=function(i){return this.reverse().find(i)},Oe.prototype.invokeMap=Se(function(i,s){return typeof i=="function"?new Oe(this):this.map(function(u){return ja(u,i,s)})}),Oe.prototype.reject=function(i){return this.filter(Nc(de(i)))},Oe.prototype.slice=function(i,s){i=be(i);var u=this;return u.__filtered__&&(i>0||s<0)?new Oe(u):(i<0?u=u.takeRight(-i):i&&(u=u.drop(i)),s!==t&&(s=be(s),u=s<0?u.dropRight(-s):u.take(s-i)),u)},Oe.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},Oe.prototype.toArray=function(){return this.take(St)},Nr(Oe.prototype,function(i,s){var u=/^(?:filter|find|map|reject)|While$/.test(s),f=/^(?:head|last)$/.test(s),_=y[f?"take"+(s=="last"?"Right":""):s],E=f||/^find/.test(s);_&&(y.prototype[s]=function(){var b=this.__wrapped__,S=f?[1]:arguments,P=b instanceof Oe,W=S[0],z=P||Ee(b),j=function(Re){var Pe=_.apply(y,wo([Re],S));return f&&te?Pe[0]:Pe};z&&u&&typeof W=="function"&&W.length!=1&&(P=z=!1);var te=this.__chain__,se=!!this.__actions__.length,he=E&&!te,Ie=P&&!se;if(!E&&z){b=Ie?b:new Oe(this);var fe=i.apply(b,S);return fe.__actions__.push({func:Ic,args:[j],thisArg:t}),new Kn(fe,te)}return he&&Ie?i.apply(this,S):(fe=this.thru(j),he?f?fe.value()[0]:fe.value():fe)})}),Hn(["pop","push","shift","sort","splice","unshift"],function(i){var s=Qs[i],u=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",f=/^(?:pop|shift)$/.test(i);y.prototype[i]=function(){var _=arguments;if(f&&!this.__chain__){var E=this.value();return s.apply(Ee(E)?E:[],_)}return this[u](function(b){return s.apply(Ee(b)?b:[],_)})}}),Nr(Oe.prototype,function(i,s){var u=y[s];if(u){var f=u.name+"";$e.call(xi,f)||(xi[f]=[]),xi[f].push({name:s,func:u})}}),xi[vc(t,I).name]=[{name:"wrapper",func:t}],Oe.prototype.clone=DI,Oe.prototype.reverse=LI,Oe.prototype.value=xI,y.prototype.at=dk,y.prototype.chain=hk,y.prototype.commit=fk,y.prototype.next=mk,y.prototype.plant=pk,y.prototype.reverse=_k,y.prototype.toJSON=y.prototype.valueOf=y.prototype.value=vk,y.prototype.first=y.prototype.head,Ha&&(y.prototype[Ha]=gk),y},Mi=fI();Qo?((Qo.exports=Mi)._=Mi,Nu._=Mi):Vt._=Mi}).call(uF)}(ss,ss.exports)),ss.exports}var Ra=dF();const ml=lF(Ra);function Oa(n,e,t=[]){const r=fF(e);if(!r)return n;const o=r.split(" ");return n.filter(a=>hF(a,o,t))}function hF(n,e,t){return t.some(r=>{const o=ml.get(n,r);if(ml.isNil(o))return!1;const a=ml.toString(o).toLowerCase();return e.every(c=>a.includes(c))})}function fF(n){return ml.trim(n).toLowerCase().replace(/\s+/g," ")}const mF={class:"text-faded mt-7"},gF={key:0,class:"d-flex align-baseline mb-1"},pF={class:"me-1"},_F={class:"max-w-_form-metadataJ"},vF={key:0,class:"mb-1"},yF={key:1,class:"mb-1"},CF={class:"mb-1"},ou=l.defineComponent({__name:"FormMetadata",props:{meta:{},id:{}},setup(n){const{t:e}=br();return(t,r)=>(l.openBlock(),l.createElementBlock("div",mF,[l.createVNode(Qe.VRow,{"no-gutters":"",class:"align-end ga-3",align:"center"},{default:l.withCtx(()=>[l.renderSlot(t.$slots,"default"),l.createVNode(Qe.VCol,{cols:"auto",class:"pa-2"},{default:l.withCtx(()=>[t.id?(l.openBlock(),l.createElementBlock("p",gF,[l.createElementVNode("b",pF,l.toDisplayString(t.id.title)+": ",1),l.createElementVNode("span",_F,l.toDisplayString(t.id.key||"-"),1),l.createElementVNode("span",null,[l.createVNode(Bl,{"content-to-copy":t.id.key,size:15},null,8,["content-to-copy"])])])):l.createCommentVNode("",!0),l.createElementVNode("p",null,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.created"))+": ",1),l.createTextVNode(l.toDisplayString(l.unref(us)(t.meta.created_at))+" - "+l.toDisplayString(t.meta.created_by),1)])]),_:1}),l.createVNode(Qe.VCol,{cols:"auto",class:"d-flex flex-column align-baseline px-2 mt-1"},{default:l.withCtx(()=>[t.meta.updated_at&&t.meta.updated_by?(l.openBlock(),l.createElementBlock("p",vF,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.updated"))+": ",1),l.createTextVNode(l.toDisplayString(l.unref(us)(t.meta.updated_at))+" - "+l.toDisplayString(t.meta.updated_by),1)])):(l.openBlock(),l.createElementBlock("p",yF,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.modified"))+": ",1),l.createTextVNode(l.toDisplayString(l.unref(us)(t.meta.modified_at))+" - "+l.toDisplayString(t.meta.modified_by),1)])),l.createElementVNode("p",CF,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.delegated"))+": ",1),l.createTextVNode(l.toDisplayString(t.meta.delegated_at)+" - "+l.toDisplayString(t.meta.delegated_by),1)])]),_:1})]),_:3})]))}}),EF={key:0,class:"mb-2 ms-1"},wF={key:3,class:"j-field w-100"},VE=l.defineComponent({__name:"JSelect",props:{modelValue:{},name:{},label:{},placeholder:{},readonly:{type:Boolean},items:{},itemTitle:{},itemValue:{},density:{},loading:{type:Boolean},clearable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=l.computed(()=>t.readonly?"solo":"solo-filled"),a=l.computed(()=>{if(Array.isArray(t.items)&&t.items.length>0)if(typeof t.items[0]=="object"&&t.itemValue&&t.itemTitle){const d=t.items.find(h=>h[t.itemValue]===t.modelValue);return d?d[t.itemTitle]:""}else{const d=t.items.indexOf(t.modelValue);return d!==-1?t.items[d]:""}return""}),c=d=>{r("update:modelValue",d)};return(d,h)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[d.name?(l.openBlock(),l.createElementBlock("p",EF,l.toDisplayString(d.name),1)):l.createCommentVNode("",!0),d.label?(l.openBlock(),l.createBlock(ys.VLabel,{key:1,class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(d.label),1)]),_:1})):l.createCommentVNode("",!0),d.readonly?(l.openBlock(),l.createElementBlock("div",wF,[l.createVNode(mE,{value:a.value},null,8,["value"])])):(l.openBlock(),l.createBlock(l.unref(Vo.VSelect),{key:2,modelValue:t.modelValue,"onUpdate:modelValue":[h[0]||(h[0]=m=>t.modelValue=m),c],variant:o.value,items:d.items,"item-title":d.itemTitle,"item-value":d.itemValue,loading:d.loading,placeholder:d.placeholder,density:d.density,"bg-color":"containerBg",rounded:"false","hide-details":"",class:"j-field",clearable:d.clearable},null,8,["modelValue","variant","items","item-title","item-value","loading","placeholder","density","clearable"]))],64))}}),TF={key:0,class:"mb-2 ms-1"},bF={key:3,class:"j-textarea px-4 py-3 rounded-sm bg-containerBg"},HE=l.defineComponent({__name:"JTextArea",props:{modelValue:{},name:{},label:{},readonly:{type:Boolean},rows:{},hideDetails:{type:Boolean}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=l.computed(()=>t.readonly?"solo":"solo-filled");return(a,c)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[a.name?(l.openBlock(),l.createElementBlock("p",TF,l.toDisplayString(a.name),1)):l.createCommentVNode("",!0),a.label?(l.openBlock(),l.createBlock(ys.VLabel,{key:1,class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(a.label),1)]),_:1})):l.createCommentVNode("",!0),a.readonly?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(bO.VTextarea,{key:2,variant:o.value,"bg-color":"containerBg",rounded:"false",rows:a.rows,hideDetails:a.hideDetails,value:a.modelValue,"onUpdate:modelValue":c[0]||(c[0]=d=>r("update:modelValue",d)),"no-resize":""},null,8,["variant","rows","hideDetails","value"])),a.readonly?(l.openBlock(),l.createElementBlock("div",bF,l.toDisplayString(a.modelValue),1)):l.createCommentVNode("",!0)],64))}}),$E=l.defineComponent({__name:"CancelButton",props:{title:{}},emits:["cancel"],setup(n,{emit:e}){const t=e,{t:r}=br();return(o,a)=>(l.openBlock(),l.createBlock(it.VBtn,{color:"secondary",variant:"outlined",onClick:a[0]||(a[0]=c=>t("cancel")),class:"me-2 j-btn-form"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(o.title?l.unref(r)("actions.cancel"):l.unref(r)("actions.back")),1)]),_:1}))}}),KE=l.defineComponent({__name:"SaveButton",props:{disabled:{type:Boolean}},emits:["onSave"],setup(n,{emit:e}){const t=e,r=l.ref(!1);async function o(){r.value=!0,await t("onSave"),r.value=!1}const{t:a}=br();return(c,d)=>(l.openBlock(),l.createBlock(it.VBtn,{disabled:c.disabled,loading:r.value,color:"secondary",onClick:o,onKeydown:l.withKeys(o,["enter"]),class:"j-btn-form"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(a)("actions.save")),1)]),_:1},8,["disabled","loading"]))}}),IF={class:"mt-4"},WE=l.defineComponent({__name:"JForm",props:{title:{},metadata:{},id:{},cancelReturn:{type:Boolean}},emits:["onSave","onCancel"],setup(n,{emit:e}){const t=e;return(r,o)=>(l.openBlock(),l.createBlock(Kl,{title:r.title,class:"d-flex flex-column ma-0"},{default:l.withCtx(()=>[r.title?(l.openBlock(),l.createBlock(pi.VDivider,{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",IF,[l.renderSlot(r.$slots,"default")]),l.createVNode(xt.VCardText,{class:"pa-0 mx-0 align-content-end"},{default:l.withCtx(()=>[l.createVNode(Qe.VRow,{justify:"space-between",class:"mt-4"},{default:l.withCtx(()=>[l.createVNode(Qe.VCol,{cols:"auto",class:"text-sm-subtitle-2 text-medium-emphasis"},{default:l.withCtx(()=>[l.createVNode(ou,{id:r.id,meta:r.metadata},null,8,["id","meta"])]),_:1}),l.createVNode(Qe.VSpacer),l.createVNode(Qe.VCol,{cols:"auto",class:"align-content-end"},{default:l.withCtx(()=>[l.createVNode($E,{"cancel-return":r.cancelReturn,onCancel:o[0]||(o[0]=a=>t("onCancel"))},null,8,["cancel-return"]),l.createVNode(KE,{onOnSave:o[1]||(o[1]=a=>t("onSave"))})]),_:1})]),_:1})]),_:1})]),_:3},8,["title"]))}}),SF={class:"d-flex align-items-center"},AF={key:0,class:"d-flex align-center"},kF={class:"ms-1"},NF={class:"d-flex"},RF={class:"d-flex mb-1 align-center"},OF={class:"min-w-100 relative"},zE=l.defineComponent({__name:"TabFormHeader",props:{id:{},readonly:{type:Boolean,default:!1}},emits:["update:isEdition","save","cancel","delete","disable"],setup(n,{emit:e}){var v;const t=n,r=e,o=l.getCurrentInstance(),a=((v=o==null?void 0:o.vnode.props)==null?void 0:v.onDisable)!==void 0,c=l.ref(t.readonly);function d(){r("cancel"),c.value=!1,r("update:isEdition",c.value)}function h(){c.value=!c.value,r("update:isEdition",c.value)}async function m(){r("delete"),r("disable")}const{t:g}=br();return(p,w)=>(l.openBlock(),l.createElementBlock("div",SF,[p.id?(l.openBlock(),l.createElementBlock("div",AF,[w[0]||(w[0]=l.createElementVNode("b",null,"ID:",-1)),l.createElementVNode("span",kF,l.toDisplayString(p.id),1),l.createVNode(Bl,{"content-to-copy":p.id,size:20},null,8,["content-to-copy"])])):l.createCommentVNode("",!0),l.createVNode(Qe.VSpacer),l.createElementVNode("div",NF,[l.createVNode(it.VBtn,{onClick:m,variant:"text"},{default:l.withCtx(()=>[a?(l.openBlock(),l.createBlock(l.unref(rP),{key:0,size:"11",class:"me-2"})):(l.openBlock(),l.createBlock(pl.VIcon,{key:1,class:"me-2"},{default:l.withCtx(()=>w[1]||(w[1]=[l.createTextVNode("mdi-delete-outline")])),_:1})),l.createTextVNode(" "+l.toDisplayString(a?l.unref(g)("actions.disable"):l.unref(g)("actions.delete")),1)]),_:1}),l.createElementVNode("div",RF,[l.createVNode(pi.VDivider,{class:"mx-2 my-1",vertical:""}),l.createElementVNode("div",OF,[l.withDirectives(l.createVNode(it.VBtn,{onClick:h,variant:"text",color:"secondary","prepend-icon":"mdi-pencil",width:"95"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(g)("actions.edit")),1)]),_:1},512),[[l.vShow,!c.value]]),l.withDirectives(l.createVNode(it.VBtn,{onClick:d,variant:"text",color:"secondary",width:"95"},{default:l.withCtx(()=>[l.createVNode(pl.VIcon,{class:"pt-1 pe-2"},{default:l.withCtx(()=>w[2]||(w[2]=[l.createTextVNode("mdi-close")])),_:1}),l.createTextVNode(" "+l.toDisplayString(l.unref(g)("actions.cancel")),1)]),_:1},512),[[l.vShow,c.value]])])])])]))}}),PF={class:"d-flex flex-column"},MF={class:"height d-flex flex-column"},DF={class:"d-flex justify-between align-end"},LF=l.defineComponent({__name:"FormHeadless",props:{id:{},metadata:{},readonly:{type:Boolean,default:!1}},emits:["save","cancel"],setup(n,{emit:e}){const t=e,r=l.getCurrentInstance(),o=l.computed(()=>{var c;return!!((c=r==null?void 0:r.vnode.props)!=null&&c.onSave)}),a=l.computed(()=>{var c;return!!((c=r==null?void 0:r.vnode.props)!=null&&c.onCancel)});return(c,d)=>(l.openBlock(),l.createBlock(Kl,null,{default:l.withCtx(()=>[l.createElementVNode("div",PF,[l.createElementVNode("div",MF,[l.renderSlot(c.$slots,"default",{},void 0,!0)])]),l.createElementVNode("div",DF,[l.createVNode(Qe.VRow,{"no-gutters":"",justify:"space-between",class:"w-100"},{default:l.withCtx(()=>[l.createVNode(Qe.VCol,{cols:"auto",class:"text-sm-subtitle-2 text-medium-emphasis"},{default:l.withCtx(()=>[l.createVNode(ou,{id:c.id,meta:c.metadata},null,8,["id","meta"])]),_:1}),c.readonly?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(Qe.VCol,{key:0,class:"d-flex align-end",cols:"auto"},{default:l.withCtx(()=>[a.value?(l.openBlock(),l.createBlock($E,{key:0,title:"Back",onCancel:d[0]||(d[0]=h=>t("cancel"))})):l.createCommentVNode("",!0),o.value?(l.openBlock(),l.createBlock(KE,{key:1,onOnSave:d[1]||(d[1]=h=>t("save"))})):l.createCommentVNode("",!0)]),_:1}))]),_:1})])]),_:3}))}}),GE=Sa(LF,[["__scopeId","data-v-e7e4d99c"]]);/**
|
73
73
|
* @license @tabler/icons-vue v3.22.0 - MIT
|
74
74
|
*
|
75
75
|
* This source code is licensed under the MIT license.
|
@@ -84,30 +84,30 @@ function print() { __p += __j.call(arguments, '') }
|
|
84
84
|
*
|
85
85
|
* This source code is licensed under the MIT license.
|
86
86
|
* See the LICENSE file in the root directory of this source tree.
|
87
|
-
*/var
|
87
|
+
*/var xF=Hs("outline","buildings","IconBuildings",[["path",{d:"M4 21v-15c0 -1 1 -2 2 -2h5c1 0 2 1 2 2v15",key:"svg-0"}],["path",{d:"M16 8h2c1 0 2 1 2 2v11",key:"svg-1"}],["path",{d:"M3 21h18",key:"svg-2"}],["path",{d:"M10 12v0",key:"svg-3"}],["path",{d:"M10 16v0",key:"svg-4"}],["path",{d:"M10 8v0",key:"svg-5"}],["path",{d:"M7 12v0",key:"svg-6"}],["path",{d:"M7 16v0",key:"svg-7"}],["path",{d:"M7 8v0",key:"svg-8"}],["path",{d:"M17 12v0",key:"svg-9"}],["path",{d:"M17 16v0",key:"svg-10"}]]);/**
|
88
88
|
* @license @tabler/icons-vue v3.22.0 - MIT
|
89
89
|
*
|
90
90
|
* This source code is licensed under the MIT license.
|
91
91
|
* See the LICENSE file in the root directory of this source tree.
|
92
|
-
*/var
|
92
|
+
*/var UF=Hs("outline","universe","IconUniverse",[["path",{d:"M7.027 11.477a5 5 0 1 0 5.496 -4.45a4.951 4.951 0 0 0 -3.088 .681",key:"svg-0"}],["path",{d:"M5.636 5.636a9 9 0 1 0 3.555 -2.188",key:"svg-1"}],["path",{d:"M18 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M9 16m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}]]);/**
|
93
93
|
* @license @tabler/icons-vue v3.22.0 - MIT
|
94
94
|
*
|
95
95
|
* This source code is licensed under the MIT license.
|
96
96
|
* See the LICENSE file in the root directory of this source tree.
|
97
|
-
*/var
|
97
|
+
*/var BF=Hs("outline","user","IconUser",[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}]]);/**
|
98
98
|
* @license @tabler/icons-vue v3.22.0 - MIT
|
99
99
|
*
|
100
100
|
* This source code is licensed under the MIT license.
|
101
101
|
* See the LICENSE file in the root directory of this source tree.
|
102
|
-
*/var
|
102
|
+
*/var FF=Hs("outline","users","IconUsers",[["path",{d:"M9 7m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"svg-2"}],["path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85",key:"svg-3"}]]);/**
|
103
103
|
* @license @tabler/icons-vue v3.22.0 - MIT
|
104
104
|
*
|
105
105
|
* This source code is licensed under the MIT license.
|
106
106
|
* See the LICENSE file in the root directory of this source tree.
|
107
|
-
*/var FF=Hs("filled","caret-right-filled","IconCaretRightFilled",[["path",{d:"M9 6c0 -.852 .986 -1.297 1.623 -.783l.084 .076l6 6a1 1 0 0 1 .083 1.32l-.083 .094l-6 6l-.094 .083l-.077 .054l-.096 .054l-.036 .017l-.067 .027l-.108 .032l-.053 .01l-.06 .01l-.057 .004l-.059 .002l-.059 -.002l-.058 -.005l-.06 -.009l-.052 -.01l-.108 -.032l-.067 -.027l-.132 -.07l-.09 -.065l-.081 -.073l-.083 -.094l-.054 -.077l-.054 -.096l-.017 -.036l-.027 -.067l-.032 -.108l-.01 -.053l-.01 -.06l-.004 -.057l-.002 -12.059z",key:"svg-0"}]]);/*! @azure/msal-common v14.16.0 2024-11-05 */const F={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",CACHE_PREFIX:"msal",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_RESPONSE_TYPE:"code",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",FRAGMENT_RESPONSE_MODE:"fragment",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",NOT_AVAILABLE:"Not Available",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],TOKEN_RESPONSE_TYPE:"token",ID_TOKEN_RESPONSE_TYPE:"id_token",SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},$c={SUCCESS:200,SUCCESS_RANGE_START:200,SUCCESS_RANGE_END:299,REDIRECT:302,CLIENT_ERROR:400,CLIENT_ERROR_RANGE_START:400,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,REQUEST_TIMEOUT:408,TOO_MANY_REQUESTS:429,CLIENT_ERROR_RANGE_END:499,SERVER_ERROR:500,SERVER_ERROR_RANGE_START:500,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,SERVER_ERROR_RANGE_END:599,MULTI_SIDED_ERROR:600},Pa=[F.OPENID_SCOPE,F.PROFILE_SCOPE,F.OFFLINE_ACCESS_SCOPE],xv=[...Pa,F.EMAIL_SCOPE],dn={CONTENT_TYPE:"Content-Type",CONTENT_LENGTH:"Content-Length",RETRY_AFTER:"Retry-After",CCS_HEADER:"X-AnchorMailbox",WWWAuthenticate:"WWW-Authenticate",AuthenticationInfo:"Authentication-Info",X_MS_REQUEST_ID:"x-ms-request-id",X_MS_HTTP_VERSION:"x-ms-httpver"},Lt={ID_TOKEN:"idtoken",CLIENT_INFO:"client.info",ADAL_ID_TOKEN:"adal.idtoken",ERROR:"error",ERROR_DESC:"error.description",ACTIVE_ACCOUNT:"active-account",ACTIVE_ACCOUNT_FILTERS:"active-account-filters"},Ho={COMMON:"common",ORGANIZATIONS:"organizations",CONSUMERS:"consumers"},Kc={ACCESS_TOKEN:"access_token",XMS_CC:"xms_cc"},Bt={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"},Uv={PLAIN:"plain",S256:"S256"},$s={QUERY:"query",FRAGMENT:"fragment"},VF={...$s,FORM_POST:"form_post"},qE={IMPLICIT_GRANT:"implicit",AUTHORIZATION_CODE_GRANT:"authorization_code",CLIENT_CREDENTIALS_GRANT:"client_credentials",RESOURCE_OWNER_PASSWORD_GRANT:"password",REFRESH_TOKEN_GRANT:"refresh_token",DEVICE_CODE_GRANT:"device_code",JWT_BEARER:"urn:ietf:params:oauth:grant-type:jwt-bearer"},Wc={MSSTS_ACCOUNT_TYPE:"MSSTS",ADFS_ACCOUNT_TYPE:"ADFS",MSAV1_ACCOUNT_TYPE:"MSA",GENERIC_ACCOUNT_TYPE:"Generic"},tn={CACHE_KEY_SEPARATOR:"-",CLIENT_INFO_SEPARATOR:"."},ge={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},Kf="appmetadata",HF="client_info",ps="1",Al={CACHE_KEY:"authority-metadata",REFRESH_TIME_SECONDS:3600*24},On={CONFIG:"config",CACHE:"cache",NETWORK:"network",HARDCODED_VALUES:"hardcoded_values"},Wt={SCHEMA_VERSION:5,MAX_CUR_HEADER_BYTES:80,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"},Ge={BEARER:"Bearer",POP:"pop",SSH:"ssh-cert"},_s={DEFAULT_THROTTLE_TIME_SECONDS:60,DEFAULT_MAX_THROTTLE_TIME_SECONDS:3600,THROTTLING_PREFIX:"throttling",X_MS_LIB_CAPABILITY_VALUE:"retry-after, h429"},Bv={INVALID_GRANT_ERROR:"invalid_grant",CLIENT_MISMATCH_ERROR:"client_mismatch"},Fv={username:"username",password:"password"},zc={httpSuccess:200,httpBadRequest:400},Yi={FAILED_AUTO_DETECTION:"1",INTERNAL_CACHE:"2",ENVIRONMENT_VARIABLE:"3",IMDS:"4"},oh={CONFIGURED_MATCHES_DETECTED:"1",CONFIGURED_NO_AUTO_DETECTION:"2",CONFIGURED_NOT_DETECTED:"3",AUTO_DETECTION_REQUESTED_SUCCESSFUL:"4",AUTO_DETECTION_REQUESTED_FAILED:"5"},Mo={NOT_APPLICABLE:"0",FORCE_REFRESH_OR_CLAIMS:"1",NO_CACHED_ACCESS_TOKEN:"2",CACHED_ACCESS_TOKEN_EXPIRED:"3",PROACTIVELY_REFRESHED:"4"},$F={Jwt:"JWT",Jwk:"JWK",Pop:"pop"},KF=300;/*! @azure/msal-common v14.16.0 2024-11-05 */const Wf="unexpected_error",WF="post_request_failed";/*! @azure/msal-common v14.16.0 2024-11-05 */const Vv={[Wf]:"Unexpected error in authentication.",[WF]:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."};class lt extends Error{constructor(e,t,r){const o=t?`${e}: ${t}`:e;super(o),Object.setPrototypeOf(this,lt.prototype),this.errorCode=e||F.EMPTY_STRING,this.errorMessage=t||F.EMPTY_STRING,this.subError=r||F.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}}function jE(n,e){return new lt(n,e?`${Vv[n]} ${e}`:Vv[n])}/*! @azure/msal-common v14.16.0 2024-11-05 */const zf="client_info_decoding_error",YE="client_info_empty_error",Gf="token_parsing_error",JE="null_or_empty_token",ao="endpoints_resolution_error",QE="network_error",XE="openid_config_error",ZE="hash_not_deserialized",wa="invalid_state",ew="state_mismatch",kl="state_not_found",tw="nonce_mismatch",qf="auth_time_not_found",nw="max_age_transpired",zF="multiple_matching_tokens",GF="multiple_matching_accounts",rw="multiple_matching_appMetadata",ow="request_cannot_be_made",iw="cannot_remove_empty_scope",aw="cannot_append_scopeset",jh="empty_input_scopeset",qF="device_code_polling_cancelled",jF="device_code_expired",YF="device_code_unknown_error",jf="no_account_in_silent_request",sw="invalid_cache_record",Yf="invalid_cache_environment",Yh="no_account_found",Jh="no_crypto_object",Qh="unexpected_credential_type",JF="invalid_assertion",QF="invalid_client_credential",co="token_refresh_required",XF="user_timeout_reached",cw="token_claims_cnf_required_for_signedjwt",lw="authorization_code_missing_from_server_response",uw="binding_key_not_removed",dw="end_session_endpoint_not_supported",Jf="key_id_missing",ZF="no_network_connectivity",eV="user_canceled",tV="missing_tenant_id_error",Ae="method_not_implemented",nV="nested_app_auth_bridge_disabled";/*! @azure/msal-common v14.16.0 2024-11-05 */const Hv={[zf]:"The client info could not be parsed/decoded correctly",[YE]:"The client info was empty",[Gf]:"Token cannot be parsed",[JE]:"The token is null or empty",[ao]:"Endpoints cannot be resolved",[QE]:"Network request failed",[XE]:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",[ZE]:"The hash parameters could not be deserialized",[wa]:"State was not the expected format",[ew]:"State mismatch error",[kl]:"State not found",[tw]:"Nonce mismatch error",[qf]:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.",[nw]:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",[zF]:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.",[GF]:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",[rw]:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",[ow]:"Token request cannot be made without authorization code or refresh token.",[iw]:"Cannot remove null or empty scope from ScopeSet",[aw]:"Cannot append ScopeSet",[jh]:"Empty input ScopeSet cannot be processed",[qF]:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",[jF]:"Device code is expired.",[YF]:"Device code stopped polling for unknown reasons.",[jf]:"Please pass an account object, silent flow is not supported without account information",[sw]:"Cache record object was null or undefined.",[Yf]:"Invalid environment when attempting to create cache entry",[Yh]:"No account found in cache for given key.",[Jh]:"No crypto object detected.",[Qh]:"Unexpected credential type.",[JF]:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",[QF]:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",[co]:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.",[XF]:"User defined timeout for device code polling reached",[cw]:"Cannot generate a POP jwt if the token_claims are not populated",[lw]:"Server response does not contain an authorization code to proceed",[uw]:"Could not remove the credential's binding key from storage.",[dw]:"The provided authority does not support logout",[Jf]:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.",[ZF]:"No network connectivity. Check your internet connection.",[eV]:"User cancelled the flow.",[tV]:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",[Ae]:"This method has not been implemented",[nV]:"The nested app auth bridge is disabled"};class iu extends lt{constructor(e,t){super(e,t?`${Hv[e]}: ${t}`:Hv[e]),this.name="ClientAuthError",Object.setPrototypeOf(this,iu.prototype)}}function Y(n,e){return new iu(n,e)}/*! @azure/msal-common v14.16.0 2024-11-05 */const Nl={createNewGuid:()=>{throw Y(Ae)},base64Decode:()=>{throw Y(Ae)},base64Encode:()=>{throw Y(Ae)},base64UrlEncode:()=>{throw Y(Ae)},encodeKid:()=>{throw Y(Ae)},async getPublicKeyThumbprint(){throw Y(Ae)},async removeTokenBindingKey(){throw Y(Ae)},async clearKeystore(){throw Y(Ae)},async signJwt(){throw Y(Ae)},async hashString(){throw Y(Ae)}};/*! @azure/msal-common v14.16.0 2024-11-05 */var tt;(function(n){n[n.Error=0]="Error",n[n.Warning=1]="Warning",n[n.Info=2]="Info",n[n.Verbose=3]="Verbose",n[n.Trace=4]="Trace"})(tt||(tt={}));class Ko{constructor(e,t,r){this.level=tt.Info;const o=()=>{},a=e||Ko.createDefaultLoggerOptions();this.localCallback=a.loggerCallback||o,this.piiLoggingEnabled=a.piiLoggingEnabled||!1,this.level=typeof a.logLevel=="number"?a.logLevel:tt.Info,this.correlationId=a.correlationId||F.EMPTY_STRING,this.packageName=t||F.EMPTY_STRING,this.packageVersion=r||F.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:tt.Info}}clone(e,t,r){return new Ko({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:r||this.correlationId},e,t)}logMessage(e,t){if(t.logLevel>this.level||!this.piiLoggingEnabled&&t.containsPii)return;const a=`${`[${new Date().toUTCString()}] : [${t.correlationId||this.correlationId||""}]`} : ${this.packageName}@${this.packageVersion} : ${tt[t.logLevel]} - ${e}`;this.executeCallback(t.logLevel,a,t.containsPii||!1)}executeCallback(e,t,r){this.localCallback&&this.localCallback(e,t,r)}error(e,t){this.logMessage(e,{logLevel:tt.Error,containsPii:!1,correlationId:t||F.EMPTY_STRING})}errorPii(e,t){this.logMessage(e,{logLevel:tt.Error,containsPii:!0,correlationId:t||F.EMPTY_STRING})}warning(e,t){this.logMessage(e,{logLevel:tt.Warning,containsPii:!1,correlationId:t||F.EMPTY_STRING})}warningPii(e,t){this.logMessage(e,{logLevel:tt.Warning,containsPii:!0,correlationId:t||F.EMPTY_STRING})}info(e,t){this.logMessage(e,{logLevel:tt.Info,containsPii:!1,correlationId:t||F.EMPTY_STRING})}infoPii(e,t){this.logMessage(e,{logLevel:tt.Info,containsPii:!0,correlationId:t||F.EMPTY_STRING})}verbose(e,t){this.logMessage(e,{logLevel:tt.Verbose,containsPii:!1,correlationId:t||F.EMPTY_STRING})}verbosePii(e,t){this.logMessage(e,{logLevel:tt.Verbose,containsPii:!0,correlationId:t||F.EMPTY_STRING})}trace(e,t){this.logMessage(e,{logLevel:tt.Trace,containsPii:!1,correlationId:t||F.EMPTY_STRING})}tracePii(e,t){this.logMessage(e,{logLevel:tt.Trace,containsPii:!0,correlationId:t||F.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}/*! @azure/msal-common v14.16.0 2024-11-05 */const hw="@azure/msal-common",Qf="14.16.0";/*! @azure/msal-common v14.16.0 2024-11-05 */const Xf={None:"none",AzurePublic:"https://login.microsoftonline.com",AzurePpe:"https://login.windows-ppe.net",AzureChina:"https://login.chinacloudapi.cn",AzureGermany:"https://login.microsoftonline.de",AzureUsGovernment:"https://login.microsoftonline.us"};/*! @azure/msal-common v14.16.0 2024-11-05 */function Si(n,e){const t=rV(n);try{const r=e(t);return JSON.parse(r)}catch{throw Y(Gf)}}function rV(n){if(!n)throw Y(JE);const t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(n);if(!t||t.length<4)throw Y(Gf);return t[2]}function fw(n,e){if(e===0||Date.now()-3e5>n+e)throw Y(nw)}/*! @azure/msal-common v14.16.0 2024-11-05 */function zr(){return Math.round(new Date().getTime()/1e3)}function Xh(n,e){const t=Number(n)||0;return zr()+e>t}function oV(n){return Number(n)>zr()}/*! @azure/msal-common v14.16.0 2024-11-05 */function ha(n){return[iV(n),aV(n),sV(n),cV(n),lV(n)].join(tn.CACHE_KEY_SEPARATOR).toLowerCase()}function au(n,e,t,r,o){return{credentialType:ge.ID_TOKEN,homeAccountId:n,environment:e,clientId:r,secret:t,realm:o}}function su(n,e,t,r,o,a,c,d,h,m,g,v,p,w,C){var k,I;const T={homeAccountId:n,credentialType:ge.ACCESS_TOKEN,secret:t,cachedAt:zr().toString(),expiresOn:c.toString(),extendedExpiresOn:d.toString(),environment:e,clientId:r,realm:o,target:a,tokenType:g||Ge.BEARER};if(v&&(T.userAssertionHash=v),m&&(T.refreshOn=m.toString()),w&&(T.requestedClaims=w,T.requestedClaimsHash=C),((k=T.tokenType)==null?void 0:k.toLowerCase())!==Ge.BEARER.toLowerCase())switch(T.credentialType=ge.ACCESS_TOKEN_WITH_AUTH_SCHEME,T.tokenType){case Ge.POP:const N=Si(t,h);if(!((I=N==null?void 0:N.cnf)!=null&&I.kid))throw Y(cw);T.keyId=N.cnf.kid;break;case Ge.SSH:T.keyId=p}return T}function mw(n,e,t,r,o,a,c){const d={credentialType:ge.REFRESH_TOKEN,homeAccountId:n,environment:e,clientId:r,secret:t};return a&&(d.userAssertionHash=a),o&&(d.familyId=o),c&&(d.expiresOn=c.toString()),d}function Zf(n){return n.hasOwnProperty("homeAccountId")&&n.hasOwnProperty("environment")&&n.hasOwnProperty("credentialType")&&n.hasOwnProperty("clientId")&&n.hasOwnProperty("secret")}function $v(n){return n?Zf(n)&&n.hasOwnProperty("realm")&&n.hasOwnProperty("target")&&(n.credentialType===ge.ACCESS_TOKEN||n.credentialType===ge.ACCESS_TOKEN_WITH_AUTH_SCHEME):!1}function Kv(n){return n?Zf(n)&&n.hasOwnProperty("realm")&&n.credentialType===ge.ID_TOKEN:!1}function Wv(n){return n?Zf(n)&&n.credentialType===ge.REFRESH_TOKEN:!1}function iV(n){return[n.homeAccountId,n.environment].join(tn.CACHE_KEY_SEPARATOR).toLowerCase()}function aV(n){const e=n.credentialType===ge.REFRESH_TOKEN&&n.familyId||n.clientId;return[n.credentialType,e,n.realm||""].join(tn.CACHE_KEY_SEPARATOR).toLowerCase()}function sV(n){return(n.target||"").toLowerCase()}function cV(n){return(n.requestedClaimsHash||"").toLowerCase()}function lV(n){return n.tokenType&&n.tokenType.toLowerCase()!==Ge.BEARER.toLowerCase()?n.tokenType.toLowerCase():""}function uV(n,e){const t=n.indexOf(Wt.CACHE_KEY)===0;let r=!0;return e&&(r=e.hasOwnProperty("failedRequests")&&e.hasOwnProperty("errors")&&e.hasOwnProperty("cacheHits")),t&&r}function dV(n,e){let t=!1;n&&(t=n.indexOf(_s.THROTTLING_PREFIX)===0);let r=!0;return e&&(r=e.hasOwnProperty("throttleTime")),t&&r}function hV({environment:n,clientId:e}){return[Kf,n,e].join(tn.CACHE_KEY_SEPARATOR).toLowerCase()}function fV(n,e){return e?n.indexOf(Kf)===0&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("environment"):!1}function mV(n,e){return e?n.indexOf(Al.CACHE_KEY)===0&&e.hasOwnProperty("aliases")&&e.hasOwnProperty("preferred_cache")&&e.hasOwnProperty("preferred_network")&&e.hasOwnProperty("canonical_authority")&&e.hasOwnProperty("authorization_endpoint")&&e.hasOwnProperty("token_endpoint")&&e.hasOwnProperty("issuer")&&e.hasOwnProperty("aliasesFromNetwork")&&e.hasOwnProperty("endpointsFromNetwork")&&e.hasOwnProperty("expiresAt")&&e.hasOwnProperty("jwks_uri"):!1}function zv(){return zr()+Al.REFRESH_TIME_SECONDS}function Gc(n,e,t){n.authorization_endpoint=e.authorization_endpoint,n.token_endpoint=e.token_endpoint,n.end_session_endpoint=e.end_session_endpoint,n.issuer=e.issuer,n.endpointsFromNetwork=t,n.jwks_uri=e.jwks_uri}function ih(n,e,t){n.aliases=e.aliases,n.preferred_cache=e.preferred_cache,n.preferred_network=e.preferred_network,n.aliasesFromNetwork=t}function Gv(n){return n.expiresAt<=zr()}/*! @azure/msal-common v14.16.0 2024-11-05 */const gw="redirect_uri_empty",gV="claims_request_parsing_error",pw="authority_uri_insecure",cs="url_parse_error",_w="empty_url_error",vw="empty_input_scopes_error",yw="invalid_prompt_value",em="invalid_claims",Cw="token_request_empty",Ew="logout_request_empty",ww="invalid_code_challenge_method",tm="pkce_params_missing",nm="invalid_cloud_discovery_metadata",Tw="invalid_authority_metadata",bw="untrusted_authority",cu="missing_ssh_jwk",Iw="missing_ssh_kid",pV="missing_nonce_authentication_header",_V="invalid_authentication_header",Sw="cannot_set_OIDCOptions",Aw="cannot_allow_native_broker",kw="authority_mismatch";/*! @azure/msal-common v14.16.0 2024-11-05 */const vV={[gw]:"A redirect URI is required for all calls, and none has been set.",[gV]:"Could not parse the given claims request object.",[pw]:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options",[cs]:"URL could not be parsed into appropriate segments.",[_w]:"URL was empty or null.",[vw]:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",[yw]:"Please see here for valid configuration options: https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#commonauthorizationurlrequest",[em]:"Given claims parameter must be a stringified JSON object.",[Cw]:"Token request was empty and not found in cache.",[Ew]:"The logout request was null or undefined.",[ww]:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',[tm]:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",[nm]:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",[Tw]:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",[bw]:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",[cu]:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",[Iw]:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",[pV]:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",[_V]:"Invalid authentication header provided",[Sw]:"Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",[Aw]:"Cannot set allowNativeBroker parameter to true when not in AAD protocol mode.",[kw]:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority."};class rm extends lt{constructor(e){super(e,vV[e]),this.name="ClientConfigurationError",Object.setPrototypeOf(this,rm.prototype)}}function Xe(n){return new rm(n)}/*! @azure/msal-common v14.16.0 2024-11-05 */class vr{static isEmptyObj(e){if(e)try{const t=JSON.parse(e);return Object.keys(t).length===0}catch{}return!0}static startsWith(e,t){return e.indexOf(t)===0}static endsWith(e,t){return e.length>=t.length&&e.lastIndexOf(t)===e.length-t.length}static queryStringToObject(e){const t={},r=e.split("&"),o=a=>decodeURIComponent(a.replace(/\+/g," "));return r.forEach(a=>{if(a.trim()){const[c,d]=a.split(/=(.+)/g,2);c&&d&&(t[o(c)]=o(d))}}),t}static trimArrayEntries(e){return e.map(t=>t.trim())}static removeEmptyStringsFromArray(e){return e.filter(t=>!!t)}static jsonParseHelper(e){try{return JSON.parse(e)}catch{return null}}static matchPattern(e,t){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(t)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class vt{constructor(e){const t=e?vr.trimArrayEntries([...e]):[],r=t?vr.removeEmptyStringsFromArray(t):[];this.validateInputScopes(r),this.scopes=new Set,r.forEach(o=>this.scopes.add(o))}static fromString(e){const r=(e||F.EMPTY_STRING).split(" ");return new vt(r)}static createSearchScopes(e){const t=new vt(e);return t.containsOnlyOIDCScopes()?t.removeScope(F.OFFLINE_ACCESS_SCOPE):t.removeOIDCScopes(),t}validateInputScopes(e){if(!e||e.length<1)throw Xe(vw)}containsScope(e){const t=this.printScopesLowerCase().split(" "),r=new vt(t);return e?r.scopes.has(e.toLowerCase()):!1}containsScopeSet(e){return!e||e.scopes.size<=0?!1:this.scopes.size>=e.scopes.size&&e.asArray().every(t=>this.containsScope(t))}containsOnlyOIDCScopes(){let e=0;return xv.forEach(t=>{this.containsScope(t)&&(e+=1)}),this.scopes.size===e}appendScope(e){e&&this.scopes.add(e.trim())}appendScopes(e){try{e.forEach(t=>this.appendScope(t))}catch{throw Y(aw)}}removeScope(e){if(!e)throw Y(iw);this.scopes.delete(e.trim())}removeOIDCScopes(){xv.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw Y(jh);const t=new Set;return e.scopes.forEach(r=>t.add(r.toLowerCase())),this.scopes.forEach(r=>t.add(r.toLowerCase())),t}intersectingScopeSets(e){if(!e)throw Y(jh);e.containsOnlyOIDCScopes()||e.removeOIDCScopes();const t=this.unionScopeSets(e),r=e.getScopeCount(),o=this.getScopeCount();return t.size<o+r}getScopeCount(){return this.scopes.size}asArray(){const e=[];return this.scopes.forEach(t=>e.push(t)),e}printScopes(){return this.scopes?this.asArray().join(" "):F.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}/*! @azure/msal-common v14.16.0 2024-11-05 */function Rl(n,e){if(!n)throw Y(YE);try{const t=e(n);return JSON.parse(t)}catch{throw Y(zf)}}function fa(n){if(!n)throw Y(zf);const e=n.split(tn.CLIENT_INFO_SEPARATOR,2);return{uid:e[0],utid:e.length<2?F.EMPTY_STRING:e[1]}}/*! @azure/msal-common v14.16.0 2024-11-05 */function Ol(n,e){return!!n&&!!e&&n===e.split(".")[1]}function om(n,e,t,r){if(r){const{oid:o,sub:a,tid:c,name:d,tfp:h,acr:m}=r,g=c||h||m||"";return{tenantId:g,localAccountId:o||a||"",name:d,isHomeTenant:Ol(g,n)}}else return{tenantId:t,localAccountId:e,isHomeTenant:Ol(t,n)}}function im(n,e,t,r){let o=n;if(e){const{isHomeTenant:a,...c}=e;o={...n,...c}}if(t){const{isHomeTenant:a,...c}=om(n.homeAccountId,n.localAccountId,n.tenantId,t);return o={...o,...c,idTokenClaims:t,idToken:r},o}return o}/*! @azure/msal-common v14.16.0 2024-11-05 */const mr={Default:0,Adfs:1,Dsts:2,Ciam:3};/*! @azure/msal-common v14.16.0 2024-11-05 */function Nw(n){return n&&(n.tid||n.tfp||n.acr)||null}/*! @azure/msal-common v14.16.0 2024-11-05 */const fo={AAD:"AAD",OIDC:"OIDC"};/*! @azure/msal-common v14.16.0 2024-11-05 */class Pt{generateAccountId(){return[this.homeAccountId,this.environment].join(tn.CACHE_KEY_SEPARATOR).toLowerCase()}generateAccountKey(){return Pt.generateAccountCacheKey({homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId})}getAccountInfo(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,name:this.name,nativeAccountId:this.nativeAccountId,authorityType:this.authorityType,tenantProfiles:new Map((this.tenantProfiles||[]).map(e=>[e.tenantId,e]))}}isSingleTenant(){return!this.tenantProfiles}static generateAccountCacheKey(e){const t=e.homeAccountId.split(".")[1];return[e.homeAccountId,e.environment||"",t||e.tenantId||""].join(tn.CACHE_KEY_SEPARATOR).toLowerCase()}static createAccount(e,t,r){var m,g,v,p,w,C;const o=new Pt;t.authorityType===mr.Adfs?o.authorityType=Wc.ADFS_ACCOUNT_TYPE:t.protocolMode===fo.AAD?o.authorityType=Wc.MSSTS_ACCOUNT_TYPE:o.authorityType=Wc.GENERIC_ACCOUNT_TYPE;let a;e.clientInfo&&r&&(a=Rl(e.clientInfo,r)),o.clientInfo=e.clientInfo,o.homeAccountId=e.homeAccountId,o.nativeAccountId=e.nativeAccountId;const c=e.environment||t&&t.getPreferredCache();if(!c)throw Y(Yf);o.environment=c,o.realm=(a==null?void 0:a.utid)||Nw(e.idTokenClaims)||"",o.localAccountId=(a==null?void 0:a.uid)||((m=e.idTokenClaims)==null?void 0:m.oid)||((g=e.idTokenClaims)==null?void 0:g.sub)||"";const d=((v=e.idTokenClaims)==null?void 0:v.preferred_username)||((p=e.idTokenClaims)==null?void 0:p.upn),h=(w=e.idTokenClaims)!=null&&w.emails?e.idTokenClaims.emails[0]:null;if(o.username=d||h||"",o.name=((C=e.idTokenClaims)==null?void 0:C.name)||"",o.cloudGraphHostName=e.cloudGraphHostName,o.msGraphHost=e.msGraphHost,e.tenantProfiles)o.tenantProfiles=e.tenantProfiles;else{const T=om(e.homeAccountId,o.localAccountId,o.realm,e.idTokenClaims);o.tenantProfiles=[T]}return o}static createFromAccountInfo(e,t,r){var a;const o=new Pt;return o.authorityType=e.authorityType||Wc.GENERIC_ACCOUNT_TYPE,o.homeAccountId=e.homeAccountId,o.localAccountId=e.localAccountId,o.nativeAccountId=e.nativeAccountId,o.realm=e.tenantId,o.environment=e.environment,o.username=e.username,o.name=e.name,o.cloudGraphHostName=t,o.msGraphHost=r,o.tenantProfiles=Array.from(((a=e.tenantProfiles)==null?void 0:a.values())||[]),o}static generateHomeAccountId(e,t,r,o,a){if(!(t===mr.Adfs||t===mr.Dsts)){if(e)try{const c=Rl(e,o.base64Decode);if(c.uid&&c.utid)return`${c.uid}.${c.utid}`}catch{}r.warning("No client info in response")}return(a==null?void 0:a.sub)||""}static isAccountEntity(e){return e?e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType"):!1}static accountInfoIsEqual(e,t,r){if(!e||!t)return!1;let o=!0;if(r){const a=e.idTokenClaims||{},c=t.idTokenClaims||{};o=a.iat===c.iat&&a.nonce===c.nonce}return e.homeAccountId===t.homeAccountId&&e.localAccountId===t.localAccountId&&e.username===t.username&&e.tenantId===t.tenantId&&e.environment===t.environment&&e.nativeAccountId===t.nativeAccountId&&o}}/*! @azure/msal-common v14.16.0 2024-11-05 */function Rw(n){return n.startsWith("#/")?n.substring(2):n.startsWith("#")||n.startsWith("?")?n.substring(1):n}function Pl(n){if(!n||n.indexOf("=")<0)return null;try{const e=Rw(n),t=Object.fromEntries(new URLSearchParams(e));if(t.code||t.error||t.error_description||t.state)return t}catch{throw Y(ZE)}return null}/*! @azure/msal-common v14.16.0 2024-11-05 */class De{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,!this._urlString)throw Xe(_w);e.includes("#")||(this._urlString=De.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let t=e.toLowerCase();return vr.endsWith(t,"?")?t=t.slice(0,-1):vr.endsWith(t,"?/")&&(t=t.slice(0,-2)),vr.endsWith(t,"/")||(t+="/"),t}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch{throw Xe(cs)}if(!e.HostNameAndPort||!e.PathSegments)throw Xe(cs);if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw Xe(pw)}static appendQueryString(e,t){return t?e.indexOf("?")<0?`${e}?${t}`:`${e}&${t}`:e}static removeHashFromUrl(e){return De.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const t=this.getUrlComponents(),r=t.PathSegments;return e&&r.length!==0&&(r[0]===Ho.COMMON||r[0]===Ho.ORGANIZATIONS)&&(r[0]=e),De.constructAuthorityUriFromObject(t)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),t=this.urlString.match(e);if(!t)throw Xe(cs);const r={Protocol:t[1],HostNameAndPort:t[4],AbsolutePath:t[5],QueryString:t[7]};let o=r.AbsolutePath.split("/");return o=o.filter(a=>a&&a.length>0),r.PathSegments=o,r.QueryString&&r.QueryString.endsWith("/")&&(r.QueryString=r.QueryString.substring(0,r.QueryString.length-1)),r}static getDomainFromUrl(e){const t=RegExp("^([^:/?#]+://)?([^/?#]*)"),r=e.match(t);if(!r)throw Xe(cs);return r[2]}static getAbsoluteUrl(e,t){if(e[0]===F.FORWARD_SLASH){const o=new De(t).getUrlComponents();return o.Protocol+"//"+o.HostNameAndPort+e}return e}static constructAuthorityUriFromObject(e){return new De(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static hashContainsKnownProperties(e){return!!Pl(e)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Ow={endpointMetadata:{"login.microsoftonline.com":{token_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/logout"},"login.chinacloudapi.cn":{token_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.chinacloudapi.cn/{tenantid}/discovery/v2.0/keys",issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",authorization_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/logout"},"login.microsoftonline.us":{token_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.us/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/logout"}},instanceDiscoveryMetadata:{tenant_discovery_endpoint:"https://{canonicalAuthority}/v2.0/.well-known/openid-configuration",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]}},qv=Ow.endpointMetadata,am=Ow.instanceDiscoveryMetadata,Pw=new Set;am.metadata.forEach(n=>{n.aliases.forEach(e=>{Pw.add(e)})});function yV(n,e){var o;let t;const r=n.canonicalAuthority;if(r){const a=new De(r).getUrlComponents().HostNameAndPort;t=jv(a,(o=n.cloudDiscoveryMetadata)==null?void 0:o.metadata,On.CONFIG,e)||jv(a,am.metadata,On.HARDCODED_VALUES,e)||n.knownAuthorities}return t||[]}function jv(n,e,t,r){if(r==null||r.trace(`getAliasesFromMetadata called with source: ${t}`),n&&e){const o=Ml(e,n);if(o)return r==null||r.trace(`getAliasesFromMetadata: found cloud discovery metadata in ${t}, returning aliases`),o.aliases;r==null||r.trace(`getAliasesFromMetadata: did not find cloud discovery metadata in ${t}`)}return null}function CV(n){return Ml(am.metadata,n)}function Ml(n,e){for(let t=0;t<n.length;t++){const r=n[t];if(r.aliases.includes(e))return r}return null}/*! @azure/msal-common v14.16.0 2024-11-05 */const Mw="cache_quota_exceeded",sm="cache_error_unknown";/*! @azure/msal-common v14.16.0 2024-11-05 */const ah={[Mw]:"Exceeded cache storage capacity.",[sm]:"Unexpected error occurred when using cache storage."};class pa extends Error{constructor(e,t){const r=t||(ah[e]?ah[e]:ah[sm]);super(`${e}: ${r}`),Object.setPrototypeOf(this,pa.prototype),this.name="CacheError",this.errorCode=e,this.errorMessage=r}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Ta{constructor(e,t,r,o){this.clientId=e,this.cryptoImpl=t,this.commonLogger=r.clone(hw,Qf),this.staticAuthorityOptions=o}getAllAccounts(e){return this.buildTenantProfiles(this.getAccountsFilteredBy(e||{}),e)}getAccountInfoFilteredBy(e){const t=this.getAllAccounts(e);return t.length>1?t.sort(o=>o.idTokenClaims?-1:1)[0]:t.length===1?t[0]:null}getBaseAccountInfo(e){const t=this.getAccountsFilteredBy(e);return t.length>0?t[0].getAccountInfo():null}buildTenantProfiles(e,t){return e.flatMap(r=>this.getTenantProfilesFromAccountEntity(r,t==null?void 0:t.tenantId,t))}getTenantedAccountInfoByFilter(e,t,r,o){let a=null,c;if(o&&!this.tenantProfileMatchesFilter(r,o))return null;const d=this.getIdToken(e,t,r.tenantId);return d&&(c=Si(d.secret,this.cryptoImpl.base64Decode),!this.idTokenClaimsMatchTenantProfileFilter(c,o))?null:(a=im(e,r,c,d==null?void 0:d.secret),a)}getTenantProfilesFromAccountEntity(e,t,r){const o=e.getAccountInfo();let a=o.tenantProfiles||new Map;const c=this.getTokenKeys();if(t){const h=a.get(t);if(h)a=new Map([[t,h]]);else return[]}const d=[];return a.forEach(h=>{const m=this.getTenantedAccountInfoByFilter(o,c,h,r);m&&d.push(m)}),d}tenantProfileMatchesFilter(e,t){return!(t.localAccountId&&!this.matchLocalAccountIdFromTenantProfile(e,t.localAccountId)||t.name&&e.name!==t.name||t.isHomeTenant!==void 0&&e.isHomeTenant!==t.isHomeTenant)}idTokenClaimsMatchTenantProfileFilter(e,t){return!(t&&(t.localAccountId&&!this.matchLocalAccountIdFromTokenClaims(e,t.localAccountId)||t.loginHint&&!this.matchLoginHintFromTokenClaims(e,t.loginHint)||t.username&&!this.matchUsername(e.preferred_username,t.username)||t.name&&!this.matchName(e,t.name)||t.sid&&!this.matchSid(e,t.sid)))}async saveCacheRecord(e,t,r){var o,a,c,d;if(!e)throw Y(sw);try{e.account&&this.setAccount(e.account),e.idToken&&(t==null?void 0:t.idToken)!==!1&&this.setIdTokenCredential(e.idToken),e.accessToken&&(t==null?void 0:t.accessToken)!==!1&&await this.saveAccessToken(e.accessToken),e.refreshToken&&(t==null?void 0:t.refreshToken)!==!1&&this.setRefreshTokenCredential(e.refreshToken),e.appMetadata&&this.setAppMetadata(e.appMetadata)}catch(h){throw(o=this.commonLogger)==null||o.error("CacheManager.saveCacheRecord: failed"),h instanceof Error?((a=this.commonLogger)==null||a.errorPii(`CacheManager.saveCacheRecord: ${h.message}`,r),h.name==="QuotaExceededError"||h.name==="NS_ERROR_DOM_QUOTA_REACHED"||h.message.includes("exceeded the quota")?((c=this.commonLogger)==null||c.error("CacheManager.saveCacheRecord: exceeded storage quota",r),new pa(Mw)):new pa(h.name,h.message)):((d=this.commonLogger)==null||d.errorPii(`CacheManager.saveCacheRecord: ${h}`,r),new pa(sm))}}async saveAccessToken(e){const t={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType,requestedClaimsHash:e.requestedClaimsHash},r=this.getTokenKeys(),o=vt.fromString(e.target),a=[];r.accessToken.forEach(c=>{if(!this.accessTokenKeyMatchesFilter(c,t,!1))return;const d=this.getAccessTokenCredential(c);d&&this.credentialMatchesFilter(d,t)&&vt.fromString(d.target).intersectingScopeSets(o)&&a.push(this.removeAccessToken(c))}),await Promise.all(a),this.setAccessTokenCredential(e)}getAccountsFilteredBy(e){const t=this.getAccountKeys(),r=[];return t.forEach(o=>{var h;if(!this.isAccountKey(o,e.homeAccountId))return;const a=this.getAccount(o,this.commonLogger);if(!a||e.homeAccountId&&!this.matchHomeAccountId(a,e.homeAccountId)||e.username&&!this.matchUsername(a.username,e.username)||e.environment&&!this.matchEnvironment(a,e.environment)||e.realm&&!this.matchRealm(a,e.realm)||e.nativeAccountId&&!this.matchNativeAccountId(a,e.nativeAccountId)||e.authorityType&&!this.matchAuthorityType(a,e.authorityType))return;const c={localAccountId:e==null?void 0:e.localAccountId,name:e==null?void 0:e.name},d=(h=a.tenantProfiles)==null?void 0:h.filter(m=>this.tenantProfileMatchesFilter(m,c));d&&d.length===0||r.push(a)}),r}isAccountKey(e,t,r){return!(e.split(tn.CACHE_KEY_SEPARATOR).length<3||t&&!e.toLowerCase().includes(t.toLowerCase())||r&&!e.toLowerCase().includes(r.toLowerCase()))}isCredentialKey(e){if(e.split(tn.CACHE_KEY_SEPARATOR).length<6)return!1;const t=e.toLowerCase();if(t.indexOf(ge.ID_TOKEN.toLowerCase())===-1&&t.indexOf(ge.ACCESS_TOKEN.toLowerCase())===-1&&t.indexOf(ge.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())===-1&&t.indexOf(ge.REFRESH_TOKEN.toLowerCase())===-1)return!1;if(t.indexOf(ge.REFRESH_TOKEN.toLowerCase())>-1){const r=`${ge.REFRESH_TOKEN}${tn.CACHE_KEY_SEPARATOR}${this.clientId}${tn.CACHE_KEY_SEPARATOR}`,o=`${ge.REFRESH_TOKEN}${tn.CACHE_KEY_SEPARATOR}${ps}${tn.CACHE_KEY_SEPARATOR}`;if(t.indexOf(r.toLowerCase())===-1&&t.indexOf(o.toLowerCase())===-1)return!1}else if(t.indexOf(this.clientId.toLowerCase())===-1)return!1;return!0}credentialMatchesFilter(e,t){return!(t.clientId&&!this.matchClientId(e,t.clientId)||t.userAssertionHash&&!this.matchUserAssertionHash(e,t.userAssertionHash)||typeof t.homeAccountId=="string"&&!this.matchHomeAccountId(e,t.homeAccountId)||t.environment&&!this.matchEnvironment(e,t.environment)||t.realm&&!this.matchRealm(e,t.realm)||t.credentialType&&!this.matchCredentialType(e,t.credentialType)||t.familyId&&!this.matchFamilyId(e,t.familyId)||t.target&&!this.matchTarget(e,t.target)||(t.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==t.requestedClaimsHash||e.credentialType===ge.ACCESS_TOKEN_WITH_AUTH_SCHEME&&(t.tokenType&&!this.matchTokenType(e,t.tokenType)||t.tokenType===Ge.SSH&&t.keyId&&!this.matchKeyId(e,t.keyId)))}getAppMetadataFilteredBy(e){const t=this.getKeys(),r={};return t.forEach(o=>{if(!this.isAppMetadata(o))return;const a=this.getAppMetadata(o);a&&(e.environment&&!this.matchEnvironment(a,e.environment)||e.clientId&&!this.matchClientId(a,e.clientId)||(r[o]=a))}),r}getAuthorityMetadataByAlias(e){const t=this.getAuthorityMetadataKeys();let r=null;return t.forEach(o=>{if(!this.isAuthorityMetadata(o)||o.indexOf(this.clientId)===-1)return;const a=this.getAuthorityMetadata(o);a&&a.aliases.indexOf(e)!==-1&&(r=a)}),r}async removeAllAccounts(){const e=this.getAccountKeys(),t=[];e.forEach(r=>{t.push(this.removeAccount(r))}),await Promise.all(t)}async removeAccount(e){const t=this.getAccount(e,this.commonLogger);t&&(await this.removeAccountContext(t),this.removeItem(e))}async removeAccountContext(e){const t=this.getTokenKeys(),r=e.generateAccountId(),o=[];t.idToken.forEach(a=>{a.indexOf(r)===0&&this.removeIdToken(a)}),t.accessToken.forEach(a=>{a.indexOf(r)===0&&o.push(this.removeAccessToken(a))}),t.refreshToken.forEach(a=>{a.indexOf(r)===0&&this.removeRefreshToken(a)}),await Promise.all(o)}updateOutdatedCachedAccount(e,t,r){var o;if(t&&t.isSingleTenant()){(o=this.commonLogger)==null||o.verbose("updateOutdatedCachedAccount: Found a single-tenant (outdated) account entity in the cache, migrating to multi-tenant account entity");const a=this.getAccountKeys().filter(g=>g.startsWith(t.homeAccountId)),c=[];a.forEach(g=>{const v=this.getCachedAccountEntity(g);v&&c.push(v)});const d=c.find(g=>Ol(g.realm,g.homeAccountId))||c[0];d.tenantProfiles=c.map(g=>({tenantId:g.realm,localAccountId:g.localAccountId,name:g.name,isHomeTenant:Ol(g.realm,g.homeAccountId)}));const h=Ta.toObject(new Pt,{...d}),m=h.generateAccountKey();return a.forEach(g=>{g!==m&&this.removeOutdatedAccount(e)}),this.setAccount(h),r==null||r.verbose("Updated an outdated account entity in the cache"),h}return t}async removeAccessToken(e){const t=this.getAccessTokenCredential(e);if(t){if(t.credentialType.toLowerCase()===ge.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()&&t.tokenType===Ge.POP){const o=t.keyId;if(o)try{await this.cryptoImpl.removeTokenBindingKey(o)}catch{throw Y(uw)}}return this.removeItem(e)}}removeAppMetadata(){return this.getKeys().forEach(t=>{this.isAppMetadata(t)&&this.removeItem(t)}),!0}readAccountFromCache(e){const t=Pt.generateAccountCacheKey(e);return this.getAccount(t,this.commonLogger)}getIdToken(e,t,r,o,a){this.commonLogger.trace("CacheManager - getIdToken called");const c={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:ge.ID_TOKEN,clientId:this.clientId,realm:r},d=this.getIdTokensByFilter(c,t),h=d.size;if(h<1)return this.commonLogger.info("CacheManager:getIdToken - No token found"),null;if(h>1){let m=d;if(!r){const g=new Map;d.forEach((p,w)=>{p.realm===e.tenantId&&g.set(w,p)});const v=g.size;if(v<1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result"),d.values().next().value;if(v===1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile"),g.values().next().value;m=g}return this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them"),m.forEach((g,v)=>{this.removeIdToken(v)}),o&&a&&o.addFields({multiMatchedID:d.size},a),null}return this.commonLogger.info("CacheManager:getIdToken - Returning ID token"),d.values().next().value}getIdTokensByFilter(e,t){const r=t&&t.idToken||this.getTokenKeys().idToken,o=new Map;return r.forEach(a=>{if(!this.idTokenKeyMatchesFilter(a,{clientId:this.clientId,...e}))return;const c=this.getIdTokenCredential(a);c&&this.credentialMatchesFilter(c,e)&&o.set(a,c)}),o}idTokenKeyMatchesFilter(e,t){const r=e.toLowerCase();return!(t.clientId&&r.indexOf(t.clientId.toLowerCase())===-1||t.homeAccountId&&r.indexOf(t.homeAccountId.toLowerCase())===-1)}removeIdToken(e){this.removeItem(e)}removeRefreshToken(e){this.removeItem(e)}getAccessToken(e,t,r,o,a,c){this.commonLogger.trace("CacheManager - getAccessToken called");const d=vt.createSearchScopes(t.scopes),h=t.authenticationScheme||Ge.BEARER,m=h&&h.toLowerCase()!==Ge.BEARER.toLowerCase()?ge.ACCESS_TOKEN_WITH_AUTH_SCHEME:ge.ACCESS_TOKEN,g={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:m,clientId:this.clientId,realm:o||e.tenantId,target:d,tokenType:h,keyId:t.sshKid,requestedClaimsHash:t.requestedClaimsHash},v=r&&r.accessToken||this.getTokenKeys().accessToken,p=[];v.forEach(C=>{if(this.accessTokenKeyMatchesFilter(C,g,!0)){const T=this.getAccessTokenCredential(C);T&&this.credentialMatchesFilter(T,g)&&p.push(T)}});const w=p.length;return w<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found"),null):w>1?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them"),p.forEach(C=>{this.removeAccessToken(ha(C))}),a&&c&&a.addFields({multiMatchedAT:p.length},c),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token"),p[0])}accessTokenKeyMatchesFilter(e,t,r){const o=e.toLowerCase();if(t.clientId&&o.indexOf(t.clientId.toLowerCase())===-1||t.homeAccountId&&o.indexOf(t.homeAccountId.toLowerCase())===-1||t.realm&&o.indexOf(t.realm.toLowerCase())===-1||t.requestedClaimsHash&&o.indexOf(t.requestedClaimsHash.toLowerCase())===-1)return!1;if(t.target){const a=t.target.asArray();for(let c=0;c<a.length;c++){if(r&&!o.includes(a[c].toLowerCase()))return!1;if(!r&&o.includes(a[c].toLowerCase()))return!0}}return!0}getAccessTokensByFilter(e){const t=this.getTokenKeys(),r=[];return t.accessToken.forEach(o=>{if(!this.accessTokenKeyMatchesFilter(o,e,!0))return;const a=this.getAccessTokenCredential(o);a&&this.credentialMatchesFilter(a,e)&&r.push(a)}),r}getRefreshToken(e,t,r,o,a){this.commonLogger.trace("CacheManager - getRefreshToken called");const c=t?ps:void 0,d={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:ge.REFRESH_TOKEN,clientId:this.clientId,familyId:c},h=r&&r.refreshToken||this.getTokenKeys().refreshToken,m=[];h.forEach(v=>{if(this.refreshTokenKeyMatchesFilter(v,d)){const p=this.getRefreshTokenCredential(v);p&&this.credentialMatchesFilter(p,d)&&m.push(p)}});const g=m.length;return g<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(g>1&&o&&a&&o.addFields({multiMatchedRT:g},a),this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),m[0])}refreshTokenKeyMatchesFilter(e,t){const r=e.toLowerCase();return!(t.familyId&&r.indexOf(t.familyId.toLowerCase())===-1||!t.familyId&&t.clientId&&r.indexOf(t.clientId.toLowerCase())===-1||t.homeAccountId&&r.indexOf(t.homeAccountId.toLowerCase())===-1)}readAppMetadataFromCache(e){const t={environment:e,clientId:this.clientId},r=this.getAppMetadataFilteredBy(t),o=Object.keys(r).map(c=>r[c]),a=o.length;if(a<1)return null;if(a>1)throw Y(rw);return o[0]}isAppMetadataFOCI(e){const t=this.readAppMetadataFromCache(e);return!!(t&&t.familyId===ps)}matchHomeAccountId(e,t){return typeof e.homeAccountId=="string"&&t===e.homeAccountId}matchLocalAccountIdFromTokenClaims(e,t){const r=e.oid||e.sub;return t===r}matchLocalAccountIdFromTenantProfile(e,t){return e.localAccountId===t}matchName(e,t){var r;return t.toLowerCase()===((r=e.name)==null?void 0:r.toLowerCase())}matchUsername(e,t){return!!(e&&typeof e=="string"&&(t==null?void 0:t.toLowerCase())===e.toLowerCase())}matchUserAssertionHash(e,t){return!!(e.userAssertionHash&&t===e.userAssertionHash)}matchEnvironment(e,t){if(this.staticAuthorityOptions){const o=yV(this.staticAuthorityOptions,this.commonLogger);if(o.includes(t)&&o.includes(e.environment))return!0}const r=this.getAuthorityMetadataByAlias(t);return!!(r&&r.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,t){return e.credentialType&&t.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,t){return!!(e.clientId&&t===e.clientId)}matchFamilyId(e,t){return!!(e.familyId&&t===e.familyId)}matchRealm(e,t){var r;return((r=e.realm)==null?void 0:r.toLowerCase())===t.toLowerCase()}matchNativeAccountId(e,t){return!!(e.nativeAccountId&&t===e.nativeAccountId)}matchLoginHintFromTokenClaims(e,t){return e.login_hint===t||e.preferred_username===t||e.upn===t}matchSid(e,t){return e.sid===t}matchAuthorityType(e,t){return!!(e.authorityType&&t.toLowerCase()===e.authorityType.toLowerCase())}matchTarget(e,t){return e.credentialType!==ge.ACCESS_TOKEN&&e.credentialType!==ge.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target?!1:vt.fromString(e.target).containsScopeSet(t)}matchTokenType(e,t){return!!(e.tokenType&&e.tokenType===t)}matchKeyId(e,t){return!!(e.keyId&&e.keyId===t)}isAppMetadata(e){return e.indexOf(Kf)!==-1}isAuthorityMetadata(e){return e.indexOf(Al.CACHE_KEY)!==-1}generateAuthorityMetadataCacheKey(e){return`${Al.CACHE_KEY}-${this.clientId}-${e}`}static toObject(e,t){for(const r in t)e[r]=t[r];return e}}class EV extends Ta{setAccount(){throw Y(Ae)}getAccount(){throw Y(Ae)}getCachedAccountEntity(){throw Y(Ae)}setIdTokenCredential(){throw Y(Ae)}getIdTokenCredential(){throw Y(Ae)}setAccessTokenCredential(){throw Y(Ae)}getAccessTokenCredential(){throw Y(Ae)}setRefreshTokenCredential(){throw Y(Ae)}getRefreshTokenCredential(){throw Y(Ae)}setAppMetadata(){throw Y(Ae)}getAppMetadata(){throw Y(Ae)}setServerTelemetry(){throw Y(Ae)}getServerTelemetry(){throw Y(Ae)}setAuthorityMetadata(){throw Y(Ae)}getAuthorityMetadata(){throw Y(Ae)}getAuthorityMetadataKeys(){throw Y(Ae)}setThrottlingCache(){throw Y(Ae)}getThrottlingCache(){throw Y(Ae)}removeItem(){throw Y(Ae)}getKeys(){throw Y(Ae)}getAccountKeys(){throw Y(Ae)}getTokenKeys(){throw Y(Ae)}updateCredentialCacheKey(){throw Y(Ae)}removeOutdatedAccount(){throw Y(Ae)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Dw={tokenRenewalOffsetSeconds:KF,preventCorsPreflight:!1},wV={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:tt.Info,correlationId:F.EMPTY_STRING},TV={claimsBasedCachingEnabled:!1},bV={async sendGetRequestAsync(){throw Y(Ae)},async sendPostRequestAsync(){throw Y(Ae)}},IV={sku:F.SKU,version:Qf,cpu:F.EMPTY_STRING,os:F.EMPTY_STRING},SV={clientSecret:F.EMPTY_STRING,clientAssertion:void 0},AV={azureCloudInstance:Xf.None,tenant:`${F.DEFAULT_COMMON_TENANT}`},kV={application:{appName:"",appVersion:""}};function NV({authOptions:n,systemOptions:e,loggerOptions:t,cacheOptions:r,storageInterface:o,networkInterface:a,cryptoInterface:c,clientCredentials:d,libraryInfo:h,telemetry:m,serverTelemetryManager:g,persistencePlugin:v,serializableCache:p}){const w={...wV,...t};return{authOptions:RV(n),systemOptions:{...Dw,...e},loggerOptions:w,cacheOptions:{...TV,...r},storageInterface:o||new EV(n.clientId,Nl,new Ko(w)),networkInterface:a||bV,cryptoInterface:c||Nl,clientCredentials:d||SV,libraryInfo:{...IV,...h},telemetry:{...kV,...m},serverTelemetryManager:g||null,persistencePlugin:v||null,serializableCache:p||null}}function RV(n){return{clientCapabilities:[],azureCloudOptions:AV,skipAuthorityMetadataCache:!1,instanceAware:!1,...n}}function Zh(n){return n.authOptions.authority.options.protocolMode===fo.OIDC}/*! @azure/msal-common v14.16.0 2024-11-05 */const Bn={HOME_ACCOUNT_ID:"home_account_id",UPN:"UPN"};/*! @azure/msal-common v14.16.0 2024-11-05 */const wi="client_id",Lw="redirect_uri",Yv="response_type",OV="response_mode",PV="grant_type",MV="claims",DV="scope",LV="refresh_token",xV="state",UV="nonce",BV="prompt",FV="code",VV="code_challenge",HV="code_challenge_method",$V="code_verifier",KV="client-request-id",WV="x-client-SKU",zV="x-client-VER",GV="x-client-OS",qV="x-client-CPU",jV="x-client-current-telemetry",YV="x-client-last-telemetry",JV="x-ms-lib-capability",QV="x-app-name",XV="x-app-ver",ZV="post_logout_redirect_uri",e2="id_token_hint",t2="device_code",n2="client_secret",r2="client_assertion",o2="client_assertion_type",Jv="token_type",Qv="req_cnf",i2="assertion",a2="requested_token_use",Xv="return_spa_code",s2="nativebroker",c2="logout_hint",l2="sid",u2="login_hint",d2="domain_hint",h2="x-client-xtra-sku",cm="brk_client_id",ef="brk_redirect_uri";/*! @azure/msal-common v14.16.0 2024-11-05 */class ia{static validateRedirectUri(e){if(!e)throw Xe(gw)}static validatePrompt(e){const t=[];for(const r in Bt)t.push(Bt[r]);if(t.indexOf(e)<0)throw Xe(yw)}static validateClaims(e){try{JSON.parse(e)}catch{throw Xe(em)}}static validateCodeChallengeParams(e,t){if(!e||!t)throw Xe(tm);this.validateCodeChallengeMethod(t)}static validateCodeChallengeMethod(e){if([Uv.PLAIN,Uv.S256].indexOf(e)<0)throw Xe(ww)}}/*! @azure/msal-common v14.16.0 2024-11-05 */function f2(n,e,t){if(!e)return;const r=n.get(wi);r&&n.has(cm)&&(t==null||t.addFields({embeddedClientId:r,embeddedRedirectUri:n.get(Lw)},e))}class vs{constructor(e,t){this.parameters=new Map,this.performanceClient=t,this.correlationId=e}addResponseTypeCode(){this.parameters.set(Yv,encodeURIComponent(F.CODE_RESPONSE_TYPE))}addResponseTypeForTokenAndIdToken(){this.parameters.set(Yv,encodeURIComponent(`${F.TOKEN_RESPONSE_TYPE} ${F.ID_TOKEN_RESPONSE_TYPE}`))}addResponseMode(e){this.parameters.set(OV,encodeURIComponent(e||VF.QUERY))}addNativeBroker(){this.parameters.set(s2,encodeURIComponent("1"))}addScopes(e,t=!0,r=Pa){t&&!r.includes("openid")&&!e.includes("openid")&&r.push("openid");const o=t?[...e||[],...r]:e||[],a=new vt(o);this.parameters.set(DV,encodeURIComponent(a.printScopes()))}addClientId(e){this.parameters.set(wi,encodeURIComponent(e))}addRedirectUri(e){ia.validateRedirectUri(e),this.parameters.set(Lw,encodeURIComponent(e))}addPostLogoutRedirectUri(e){ia.validateRedirectUri(e),this.parameters.set(ZV,encodeURIComponent(e))}addIdTokenHint(e){this.parameters.set(e2,encodeURIComponent(e))}addDomainHint(e){this.parameters.set(d2,encodeURIComponent(e))}addLoginHint(e){this.parameters.set(u2,encodeURIComponent(e))}addCcsUpn(e){this.parameters.set(dn.CCS_HEADER,encodeURIComponent(`UPN:${e}`))}addCcsOid(e){this.parameters.set(dn.CCS_HEADER,encodeURIComponent(`Oid:${e.uid}@${e.utid}`))}addSid(e){this.parameters.set(l2,encodeURIComponent(e))}addClaims(e,t){const r=this.addClientCapabilitiesToClaims(e,t);ia.validateClaims(r),this.parameters.set(MV,encodeURIComponent(r))}addCorrelationId(e){this.parameters.set(KV,encodeURIComponent(e))}addLibraryInfo(e){this.parameters.set(WV,e.sku),this.parameters.set(zV,e.version),e.os&&this.parameters.set(GV,e.os),e.cpu&&this.parameters.set(qV,e.cpu)}addApplicationTelemetry(e){e!=null&&e.appName&&this.parameters.set(QV,e.appName),e!=null&&e.appVersion&&this.parameters.set(XV,e.appVersion)}addPrompt(e){ia.validatePrompt(e),this.parameters.set(`${BV}`,encodeURIComponent(e))}addState(e){e&&this.parameters.set(xV,encodeURIComponent(e))}addNonce(e){this.parameters.set(UV,encodeURIComponent(e))}addCodeChallengeParams(e,t){if(ia.validateCodeChallengeParams(e,t),e&&t)this.parameters.set(VV,encodeURIComponent(e)),this.parameters.set(HV,encodeURIComponent(t));else throw Xe(tm)}addAuthorizationCode(e){this.parameters.set(FV,encodeURIComponent(e))}addDeviceCode(e){this.parameters.set(t2,encodeURIComponent(e))}addRefreshToken(e){this.parameters.set(LV,encodeURIComponent(e))}addCodeVerifier(e){this.parameters.set($V,encodeURIComponent(e))}addClientSecret(e){this.parameters.set(n2,encodeURIComponent(e))}addClientAssertion(e){e&&this.parameters.set(r2,encodeURIComponent(e))}addClientAssertionType(e){e&&this.parameters.set(o2,encodeURIComponent(e))}addOboAssertion(e){this.parameters.set(i2,encodeURIComponent(e))}addRequestTokenUse(e){this.parameters.set(a2,encodeURIComponent(e))}addGrantType(e){this.parameters.set(PV,encodeURIComponent(e))}addClientInfo(){this.parameters.set(HF,"1")}addExtraQueryParameters(e){Object.entries(e).forEach(([t,r])=>{!this.parameters.has(t)&&r&&this.parameters.set(t,r)})}addClientCapabilitiesToClaims(e,t){let r;if(!e)r={};else try{r=JSON.parse(e)}catch{throw Xe(em)}return t&&t.length>0&&(r.hasOwnProperty(Kc.ACCESS_TOKEN)||(r[Kc.ACCESS_TOKEN]={}),r[Kc.ACCESS_TOKEN][Kc.XMS_CC]={values:t}),JSON.stringify(r)}addUsername(e){this.parameters.set(Fv.username,encodeURIComponent(e))}addPassword(e){this.parameters.set(Fv.password,encodeURIComponent(e))}addPopToken(e){e&&(this.parameters.set(Jv,Ge.POP),this.parameters.set(Qv,encodeURIComponent(e)))}addSshJwk(e){e&&(this.parameters.set(Jv,Ge.SSH),this.parameters.set(Qv,encodeURIComponent(e)))}addServerTelemetry(e){this.parameters.set(jV,e.generateCurrentRequestHeaderValue()),this.parameters.set(YV,e.generateLastRequestHeaderValue())}addThrottling(){this.parameters.set(JV,_s.X_MS_LIB_CAPABILITY_VALUE)}addLogoutHint(e){this.parameters.set(c2,encodeURIComponent(e))}addBrokerParameters(e){const t={};t[cm]=e.brokerClientId,t[ef]=e.brokerRedirectUri,this.addExtraQueryParameters(t)}createQueryString(){const e=new Array;return this.parameters.forEach((t,r)=>{e.push(`${r}=${t}`)}),f2(this.parameters,this.correlationId,this.performanceClient),e.join("&")}}/*! @azure/msal-common v14.16.0 2024-11-05 */function m2(n){return n.hasOwnProperty("authorization_endpoint")&&n.hasOwnProperty("token_endpoint")&&n.hasOwnProperty("issuer")&&n.hasOwnProperty("jwks_uri")}/*! @azure/msal-common v14.16.0 2024-11-05 */function g2(n){return n.hasOwnProperty("tenant_discovery_endpoint")&&n.hasOwnProperty("metadata")}/*! @azure/msal-common v14.16.0 2024-11-05 */function p2(n){return n.hasOwnProperty("error")&&n.hasOwnProperty("error_description")}/*! @azure/msal-common v14.16.0 2024-11-05 */const x={AcquireTokenByCode:"acquireTokenByCode",AcquireTokenByRefreshToken:"acquireTokenByRefreshToken",AcquireTokenSilent:"acquireTokenSilent",AcquireTokenSilentAsync:"acquireTokenSilentAsync",AcquireTokenPopup:"acquireTokenPopup",AcquireTokenPreRedirect:"acquireTokenPreRedirect",AcquireTokenRedirect:"acquireTokenRedirect",CryptoOptsGetPublicKeyThumbprint:"cryptoOptsGetPublicKeyThumbprint",CryptoOptsSignJwt:"cryptoOptsSignJwt",SilentCacheClientAcquireToken:"silentCacheClientAcquireToken",SilentIframeClientAcquireToken:"silentIframeClientAcquireToken",AwaitConcurrentIframe:"awaitConcurrentIframe",SilentRefreshClientAcquireToken:"silentRefreshClientAcquireToken",SsoSilent:"ssoSilent",StandardInteractionClientGetDiscoveredAuthority:"standardInteractionClientGetDiscoveredAuthority",FetchAccountIdWithNativeBroker:"fetchAccountIdWithNativeBroker",NativeInteractionClientAcquireToken:"nativeInteractionClientAcquireToken",BaseClientCreateTokenRequestHeaders:"baseClientCreateTokenRequestHeaders",NetworkClientSendPostRequestAsync:"networkClientSendPostRequestAsync",RefreshTokenClientExecutePostToTokenEndpoint:"refreshTokenClientExecutePostToTokenEndpoint",AuthorizationCodeClientExecutePostToTokenEndpoint:"authorizationCodeClientExecutePostToTokenEndpoint",BrokerHandhshake:"brokerHandshake",AcquireTokenByRefreshTokenInBroker:"acquireTokenByRefreshTokenInBroker",AcquireTokenByBroker:"acquireTokenByBroker",RefreshTokenClientExecuteTokenRequest:"refreshTokenClientExecuteTokenRequest",RefreshTokenClientAcquireToken:"refreshTokenClientAcquireToken",RefreshTokenClientAcquireTokenWithCachedRefreshToken:"refreshTokenClientAcquireTokenWithCachedRefreshToken",RefreshTokenClientAcquireTokenByRefreshToken:"refreshTokenClientAcquireTokenByRefreshToken",RefreshTokenClientCreateTokenRequestBody:"refreshTokenClientCreateTokenRequestBody",AcquireTokenFromCache:"acquireTokenFromCache",SilentFlowClientAcquireCachedToken:"silentFlowClientAcquireCachedToken",SilentFlowClientGenerateResultFromCacheRecord:"silentFlowClientGenerateResultFromCacheRecord",AcquireTokenBySilentIframe:"acquireTokenBySilentIframe",InitializeBaseRequest:"initializeBaseRequest",InitializeSilentRequest:"initializeSilentRequest",InitializeClientApplication:"initializeClientApplication",SilentIframeClientTokenHelper:"silentIframeClientTokenHelper",SilentHandlerInitiateAuthRequest:"silentHandlerInitiateAuthRequest",SilentHandlerMonitorIframeForHash:"silentHandlerMonitorIframeForHash",SilentHandlerLoadFrame:"silentHandlerLoadFrame",SilentHandlerLoadFrameSync:"silentHandlerLoadFrameSync",StandardInteractionClientCreateAuthCodeClient:"standardInteractionClientCreateAuthCodeClient",StandardInteractionClientGetClientConfiguration:"standardInteractionClientGetClientConfiguration",StandardInteractionClientInitializeAuthorizationRequest:"standardInteractionClientInitializeAuthorizationRequest",StandardInteractionClientInitializeAuthorizationCodeRequest:"standardInteractionClientInitializeAuthorizationCodeRequest",GetAuthCodeUrl:"getAuthCodeUrl",HandleCodeResponseFromServer:"handleCodeResponseFromServer",HandleCodeResponse:"handleCodeResponse",UpdateTokenEndpointAuthority:"updateTokenEndpointAuthority",AuthClientAcquireToken:"authClientAcquireToken",AuthClientExecuteTokenRequest:"authClientExecuteTokenRequest",AuthClientCreateTokenRequestBody:"authClientCreateTokenRequestBody",AuthClientCreateQueryString:"authClientCreateQueryString",PopTokenGenerateCnf:"popTokenGenerateCnf",PopTokenGenerateKid:"popTokenGenerateKid",HandleServerTokenResponse:"handleServerTokenResponse",DeserializeResponse:"deserializeResponse",AuthorityFactoryCreateDiscoveredInstance:"authorityFactoryCreateDiscoveredInstance",AuthorityResolveEndpointsAsync:"authorityResolveEndpointsAsync",AuthorityResolveEndpointsFromLocalSources:"authorityResolveEndpointsFromLocalSources",AuthorityGetCloudDiscoveryMetadataFromNetwork:"authorityGetCloudDiscoveryMetadataFromNetwork",AuthorityUpdateCloudDiscoveryMetadata:"authorityUpdateCloudDiscoveryMetadata",AuthorityGetEndpointMetadataFromNetwork:"authorityGetEndpointMetadataFromNetwork",AuthorityUpdateEndpointMetadata:"authorityUpdateEndpointMetadata",AuthorityUpdateMetadataWithRegionalInformation:"authorityUpdateMetadataWithRegionalInformation",RegionDiscoveryDetectRegion:"regionDiscoveryDetectRegion",RegionDiscoveryGetRegionFromIMDS:"regionDiscoveryGetRegionFromIMDS",RegionDiscoveryGetCurrentVersion:"regionDiscoveryGetCurrentVersion",AcquireTokenByCodeAsync:"acquireTokenByCodeAsync",GetEndpointMetadataFromNetwork:"getEndpointMetadataFromNetwork",GetCloudDiscoveryMetadataFromNetworkMeasurement:"getCloudDiscoveryMetadataFromNetworkMeasurement",HandleRedirectPromiseMeasurement:"handleRedirectPromise",HandleNativeRedirectPromiseMeasurement:"handleNativeRedirectPromise",UpdateCloudDiscoveryMetadataMeasurement:"updateCloudDiscoveryMetadataMeasurement",UsernamePasswordClientAcquireToken:"usernamePasswordClientAcquireToken",NativeMessageHandlerHandshake:"nativeMessageHandlerHandshake",NativeGenerateAuthResult:"nativeGenerateAuthResult",RemoveHiddenIframe:"removeHiddenIframe",ClearTokensAndKeysWithClaims:"clearTokensAndKeysWithClaims",CacheManagerGetRefreshToken:"cacheManagerGetRefreshToken",GeneratePkceCodes:"generatePkceCodes",GenerateCodeVerifier:"generateCodeVerifier",GenerateCodeChallengeFromVerifier:"generateCodeChallengeFromVerifier",Sha256Digest:"sha256Digest",GetRandomValues:"getRandomValues"},_2={NotStarted:0,InProgress:1,Completed:2};/*! @azure/msal-common v14.16.0 2024-11-05 */const Ai=(n,e,t,r,o)=>(...a)=>{t.trace(`Executing function ${e}`);const c=r==null?void 0:r.startMeasurement(e,o);if(o){const d=e+"CallCount";r==null||r.incrementFields({[d]:1},o)}try{const d=n(...a);return c==null||c.end({success:!0}),t.trace(`Returning result from ${e}`),d}catch(d){t.trace(`Error occurred in ${e}`);try{t.trace(JSON.stringify(d))}catch{t.trace("Unable to print error message.")}throw c==null||c.end({success:!1},d),d}},Q=(n,e,t,r,o)=>(...a)=>{t.trace(`Executing function ${e}`);const c=r==null?void 0:r.startMeasurement(e,o);if(o){const d=e+"CallCount";r==null||r.incrementFields({[d]:1},o)}return r==null||r.setPreQueueTime(e,o),n(...a).then(d=>(t.trace(`Returning result from ${e}`),c==null||c.end({success:!0}),d)).catch(d=>{t.trace(`Error occurred in ${e}`);try{t.trace(JSON.stringify(d))}catch{t.trace("Unable to print error message.")}throw c==null||c.end({success:!1},d),d})};/*! @azure/msal-common v14.16.0 2024-11-05 */class lu{constructor(e,t,r,o){this.networkInterface=e,this.logger=t,this.performanceClient=r,this.correlationId=o}async detectRegion(e,t){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(x.RegionDiscoveryDetectRegion,this.correlationId);let r=e;if(r)t.region_source=Yi.ENVIRONMENT_VARIABLE;else{const a=lu.IMDS_OPTIONS;try{const c=await Q(this.getRegionFromIMDS.bind(this),x.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(F.IMDS_VERSION,a);if(c.status===zc.httpSuccess&&(r=c.body,t.region_source=Yi.IMDS),c.status===zc.httpBadRequest){const d=await Q(this.getCurrentVersion.bind(this),x.RegionDiscoveryGetCurrentVersion,this.logger,this.performanceClient,this.correlationId)(a);if(!d)return t.region_source=Yi.FAILED_AUTO_DETECTION,null;const h=await Q(this.getRegionFromIMDS.bind(this),x.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(d,a);h.status===zc.httpSuccess&&(r=h.body,t.region_source=Yi.IMDS)}}catch{return t.region_source=Yi.FAILED_AUTO_DETECTION,null}}return r||(t.region_source=Yi.FAILED_AUTO_DETECTION),r||null}async getRegionFromIMDS(e,t){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(x.RegionDiscoveryGetRegionFromIMDS,this.correlationId),this.networkInterface.sendGetRequestAsync(`${F.IMDS_ENDPOINT}?api-version=${e}&format=text`,t,F.IMDS_TIMEOUT)}async getCurrentVersion(e){var t;(t=this.performanceClient)==null||t.addQueueMeasurement(x.RegionDiscoveryGetCurrentVersion,this.correlationId);try{const r=await this.networkInterface.sendGetRequestAsync(`${F.IMDS_ENDPOINT}?format=json`,e);return r.status===zc.httpBadRequest&&r.body&&r.body["newest-versions"]&&r.body["newest-versions"].length>0?r.body["newest-versions"][0]:null}catch{return null}}}lu.IMDS_OPTIONS={headers:{Metadata:"true"}};/*! @azure/msal-common v14.16.0 2024-11-05 */class Xt{constructor(e,t,r,o,a,c,d,h){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=t,this.cacheManager=r,this.authorityOptions=o,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=a,this.performanceClient=d,this.correlationId=c,this.managedIdentity=h||!1,this.regionDiscovery=new lu(t,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(F.CIAM_AUTH_URL))return mr.Ciam;const t=e.PathSegments;if(t.length)switch(t[0].toLowerCase()){case F.ADFS:return mr.Adfs;case F.DSTS:return mr.Dsts}return mr.Default}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new De(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw Y(ao)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw Y(ao)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw Y(ao)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw Y(dw);return this.replacePath(this.metadata.end_session_endpoint)}else throw Y(ao)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw Y(ao)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw Y(ao)}canReplaceTenant(e){return e.PathSegments.length===1&&!Xt.reservedTenantDomains.has(e.PathSegments[0])&&this.getAuthorityType(e)===mr.Default&&this.protocolMode===fo.AAD}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let t=e;const o=new De(this.metadata.canonical_authority).getUrlComponents(),a=o.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach((d,h)=>{let m=a[h];if(h===0&&this.canReplaceTenant(o)){const g=new De(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];m!==g&&(this.logger.verbose(`Replacing tenant domain name ${m} with id ${g}`),m=g)}d!==m&&(t=t.replace(`/${m}/`,`/${d}/`))}),this.replaceTenant(t)}get defaultOpenIdConfigurationEndpoint(){const e=this.hostnameAndPort;return this.canonicalAuthority.endsWith("v2.0/")||this.authorityType===mr.Adfs||this.protocolMode!==fo.AAD&&!this.isAliasOfKnownMicrosoftAuthority(e)?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){var o,a;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthorityResolveEndpointsAsync,this.correlationId);const e=this.getCurrentMetadataEntity(),t=await Q(this.updateCloudDiscoveryMetadata.bind(this),x.AuthorityUpdateCloudDiscoveryMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);const r=await Q(this.updateEndpointMetadata.bind(this),x.AuthorityUpdateEndpointMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.updateCachedMetadata(e,t,{source:r}),(a=this.performanceClient)==null||a.addFields({cloudDiscoverySource:t,authorityEndpointSource:r},this.correlationId)}getCurrentMetadataEntity(){let e=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);return e||(e={aliases:[],preferred_cache:this.hostnameAndPort,preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:"",token_endpoint:"",end_session_endpoint:"",issuer:"",aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:zv(),jwks_uri:""}),e}updateCachedMetadata(e,t,r){t!==On.CACHE&&(r==null?void 0:r.source)!==On.CACHE&&(e.expiresAt=zv(),e.canonical_authority=this.canonicalAuthority);const o=this.cacheManager.generateAuthorityMetadataCacheKey(e.preferred_cache);this.cacheManager.setAuthorityMetadata(o,e),this.metadata=e}async updateEndpointMetadata(e){var o,a,c;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthorityUpdateEndpointMetadata,this.correlationId);const t=this.updateEndpointMetadataFromLocalSources(e);if(t){if(t.source===On.HARDCODED_VALUES&&(a=this.authorityOptions.azureRegionConfiguration)!=null&&a.azureRegion&&t.metadata){const d=await Q(this.updateMetadataWithRegionalInformation.bind(this),x.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(t.metadata);Gc(e,d,!1),e.canonical_authority=this.canonicalAuthority}return t.source}let r=await Q(this.getEndpointMetadataFromNetwork.bind(this),x.AuthorityGetEndpointMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return(c=this.authorityOptions.azureRegionConfiguration)!=null&&c.azureRegion&&(r=await Q(this.updateMetadataWithRegionalInformation.bind(this),x.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(r)),Gc(e,r,!0),On.NETWORK;throw Y(XE,this.defaultOpenIdConfigurationEndpoint)}updateEndpointMetadataFromLocalSources(e){this.logger.verbose("Attempting to get endpoint metadata from authority configuration");const t=this.getEndpointMetadataFromConfig();if(t)return this.logger.verbose("Found endpoint metadata in authority configuration"),Gc(e,t,!1),{source:On.CONFIG};if(this.logger.verbose("Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values."),this.authorityOptions.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get endpoint metadata from the network metadata cache.");else{const o=this.getEndpointMetadataFromHardcodedValues();if(o)return Gc(e,o,!1),{source:On.HARDCODED_VALUES,metadata:o};this.logger.verbose("Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.")}const r=Gv(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!r?(this.logger.verbose("Found endpoint metadata in the cache."),{source:On.CACHE}):(r&&this.logger.verbose("The metadata entity is expired."),null)}isAuthoritySameType(e){return new De(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch{throw Xe(Tw)}return null}async getEndpointMetadataFromNetwork(){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(x.AuthorityGetEndpointMetadataFromNetwork,this.correlationId);const e={},t=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from ${t}`);try{const o=await this.networkInterface.sendGetRequestAsync(t,e);return m2(o.body)?o.body:(this.logger.verbose("Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration"),null)}catch(o){return this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${o}`),null}}getEndpointMetadataFromHardcodedValues(){return this.hostnameAndPort in qv?qv[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(e){var r,o,a;(r=this.performanceClient)==null||r.addQueueMeasurement(x.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId);const t=(o=this.authorityOptions.azureRegionConfiguration)==null?void 0:o.azureRegion;if(t){if(t!==F.AZURE_REGION_AUTO_DISCOVER_FLAG)return this.regionDiscoveryMetadata.region_outcome=oh.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=t,Xt.replaceWithRegionalInformation(e,t);const c=await Q(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),x.RegionDiscoveryDetectRegion,this.logger,this.performanceClient,this.correlationId)((a=this.authorityOptions.azureRegionConfiguration)==null?void 0:a.environmentRegion,this.regionDiscoveryMetadata);if(c)return this.regionDiscoveryMetadata.region_outcome=oh.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=c,Xt.replaceWithRegionalInformation(e,c);this.regionDiscoveryMetadata.region_outcome=oh.AUTO_DETECTION_REQUESTED_FAILED}return e}async updateCloudDiscoveryMetadata(e){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId);const t=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(t)return t;const r=await Q(this.getCloudDiscoveryMetadataFromNetwork.bind(this),x.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return ih(e,r,!0),On.NETWORK;throw Xe(bw)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||F.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||F.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${e.canonical_authority||F.NOT_APPLICABLE}`);const t=this.getCloudDiscoveryMetadataFromConfig();if(t)return this.logger.verbose("Found cloud discovery metadata in authority configuration"),ih(e,t,!1),On.CONFIG;if(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values."),this.options.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded cloud discovery metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get cloud discovery metadata from the network metadata cache.");else{const o=CV(this.hostnameAndPort);if(o)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),ih(e,o,!1),On.HARDCODED_VALUES;this.logger.verbose("Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.")}const r=Gv(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose("Found cloud discovery metadata in the cache."),On.CACHE):(r&&this.logger.verbose("The metadata entity is expired."),null)}getCloudDiscoveryMetadataFromConfig(){if(this.authorityType===mr.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),Xt.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");const e=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),t=Ml(e.metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),t)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),t;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch{throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),Xe(nm)}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),Xt.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId);const e=`${F.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`,t={};let r=null;try{const a=await this.networkInterface.sendGetRequestAsync(e,t);let c,d;if(g2(a.body))c=a.body,d=c.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${c.tenant_discovery_endpoint}`);else if(p2(a.body)){if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${a.status}`),c=a.body,c.error===F.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${c.error}`),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${c.error_description}`),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),d=[]}else return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),null;this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),r=Ml(d,this.hostnameAndPort)}catch(a){if(a instanceof lt)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata.
|
107
|
+
*/var VF=Hs("filled","caret-right-filled","IconCaretRightFilled",[["path",{d:"M9 6c0 -.852 .986 -1.297 1.623 -.783l.084 .076l6 6a1 1 0 0 1 .083 1.32l-.083 .094l-6 6l-.094 .083l-.077 .054l-.096 .054l-.036 .017l-.067 .027l-.108 .032l-.053 .01l-.06 .01l-.057 .004l-.059 .002l-.059 -.002l-.058 -.005l-.06 -.009l-.052 -.01l-.108 -.032l-.067 -.027l-.132 -.07l-.09 -.065l-.081 -.073l-.083 -.094l-.054 -.077l-.054 -.096l-.017 -.036l-.027 -.067l-.032 -.108l-.01 -.053l-.01 -.06l-.004 -.057l-.002 -12.059z",key:"svg-0"}]]);/*! @azure/msal-common v14.16.0 2024-11-05 */const F={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",CACHE_PREFIX:"msal",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_RESPONSE_TYPE:"code",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",FRAGMENT_RESPONSE_MODE:"fragment",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",NOT_AVAILABLE:"Not Available",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],TOKEN_RESPONSE_TYPE:"token",ID_TOKEN_RESPONSE_TYPE:"id_token",SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},$c={SUCCESS:200,SUCCESS_RANGE_START:200,SUCCESS_RANGE_END:299,REDIRECT:302,CLIENT_ERROR:400,CLIENT_ERROR_RANGE_START:400,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,REQUEST_TIMEOUT:408,TOO_MANY_REQUESTS:429,CLIENT_ERROR_RANGE_END:499,SERVER_ERROR:500,SERVER_ERROR_RANGE_START:500,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,SERVER_ERROR_RANGE_END:599,MULTI_SIDED_ERROR:600},Pa=[F.OPENID_SCOPE,F.PROFILE_SCOPE,F.OFFLINE_ACCESS_SCOPE],xv=[...Pa,F.EMAIL_SCOPE],dn={CONTENT_TYPE:"Content-Type",CONTENT_LENGTH:"Content-Length",RETRY_AFTER:"Retry-After",CCS_HEADER:"X-AnchorMailbox",WWWAuthenticate:"WWW-Authenticate",AuthenticationInfo:"Authentication-Info",X_MS_REQUEST_ID:"x-ms-request-id",X_MS_HTTP_VERSION:"x-ms-httpver"},Lt={ID_TOKEN:"idtoken",CLIENT_INFO:"client.info",ADAL_ID_TOKEN:"adal.idtoken",ERROR:"error",ERROR_DESC:"error.description",ACTIVE_ACCOUNT:"active-account",ACTIVE_ACCOUNT_FILTERS:"active-account-filters"},Ho={COMMON:"common",ORGANIZATIONS:"organizations",CONSUMERS:"consumers"},Kc={ACCESS_TOKEN:"access_token",XMS_CC:"xms_cc"},Bt={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"},Uv={PLAIN:"plain",S256:"S256"},$s={QUERY:"query",FRAGMENT:"fragment"},HF={...$s,FORM_POST:"form_post"},qE={IMPLICIT_GRANT:"implicit",AUTHORIZATION_CODE_GRANT:"authorization_code",CLIENT_CREDENTIALS_GRANT:"client_credentials",RESOURCE_OWNER_PASSWORD_GRANT:"password",REFRESH_TOKEN_GRANT:"refresh_token",DEVICE_CODE_GRANT:"device_code",JWT_BEARER:"urn:ietf:params:oauth:grant-type:jwt-bearer"},Wc={MSSTS_ACCOUNT_TYPE:"MSSTS",ADFS_ACCOUNT_TYPE:"ADFS",MSAV1_ACCOUNT_TYPE:"MSA",GENERIC_ACCOUNT_TYPE:"Generic"},tn={CACHE_KEY_SEPARATOR:"-",CLIENT_INFO_SEPARATOR:"."},ge={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},Kf="appmetadata",$F="client_info",ps="1",Al={CACHE_KEY:"authority-metadata",REFRESH_TIME_SECONDS:3600*24},On={CONFIG:"config",CACHE:"cache",NETWORK:"network",HARDCODED_VALUES:"hardcoded_values"},Wt={SCHEMA_VERSION:5,MAX_CUR_HEADER_BYTES:80,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"},Ge={BEARER:"Bearer",POP:"pop",SSH:"ssh-cert"},_s={DEFAULT_THROTTLE_TIME_SECONDS:60,DEFAULT_MAX_THROTTLE_TIME_SECONDS:3600,THROTTLING_PREFIX:"throttling",X_MS_LIB_CAPABILITY_VALUE:"retry-after, h429"},Bv={INVALID_GRANT_ERROR:"invalid_grant",CLIENT_MISMATCH_ERROR:"client_mismatch"},Fv={username:"username",password:"password"},zc={httpSuccess:200,httpBadRequest:400},Yi={FAILED_AUTO_DETECTION:"1",INTERNAL_CACHE:"2",ENVIRONMENT_VARIABLE:"3",IMDS:"4"},oh={CONFIGURED_MATCHES_DETECTED:"1",CONFIGURED_NO_AUTO_DETECTION:"2",CONFIGURED_NOT_DETECTED:"3",AUTO_DETECTION_REQUESTED_SUCCESSFUL:"4",AUTO_DETECTION_REQUESTED_FAILED:"5"},Mo={NOT_APPLICABLE:"0",FORCE_REFRESH_OR_CLAIMS:"1",NO_CACHED_ACCESS_TOKEN:"2",CACHED_ACCESS_TOKEN_EXPIRED:"3",PROACTIVELY_REFRESHED:"4"},KF={Jwt:"JWT",Jwk:"JWK",Pop:"pop"},WF=300;/*! @azure/msal-common v14.16.0 2024-11-05 */const Wf="unexpected_error",zF="post_request_failed";/*! @azure/msal-common v14.16.0 2024-11-05 */const Vv={[Wf]:"Unexpected error in authentication.",[zF]:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."};class lt extends Error{constructor(e,t,r){const o=t?`${e}: ${t}`:e;super(o),Object.setPrototypeOf(this,lt.prototype),this.errorCode=e||F.EMPTY_STRING,this.errorMessage=t||F.EMPTY_STRING,this.subError=r||F.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}}function jE(n,e){return new lt(n,e?`${Vv[n]} ${e}`:Vv[n])}/*! @azure/msal-common v14.16.0 2024-11-05 */const zf="client_info_decoding_error",YE="client_info_empty_error",Gf="token_parsing_error",JE="null_or_empty_token",ao="endpoints_resolution_error",QE="network_error",XE="openid_config_error",ZE="hash_not_deserialized",wa="invalid_state",ew="state_mismatch",kl="state_not_found",tw="nonce_mismatch",qf="auth_time_not_found",nw="max_age_transpired",GF="multiple_matching_tokens",qF="multiple_matching_accounts",rw="multiple_matching_appMetadata",ow="request_cannot_be_made",iw="cannot_remove_empty_scope",aw="cannot_append_scopeset",jh="empty_input_scopeset",jF="device_code_polling_cancelled",YF="device_code_expired",JF="device_code_unknown_error",jf="no_account_in_silent_request",sw="invalid_cache_record",Yf="invalid_cache_environment",Yh="no_account_found",Jh="no_crypto_object",Qh="unexpected_credential_type",QF="invalid_assertion",XF="invalid_client_credential",co="token_refresh_required",ZF="user_timeout_reached",cw="token_claims_cnf_required_for_signedjwt",lw="authorization_code_missing_from_server_response",uw="binding_key_not_removed",dw="end_session_endpoint_not_supported",Jf="key_id_missing",eV="no_network_connectivity",tV="user_canceled",nV="missing_tenant_id_error",Ae="method_not_implemented",rV="nested_app_auth_bridge_disabled";/*! @azure/msal-common v14.16.0 2024-11-05 */const Hv={[zf]:"The client info could not be parsed/decoded correctly",[YE]:"The client info was empty",[Gf]:"Token cannot be parsed",[JE]:"The token is null or empty",[ao]:"Endpoints cannot be resolved",[QE]:"Network request failed",[XE]:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",[ZE]:"The hash parameters could not be deserialized",[wa]:"State was not the expected format",[ew]:"State mismatch error",[kl]:"State not found",[tw]:"Nonce mismatch error",[qf]:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.",[nw]:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",[GF]:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.",[qF]:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",[rw]:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",[ow]:"Token request cannot be made without authorization code or refresh token.",[iw]:"Cannot remove null or empty scope from ScopeSet",[aw]:"Cannot append ScopeSet",[jh]:"Empty input ScopeSet cannot be processed",[jF]:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",[YF]:"Device code is expired.",[JF]:"Device code stopped polling for unknown reasons.",[jf]:"Please pass an account object, silent flow is not supported without account information",[sw]:"Cache record object was null or undefined.",[Yf]:"Invalid environment when attempting to create cache entry",[Yh]:"No account found in cache for given key.",[Jh]:"No crypto object detected.",[Qh]:"Unexpected credential type.",[QF]:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",[XF]:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",[co]:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.",[ZF]:"User defined timeout for device code polling reached",[cw]:"Cannot generate a POP jwt if the token_claims are not populated",[lw]:"Server response does not contain an authorization code to proceed",[uw]:"Could not remove the credential's binding key from storage.",[dw]:"The provided authority does not support logout",[Jf]:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.",[eV]:"No network connectivity. Check your internet connection.",[tV]:"User cancelled the flow.",[nV]:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",[Ae]:"This method has not been implemented",[rV]:"The nested app auth bridge is disabled"};class iu extends lt{constructor(e,t){super(e,t?`${Hv[e]}: ${t}`:Hv[e]),this.name="ClientAuthError",Object.setPrototypeOf(this,iu.prototype)}}function Y(n,e){return new iu(n,e)}/*! @azure/msal-common v14.16.0 2024-11-05 */const Nl={createNewGuid:()=>{throw Y(Ae)},base64Decode:()=>{throw Y(Ae)},base64Encode:()=>{throw Y(Ae)},base64UrlEncode:()=>{throw Y(Ae)},encodeKid:()=>{throw Y(Ae)},async getPublicKeyThumbprint(){throw Y(Ae)},async removeTokenBindingKey(){throw Y(Ae)},async clearKeystore(){throw Y(Ae)},async signJwt(){throw Y(Ae)},async hashString(){throw Y(Ae)}};/*! @azure/msal-common v14.16.0 2024-11-05 */var tt;(function(n){n[n.Error=0]="Error",n[n.Warning=1]="Warning",n[n.Info=2]="Info",n[n.Verbose=3]="Verbose",n[n.Trace=4]="Trace"})(tt||(tt={}));class Ko{constructor(e,t,r){this.level=tt.Info;const o=()=>{},a=e||Ko.createDefaultLoggerOptions();this.localCallback=a.loggerCallback||o,this.piiLoggingEnabled=a.piiLoggingEnabled||!1,this.level=typeof a.logLevel=="number"?a.logLevel:tt.Info,this.correlationId=a.correlationId||F.EMPTY_STRING,this.packageName=t||F.EMPTY_STRING,this.packageVersion=r||F.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:tt.Info}}clone(e,t,r){return new Ko({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:r||this.correlationId},e,t)}logMessage(e,t){if(t.logLevel>this.level||!this.piiLoggingEnabled&&t.containsPii)return;const a=`${`[${new Date().toUTCString()}] : [${t.correlationId||this.correlationId||""}]`} : ${this.packageName}@${this.packageVersion} : ${tt[t.logLevel]} - ${e}`;this.executeCallback(t.logLevel,a,t.containsPii||!1)}executeCallback(e,t,r){this.localCallback&&this.localCallback(e,t,r)}error(e,t){this.logMessage(e,{logLevel:tt.Error,containsPii:!1,correlationId:t||F.EMPTY_STRING})}errorPii(e,t){this.logMessage(e,{logLevel:tt.Error,containsPii:!0,correlationId:t||F.EMPTY_STRING})}warning(e,t){this.logMessage(e,{logLevel:tt.Warning,containsPii:!1,correlationId:t||F.EMPTY_STRING})}warningPii(e,t){this.logMessage(e,{logLevel:tt.Warning,containsPii:!0,correlationId:t||F.EMPTY_STRING})}info(e,t){this.logMessage(e,{logLevel:tt.Info,containsPii:!1,correlationId:t||F.EMPTY_STRING})}infoPii(e,t){this.logMessage(e,{logLevel:tt.Info,containsPii:!0,correlationId:t||F.EMPTY_STRING})}verbose(e,t){this.logMessage(e,{logLevel:tt.Verbose,containsPii:!1,correlationId:t||F.EMPTY_STRING})}verbosePii(e,t){this.logMessage(e,{logLevel:tt.Verbose,containsPii:!0,correlationId:t||F.EMPTY_STRING})}trace(e,t){this.logMessage(e,{logLevel:tt.Trace,containsPii:!1,correlationId:t||F.EMPTY_STRING})}tracePii(e,t){this.logMessage(e,{logLevel:tt.Trace,containsPii:!0,correlationId:t||F.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}/*! @azure/msal-common v14.16.0 2024-11-05 */const hw="@azure/msal-common",Qf="14.16.0";/*! @azure/msal-common v14.16.0 2024-11-05 */const Xf={None:"none",AzurePublic:"https://login.microsoftonline.com",AzurePpe:"https://login.windows-ppe.net",AzureChina:"https://login.chinacloudapi.cn",AzureGermany:"https://login.microsoftonline.de",AzureUsGovernment:"https://login.microsoftonline.us"};/*! @azure/msal-common v14.16.0 2024-11-05 */function Si(n,e){const t=oV(n);try{const r=e(t);return JSON.parse(r)}catch{throw Y(Gf)}}function oV(n){if(!n)throw Y(JE);const t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(n);if(!t||t.length<4)throw Y(Gf);return t[2]}function fw(n,e){if(e===0||Date.now()-3e5>n+e)throw Y(nw)}/*! @azure/msal-common v14.16.0 2024-11-05 */function zr(){return Math.round(new Date().getTime()/1e3)}function Xh(n,e){const t=Number(n)||0;return zr()+e>t}function iV(n){return Number(n)>zr()}/*! @azure/msal-common v14.16.0 2024-11-05 */function ha(n){return[aV(n),sV(n),cV(n),lV(n),uV(n)].join(tn.CACHE_KEY_SEPARATOR).toLowerCase()}function au(n,e,t,r,o){return{credentialType:ge.ID_TOKEN,homeAccountId:n,environment:e,clientId:r,secret:t,realm:o}}function su(n,e,t,r,o,a,c,d,h,m,g,v,p,w,C){var k,I;const T={homeAccountId:n,credentialType:ge.ACCESS_TOKEN,secret:t,cachedAt:zr().toString(),expiresOn:c.toString(),extendedExpiresOn:d.toString(),environment:e,clientId:r,realm:o,target:a,tokenType:g||Ge.BEARER};if(v&&(T.userAssertionHash=v),m&&(T.refreshOn=m.toString()),w&&(T.requestedClaims=w,T.requestedClaimsHash=C),((k=T.tokenType)==null?void 0:k.toLowerCase())!==Ge.BEARER.toLowerCase())switch(T.credentialType=ge.ACCESS_TOKEN_WITH_AUTH_SCHEME,T.tokenType){case Ge.POP:const N=Si(t,h);if(!((I=N==null?void 0:N.cnf)!=null&&I.kid))throw Y(cw);T.keyId=N.cnf.kid;break;case Ge.SSH:T.keyId=p}return T}function mw(n,e,t,r,o,a,c){const d={credentialType:ge.REFRESH_TOKEN,homeAccountId:n,environment:e,clientId:r,secret:t};return a&&(d.userAssertionHash=a),o&&(d.familyId=o),c&&(d.expiresOn=c.toString()),d}function Zf(n){return n.hasOwnProperty("homeAccountId")&&n.hasOwnProperty("environment")&&n.hasOwnProperty("credentialType")&&n.hasOwnProperty("clientId")&&n.hasOwnProperty("secret")}function $v(n){return n?Zf(n)&&n.hasOwnProperty("realm")&&n.hasOwnProperty("target")&&(n.credentialType===ge.ACCESS_TOKEN||n.credentialType===ge.ACCESS_TOKEN_WITH_AUTH_SCHEME):!1}function Kv(n){return n?Zf(n)&&n.hasOwnProperty("realm")&&n.credentialType===ge.ID_TOKEN:!1}function Wv(n){return n?Zf(n)&&n.credentialType===ge.REFRESH_TOKEN:!1}function aV(n){return[n.homeAccountId,n.environment].join(tn.CACHE_KEY_SEPARATOR).toLowerCase()}function sV(n){const e=n.credentialType===ge.REFRESH_TOKEN&&n.familyId||n.clientId;return[n.credentialType,e,n.realm||""].join(tn.CACHE_KEY_SEPARATOR).toLowerCase()}function cV(n){return(n.target||"").toLowerCase()}function lV(n){return(n.requestedClaimsHash||"").toLowerCase()}function uV(n){return n.tokenType&&n.tokenType.toLowerCase()!==Ge.BEARER.toLowerCase()?n.tokenType.toLowerCase():""}function dV(n,e){const t=n.indexOf(Wt.CACHE_KEY)===0;let r=!0;return e&&(r=e.hasOwnProperty("failedRequests")&&e.hasOwnProperty("errors")&&e.hasOwnProperty("cacheHits")),t&&r}function hV(n,e){let t=!1;n&&(t=n.indexOf(_s.THROTTLING_PREFIX)===0);let r=!0;return e&&(r=e.hasOwnProperty("throttleTime")),t&&r}function fV({environment:n,clientId:e}){return[Kf,n,e].join(tn.CACHE_KEY_SEPARATOR).toLowerCase()}function mV(n,e){return e?n.indexOf(Kf)===0&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("environment"):!1}function gV(n,e){return e?n.indexOf(Al.CACHE_KEY)===0&&e.hasOwnProperty("aliases")&&e.hasOwnProperty("preferred_cache")&&e.hasOwnProperty("preferred_network")&&e.hasOwnProperty("canonical_authority")&&e.hasOwnProperty("authorization_endpoint")&&e.hasOwnProperty("token_endpoint")&&e.hasOwnProperty("issuer")&&e.hasOwnProperty("aliasesFromNetwork")&&e.hasOwnProperty("endpointsFromNetwork")&&e.hasOwnProperty("expiresAt")&&e.hasOwnProperty("jwks_uri"):!1}function zv(){return zr()+Al.REFRESH_TIME_SECONDS}function Gc(n,e,t){n.authorization_endpoint=e.authorization_endpoint,n.token_endpoint=e.token_endpoint,n.end_session_endpoint=e.end_session_endpoint,n.issuer=e.issuer,n.endpointsFromNetwork=t,n.jwks_uri=e.jwks_uri}function ih(n,e,t){n.aliases=e.aliases,n.preferred_cache=e.preferred_cache,n.preferred_network=e.preferred_network,n.aliasesFromNetwork=t}function Gv(n){return n.expiresAt<=zr()}/*! @azure/msal-common v14.16.0 2024-11-05 */const gw="redirect_uri_empty",pV="claims_request_parsing_error",pw="authority_uri_insecure",cs="url_parse_error",_w="empty_url_error",vw="empty_input_scopes_error",yw="invalid_prompt_value",em="invalid_claims",Cw="token_request_empty",Ew="logout_request_empty",ww="invalid_code_challenge_method",tm="pkce_params_missing",nm="invalid_cloud_discovery_metadata",Tw="invalid_authority_metadata",bw="untrusted_authority",cu="missing_ssh_jwk",Iw="missing_ssh_kid",_V="missing_nonce_authentication_header",vV="invalid_authentication_header",Sw="cannot_set_OIDCOptions",Aw="cannot_allow_native_broker",kw="authority_mismatch";/*! @azure/msal-common v14.16.0 2024-11-05 */const yV={[gw]:"A redirect URI is required for all calls, and none has been set.",[pV]:"Could not parse the given claims request object.",[pw]:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options",[cs]:"URL could not be parsed into appropriate segments.",[_w]:"URL was empty or null.",[vw]:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",[yw]:"Please see here for valid configuration options: https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#commonauthorizationurlrequest",[em]:"Given claims parameter must be a stringified JSON object.",[Cw]:"Token request was empty and not found in cache.",[Ew]:"The logout request was null or undefined.",[ww]:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',[tm]:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",[nm]:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",[Tw]:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",[bw]:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",[cu]:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",[Iw]:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",[_V]:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",[vV]:"Invalid authentication header provided",[Sw]:"Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",[Aw]:"Cannot set allowNativeBroker parameter to true when not in AAD protocol mode.",[kw]:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority."};class rm extends lt{constructor(e){super(e,yV[e]),this.name="ClientConfigurationError",Object.setPrototypeOf(this,rm.prototype)}}function Xe(n){return new rm(n)}/*! @azure/msal-common v14.16.0 2024-11-05 */class vr{static isEmptyObj(e){if(e)try{const t=JSON.parse(e);return Object.keys(t).length===0}catch{}return!0}static startsWith(e,t){return e.indexOf(t)===0}static endsWith(e,t){return e.length>=t.length&&e.lastIndexOf(t)===e.length-t.length}static queryStringToObject(e){const t={},r=e.split("&"),o=a=>decodeURIComponent(a.replace(/\+/g," "));return r.forEach(a=>{if(a.trim()){const[c,d]=a.split(/=(.+)/g,2);c&&d&&(t[o(c)]=o(d))}}),t}static trimArrayEntries(e){return e.map(t=>t.trim())}static removeEmptyStringsFromArray(e){return e.filter(t=>!!t)}static jsonParseHelper(e){try{return JSON.parse(e)}catch{return null}}static matchPattern(e,t){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(t)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class vt{constructor(e){const t=e?vr.trimArrayEntries([...e]):[],r=t?vr.removeEmptyStringsFromArray(t):[];this.validateInputScopes(r),this.scopes=new Set,r.forEach(o=>this.scopes.add(o))}static fromString(e){const r=(e||F.EMPTY_STRING).split(" ");return new vt(r)}static createSearchScopes(e){const t=new vt(e);return t.containsOnlyOIDCScopes()?t.removeScope(F.OFFLINE_ACCESS_SCOPE):t.removeOIDCScopes(),t}validateInputScopes(e){if(!e||e.length<1)throw Xe(vw)}containsScope(e){const t=this.printScopesLowerCase().split(" "),r=new vt(t);return e?r.scopes.has(e.toLowerCase()):!1}containsScopeSet(e){return!e||e.scopes.size<=0?!1:this.scopes.size>=e.scopes.size&&e.asArray().every(t=>this.containsScope(t))}containsOnlyOIDCScopes(){let e=0;return xv.forEach(t=>{this.containsScope(t)&&(e+=1)}),this.scopes.size===e}appendScope(e){e&&this.scopes.add(e.trim())}appendScopes(e){try{e.forEach(t=>this.appendScope(t))}catch{throw Y(aw)}}removeScope(e){if(!e)throw Y(iw);this.scopes.delete(e.trim())}removeOIDCScopes(){xv.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw Y(jh);const t=new Set;return e.scopes.forEach(r=>t.add(r.toLowerCase())),this.scopes.forEach(r=>t.add(r.toLowerCase())),t}intersectingScopeSets(e){if(!e)throw Y(jh);e.containsOnlyOIDCScopes()||e.removeOIDCScopes();const t=this.unionScopeSets(e),r=e.getScopeCount(),o=this.getScopeCount();return t.size<o+r}getScopeCount(){return this.scopes.size}asArray(){const e=[];return this.scopes.forEach(t=>e.push(t)),e}printScopes(){return this.scopes?this.asArray().join(" "):F.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}/*! @azure/msal-common v14.16.0 2024-11-05 */function Rl(n,e){if(!n)throw Y(YE);try{const t=e(n);return JSON.parse(t)}catch{throw Y(zf)}}function fa(n){if(!n)throw Y(zf);const e=n.split(tn.CLIENT_INFO_SEPARATOR,2);return{uid:e[0],utid:e.length<2?F.EMPTY_STRING:e[1]}}/*! @azure/msal-common v14.16.0 2024-11-05 */function Ol(n,e){return!!n&&!!e&&n===e.split(".")[1]}function om(n,e,t,r){if(r){const{oid:o,sub:a,tid:c,name:d,tfp:h,acr:m}=r,g=c||h||m||"";return{tenantId:g,localAccountId:o||a||"",name:d,isHomeTenant:Ol(g,n)}}else return{tenantId:t,localAccountId:e,isHomeTenant:Ol(t,n)}}function im(n,e,t,r){let o=n;if(e){const{isHomeTenant:a,...c}=e;o={...n,...c}}if(t){const{isHomeTenant:a,...c}=om(n.homeAccountId,n.localAccountId,n.tenantId,t);return o={...o,...c,idTokenClaims:t,idToken:r},o}return o}/*! @azure/msal-common v14.16.0 2024-11-05 */const mr={Default:0,Adfs:1,Dsts:2,Ciam:3};/*! @azure/msal-common v14.16.0 2024-11-05 */function Nw(n){return n&&(n.tid||n.tfp||n.acr)||null}/*! @azure/msal-common v14.16.0 2024-11-05 */const fo={AAD:"AAD",OIDC:"OIDC"};/*! @azure/msal-common v14.16.0 2024-11-05 */class Pt{generateAccountId(){return[this.homeAccountId,this.environment].join(tn.CACHE_KEY_SEPARATOR).toLowerCase()}generateAccountKey(){return Pt.generateAccountCacheKey({homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId})}getAccountInfo(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,name:this.name,nativeAccountId:this.nativeAccountId,authorityType:this.authorityType,tenantProfiles:new Map((this.tenantProfiles||[]).map(e=>[e.tenantId,e]))}}isSingleTenant(){return!this.tenantProfiles}static generateAccountCacheKey(e){const t=e.homeAccountId.split(".")[1];return[e.homeAccountId,e.environment||"",t||e.tenantId||""].join(tn.CACHE_KEY_SEPARATOR).toLowerCase()}static createAccount(e,t,r){var m,g,v,p,w,C;const o=new Pt;t.authorityType===mr.Adfs?o.authorityType=Wc.ADFS_ACCOUNT_TYPE:t.protocolMode===fo.AAD?o.authorityType=Wc.MSSTS_ACCOUNT_TYPE:o.authorityType=Wc.GENERIC_ACCOUNT_TYPE;let a;e.clientInfo&&r&&(a=Rl(e.clientInfo,r)),o.clientInfo=e.clientInfo,o.homeAccountId=e.homeAccountId,o.nativeAccountId=e.nativeAccountId;const c=e.environment||t&&t.getPreferredCache();if(!c)throw Y(Yf);o.environment=c,o.realm=(a==null?void 0:a.utid)||Nw(e.idTokenClaims)||"",o.localAccountId=(a==null?void 0:a.uid)||((m=e.idTokenClaims)==null?void 0:m.oid)||((g=e.idTokenClaims)==null?void 0:g.sub)||"";const d=((v=e.idTokenClaims)==null?void 0:v.preferred_username)||((p=e.idTokenClaims)==null?void 0:p.upn),h=(w=e.idTokenClaims)!=null&&w.emails?e.idTokenClaims.emails[0]:null;if(o.username=d||h||"",o.name=((C=e.idTokenClaims)==null?void 0:C.name)||"",o.cloudGraphHostName=e.cloudGraphHostName,o.msGraphHost=e.msGraphHost,e.tenantProfiles)o.tenantProfiles=e.tenantProfiles;else{const T=om(e.homeAccountId,o.localAccountId,o.realm,e.idTokenClaims);o.tenantProfiles=[T]}return o}static createFromAccountInfo(e,t,r){var a;const o=new Pt;return o.authorityType=e.authorityType||Wc.GENERIC_ACCOUNT_TYPE,o.homeAccountId=e.homeAccountId,o.localAccountId=e.localAccountId,o.nativeAccountId=e.nativeAccountId,o.realm=e.tenantId,o.environment=e.environment,o.username=e.username,o.name=e.name,o.cloudGraphHostName=t,o.msGraphHost=r,o.tenantProfiles=Array.from(((a=e.tenantProfiles)==null?void 0:a.values())||[]),o}static generateHomeAccountId(e,t,r,o,a){if(!(t===mr.Adfs||t===mr.Dsts)){if(e)try{const c=Rl(e,o.base64Decode);if(c.uid&&c.utid)return`${c.uid}.${c.utid}`}catch{}r.warning("No client info in response")}return(a==null?void 0:a.sub)||""}static isAccountEntity(e){return e?e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType"):!1}static accountInfoIsEqual(e,t,r){if(!e||!t)return!1;let o=!0;if(r){const a=e.idTokenClaims||{},c=t.idTokenClaims||{};o=a.iat===c.iat&&a.nonce===c.nonce}return e.homeAccountId===t.homeAccountId&&e.localAccountId===t.localAccountId&&e.username===t.username&&e.tenantId===t.tenantId&&e.environment===t.environment&&e.nativeAccountId===t.nativeAccountId&&o}}/*! @azure/msal-common v14.16.0 2024-11-05 */function Rw(n){return n.startsWith("#/")?n.substring(2):n.startsWith("#")||n.startsWith("?")?n.substring(1):n}function Pl(n){if(!n||n.indexOf("=")<0)return null;try{const e=Rw(n),t=Object.fromEntries(new URLSearchParams(e));if(t.code||t.error||t.error_description||t.state)return t}catch{throw Y(ZE)}return null}/*! @azure/msal-common v14.16.0 2024-11-05 */class De{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,!this._urlString)throw Xe(_w);e.includes("#")||(this._urlString=De.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let t=e.toLowerCase();return vr.endsWith(t,"?")?t=t.slice(0,-1):vr.endsWith(t,"?/")&&(t=t.slice(0,-2)),vr.endsWith(t,"/")||(t+="/"),t}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch{throw Xe(cs)}if(!e.HostNameAndPort||!e.PathSegments)throw Xe(cs);if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw Xe(pw)}static appendQueryString(e,t){return t?e.indexOf("?")<0?`${e}?${t}`:`${e}&${t}`:e}static removeHashFromUrl(e){return De.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const t=this.getUrlComponents(),r=t.PathSegments;return e&&r.length!==0&&(r[0]===Ho.COMMON||r[0]===Ho.ORGANIZATIONS)&&(r[0]=e),De.constructAuthorityUriFromObject(t)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),t=this.urlString.match(e);if(!t)throw Xe(cs);const r={Protocol:t[1],HostNameAndPort:t[4],AbsolutePath:t[5],QueryString:t[7]};let o=r.AbsolutePath.split("/");return o=o.filter(a=>a&&a.length>0),r.PathSegments=o,r.QueryString&&r.QueryString.endsWith("/")&&(r.QueryString=r.QueryString.substring(0,r.QueryString.length-1)),r}static getDomainFromUrl(e){const t=RegExp("^([^:/?#]+://)?([^/?#]*)"),r=e.match(t);if(!r)throw Xe(cs);return r[2]}static getAbsoluteUrl(e,t){if(e[0]===F.FORWARD_SLASH){const o=new De(t).getUrlComponents();return o.Protocol+"//"+o.HostNameAndPort+e}return e}static constructAuthorityUriFromObject(e){return new De(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static hashContainsKnownProperties(e){return!!Pl(e)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Ow={endpointMetadata:{"login.microsoftonline.com":{token_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/logout"},"login.chinacloudapi.cn":{token_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.chinacloudapi.cn/{tenantid}/discovery/v2.0/keys",issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",authorization_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/logout"},"login.microsoftonline.us":{token_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.us/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/logout"}},instanceDiscoveryMetadata:{tenant_discovery_endpoint:"https://{canonicalAuthority}/v2.0/.well-known/openid-configuration",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]}},qv=Ow.endpointMetadata,am=Ow.instanceDiscoveryMetadata,Pw=new Set;am.metadata.forEach(n=>{n.aliases.forEach(e=>{Pw.add(e)})});function CV(n,e){var o;let t;const r=n.canonicalAuthority;if(r){const a=new De(r).getUrlComponents().HostNameAndPort;t=jv(a,(o=n.cloudDiscoveryMetadata)==null?void 0:o.metadata,On.CONFIG,e)||jv(a,am.metadata,On.HARDCODED_VALUES,e)||n.knownAuthorities}return t||[]}function jv(n,e,t,r){if(r==null||r.trace(`getAliasesFromMetadata called with source: ${t}`),n&&e){const o=Ml(e,n);if(o)return r==null||r.trace(`getAliasesFromMetadata: found cloud discovery metadata in ${t}, returning aliases`),o.aliases;r==null||r.trace(`getAliasesFromMetadata: did not find cloud discovery metadata in ${t}`)}return null}function EV(n){return Ml(am.metadata,n)}function Ml(n,e){for(let t=0;t<n.length;t++){const r=n[t];if(r.aliases.includes(e))return r}return null}/*! @azure/msal-common v14.16.0 2024-11-05 */const Mw="cache_quota_exceeded",sm="cache_error_unknown";/*! @azure/msal-common v14.16.0 2024-11-05 */const ah={[Mw]:"Exceeded cache storage capacity.",[sm]:"Unexpected error occurred when using cache storage."};class pa extends Error{constructor(e,t){const r=t||(ah[e]?ah[e]:ah[sm]);super(`${e}: ${r}`),Object.setPrototypeOf(this,pa.prototype),this.name="CacheError",this.errorCode=e,this.errorMessage=r}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Ta{constructor(e,t,r,o){this.clientId=e,this.cryptoImpl=t,this.commonLogger=r.clone(hw,Qf),this.staticAuthorityOptions=o}getAllAccounts(e){return this.buildTenantProfiles(this.getAccountsFilteredBy(e||{}),e)}getAccountInfoFilteredBy(e){const t=this.getAllAccounts(e);return t.length>1?t.sort(o=>o.idTokenClaims?-1:1)[0]:t.length===1?t[0]:null}getBaseAccountInfo(e){const t=this.getAccountsFilteredBy(e);return t.length>0?t[0].getAccountInfo():null}buildTenantProfiles(e,t){return e.flatMap(r=>this.getTenantProfilesFromAccountEntity(r,t==null?void 0:t.tenantId,t))}getTenantedAccountInfoByFilter(e,t,r,o){let a=null,c;if(o&&!this.tenantProfileMatchesFilter(r,o))return null;const d=this.getIdToken(e,t,r.tenantId);return d&&(c=Si(d.secret,this.cryptoImpl.base64Decode),!this.idTokenClaimsMatchTenantProfileFilter(c,o))?null:(a=im(e,r,c,d==null?void 0:d.secret),a)}getTenantProfilesFromAccountEntity(e,t,r){const o=e.getAccountInfo();let a=o.tenantProfiles||new Map;const c=this.getTokenKeys();if(t){const h=a.get(t);if(h)a=new Map([[t,h]]);else return[]}const d=[];return a.forEach(h=>{const m=this.getTenantedAccountInfoByFilter(o,c,h,r);m&&d.push(m)}),d}tenantProfileMatchesFilter(e,t){return!(t.localAccountId&&!this.matchLocalAccountIdFromTenantProfile(e,t.localAccountId)||t.name&&e.name!==t.name||t.isHomeTenant!==void 0&&e.isHomeTenant!==t.isHomeTenant)}idTokenClaimsMatchTenantProfileFilter(e,t){return!(t&&(t.localAccountId&&!this.matchLocalAccountIdFromTokenClaims(e,t.localAccountId)||t.loginHint&&!this.matchLoginHintFromTokenClaims(e,t.loginHint)||t.username&&!this.matchUsername(e.preferred_username,t.username)||t.name&&!this.matchName(e,t.name)||t.sid&&!this.matchSid(e,t.sid)))}async saveCacheRecord(e,t,r){var o,a,c,d;if(!e)throw Y(sw);try{e.account&&this.setAccount(e.account),e.idToken&&(t==null?void 0:t.idToken)!==!1&&this.setIdTokenCredential(e.idToken),e.accessToken&&(t==null?void 0:t.accessToken)!==!1&&await this.saveAccessToken(e.accessToken),e.refreshToken&&(t==null?void 0:t.refreshToken)!==!1&&this.setRefreshTokenCredential(e.refreshToken),e.appMetadata&&this.setAppMetadata(e.appMetadata)}catch(h){throw(o=this.commonLogger)==null||o.error("CacheManager.saveCacheRecord: failed"),h instanceof Error?((a=this.commonLogger)==null||a.errorPii(`CacheManager.saveCacheRecord: ${h.message}`,r),h.name==="QuotaExceededError"||h.name==="NS_ERROR_DOM_QUOTA_REACHED"||h.message.includes("exceeded the quota")?((c=this.commonLogger)==null||c.error("CacheManager.saveCacheRecord: exceeded storage quota",r),new pa(Mw)):new pa(h.name,h.message)):((d=this.commonLogger)==null||d.errorPii(`CacheManager.saveCacheRecord: ${h}`,r),new pa(sm))}}async saveAccessToken(e){const t={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType,requestedClaimsHash:e.requestedClaimsHash},r=this.getTokenKeys(),o=vt.fromString(e.target),a=[];r.accessToken.forEach(c=>{if(!this.accessTokenKeyMatchesFilter(c,t,!1))return;const d=this.getAccessTokenCredential(c);d&&this.credentialMatchesFilter(d,t)&&vt.fromString(d.target).intersectingScopeSets(o)&&a.push(this.removeAccessToken(c))}),await Promise.all(a),this.setAccessTokenCredential(e)}getAccountsFilteredBy(e){const t=this.getAccountKeys(),r=[];return t.forEach(o=>{var h;if(!this.isAccountKey(o,e.homeAccountId))return;const a=this.getAccount(o,this.commonLogger);if(!a||e.homeAccountId&&!this.matchHomeAccountId(a,e.homeAccountId)||e.username&&!this.matchUsername(a.username,e.username)||e.environment&&!this.matchEnvironment(a,e.environment)||e.realm&&!this.matchRealm(a,e.realm)||e.nativeAccountId&&!this.matchNativeAccountId(a,e.nativeAccountId)||e.authorityType&&!this.matchAuthorityType(a,e.authorityType))return;const c={localAccountId:e==null?void 0:e.localAccountId,name:e==null?void 0:e.name},d=(h=a.tenantProfiles)==null?void 0:h.filter(m=>this.tenantProfileMatchesFilter(m,c));d&&d.length===0||r.push(a)}),r}isAccountKey(e,t,r){return!(e.split(tn.CACHE_KEY_SEPARATOR).length<3||t&&!e.toLowerCase().includes(t.toLowerCase())||r&&!e.toLowerCase().includes(r.toLowerCase()))}isCredentialKey(e){if(e.split(tn.CACHE_KEY_SEPARATOR).length<6)return!1;const t=e.toLowerCase();if(t.indexOf(ge.ID_TOKEN.toLowerCase())===-1&&t.indexOf(ge.ACCESS_TOKEN.toLowerCase())===-1&&t.indexOf(ge.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())===-1&&t.indexOf(ge.REFRESH_TOKEN.toLowerCase())===-1)return!1;if(t.indexOf(ge.REFRESH_TOKEN.toLowerCase())>-1){const r=`${ge.REFRESH_TOKEN}${tn.CACHE_KEY_SEPARATOR}${this.clientId}${tn.CACHE_KEY_SEPARATOR}`,o=`${ge.REFRESH_TOKEN}${tn.CACHE_KEY_SEPARATOR}${ps}${tn.CACHE_KEY_SEPARATOR}`;if(t.indexOf(r.toLowerCase())===-1&&t.indexOf(o.toLowerCase())===-1)return!1}else if(t.indexOf(this.clientId.toLowerCase())===-1)return!1;return!0}credentialMatchesFilter(e,t){return!(t.clientId&&!this.matchClientId(e,t.clientId)||t.userAssertionHash&&!this.matchUserAssertionHash(e,t.userAssertionHash)||typeof t.homeAccountId=="string"&&!this.matchHomeAccountId(e,t.homeAccountId)||t.environment&&!this.matchEnvironment(e,t.environment)||t.realm&&!this.matchRealm(e,t.realm)||t.credentialType&&!this.matchCredentialType(e,t.credentialType)||t.familyId&&!this.matchFamilyId(e,t.familyId)||t.target&&!this.matchTarget(e,t.target)||(t.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==t.requestedClaimsHash||e.credentialType===ge.ACCESS_TOKEN_WITH_AUTH_SCHEME&&(t.tokenType&&!this.matchTokenType(e,t.tokenType)||t.tokenType===Ge.SSH&&t.keyId&&!this.matchKeyId(e,t.keyId)))}getAppMetadataFilteredBy(e){const t=this.getKeys(),r={};return t.forEach(o=>{if(!this.isAppMetadata(o))return;const a=this.getAppMetadata(o);a&&(e.environment&&!this.matchEnvironment(a,e.environment)||e.clientId&&!this.matchClientId(a,e.clientId)||(r[o]=a))}),r}getAuthorityMetadataByAlias(e){const t=this.getAuthorityMetadataKeys();let r=null;return t.forEach(o=>{if(!this.isAuthorityMetadata(o)||o.indexOf(this.clientId)===-1)return;const a=this.getAuthorityMetadata(o);a&&a.aliases.indexOf(e)!==-1&&(r=a)}),r}async removeAllAccounts(){const e=this.getAccountKeys(),t=[];e.forEach(r=>{t.push(this.removeAccount(r))}),await Promise.all(t)}async removeAccount(e){const t=this.getAccount(e,this.commonLogger);t&&(await this.removeAccountContext(t),this.removeItem(e))}async removeAccountContext(e){const t=this.getTokenKeys(),r=e.generateAccountId(),o=[];t.idToken.forEach(a=>{a.indexOf(r)===0&&this.removeIdToken(a)}),t.accessToken.forEach(a=>{a.indexOf(r)===0&&o.push(this.removeAccessToken(a))}),t.refreshToken.forEach(a=>{a.indexOf(r)===0&&this.removeRefreshToken(a)}),await Promise.all(o)}updateOutdatedCachedAccount(e,t,r){var o;if(t&&t.isSingleTenant()){(o=this.commonLogger)==null||o.verbose("updateOutdatedCachedAccount: Found a single-tenant (outdated) account entity in the cache, migrating to multi-tenant account entity");const a=this.getAccountKeys().filter(g=>g.startsWith(t.homeAccountId)),c=[];a.forEach(g=>{const v=this.getCachedAccountEntity(g);v&&c.push(v)});const d=c.find(g=>Ol(g.realm,g.homeAccountId))||c[0];d.tenantProfiles=c.map(g=>({tenantId:g.realm,localAccountId:g.localAccountId,name:g.name,isHomeTenant:Ol(g.realm,g.homeAccountId)}));const h=Ta.toObject(new Pt,{...d}),m=h.generateAccountKey();return a.forEach(g=>{g!==m&&this.removeOutdatedAccount(e)}),this.setAccount(h),r==null||r.verbose("Updated an outdated account entity in the cache"),h}return t}async removeAccessToken(e){const t=this.getAccessTokenCredential(e);if(t){if(t.credentialType.toLowerCase()===ge.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()&&t.tokenType===Ge.POP){const o=t.keyId;if(o)try{await this.cryptoImpl.removeTokenBindingKey(o)}catch{throw Y(uw)}}return this.removeItem(e)}}removeAppMetadata(){return this.getKeys().forEach(t=>{this.isAppMetadata(t)&&this.removeItem(t)}),!0}readAccountFromCache(e){const t=Pt.generateAccountCacheKey(e);return this.getAccount(t,this.commonLogger)}getIdToken(e,t,r,o,a){this.commonLogger.trace("CacheManager - getIdToken called");const c={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:ge.ID_TOKEN,clientId:this.clientId,realm:r},d=this.getIdTokensByFilter(c,t),h=d.size;if(h<1)return this.commonLogger.info("CacheManager:getIdToken - No token found"),null;if(h>1){let m=d;if(!r){const g=new Map;d.forEach((p,w)=>{p.realm===e.tenantId&&g.set(w,p)});const v=g.size;if(v<1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result"),d.values().next().value;if(v===1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile"),g.values().next().value;m=g}return this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them"),m.forEach((g,v)=>{this.removeIdToken(v)}),o&&a&&o.addFields({multiMatchedID:d.size},a),null}return this.commonLogger.info("CacheManager:getIdToken - Returning ID token"),d.values().next().value}getIdTokensByFilter(e,t){const r=t&&t.idToken||this.getTokenKeys().idToken,o=new Map;return r.forEach(a=>{if(!this.idTokenKeyMatchesFilter(a,{clientId:this.clientId,...e}))return;const c=this.getIdTokenCredential(a);c&&this.credentialMatchesFilter(c,e)&&o.set(a,c)}),o}idTokenKeyMatchesFilter(e,t){const r=e.toLowerCase();return!(t.clientId&&r.indexOf(t.clientId.toLowerCase())===-1||t.homeAccountId&&r.indexOf(t.homeAccountId.toLowerCase())===-1)}removeIdToken(e){this.removeItem(e)}removeRefreshToken(e){this.removeItem(e)}getAccessToken(e,t,r,o,a,c){this.commonLogger.trace("CacheManager - getAccessToken called");const d=vt.createSearchScopes(t.scopes),h=t.authenticationScheme||Ge.BEARER,m=h&&h.toLowerCase()!==Ge.BEARER.toLowerCase()?ge.ACCESS_TOKEN_WITH_AUTH_SCHEME:ge.ACCESS_TOKEN,g={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:m,clientId:this.clientId,realm:o||e.tenantId,target:d,tokenType:h,keyId:t.sshKid,requestedClaimsHash:t.requestedClaimsHash},v=r&&r.accessToken||this.getTokenKeys().accessToken,p=[];v.forEach(C=>{if(this.accessTokenKeyMatchesFilter(C,g,!0)){const T=this.getAccessTokenCredential(C);T&&this.credentialMatchesFilter(T,g)&&p.push(T)}});const w=p.length;return w<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found"),null):w>1?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them"),p.forEach(C=>{this.removeAccessToken(ha(C))}),a&&c&&a.addFields({multiMatchedAT:p.length},c),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token"),p[0])}accessTokenKeyMatchesFilter(e,t,r){const o=e.toLowerCase();if(t.clientId&&o.indexOf(t.clientId.toLowerCase())===-1||t.homeAccountId&&o.indexOf(t.homeAccountId.toLowerCase())===-1||t.realm&&o.indexOf(t.realm.toLowerCase())===-1||t.requestedClaimsHash&&o.indexOf(t.requestedClaimsHash.toLowerCase())===-1)return!1;if(t.target){const a=t.target.asArray();for(let c=0;c<a.length;c++){if(r&&!o.includes(a[c].toLowerCase()))return!1;if(!r&&o.includes(a[c].toLowerCase()))return!0}}return!0}getAccessTokensByFilter(e){const t=this.getTokenKeys(),r=[];return t.accessToken.forEach(o=>{if(!this.accessTokenKeyMatchesFilter(o,e,!0))return;const a=this.getAccessTokenCredential(o);a&&this.credentialMatchesFilter(a,e)&&r.push(a)}),r}getRefreshToken(e,t,r,o,a){this.commonLogger.trace("CacheManager - getRefreshToken called");const c=t?ps:void 0,d={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:ge.REFRESH_TOKEN,clientId:this.clientId,familyId:c},h=r&&r.refreshToken||this.getTokenKeys().refreshToken,m=[];h.forEach(v=>{if(this.refreshTokenKeyMatchesFilter(v,d)){const p=this.getRefreshTokenCredential(v);p&&this.credentialMatchesFilter(p,d)&&m.push(p)}});const g=m.length;return g<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(g>1&&o&&a&&o.addFields({multiMatchedRT:g},a),this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),m[0])}refreshTokenKeyMatchesFilter(e,t){const r=e.toLowerCase();return!(t.familyId&&r.indexOf(t.familyId.toLowerCase())===-1||!t.familyId&&t.clientId&&r.indexOf(t.clientId.toLowerCase())===-1||t.homeAccountId&&r.indexOf(t.homeAccountId.toLowerCase())===-1)}readAppMetadataFromCache(e){const t={environment:e,clientId:this.clientId},r=this.getAppMetadataFilteredBy(t),o=Object.keys(r).map(c=>r[c]),a=o.length;if(a<1)return null;if(a>1)throw Y(rw);return o[0]}isAppMetadataFOCI(e){const t=this.readAppMetadataFromCache(e);return!!(t&&t.familyId===ps)}matchHomeAccountId(e,t){return typeof e.homeAccountId=="string"&&t===e.homeAccountId}matchLocalAccountIdFromTokenClaims(e,t){const r=e.oid||e.sub;return t===r}matchLocalAccountIdFromTenantProfile(e,t){return e.localAccountId===t}matchName(e,t){var r;return t.toLowerCase()===((r=e.name)==null?void 0:r.toLowerCase())}matchUsername(e,t){return!!(e&&typeof e=="string"&&(t==null?void 0:t.toLowerCase())===e.toLowerCase())}matchUserAssertionHash(e,t){return!!(e.userAssertionHash&&t===e.userAssertionHash)}matchEnvironment(e,t){if(this.staticAuthorityOptions){const o=CV(this.staticAuthorityOptions,this.commonLogger);if(o.includes(t)&&o.includes(e.environment))return!0}const r=this.getAuthorityMetadataByAlias(t);return!!(r&&r.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,t){return e.credentialType&&t.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,t){return!!(e.clientId&&t===e.clientId)}matchFamilyId(e,t){return!!(e.familyId&&t===e.familyId)}matchRealm(e,t){var r;return((r=e.realm)==null?void 0:r.toLowerCase())===t.toLowerCase()}matchNativeAccountId(e,t){return!!(e.nativeAccountId&&t===e.nativeAccountId)}matchLoginHintFromTokenClaims(e,t){return e.login_hint===t||e.preferred_username===t||e.upn===t}matchSid(e,t){return e.sid===t}matchAuthorityType(e,t){return!!(e.authorityType&&t.toLowerCase()===e.authorityType.toLowerCase())}matchTarget(e,t){return e.credentialType!==ge.ACCESS_TOKEN&&e.credentialType!==ge.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target?!1:vt.fromString(e.target).containsScopeSet(t)}matchTokenType(e,t){return!!(e.tokenType&&e.tokenType===t)}matchKeyId(e,t){return!!(e.keyId&&e.keyId===t)}isAppMetadata(e){return e.indexOf(Kf)!==-1}isAuthorityMetadata(e){return e.indexOf(Al.CACHE_KEY)!==-1}generateAuthorityMetadataCacheKey(e){return`${Al.CACHE_KEY}-${this.clientId}-${e}`}static toObject(e,t){for(const r in t)e[r]=t[r];return e}}class wV extends Ta{setAccount(){throw Y(Ae)}getAccount(){throw Y(Ae)}getCachedAccountEntity(){throw Y(Ae)}setIdTokenCredential(){throw Y(Ae)}getIdTokenCredential(){throw Y(Ae)}setAccessTokenCredential(){throw Y(Ae)}getAccessTokenCredential(){throw Y(Ae)}setRefreshTokenCredential(){throw Y(Ae)}getRefreshTokenCredential(){throw Y(Ae)}setAppMetadata(){throw Y(Ae)}getAppMetadata(){throw Y(Ae)}setServerTelemetry(){throw Y(Ae)}getServerTelemetry(){throw Y(Ae)}setAuthorityMetadata(){throw Y(Ae)}getAuthorityMetadata(){throw Y(Ae)}getAuthorityMetadataKeys(){throw Y(Ae)}setThrottlingCache(){throw Y(Ae)}getThrottlingCache(){throw Y(Ae)}removeItem(){throw Y(Ae)}getKeys(){throw Y(Ae)}getAccountKeys(){throw Y(Ae)}getTokenKeys(){throw Y(Ae)}updateCredentialCacheKey(){throw Y(Ae)}removeOutdatedAccount(){throw Y(Ae)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Dw={tokenRenewalOffsetSeconds:WF,preventCorsPreflight:!1},TV={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:tt.Info,correlationId:F.EMPTY_STRING},bV={claimsBasedCachingEnabled:!1},IV={async sendGetRequestAsync(){throw Y(Ae)},async sendPostRequestAsync(){throw Y(Ae)}},SV={sku:F.SKU,version:Qf,cpu:F.EMPTY_STRING,os:F.EMPTY_STRING},AV={clientSecret:F.EMPTY_STRING,clientAssertion:void 0},kV={azureCloudInstance:Xf.None,tenant:`${F.DEFAULT_COMMON_TENANT}`},NV={application:{appName:"",appVersion:""}};function RV({authOptions:n,systemOptions:e,loggerOptions:t,cacheOptions:r,storageInterface:o,networkInterface:a,cryptoInterface:c,clientCredentials:d,libraryInfo:h,telemetry:m,serverTelemetryManager:g,persistencePlugin:v,serializableCache:p}){const w={...TV,...t};return{authOptions:OV(n),systemOptions:{...Dw,...e},loggerOptions:w,cacheOptions:{...bV,...r},storageInterface:o||new wV(n.clientId,Nl,new Ko(w)),networkInterface:a||IV,cryptoInterface:c||Nl,clientCredentials:d||AV,libraryInfo:{...SV,...h},telemetry:{...NV,...m},serverTelemetryManager:g||null,persistencePlugin:v||null,serializableCache:p||null}}function OV(n){return{clientCapabilities:[],azureCloudOptions:kV,skipAuthorityMetadataCache:!1,instanceAware:!1,...n}}function Zh(n){return n.authOptions.authority.options.protocolMode===fo.OIDC}/*! @azure/msal-common v14.16.0 2024-11-05 */const Bn={HOME_ACCOUNT_ID:"home_account_id",UPN:"UPN"};/*! @azure/msal-common v14.16.0 2024-11-05 */const wi="client_id",Lw="redirect_uri",Yv="response_type",PV="response_mode",MV="grant_type",DV="claims",LV="scope",xV="refresh_token",UV="state",BV="nonce",FV="prompt",VV="code",HV="code_challenge",$V="code_challenge_method",KV="code_verifier",WV="client-request-id",zV="x-client-SKU",GV="x-client-VER",qV="x-client-OS",jV="x-client-CPU",YV="x-client-current-telemetry",JV="x-client-last-telemetry",QV="x-ms-lib-capability",XV="x-app-name",ZV="x-app-ver",e2="post_logout_redirect_uri",t2="id_token_hint",n2="device_code",r2="client_secret",o2="client_assertion",i2="client_assertion_type",Jv="token_type",Qv="req_cnf",a2="assertion",s2="requested_token_use",Xv="return_spa_code",c2="nativebroker",l2="logout_hint",u2="sid",d2="login_hint",h2="domain_hint",f2="x-client-xtra-sku",cm="brk_client_id",ef="brk_redirect_uri";/*! @azure/msal-common v14.16.0 2024-11-05 */class ia{static validateRedirectUri(e){if(!e)throw Xe(gw)}static validatePrompt(e){const t=[];for(const r in Bt)t.push(Bt[r]);if(t.indexOf(e)<0)throw Xe(yw)}static validateClaims(e){try{JSON.parse(e)}catch{throw Xe(em)}}static validateCodeChallengeParams(e,t){if(!e||!t)throw Xe(tm);this.validateCodeChallengeMethod(t)}static validateCodeChallengeMethod(e){if([Uv.PLAIN,Uv.S256].indexOf(e)<0)throw Xe(ww)}}/*! @azure/msal-common v14.16.0 2024-11-05 */function m2(n,e,t){if(!e)return;const r=n.get(wi);r&&n.has(cm)&&(t==null||t.addFields({embeddedClientId:r,embeddedRedirectUri:n.get(Lw)},e))}class vs{constructor(e,t){this.parameters=new Map,this.performanceClient=t,this.correlationId=e}addResponseTypeCode(){this.parameters.set(Yv,encodeURIComponent(F.CODE_RESPONSE_TYPE))}addResponseTypeForTokenAndIdToken(){this.parameters.set(Yv,encodeURIComponent(`${F.TOKEN_RESPONSE_TYPE} ${F.ID_TOKEN_RESPONSE_TYPE}`))}addResponseMode(e){this.parameters.set(PV,encodeURIComponent(e||HF.QUERY))}addNativeBroker(){this.parameters.set(c2,encodeURIComponent("1"))}addScopes(e,t=!0,r=Pa){t&&!r.includes("openid")&&!e.includes("openid")&&r.push("openid");const o=t?[...e||[],...r]:e||[],a=new vt(o);this.parameters.set(LV,encodeURIComponent(a.printScopes()))}addClientId(e){this.parameters.set(wi,encodeURIComponent(e))}addRedirectUri(e){ia.validateRedirectUri(e),this.parameters.set(Lw,encodeURIComponent(e))}addPostLogoutRedirectUri(e){ia.validateRedirectUri(e),this.parameters.set(e2,encodeURIComponent(e))}addIdTokenHint(e){this.parameters.set(t2,encodeURIComponent(e))}addDomainHint(e){this.parameters.set(h2,encodeURIComponent(e))}addLoginHint(e){this.parameters.set(d2,encodeURIComponent(e))}addCcsUpn(e){this.parameters.set(dn.CCS_HEADER,encodeURIComponent(`UPN:${e}`))}addCcsOid(e){this.parameters.set(dn.CCS_HEADER,encodeURIComponent(`Oid:${e.uid}@${e.utid}`))}addSid(e){this.parameters.set(u2,encodeURIComponent(e))}addClaims(e,t){const r=this.addClientCapabilitiesToClaims(e,t);ia.validateClaims(r),this.parameters.set(DV,encodeURIComponent(r))}addCorrelationId(e){this.parameters.set(WV,encodeURIComponent(e))}addLibraryInfo(e){this.parameters.set(zV,e.sku),this.parameters.set(GV,e.version),e.os&&this.parameters.set(qV,e.os),e.cpu&&this.parameters.set(jV,e.cpu)}addApplicationTelemetry(e){e!=null&&e.appName&&this.parameters.set(XV,e.appName),e!=null&&e.appVersion&&this.parameters.set(ZV,e.appVersion)}addPrompt(e){ia.validatePrompt(e),this.parameters.set(`${FV}`,encodeURIComponent(e))}addState(e){e&&this.parameters.set(UV,encodeURIComponent(e))}addNonce(e){this.parameters.set(BV,encodeURIComponent(e))}addCodeChallengeParams(e,t){if(ia.validateCodeChallengeParams(e,t),e&&t)this.parameters.set(HV,encodeURIComponent(e)),this.parameters.set($V,encodeURIComponent(t));else throw Xe(tm)}addAuthorizationCode(e){this.parameters.set(VV,encodeURIComponent(e))}addDeviceCode(e){this.parameters.set(n2,encodeURIComponent(e))}addRefreshToken(e){this.parameters.set(xV,encodeURIComponent(e))}addCodeVerifier(e){this.parameters.set(KV,encodeURIComponent(e))}addClientSecret(e){this.parameters.set(r2,encodeURIComponent(e))}addClientAssertion(e){e&&this.parameters.set(o2,encodeURIComponent(e))}addClientAssertionType(e){e&&this.parameters.set(i2,encodeURIComponent(e))}addOboAssertion(e){this.parameters.set(a2,encodeURIComponent(e))}addRequestTokenUse(e){this.parameters.set(s2,encodeURIComponent(e))}addGrantType(e){this.parameters.set(MV,encodeURIComponent(e))}addClientInfo(){this.parameters.set($F,"1")}addExtraQueryParameters(e){Object.entries(e).forEach(([t,r])=>{!this.parameters.has(t)&&r&&this.parameters.set(t,r)})}addClientCapabilitiesToClaims(e,t){let r;if(!e)r={};else try{r=JSON.parse(e)}catch{throw Xe(em)}return t&&t.length>0&&(r.hasOwnProperty(Kc.ACCESS_TOKEN)||(r[Kc.ACCESS_TOKEN]={}),r[Kc.ACCESS_TOKEN][Kc.XMS_CC]={values:t}),JSON.stringify(r)}addUsername(e){this.parameters.set(Fv.username,encodeURIComponent(e))}addPassword(e){this.parameters.set(Fv.password,encodeURIComponent(e))}addPopToken(e){e&&(this.parameters.set(Jv,Ge.POP),this.parameters.set(Qv,encodeURIComponent(e)))}addSshJwk(e){e&&(this.parameters.set(Jv,Ge.SSH),this.parameters.set(Qv,encodeURIComponent(e)))}addServerTelemetry(e){this.parameters.set(YV,e.generateCurrentRequestHeaderValue()),this.parameters.set(JV,e.generateLastRequestHeaderValue())}addThrottling(){this.parameters.set(QV,_s.X_MS_LIB_CAPABILITY_VALUE)}addLogoutHint(e){this.parameters.set(l2,encodeURIComponent(e))}addBrokerParameters(e){const t={};t[cm]=e.brokerClientId,t[ef]=e.brokerRedirectUri,this.addExtraQueryParameters(t)}createQueryString(){const e=new Array;return this.parameters.forEach((t,r)=>{e.push(`${r}=${t}`)}),m2(this.parameters,this.correlationId,this.performanceClient),e.join("&")}}/*! @azure/msal-common v14.16.0 2024-11-05 */function g2(n){return n.hasOwnProperty("authorization_endpoint")&&n.hasOwnProperty("token_endpoint")&&n.hasOwnProperty("issuer")&&n.hasOwnProperty("jwks_uri")}/*! @azure/msal-common v14.16.0 2024-11-05 */function p2(n){return n.hasOwnProperty("tenant_discovery_endpoint")&&n.hasOwnProperty("metadata")}/*! @azure/msal-common v14.16.0 2024-11-05 */function _2(n){return n.hasOwnProperty("error")&&n.hasOwnProperty("error_description")}/*! @azure/msal-common v14.16.0 2024-11-05 */const x={AcquireTokenByCode:"acquireTokenByCode",AcquireTokenByRefreshToken:"acquireTokenByRefreshToken",AcquireTokenSilent:"acquireTokenSilent",AcquireTokenSilentAsync:"acquireTokenSilentAsync",AcquireTokenPopup:"acquireTokenPopup",AcquireTokenPreRedirect:"acquireTokenPreRedirect",AcquireTokenRedirect:"acquireTokenRedirect",CryptoOptsGetPublicKeyThumbprint:"cryptoOptsGetPublicKeyThumbprint",CryptoOptsSignJwt:"cryptoOptsSignJwt",SilentCacheClientAcquireToken:"silentCacheClientAcquireToken",SilentIframeClientAcquireToken:"silentIframeClientAcquireToken",AwaitConcurrentIframe:"awaitConcurrentIframe",SilentRefreshClientAcquireToken:"silentRefreshClientAcquireToken",SsoSilent:"ssoSilent",StandardInteractionClientGetDiscoveredAuthority:"standardInteractionClientGetDiscoveredAuthority",FetchAccountIdWithNativeBroker:"fetchAccountIdWithNativeBroker",NativeInteractionClientAcquireToken:"nativeInteractionClientAcquireToken",BaseClientCreateTokenRequestHeaders:"baseClientCreateTokenRequestHeaders",NetworkClientSendPostRequestAsync:"networkClientSendPostRequestAsync",RefreshTokenClientExecutePostToTokenEndpoint:"refreshTokenClientExecutePostToTokenEndpoint",AuthorizationCodeClientExecutePostToTokenEndpoint:"authorizationCodeClientExecutePostToTokenEndpoint",BrokerHandhshake:"brokerHandshake",AcquireTokenByRefreshTokenInBroker:"acquireTokenByRefreshTokenInBroker",AcquireTokenByBroker:"acquireTokenByBroker",RefreshTokenClientExecuteTokenRequest:"refreshTokenClientExecuteTokenRequest",RefreshTokenClientAcquireToken:"refreshTokenClientAcquireToken",RefreshTokenClientAcquireTokenWithCachedRefreshToken:"refreshTokenClientAcquireTokenWithCachedRefreshToken",RefreshTokenClientAcquireTokenByRefreshToken:"refreshTokenClientAcquireTokenByRefreshToken",RefreshTokenClientCreateTokenRequestBody:"refreshTokenClientCreateTokenRequestBody",AcquireTokenFromCache:"acquireTokenFromCache",SilentFlowClientAcquireCachedToken:"silentFlowClientAcquireCachedToken",SilentFlowClientGenerateResultFromCacheRecord:"silentFlowClientGenerateResultFromCacheRecord",AcquireTokenBySilentIframe:"acquireTokenBySilentIframe",InitializeBaseRequest:"initializeBaseRequest",InitializeSilentRequest:"initializeSilentRequest",InitializeClientApplication:"initializeClientApplication",SilentIframeClientTokenHelper:"silentIframeClientTokenHelper",SilentHandlerInitiateAuthRequest:"silentHandlerInitiateAuthRequest",SilentHandlerMonitorIframeForHash:"silentHandlerMonitorIframeForHash",SilentHandlerLoadFrame:"silentHandlerLoadFrame",SilentHandlerLoadFrameSync:"silentHandlerLoadFrameSync",StandardInteractionClientCreateAuthCodeClient:"standardInteractionClientCreateAuthCodeClient",StandardInteractionClientGetClientConfiguration:"standardInteractionClientGetClientConfiguration",StandardInteractionClientInitializeAuthorizationRequest:"standardInteractionClientInitializeAuthorizationRequest",StandardInteractionClientInitializeAuthorizationCodeRequest:"standardInteractionClientInitializeAuthorizationCodeRequest",GetAuthCodeUrl:"getAuthCodeUrl",HandleCodeResponseFromServer:"handleCodeResponseFromServer",HandleCodeResponse:"handleCodeResponse",UpdateTokenEndpointAuthority:"updateTokenEndpointAuthority",AuthClientAcquireToken:"authClientAcquireToken",AuthClientExecuteTokenRequest:"authClientExecuteTokenRequest",AuthClientCreateTokenRequestBody:"authClientCreateTokenRequestBody",AuthClientCreateQueryString:"authClientCreateQueryString",PopTokenGenerateCnf:"popTokenGenerateCnf",PopTokenGenerateKid:"popTokenGenerateKid",HandleServerTokenResponse:"handleServerTokenResponse",DeserializeResponse:"deserializeResponse",AuthorityFactoryCreateDiscoveredInstance:"authorityFactoryCreateDiscoveredInstance",AuthorityResolveEndpointsAsync:"authorityResolveEndpointsAsync",AuthorityResolveEndpointsFromLocalSources:"authorityResolveEndpointsFromLocalSources",AuthorityGetCloudDiscoveryMetadataFromNetwork:"authorityGetCloudDiscoveryMetadataFromNetwork",AuthorityUpdateCloudDiscoveryMetadata:"authorityUpdateCloudDiscoveryMetadata",AuthorityGetEndpointMetadataFromNetwork:"authorityGetEndpointMetadataFromNetwork",AuthorityUpdateEndpointMetadata:"authorityUpdateEndpointMetadata",AuthorityUpdateMetadataWithRegionalInformation:"authorityUpdateMetadataWithRegionalInformation",RegionDiscoveryDetectRegion:"regionDiscoveryDetectRegion",RegionDiscoveryGetRegionFromIMDS:"regionDiscoveryGetRegionFromIMDS",RegionDiscoveryGetCurrentVersion:"regionDiscoveryGetCurrentVersion",AcquireTokenByCodeAsync:"acquireTokenByCodeAsync",GetEndpointMetadataFromNetwork:"getEndpointMetadataFromNetwork",GetCloudDiscoveryMetadataFromNetworkMeasurement:"getCloudDiscoveryMetadataFromNetworkMeasurement",HandleRedirectPromiseMeasurement:"handleRedirectPromise",HandleNativeRedirectPromiseMeasurement:"handleNativeRedirectPromise",UpdateCloudDiscoveryMetadataMeasurement:"updateCloudDiscoveryMetadataMeasurement",UsernamePasswordClientAcquireToken:"usernamePasswordClientAcquireToken",NativeMessageHandlerHandshake:"nativeMessageHandlerHandshake",NativeGenerateAuthResult:"nativeGenerateAuthResult",RemoveHiddenIframe:"removeHiddenIframe",ClearTokensAndKeysWithClaims:"clearTokensAndKeysWithClaims",CacheManagerGetRefreshToken:"cacheManagerGetRefreshToken",GeneratePkceCodes:"generatePkceCodes",GenerateCodeVerifier:"generateCodeVerifier",GenerateCodeChallengeFromVerifier:"generateCodeChallengeFromVerifier",Sha256Digest:"sha256Digest",GetRandomValues:"getRandomValues"},v2={NotStarted:0,InProgress:1,Completed:2};/*! @azure/msal-common v14.16.0 2024-11-05 */const Ai=(n,e,t,r,o)=>(...a)=>{t.trace(`Executing function ${e}`);const c=r==null?void 0:r.startMeasurement(e,o);if(o){const d=e+"CallCount";r==null||r.incrementFields({[d]:1},o)}try{const d=n(...a);return c==null||c.end({success:!0}),t.trace(`Returning result from ${e}`),d}catch(d){t.trace(`Error occurred in ${e}`);try{t.trace(JSON.stringify(d))}catch{t.trace("Unable to print error message.")}throw c==null||c.end({success:!1},d),d}},Q=(n,e,t,r,o)=>(...a)=>{t.trace(`Executing function ${e}`);const c=r==null?void 0:r.startMeasurement(e,o);if(o){const d=e+"CallCount";r==null||r.incrementFields({[d]:1},o)}return r==null||r.setPreQueueTime(e,o),n(...a).then(d=>(t.trace(`Returning result from ${e}`),c==null||c.end({success:!0}),d)).catch(d=>{t.trace(`Error occurred in ${e}`);try{t.trace(JSON.stringify(d))}catch{t.trace("Unable to print error message.")}throw c==null||c.end({success:!1},d),d})};/*! @azure/msal-common v14.16.0 2024-11-05 */class lu{constructor(e,t,r,o){this.networkInterface=e,this.logger=t,this.performanceClient=r,this.correlationId=o}async detectRegion(e,t){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(x.RegionDiscoveryDetectRegion,this.correlationId);let r=e;if(r)t.region_source=Yi.ENVIRONMENT_VARIABLE;else{const a=lu.IMDS_OPTIONS;try{const c=await Q(this.getRegionFromIMDS.bind(this),x.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(F.IMDS_VERSION,a);if(c.status===zc.httpSuccess&&(r=c.body,t.region_source=Yi.IMDS),c.status===zc.httpBadRequest){const d=await Q(this.getCurrentVersion.bind(this),x.RegionDiscoveryGetCurrentVersion,this.logger,this.performanceClient,this.correlationId)(a);if(!d)return t.region_source=Yi.FAILED_AUTO_DETECTION,null;const h=await Q(this.getRegionFromIMDS.bind(this),x.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(d,a);h.status===zc.httpSuccess&&(r=h.body,t.region_source=Yi.IMDS)}}catch{return t.region_source=Yi.FAILED_AUTO_DETECTION,null}}return r||(t.region_source=Yi.FAILED_AUTO_DETECTION),r||null}async getRegionFromIMDS(e,t){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(x.RegionDiscoveryGetRegionFromIMDS,this.correlationId),this.networkInterface.sendGetRequestAsync(`${F.IMDS_ENDPOINT}?api-version=${e}&format=text`,t,F.IMDS_TIMEOUT)}async getCurrentVersion(e){var t;(t=this.performanceClient)==null||t.addQueueMeasurement(x.RegionDiscoveryGetCurrentVersion,this.correlationId);try{const r=await this.networkInterface.sendGetRequestAsync(`${F.IMDS_ENDPOINT}?format=json`,e);return r.status===zc.httpBadRequest&&r.body&&r.body["newest-versions"]&&r.body["newest-versions"].length>0?r.body["newest-versions"][0]:null}catch{return null}}}lu.IMDS_OPTIONS={headers:{Metadata:"true"}};/*! @azure/msal-common v14.16.0 2024-11-05 */class Xt{constructor(e,t,r,o,a,c,d,h){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=t,this.cacheManager=r,this.authorityOptions=o,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=a,this.performanceClient=d,this.correlationId=c,this.managedIdentity=h||!1,this.regionDiscovery=new lu(t,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(F.CIAM_AUTH_URL))return mr.Ciam;const t=e.PathSegments;if(t.length)switch(t[0].toLowerCase()){case F.ADFS:return mr.Adfs;case F.DSTS:return mr.Dsts}return mr.Default}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new De(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw Y(ao)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw Y(ao)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw Y(ao)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw Y(dw);return this.replacePath(this.metadata.end_session_endpoint)}else throw Y(ao)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw Y(ao)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw Y(ao)}canReplaceTenant(e){return e.PathSegments.length===1&&!Xt.reservedTenantDomains.has(e.PathSegments[0])&&this.getAuthorityType(e)===mr.Default&&this.protocolMode===fo.AAD}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let t=e;const o=new De(this.metadata.canonical_authority).getUrlComponents(),a=o.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach((d,h)=>{let m=a[h];if(h===0&&this.canReplaceTenant(o)){const g=new De(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];m!==g&&(this.logger.verbose(`Replacing tenant domain name ${m} with id ${g}`),m=g)}d!==m&&(t=t.replace(`/${m}/`,`/${d}/`))}),this.replaceTenant(t)}get defaultOpenIdConfigurationEndpoint(){const e=this.hostnameAndPort;return this.canonicalAuthority.endsWith("v2.0/")||this.authorityType===mr.Adfs||this.protocolMode!==fo.AAD&&!this.isAliasOfKnownMicrosoftAuthority(e)?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){var o,a;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthorityResolveEndpointsAsync,this.correlationId);const e=this.getCurrentMetadataEntity(),t=await Q(this.updateCloudDiscoveryMetadata.bind(this),x.AuthorityUpdateCloudDiscoveryMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);const r=await Q(this.updateEndpointMetadata.bind(this),x.AuthorityUpdateEndpointMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.updateCachedMetadata(e,t,{source:r}),(a=this.performanceClient)==null||a.addFields({cloudDiscoverySource:t,authorityEndpointSource:r},this.correlationId)}getCurrentMetadataEntity(){let e=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);return e||(e={aliases:[],preferred_cache:this.hostnameAndPort,preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:"",token_endpoint:"",end_session_endpoint:"",issuer:"",aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:zv(),jwks_uri:""}),e}updateCachedMetadata(e,t,r){t!==On.CACHE&&(r==null?void 0:r.source)!==On.CACHE&&(e.expiresAt=zv(),e.canonical_authority=this.canonicalAuthority);const o=this.cacheManager.generateAuthorityMetadataCacheKey(e.preferred_cache);this.cacheManager.setAuthorityMetadata(o,e),this.metadata=e}async updateEndpointMetadata(e){var o,a,c;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthorityUpdateEndpointMetadata,this.correlationId);const t=this.updateEndpointMetadataFromLocalSources(e);if(t){if(t.source===On.HARDCODED_VALUES&&(a=this.authorityOptions.azureRegionConfiguration)!=null&&a.azureRegion&&t.metadata){const d=await Q(this.updateMetadataWithRegionalInformation.bind(this),x.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(t.metadata);Gc(e,d,!1),e.canonical_authority=this.canonicalAuthority}return t.source}let r=await Q(this.getEndpointMetadataFromNetwork.bind(this),x.AuthorityGetEndpointMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return(c=this.authorityOptions.azureRegionConfiguration)!=null&&c.azureRegion&&(r=await Q(this.updateMetadataWithRegionalInformation.bind(this),x.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(r)),Gc(e,r,!0),On.NETWORK;throw Y(XE,this.defaultOpenIdConfigurationEndpoint)}updateEndpointMetadataFromLocalSources(e){this.logger.verbose("Attempting to get endpoint metadata from authority configuration");const t=this.getEndpointMetadataFromConfig();if(t)return this.logger.verbose("Found endpoint metadata in authority configuration"),Gc(e,t,!1),{source:On.CONFIG};if(this.logger.verbose("Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values."),this.authorityOptions.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get endpoint metadata from the network metadata cache.");else{const o=this.getEndpointMetadataFromHardcodedValues();if(o)return Gc(e,o,!1),{source:On.HARDCODED_VALUES,metadata:o};this.logger.verbose("Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.")}const r=Gv(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!r?(this.logger.verbose("Found endpoint metadata in the cache."),{source:On.CACHE}):(r&&this.logger.verbose("The metadata entity is expired."),null)}isAuthoritySameType(e){return new De(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch{throw Xe(Tw)}return null}async getEndpointMetadataFromNetwork(){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(x.AuthorityGetEndpointMetadataFromNetwork,this.correlationId);const e={},t=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from ${t}`);try{const o=await this.networkInterface.sendGetRequestAsync(t,e);return g2(o.body)?o.body:(this.logger.verbose("Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration"),null)}catch(o){return this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${o}`),null}}getEndpointMetadataFromHardcodedValues(){return this.hostnameAndPort in qv?qv[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(e){var r,o,a;(r=this.performanceClient)==null||r.addQueueMeasurement(x.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId);const t=(o=this.authorityOptions.azureRegionConfiguration)==null?void 0:o.azureRegion;if(t){if(t!==F.AZURE_REGION_AUTO_DISCOVER_FLAG)return this.regionDiscoveryMetadata.region_outcome=oh.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=t,Xt.replaceWithRegionalInformation(e,t);const c=await Q(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),x.RegionDiscoveryDetectRegion,this.logger,this.performanceClient,this.correlationId)((a=this.authorityOptions.azureRegionConfiguration)==null?void 0:a.environmentRegion,this.regionDiscoveryMetadata);if(c)return this.regionDiscoveryMetadata.region_outcome=oh.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=c,Xt.replaceWithRegionalInformation(e,c);this.regionDiscoveryMetadata.region_outcome=oh.AUTO_DETECTION_REQUESTED_FAILED}return e}async updateCloudDiscoveryMetadata(e){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId);const t=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(t)return t;const r=await Q(this.getCloudDiscoveryMetadataFromNetwork.bind(this),x.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return ih(e,r,!0),On.NETWORK;throw Xe(bw)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||F.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||F.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${e.canonical_authority||F.NOT_APPLICABLE}`);const t=this.getCloudDiscoveryMetadataFromConfig();if(t)return this.logger.verbose("Found cloud discovery metadata in authority configuration"),ih(e,t,!1),On.CONFIG;if(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values."),this.options.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded cloud discovery metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get cloud discovery metadata from the network metadata cache.");else{const o=EV(this.hostnameAndPort);if(o)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),ih(e,o,!1),On.HARDCODED_VALUES;this.logger.verbose("Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.")}const r=Gv(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose("Found cloud discovery metadata in the cache."),On.CACHE):(r&&this.logger.verbose("The metadata entity is expired."),null)}getCloudDiscoveryMetadataFromConfig(){if(this.authorityType===mr.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),Xt.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");const e=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),t=Ml(e.metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),t)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),t;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch{throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),Xe(nm)}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),Xt.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId);const e=`${F.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`,t={};let r=null;try{const a=await this.networkInterface.sendGetRequestAsync(e,t);let c,d;if(p2(a.body))c=a.body,d=c.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${c.tenant_discovery_endpoint}`);else if(_2(a.body)){if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${a.status}`),c=a.body,c.error===F.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${c.error}`),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${c.error_description}`),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),d=[]}else return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),null;this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),r=Ml(d,this.hostnameAndPort)}catch(a){if(a instanceof lt)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata.
|
108
108
|
Error: ${a.errorCode}
|
109
109
|
Error Description: ${a.errorMessage}`);else{const c=a;this.logger.error(`A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.
|
110
110
|
Error: ${c.name}
|
111
|
-
Error Description: ${c.message}`)}return null}return r||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),r=Xt.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(t=>t&&De.getDomainFromUrl(t).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,t){let r;if(t&&t.azureCloudInstance!==Xf.None){const o=t.tenant?t.tenant:F.DEFAULT_COMMON_TENANT;r=`${t.azureCloudInstance}/${o}/`}return r||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return F.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw Y(ao)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return Pw.has(e)}static isPublicCloudAuthority(e){return F.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,t,r){const o=new De(e);o.validateAsUri();const a=o.getUrlComponents();let c=`${t}.${a.HostNameAndPort}`;this.isPublicCloudAuthority(a.HostNameAndPort)&&(c=`${t}.${F.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const d=De.constructAuthorityUriFromObject({...o.getUrlComponents(),HostNameAndPort:c}).urlString;return r?`${d}?${r}`:d}static replaceWithRegionalInformation(e,t){const r={...e};return r.authorization_endpoint=Xt.buildRegionalAuthorityString(r.authorization_endpoint,t),r.token_endpoint=Xt.buildRegionalAuthorityString(r.token_endpoint,t),r.end_session_endpoint&&(r.end_session_endpoint=Xt.buildRegionalAuthorityString(r.end_session_endpoint,t)),r}static transformCIAMAuthority(e){let t=e;const o=new De(e).getUrlComponents();if(o.PathSegments.length===0&&o.HostNameAndPort.endsWith(F.CIAM_AUTH_URL)){const a=o.HostNameAndPort.split(".")[0];t=`${t}${a}${F.AAD_TENANT_DOMAIN_SUFFIX}`}return t}}Xt.reservedTenantDomains=new Set(["{tenant}","{tenantid}",Ho.COMMON,Ho.CONSUMERS,Ho.ORGANIZATIONS]);function v2(n){var o;const r=(o=new De(n).getUrlComponents().PathSegments.slice(-1)[0])==null?void 0:o.toLowerCase();switch(r){case Ho.COMMON:case Ho.ORGANIZATIONS:case Ho.CONSUMERS:return;default:return r}}function xw(n){return n.endsWith(F.FORWARD_SLASH)?n:`${n}${F.FORWARD_SLASH}`}function y2(n){const e=n.cloudDiscoveryMetadata;let t;if(e)try{t=JSON.parse(e)}catch{throw Xe(nm)}return{canonicalAuthority:n.authority?xw(n.authority):void 0,knownAuthorities:n.knownAuthorities,cloudDiscoveryMetadata:t}}/*! @azure/msal-common v14.16.0 2024-11-05 */async function Uw(n,e,t,r,o,a,c){c==null||c.addQueueMeasurement(x.AuthorityFactoryCreateDiscoveredInstance,a);const d=Xt.transformCIAMAuthority(xw(n)),h=new Xt(d,e,t,r,o,a,c);try{return await Q(h.resolveEndpointsAsync.bind(h),x.AuthorityResolveEndpointsAsync,o,c,a)(),h}catch{throw Y(ao)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Wo extends lt{constructor(e,t,r,o,a){super(e,t,r),this.name="ServerError",this.errorNo=o,this.status=a,Object.setPrototypeOf(this,Wo.prototype)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Ur{static generateThrottlingStorageKey(e){return`${_s.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,t){var a;const r=Ur.generateThrottlingStorageKey(t),o=e.getThrottlingCache(r);if(o){if(o.throttleTime<Date.now()){e.removeItem(r);return}throw new Wo(((a=o.errorCodes)==null?void 0:a.join(" "))||F.EMPTY_STRING,o.errorMessage,o.subError)}}static postProcess(e,t,r){if(Ur.checkResponseStatus(r)||Ur.checkResponseForRetryAfter(r)){const o={throttleTime:Ur.calculateThrottleTime(parseInt(r.headers[dn.RETRY_AFTER])),error:r.body.error,errorCodes:r.body.error_codes,errorMessage:r.body.error_description,subError:r.body.suberror};e.setThrottlingCache(Ur.generateThrottlingStorageKey(t),o)}}static checkResponseStatus(e){return e.status===429||e.status>=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(dn.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){const t=e<=0?0:e,r=Date.now()/1e3;return Math.floor(Math.min(r+(t||_s.DEFAULT_THROTTLE_TIME_SECONDS),r+_s.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)}static removeThrottle(e,t,r,o){const a={clientId:t,authority:r.authority,scopes:r.scopes,homeAccountIdentifier:o,claims:r.claims,authenticationScheme:r.authenticationScheme,resourceRequestMethod:r.resourceRequestMethod,resourceRequestUri:r.resourceRequestUri,shrClaims:r.shrClaims,sshKid:r.sshKid},c=this.generateThrottlingStorageKey(a);e.removeItem(c)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class uu extends lt{constructor(e,t,r){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,uu.prototype),this.name="NetworkError",this.error=e,this.httpStatus=t,this.responseHeaders=r}}function Zv(n,e,t){return new uu(n,e,t)}/*! @azure/msal-common v14.16.0 2024-11-05 */class lm{constructor(e,t){this.config=NV(e),this.logger=new Ko(this.config.loggerOptions,hw,Qf),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=t}createTokenRequestHeaders(e){const t={};if(t[dn.CONTENT_TYPE]=F.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case Bn.HOME_ACCOUNT_ID:try{const r=fa(e.credential);t[dn.CCS_HEADER]=`Oid:${r.uid}@${r.utid}`}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case Bn.UPN:t[dn.CCS_HEADER]=`UPN: ${e.credential}`;break}return t}async executePostToTokenEndpoint(e,t,r,o,a,c){var h;c&&((h=this.performanceClient)==null||h.addQueueMeasurement(c,a));const d=await this.sendPostRequest(o,e,{body:t,headers:r},a);return this.config.serverTelemetryManager&&d.status<500&&d.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),d}async sendPostRequest(e,t,r,o){var c,d,h;Ur.preProcess(this.cacheManager,e);let a;try{a=await Q(this.networkClient.sendPostRequestAsync.bind(this.networkClient),x.NetworkClientSendPostRequestAsync,this.logger,this.performanceClient,o)(t,r);const m=a.headers||{};(d=this.performanceClient)==null||d.addFields({refreshTokenSize:((c=a.body.refresh_token)==null?void 0:c.length)||0,httpVerToken:m[dn.X_MS_HTTP_VERSION]||"",requestId:m[dn.X_MS_REQUEST_ID]||""},o)}catch(m){if(m instanceof uu){const g=m.responseHeaders;throw g&&((h=this.performanceClient)==null||h.addFields({httpVerToken:g[dn.X_MS_HTTP_VERSION]||"",requestId:g[dn.X_MS_REQUEST_ID]||"",contentTypeHeader:g[dn.CONTENT_TYPE]||void 0,contentLengthHeader:g[dn.CONTENT_LENGTH]||void 0,httpStatus:m.httpStatus},o)),m.error}throw m instanceof lt?m:Y(QE)}return Ur.postProcess(this.cacheManager,e,a),a}async updateAuthority(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.UpdateTokenEndpointAuthority,t);const r=`https://${e}/${this.authority.tenant}/`,o=await Uw(r,this.networkClient,this.cacheManager,this.authority.options,this.logger,t,this.performanceClient);this.authority=o}createTokenQueryParameters(e){const t=new vs(e.correlationId,this.performanceClient);return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenQueryParameters&&t.addExtraQueryParameters(e.tokenQueryParameters),t.addCorrelationId(e.correlationId),t.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Dl="no_tokens_found",Bw="native_account_unavailable",um="refresh_token_expired",C2="interaction_required",E2="consent_required",w2="login_required",du="bad_token";/*! @azure/msal-common v14.16.0 2024-11-05 */const ey=[C2,E2,w2,du],T2=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],b2={[Dl]:"No refresh token found in the cache. Please sign-in.",[Bw]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[um]:"Refresh token has expired.",[du]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve."};class Er extends lt{constructor(e,t,r,o,a,c,d,h){super(e,t,r),Object.setPrototypeOf(this,Er.prototype),this.timestamp=o||F.EMPTY_STRING,this.traceId=a||F.EMPTY_STRING,this.correlationId=c||F.EMPTY_STRING,this.claims=d||F.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=h}}function ty(n,e,t){const r=!!n&&ey.indexOf(n)>-1,o=!!t&&T2.indexOf(t)>-1,a=!!e&&ey.some(c=>e.indexOf(c)>-1);return r||a||o}function tf(n){return new Er(n,b2[n])}/*! @azure/msal-common v14.16.0 2024-11-05 */class yr{static setRequestState(e,t,r){const o=yr.generateLibraryState(e,r);return t?`${o}${F.RESOURCE_DELIM}${t}`:o}static generateLibraryState(e,t){if(!e)throw Y(Jh);const r={id:e.createNewGuid()};t&&(r.meta=t);const o=JSON.stringify(r);return e.base64Encode(o)}static parseRequestState(e,t){if(!e)throw Y(Jh);if(!t)throw Y(wa);try{const r=t.split(F.RESOURCE_DELIM),o=r[0],a=r.length>1?r.slice(1).join(F.RESOURCE_DELIM):F.EMPTY_STRING,c=e.base64Decode(o),d=JSON.parse(c);return{userRequestState:a||F.EMPTY_STRING,libraryState:d}}catch{throw Y(wa)}}}/*! @azure/msal-common v14.16.0 2024-11-05 */const I2={SW:"sw",UHW:"uhw"};class ba{constructor(e,t){this.cryptoUtils=e,this.performanceClient=t}async generateCnf(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.PopTokenGenerateCnf,e.correlationId);const r=await Q(this.generateKid.bind(this),x.PopTokenGenerateCnf,t,this.performanceClient,e.correlationId)(e),o=this.cryptoUtils.base64UrlEncode(JSON.stringify(r));return{kid:r.kid,reqCnfString:o}}async generateKid(e){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(x.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:I2.SW}}async signPopToken(e,t,r){return this.signPayload(e,t,r)}async signPayload(e,t,r,o){const{resourceRequestMethod:a,resourceRequestUri:c,shrClaims:d,shrNonce:h,shrOptions:m}=r,g=c?new De(c):void 0,v=g==null?void 0:g.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:zr(),m:a==null?void 0:a.toUpperCase(),u:v==null?void 0:v.HostNameAndPort,nonce:h||this.cryptoUtils.createNewGuid(),p:v==null?void 0:v.AbsolutePath,q:v!=null&&v.QueryString?[[],v.QueryString]:void 0,client_claims:d||void 0,...o},t,m,r.correlationId)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class S2{constructor(e,t){this.cache=e,this.hasChanged=t}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}/*! @azure/msal-common v14.16.0 2024-11-05 */function A2(n){var r,o;const e="code=",t=(r=n.error_uri)==null?void 0:r.lastIndexOf(e);return t&&t>=0?(o=n.error_uri)==null?void 0:o.substring(t+e.length):void 0}class Ti{constructor(e,t,r,o,a,c,d){this.clientId=e,this.cacheStorage=t,this.cryptoObj=r,this.logger=o,this.serializableCache=a,this.persistencePlugin=c,this.performanceClient=d}validateServerAuthorizationCodeResponse(e,t){if(!e.state||!t)throw e.state?Y(kl,"Cached State"):Y(kl,"Server State");let r,o;try{r=decodeURIComponent(e.state)}catch{throw Y(wa,e.state)}try{o=decodeURIComponent(t)}catch{throw Y(wa,e.state)}if(r!==o)throw Y(ew);if(e.error||e.error_description||e.suberror){const a=A2(e);throw ty(e.error,e.error_description,e.suberror)?new Er(e.error||"",e.error_description,e.suberror,e.timestamp||"",e.trace_id||"",e.correlation_id||"",e.claims||"",a):new Wo(e.error||"",e.error_description,e.suberror,a)}}validateTokenResponse(e,t){var r;if(e.error||e.error_description||e.suberror){const o=`Error(s): ${e.error_codes||F.NOT_AVAILABLE} - Timestamp: ${e.timestamp||F.NOT_AVAILABLE} - Description: ${e.error_description||F.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||F.NOT_AVAILABLE} - Trace ID: ${e.trace_id||F.NOT_AVAILABLE}`,a=(r=e.error_codes)!=null&&r.length?e.error_codes[0]:void 0,c=new Wo(e.error,o,e.suberror,a,e.status);if(t&&e.status&&e.status>=$c.SERVER_ERROR_RANGE_START&&e.status<=$c.SERVER_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed.
|
111
|
+
Error Description: ${c.message}`)}return null}return r||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),r=Xt.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(t=>t&&De.getDomainFromUrl(t).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,t){let r;if(t&&t.azureCloudInstance!==Xf.None){const o=t.tenant?t.tenant:F.DEFAULT_COMMON_TENANT;r=`${t.azureCloudInstance}/${o}/`}return r||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return F.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw Y(ao)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return Pw.has(e)}static isPublicCloudAuthority(e){return F.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,t,r){const o=new De(e);o.validateAsUri();const a=o.getUrlComponents();let c=`${t}.${a.HostNameAndPort}`;this.isPublicCloudAuthority(a.HostNameAndPort)&&(c=`${t}.${F.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const d=De.constructAuthorityUriFromObject({...o.getUrlComponents(),HostNameAndPort:c}).urlString;return r?`${d}?${r}`:d}static replaceWithRegionalInformation(e,t){const r={...e};return r.authorization_endpoint=Xt.buildRegionalAuthorityString(r.authorization_endpoint,t),r.token_endpoint=Xt.buildRegionalAuthorityString(r.token_endpoint,t),r.end_session_endpoint&&(r.end_session_endpoint=Xt.buildRegionalAuthorityString(r.end_session_endpoint,t)),r}static transformCIAMAuthority(e){let t=e;const o=new De(e).getUrlComponents();if(o.PathSegments.length===0&&o.HostNameAndPort.endsWith(F.CIAM_AUTH_URL)){const a=o.HostNameAndPort.split(".")[0];t=`${t}${a}${F.AAD_TENANT_DOMAIN_SUFFIX}`}return t}}Xt.reservedTenantDomains=new Set(["{tenant}","{tenantid}",Ho.COMMON,Ho.CONSUMERS,Ho.ORGANIZATIONS]);function y2(n){var o;const r=(o=new De(n).getUrlComponents().PathSegments.slice(-1)[0])==null?void 0:o.toLowerCase();switch(r){case Ho.COMMON:case Ho.ORGANIZATIONS:case Ho.CONSUMERS:return;default:return r}}function xw(n){return n.endsWith(F.FORWARD_SLASH)?n:`${n}${F.FORWARD_SLASH}`}function C2(n){const e=n.cloudDiscoveryMetadata;let t;if(e)try{t=JSON.parse(e)}catch{throw Xe(nm)}return{canonicalAuthority:n.authority?xw(n.authority):void 0,knownAuthorities:n.knownAuthorities,cloudDiscoveryMetadata:t}}/*! @azure/msal-common v14.16.0 2024-11-05 */async function Uw(n,e,t,r,o,a,c){c==null||c.addQueueMeasurement(x.AuthorityFactoryCreateDiscoveredInstance,a);const d=Xt.transformCIAMAuthority(xw(n)),h=new Xt(d,e,t,r,o,a,c);try{return await Q(h.resolveEndpointsAsync.bind(h),x.AuthorityResolveEndpointsAsync,o,c,a)(),h}catch{throw Y(ao)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Wo extends lt{constructor(e,t,r,o,a){super(e,t,r),this.name="ServerError",this.errorNo=o,this.status=a,Object.setPrototypeOf(this,Wo.prototype)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Ur{static generateThrottlingStorageKey(e){return`${_s.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,t){var a;const r=Ur.generateThrottlingStorageKey(t),o=e.getThrottlingCache(r);if(o){if(o.throttleTime<Date.now()){e.removeItem(r);return}throw new Wo(((a=o.errorCodes)==null?void 0:a.join(" "))||F.EMPTY_STRING,o.errorMessage,o.subError)}}static postProcess(e,t,r){if(Ur.checkResponseStatus(r)||Ur.checkResponseForRetryAfter(r)){const o={throttleTime:Ur.calculateThrottleTime(parseInt(r.headers[dn.RETRY_AFTER])),error:r.body.error,errorCodes:r.body.error_codes,errorMessage:r.body.error_description,subError:r.body.suberror};e.setThrottlingCache(Ur.generateThrottlingStorageKey(t),o)}}static checkResponseStatus(e){return e.status===429||e.status>=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(dn.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){const t=e<=0?0:e,r=Date.now()/1e3;return Math.floor(Math.min(r+(t||_s.DEFAULT_THROTTLE_TIME_SECONDS),r+_s.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)}static removeThrottle(e,t,r,o){const a={clientId:t,authority:r.authority,scopes:r.scopes,homeAccountIdentifier:o,claims:r.claims,authenticationScheme:r.authenticationScheme,resourceRequestMethod:r.resourceRequestMethod,resourceRequestUri:r.resourceRequestUri,shrClaims:r.shrClaims,sshKid:r.sshKid},c=this.generateThrottlingStorageKey(a);e.removeItem(c)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class uu extends lt{constructor(e,t,r){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,uu.prototype),this.name="NetworkError",this.error=e,this.httpStatus=t,this.responseHeaders=r}}function Zv(n,e,t){return new uu(n,e,t)}/*! @azure/msal-common v14.16.0 2024-11-05 */class lm{constructor(e,t){this.config=RV(e),this.logger=new Ko(this.config.loggerOptions,hw,Qf),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=t}createTokenRequestHeaders(e){const t={};if(t[dn.CONTENT_TYPE]=F.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case Bn.HOME_ACCOUNT_ID:try{const r=fa(e.credential);t[dn.CCS_HEADER]=`Oid:${r.uid}@${r.utid}`}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case Bn.UPN:t[dn.CCS_HEADER]=`UPN: ${e.credential}`;break}return t}async executePostToTokenEndpoint(e,t,r,o,a,c){var h;c&&((h=this.performanceClient)==null||h.addQueueMeasurement(c,a));const d=await this.sendPostRequest(o,e,{body:t,headers:r},a);return this.config.serverTelemetryManager&&d.status<500&&d.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),d}async sendPostRequest(e,t,r,o){var c,d,h;Ur.preProcess(this.cacheManager,e);let a;try{a=await Q(this.networkClient.sendPostRequestAsync.bind(this.networkClient),x.NetworkClientSendPostRequestAsync,this.logger,this.performanceClient,o)(t,r);const m=a.headers||{};(d=this.performanceClient)==null||d.addFields({refreshTokenSize:((c=a.body.refresh_token)==null?void 0:c.length)||0,httpVerToken:m[dn.X_MS_HTTP_VERSION]||"",requestId:m[dn.X_MS_REQUEST_ID]||""},o)}catch(m){if(m instanceof uu){const g=m.responseHeaders;throw g&&((h=this.performanceClient)==null||h.addFields({httpVerToken:g[dn.X_MS_HTTP_VERSION]||"",requestId:g[dn.X_MS_REQUEST_ID]||"",contentTypeHeader:g[dn.CONTENT_TYPE]||void 0,contentLengthHeader:g[dn.CONTENT_LENGTH]||void 0,httpStatus:m.httpStatus},o)),m.error}throw m instanceof lt?m:Y(QE)}return Ur.postProcess(this.cacheManager,e,a),a}async updateAuthority(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.UpdateTokenEndpointAuthority,t);const r=`https://${e}/${this.authority.tenant}/`,o=await Uw(r,this.networkClient,this.cacheManager,this.authority.options,this.logger,t,this.performanceClient);this.authority=o}createTokenQueryParameters(e){const t=new vs(e.correlationId,this.performanceClient);return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenQueryParameters&&t.addExtraQueryParameters(e.tokenQueryParameters),t.addCorrelationId(e.correlationId),t.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Dl="no_tokens_found",Bw="native_account_unavailable",um="refresh_token_expired",E2="interaction_required",w2="consent_required",T2="login_required",du="bad_token";/*! @azure/msal-common v14.16.0 2024-11-05 */const ey=[E2,w2,T2,du],b2=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],I2={[Dl]:"No refresh token found in the cache. Please sign-in.",[Bw]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[um]:"Refresh token has expired.",[du]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve."};class Er extends lt{constructor(e,t,r,o,a,c,d,h){super(e,t,r),Object.setPrototypeOf(this,Er.prototype),this.timestamp=o||F.EMPTY_STRING,this.traceId=a||F.EMPTY_STRING,this.correlationId=c||F.EMPTY_STRING,this.claims=d||F.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=h}}function ty(n,e,t){const r=!!n&&ey.indexOf(n)>-1,o=!!t&&b2.indexOf(t)>-1,a=!!e&&ey.some(c=>e.indexOf(c)>-1);return r||a||o}function tf(n){return new Er(n,I2[n])}/*! @azure/msal-common v14.16.0 2024-11-05 */class yr{static setRequestState(e,t,r){const o=yr.generateLibraryState(e,r);return t?`${o}${F.RESOURCE_DELIM}${t}`:o}static generateLibraryState(e,t){if(!e)throw Y(Jh);const r={id:e.createNewGuid()};t&&(r.meta=t);const o=JSON.stringify(r);return e.base64Encode(o)}static parseRequestState(e,t){if(!e)throw Y(Jh);if(!t)throw Y(wa);try{const r=t.split(F.RESOURCE_DELIM),o=r[0],a=r.length>1?r.slice(1).join(F.RESOURCE_DELIM):F.EMPTY_STRING,c=e.base64Decode(o),d=JSON.parse(c);return{userRequestState:a||F.EMPTY_STRING,libraryState:d}}catch{throw Y(wa)}}}/*! @azure/msal-common v14.16.0 2024-11-05 */const S2={SW:"sw",UHW:"uhw"};class ba{constructor(e,t){this.cryptoUtils=e,this.performanceClient=t}async generateCnf(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.PopTokenGenerateCnf,e.correlationId);const r=await Q(this.generateKid.bind(this),x.PopTokenGenerateCnf,t,this.performanceClient,e.correlationId)(e),o=this.cryptoUtils.base64UrlEncode(JSON.stringify(r));return{kid:r.kid,reqCnfString:o}}async generateKid(e){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(x.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:S2.SW}}async signPopToken(e,t,r){return this.signPayload(e,t,r)}async signPayload(e,t,r,o){const{resourceRequestMethod:a,resourceRequestUri:c,shrClaims:d,shrNonce:h,shrOptions:m}=r,g=c?new De(c):void 0,v=g==null?void 0:g.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:zr(),m:a==null?void 0:a.toUpperCase(),u:v==null?void 0:v.HostNameAndPort,nonce:h||this.cryptoUtils.createNewGuid(),p:v==null?void 0:v.AbsolutePath,q:v!=null&&v.QueryString?[[],v.QueryString]:void 0,client_claims:d||void 0,...o},t,m,r.correlationId)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class A2{constructor(e,t){this.cache=e,this.hasChanged=t}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}/*! @azure/msal-common v14.16.0 2024-11-05 */function k2(n){var r,o;const e="code=",t=(r=n.error_uri)==null?void 0:r.lastIndexOf(e);return t&&t>=0?(o=n.error_uri)==null?void 0:o.substring(t+e.length):void 0}class Ti{constructor(e,t,r,o,a,c,d){this.clientId=e,this.cacheStorage=t,this.cryptoObj=r,this.logger=o,this.serializableCache=a,this.persistencePlugin=c,this.performanceClient=d}validateServerAuthorizationCodeResponse(e,t){if(!e.state||!t)throw e.state?Y(kl,"Cached State"):Y(kl,"Server State");let r,o;try{r=decodeURIComponent(e.state)}catch{throw Y(wa,e.state)}try{o=decodeURIComponent(t)}catch{throw Y(wa,e.state)}if(r!==o)throw Y(ew);if(e.error||e.error_description||e.suberror){const a=k2(e);throw ty(e.error,e.error_description,e.suberror)?new Er(e.error||"",e.error_description,e.suberror,e.timestamp||"",e.trace_id||"",e.correlation_id||"",e.claims||"",a):new Wo(e.error||"",e.error_description,e.suberror,a)}}validateTokenResponse(e,t){var r;if(e.error||e.error_description||e.suberror){const o=`Error(s): ${e.error_codes||F.NOT_AVAILABLE} - Timestamp: ${e.timestamp||F.NOT_AVAILABLE} - Description: ${e.error_description||F.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||F.NOT_AVAILABLE} - Trace ID: ${e.trace_id||F.NOT_AVAILABLE}`,a=(r=e.error_codes)!=null&&r.length?e.error_codes[0]:void 0,c=new Wo(e.error,o,e.suberror,a,e.status);if(t&&e.status&&e.status>=$c.SERVER_ERROR_RANGE_START&&e.status<=$c.SERVER_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed.
|
112
112
|
${c}`);return}else if(t&&e.status&&e.status>=$c.CLIENT_ERROR_RANGE_START&&e.status<=$c.CLIENT_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently available but is unable to refresh the access token.
|
113
|
-
${c}`);return}throw ty(e.error,e.error_description,e.suberror)?new Er(e.error,e.error_description,e.suberror,e.timestamp||F.EMPTY_STRING,e.trace_id||F.EMPTY_STRING,e.correlation_id||F.EMPTY_STRING,e.claims||F.EMPTY_STRING,a):c}}async handleServerTokenResponse(e,t,r,o,a,c,d,h,m){var C;(C=this.performanceClient)==null||C.addQueueMeasurement(x.HandleServerTokenResponse,e.correlation_id);let g;if(e.id_token){if(g=Si(e.id_token||F.EMPTY_STRING,this.cryptoObj.base64Decode),a&&a.nonce&&g.nonce!==a.nonce)throw Y(tw);if(o.maxAge||o.maxAge===0){const T=g.auth_time;if(!T)throw Y(qf);fw(T,o.maxAge)}}this.homeAccountIdentifier=Pt.generateHomeAccountId(e.client_info||F.EMPTY_STRING,t.authorityType,this.logger,this.cryptoObj,g);let v;a&&a.state&&(v=yr.parseRequestState(this.cryptoObj,a.state)),e.key_id=e.key_id||o.sshKid||void 0;const p=this.generateCacheRecord(e,t,r,o,g,c,a);let w;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),w=new S2(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(w)),d&&!h&&p.account){const T=p.account.generateAccountKey();if(!this.cacheStorage.getAccount(T,this.logger))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await Ti.generateAuthenticationResult(this.cryptoObj,t,p,!1,o,g,v,void 0,m)}await this.cacheStorage.saveCacheRecord(p,o.storeInCache,o.correlationId)}finally{this.persistencePlugin&&this.serializableCache&&w&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(w))}return Ti.generateAuthenticationResult(this.cryptoObj,t,p,!1,o,g,v,e,m)}generateCacheRecord(e,t,r,o,a,c,d){const h=t.getPreferredCache();if(!h)throw Y(Yf);const m=Nw(a);let g,v;e.id_token&&a&&(g=au(this.homeAccountIdentifier,h,e.id_token,this.clientId,m||""),v=dm(this.cacheStorage,t,this.homeAccountIdentifier,this.cryptoObj.base64Decode,a,e.client_info,h,m,d,void 0,this.logger));let p=null;if(e.access_token){const T=e.scope?vt.fromString(e.scope):new vt(o.scopes||[]),k=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,I=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,N=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,D=r+k,L=D+I,K=N&&N>0?r+N:void 0;p=su(this.homeAccountIdentifier,h,e.access_token,this.clientId,m||t.tenant||"",T.printScopes(),D,L,this.cryptoObj.base64Decode,K,e.token_type,c,e.key_id,o.claims,o.requestedClaimsHash)}let w=null;if(e.refresh_token){let T;if(e.refresh_token_expires_in){const k=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;T=r+k}w=mw(this.homeAccountIdentifier,h,e.refresh_token,this.clientId,e.foci,c,T)}let C=null;return e.foci&&(C={clientId:this.clientId,environment:h,familyId:e.foci}),{account:v,idToken:g,accessToken:p,refreshToken:w,appMetadata:C}}static async generateAuthenticationResult(e,t,r,o,a,c,d,h,m){var D,L,K,q,M;let g=F.EMPTY_STRING,v=[],p=null,w,C,T=F.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===Ge.POP&&!a.popKid){const ce=new ba(e),{secret:ae,keyId:X}=r.accessToken;if(!X)throw Y(Jf);g=await ce.signPopToken(ae,X,a)}else g=r.accessToken.secret;v=vt.fromString(r.accessToken.target).asArray(),p=new Date(Number(r.accessToken.expiresOn)*1e3),w=new Date(Number(r.accessToken.extendedExpiresOn)*1e3),r.accessToken.refreshOn&&(C=new Date(Number(r.accessToken.refreshOn)*1e3))}r.appMetadata&&(T=r.appMetadata.familyId===ps?ps:"");const k=(c==null?void 0:c.oid)||(c==null?void 0:c.sub)||"",I=(c==null?void 0:c.tid)||"";h!=null&&h.spa_accountid&&r.account&&(r.account.nativeAccountId=h==null?void 0:h.spa_accountid);const N=r.account?im(r.account.getAccountInfo(),void 0,c,(D=r.idToken)==null?void 0:D.secret):null;return{authority:t.canonicalAuthority,uniqueId:k,tenantId:I,scopes:v,account:N,idToken:((L=r==null?void 0:r.idToken)==null?void 0:L.secret)||"",idTokenClaims:c||{},accessToken:g,fromCache:o,expiresOn:p,extExpiresOn:w,refreshOn:C,correlationId:a.correlationId,requestId:m||F.EMPTY_STRING,familyId:T,tokenType:((K=r.accessToken)==null?void 0:K.tokenType)||F.EMPTY_STRING,state:d?d.userRequestState:F.EMPTY_STRING,cloudGraphHostName:((q=r.account)==null?void 0:q.cloudGraphHostName)||F.EMPTY_STRING,msGraphHost:((M=r.account)==null?void 0:M.msGraphHost)||F.EMPTY_STRING,code:h==null?void 0:h.spa_code,fromNativeBroker:!1}}}function dm(n,e,t,r,o,a,c,d,h,m,g){g==null||g.verbose("setCachedAccount called");const p=n.getAccountKeys().find(I=>I.startsWith(t));let w=null;p&&(w=n.getAccount(p,g));const C=w||Pt.createAccount({homeAccountId:t,idTokenClaims:o,clientInfo:a,environment:c,cloudGraphHostName:h==null?void 0:h.cloud_graph_host_name,msGraphHost:h==null?void 0:h.msgraph_host,nativeAccountId:m},e,r),T=C.tenantProfiles||[],k=d||C.realm;if(k&&!T.find(I=>I.tenantId===k)){const I=om(t,C.localAccountId,k,o);T.push(I)}return C.tenantProfiles=T,C}/*! @azure/msal-common v14.16.0 2024-11-05 */async function Fw(n,e,t){return typeof n=="string"?n:n({clientId:e,tokenEndpoint:t})}/*! @azure/msal-common v14.16.0 2024-11-05 */class Vw extends lm{constructor(e,t){var r;super(e,t),this.includeRedirectUri=!0,this.oidcDefaultScopes=(r=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:r.defaultScopes}async getAuthCodeUrl(e){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(x.GetAuthCodeUrl,e.correlationId);const t=await Q(this.createAuthCodeUrlQueryString.bind(this),x.AuthClientCreateQueryString,this.logger,this.performanceClient,e.correlationId)(e);return De.appendQueryString(this.authority.authorizationEndpoint,t)}async acquireToken(e,t){var d,h;if((d=this.performanceClient)==null||d.addQueueMeasurement(x.AuthClientAcquireToken,e.correlationId),!e.code)throw Y(ow);const r=zr(),o=await Q(this.executeTokenRequest.bind(this),x.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),a=(h=o.headers)==null?void 0:h[dn.X_MS_REQUEST_ID],c=new Ti(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return c.validateTokenResponse(o.body),Q(c.handleServerTokenResponse.bind(c),x.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(o.body,this.authority,r,e,t,void 0,void 0,void 0,a)}handleFragmentResponse(e,t){if(new Ti(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null).validateServerAuthorizationCodeResponse(e,t),!e.code)throw Y(lw);return e}getLogoutUri(e){if(!e)throw Xe(Ew);const t=this.createLogoutUrlQueryString(e);return De.appendQueryString(this.authority.endSessionEndpoint,t)}async executeTokenRequest(e,t){var m,g;(m=this.performanceClient)==null||m.addQueueMeasurement(x.AuthClientExecuteTokenRequest,t.correlationId);const r=this.createTokenQueryParameters(t),o=De.appendQueryString(e.tokenEndpoint,r),a=await Q(this.createTokenRequestBody.bind(this),x.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,t.correlationId)(t);let c;if(t.clientInfo)try{const v=Rl(t.clientInfo,this.cryptoUtils.base64Decode);c={credential:`${v.uid}${tn.CLIENT_INFO_SEPARATOR}${v.utid}`,type:Bn.HOME_ACCOUNT_ID}}catch(v){this.logger.verbose("Could not parse client info for CCS Header: "+v)}const d=this.createTokenRequestHeaders(c||t.ccsCredential),h={clientId:((g=t.tokenBodyParameters)==null?void 0:g.clientId)||this.config.authOptions.clientId,authority:e.canonicalAuthority,scopes:t.scopes,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid};return Q(this.executePostToTokenEndpoint.bind(this),x.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,t.correlationId)(o,a,d,h,t.correlationId,x.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var o,a;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthClientCreateTokenRequestBody,e.correlationId);const t=new vs(e.correlationId,this.performanceClient);if(t.addClientId(e.embeddedClientId||((a=e.tokenBodyParameters)==null?void 0:a[wi])||this.config.authOptions.clientId),this.includeRedirectUri?t.addRedirectUri(e.redirectUri):ia.validateRedirectUri(e.redirectUri),t.addScopes(e.scopes,!0,this.oidcDefaultScopes),t.addAuthorizationCode(e.code),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addThrottling(),this.serverTelemetryManager&&!Zh(this.config)&&t.addServerTelemetry(this.serverTelemetryManager),e.codeVerifier&&t.addCodeVerifier(e.codeVerifier),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const c=this.config.clientCredentials.clientAssertion;t.addClientAssertion(await Fw(c.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),t.addClientAssertionType(c.assertionType)}if(t.addGrantType(qE.AUTHORIZATION_CODE_GRANT),t.addClientInfo(),e.authenticationScheme===Ge.POP){const c=new ba(this.cryptoUtils,this.performanceClient);let d;e.popKid?d=this.cryptoUtils.encodeKid(e.popKid):d=(await Q(c.generateCnf.bind(c),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,t.addPopToken(d)}else if(e.authenticationScheme===Ge.SSH)if(e.sshJwk)t.addSshJwk(e.sshJwk);else throw Xe(cu);(!vr.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const c=Rl(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${c.uid}${tn.CLIENT_INFO_SEPARATOR}${c.utid}`,type:Bn.HOME_ACCOUNT_ID}}catch(c){this.logger.verbose("Could not parse client info for CCS Header: "+c)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case Bn.HOME_ACCOUNT_ID:try{const c=fa(r.credential);t.addCcsOid(c)}catch(c){this.logger.verbose("Could not parse home account ID for CCS Header: "+c)}break;case Bn.UPN:t.addCcsUpn(r.credential);break}return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&t.addExtraQueryParameters(e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[Xv])&&t.addExtraQueryParameters({[Xv]:"1"}),t.createQueryString()}async createAuthCodeUrlQueryString(e){var a,c;const t=e.correlationId||this.config.cryptoInterface.createNewGuid();(a=this.performanceClient)==null||a.addQueueMeasurement(x.AuthClientCreateQueryString,t);const r=new vs(t,this.performanceClient);r.addClientId(e.embeddedClientId||((c=e.extraQueryParameters)==null?void 0:c[wi])||this.config.authOptions.clientId);const o=[...e.scopes||[],...e.extraScopesToConsent||[]];if(r.addScopes(o,!0,this.oidcDefaultScopes),r.addRedirectUri(e.redirectUri),r.addCorrelationId(t),r.addResponseMode(e.responseMode),r.addResponseTypeCode(),r.addLibraryInfo(this.config.libraryInfo),Zh(this.config)||r.addApplicationTelemetry(this.config.telemetry.application),r.addClientInfo(),e.codeChallenge&&e.codeChallengeMethod&&r.addCodeChallengeParams(e.codeChallenge,e.codeChallengeMethod),e.prompt&&r.addPrompt(e.prompt),e.domainHint&&r.addDomainHint(e.domainHint),e.prompt!==Bt.SELECT_ACCOUNT)if(e.sid&&e.prompt===Bt.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),r.addSid(e.sid);else if(e.account){const d=this.extractAccountSid(e.account);let h=this.extractLoginHint(e.account);if(h&&e.domainHint&&(this.logger.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),h=null),h){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),r.addLoginHint(h);try{const m=fa(e.account.homeAccountId);r.addCcsOid(m)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(d&&e.prompt===Bt.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),r.addSid(d);try{const m=fa(e.account.homeAccountId);r.addCcsOid(m)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),r.addLoginHint(e.loginHint),r.addCcsUpn(e.loginHint);else if(e.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),r.addLoginHint(e.account.username);try{const m=fa(e.account.homeAccountId);r.addCcsOid(m)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),r.addLoginHint(e.loginHint),r.addCcsUpn(e.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");if(e.nonce&&r.addNonce(e.nonce),e.state&&r.addState(e.state),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(e.claims,this.config.authOptions.clientCapabilities),e.embeddedClientId&&r.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),this.addExtraQueryParams(e,r),e.nativeBroker&&(r.addNativeBroker(),e.authenticationScheme===Ge.POP)){const d=new ba(this.cryptoUtils);let h;e.popKid?h=this.cryptoUtils.encodeKid(e.popKid):h=(await Q(d.generateCnf.bind(d),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,r.addPopToken(h)}return r.createQueryString()}createLogoutUrlQueryString(e){const t=new vs(e.correlationId,this.performanceClient);return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),this.addExtraQueryParams(e,t),t.createQueryString()}addExtraQueryParams(e,t){!(e.extraQueryParameters&&e.extraQueryParameters.hasOwnProperty("instance_aware"))&&this.config.authOptions.instanceAware&&(e.extraQueryParameters=e.extraQueryParameters||{},e.extraQueryParameters.instance_aware="true"),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters)}extractAccountSid(e){var t;return((t=e.idTokenClaims)==null?void 0:t.sid)||null}extractLoginHint(e){var t;return((t=e.idTokenClaims)==null?void 0:t.login_hint)||null}}/*! @azure/msal-common v14.16.0 2024-11-05 */const k2=300;class nf extends lm{constructor(e,t){super(e,t)}async acquireToken(e){var c,d;(c=this.performanceClient)==null||c.addQueueMeasurement(x.RefreshTokenClientAcquireToken,e.correlationId);const t=zr(),r=await Q(this.executeTokenRequest.bind(this),x.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),o=(d=r.headers)==null?void 0:d[dn.X_MS_REQUEST_ID],a=new Ti(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return a.validateTokenResponse(r.body),Q(a.handleServerTokenResponse.bind(a),x.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,t,e,void 0,void 0,!0,e.forceCache,o)}async acquireTokenByRefreshToken(e){var r;if(!e)throw Xe(Cw);if((r=this.performanceClient)==null||r.addQueueMeasurement(x.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw Y(jf);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await Q(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(o){const a=o instanceof Er&&o.errorCode===Dl,c=o instanceof Wo&&o.errorCode===Bv.INVALID_GRANT_ERROR&&o.subError===Bv.CLIENT_MISMATCH_ERROR;if(a||c)return Q(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw o}return Q(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=Ai(this.cacheManager.getRefreshToken.bind(this.cacheManager),x.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,t,void 0,this.performanceClient,e.correlationId);if(!r)throw tf(Dl);if(r.expiresOn&&Xh(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||k2))throw tf(um);const o={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||Ge.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:Bn.HOME_ACCOUNT_ID}};try{return await Q(this.acquireToken.bind(this),x.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(o)}catch(c){if(c instanceof Er&&c.subError===du){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const d=ha(r);this.cacheManager.removeRefreshToken(d)}throw c}}async executeTokenRequest(e,t){var h,m;(h=this.performanceClient)==null||h.addQueueMeasurement(x.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),o=De.appendQueryString(t.tokenEndpoint,r),a=await Q(this.createTokenRequestBody.bind(this),x.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),c=this.createTokenRequestHeaders(e.ccsCredential),d={clientId:((m=e.tokenBodyParameters)==null?void 0:m.clientId)||this.config.authOptions.clientId,authority:t.canonicalAuthority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid};return Q(this.executePostToTokenEndpoint.bind(this),x.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(o,a,c,d,e.correlationId,x.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var o,a,c;(o=this.performanceClient)==null||o.addQueueMeasurement(x.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const t=e.correlationId,r=new vs(t,this.performanceClient);if(r.addClientId(e.embeddedClientId||((a=e.tokenBodyParameters)==null?void 0:a[wi])||this.config.authOptions.clientId),e.redirectUri&&r.addRedirectUri(e.redirectUri),r.addScopes(e.scopes,!0,(c=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:c.defaultScopes),r.addGrantType(qE.REFRESH_TOKEN_GRANT),r.addClientInfo(),r.addLibraryInfo(this.config.libraryInfo),r.addApplicationTelemetry(this.config.telemetry.application),r.addThrottling(),this.serverTelemetryManager&&!Zh(this.config)&&r.addServerTelemetry(this.serverTelemetryManager),r.addRefreshToken(e.refreshToken),this.config.clientCredentials.clientSecret&&r.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const d=this.config.clientCredentials.clientAssertion;r.addClientAssertion(await Fw(d.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),r.addClientAssertionType(d.assertionType)}if(e.authenticationScheme===Ge.POP){const d=new ba(this.cryptoUtils,this.performanceClient);let h;e.popKid?h=this.cryptoUtils.encodeKid(e.popKid):h=(await Q(d.generateCnf.bind(d),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,r.addPopToken(h)}else if(e.authenticationScheme===Ge.SSH)if(e.sshJwk)r.addSshJwk(e.sshJwk);else throw Xe(cu);if((!vr.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case Bn.HOME_ACCOUNT_ID:try{const d=fa(e.ccsCredential.credential);r.addCcsOid(d)}catch(d){this.logger.verbose("Could not parse home account ID for CCS Header: "+d)}break;case Bn.UPN:r.addCcsUpn(e.ccsCredential.credential);break}return e.embeddedClientId&&r.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&r.addExtraQueryParameters(e.tokenBodyParameters),r.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */class N2 extends lm{constructor(e,t){super(e,t)}async acquireToken(e){var t;try{const[r,o]=await this.acquireCachedToken({...e,scopes:(t=e.scopes)!=null&&t.length?e.scopes:[...Pa]});return o===Mo.PROACTIVELY_REFRESHED&&(this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."),new nf(this.config,this.performanceClient).acquireTokenByRefreshToken(e).catch(()=>{})),r}catch(r){if(r instanceof iu&&r.errorCode===co)return new nf(this.config,this.performanceClient).acquireTokenByRefreshToken(e);throw r}}async acquireCachedToken(e){var h;(h=this.performanceClient)==null||h.addQueueMeasurement(x.SilentFlowClientAcquireCachedToken,e.correlationId);let t=Mo.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!vr.isEmptyObj(e.claims))throw this.setCacheOutcome(Mo.FORCE_REFRESH_OR_CLAIMS,e.correlationId),Y(co);if(!e.account)throw Y(jf);const r=e.account.tenantId||v2(e.authority),o=this.cacheManager.getTokenKeys(),a=this.cacheManager.getAccessToken(e.account,e,o,r,this.performanceClient,e.correlationId);if(a){if(oV(a.cachedAt)||Xh(a.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(Mo.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),Y(co);a.refreshOn&&Xh(a.refreshOn,0)&&(t=Mo.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(Mo.NO_CACHED_ACCESS_TOKEN,e.correlationId),Y(co);const c=e.authority||this.authority.getPreferredCache(),d={account:this.cacheManager.readAccountFromCache(e.account),accessToken:a,idToken:this.cacheManager.getIdToken(e.account,o,r,this.performanceClient,e.correlationId),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(c)};return this.setCacheOutcome(t,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await Q(this.generateResultFromCacheRecord.bind(this),x.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(d,e),t]}setCacheOutcome(e,t){var r,o;(r=this.serverTelemetryManager)==null||r.setCacheOutcome(e),(o=this.performanceClient)==null||o.addFields({cacheOutcome:e},t),e!==Mo.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,t){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(x.SilentFlowClientGenerateResultFromCacheRecord,t.correlationId);let r;if(e.idToken&&(r=Si(e.idToken.secret,this.config.cryptoInterface.base64Decode)),t.maxAge||t.maxAge===0){const a=r==null?void 0:r.auth_time;if(!a)throw Y(qf);fw(a,t.maxAge)}return Ti.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,t,r)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const R2={sendGetRequestAsync:()=>Promise.reject(Y(Ae)),sendPostRequestAsync:()=>Promise.reject(Y(Ae))};/*! @azure/msal-common v14.16.0 2024-11-05 */const ny=",",Hw="|";function O2(n){const{skus:e,libraryName:t,libraryVersion:r,extensionName:o,extensionVersion:a}=n,c=new Map([[0,[t,r]],[2,[o,a]]]);let d=[];if(e!=null&&e.length){if(d=e.split(ny),d.length<4)return e}else d=Array.from({length:4},()=>Hw);return c.forEach((h,m)=>{var g,v;h.length===2&&((g=h[0])!=null&&g.length)&&((v=h[1])!=null&&v.length)&&P2({skuArr:d,index:m,skuName:h[0],skuVersion:h[1]})}),d.join(ny)}function P2(n){const{skuArr:e,index:t,skuName:r,skuVersion:o}=n;t>=e.length||(e[t]=[r,o].join(Hw))}class Os{constructor(e,t){this.cacheOutcome=Mo.NOT_APPLICABLE,this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||F.EMPTY_STRING,this.wrapperVer=e.wrapperVer||F.EMPTY_STRING,this.telemetryCacheKey=Wt.CACHE_KEY+tn.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${Wt.VALUE_SEPARATOR}${this.cacheOutcome}`,t=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r!=null&&r.length&&t.push(`broker_error=${r}`);const o=t.join(Wt.VALUE_SEPARATOR),a=this.getRegionDiscoveryFields(),c=[e,a].join(Wt.VALUE_SEPARATOR);return[Wt.SCHEMA_VERSION,c,o].join(Wt.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),t=Os.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*t).join(Wt.VALUE_SEPARATOR),o=e.errors.slice(0,t).join(Wt.VALUE_SEPARATOR),a=e.errors.length,c=t<a?Wt.OVERFLOW_TRUE:Wt.OVERFLOW_FALSE,d=[a,c].join(Wt.VALUE_SEPARATOR);return[Wt.SCHEMA_VERSION,e.cacheHits,r,o,d].join(Wt.CATEGORY_SEPARATOR)}cacheFailedRequest(e){const t=this.getLastRequests();t.errors.length>=Wt.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof lt?e.subError?t.errors.push(e.subError):e.errorCode?t.errors.push(e.errorCode):t.errors.push(e.toString()):t.errors.push(e.toString()):t.errors.push(Wt.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),t=Os.maxErrorsToSend(e),r=e.errors.length;if(t===r)this.cacheManager.removeItem(this.telemetryCacheKey);else{const o={failedRequests:e.failedRequests.slice(t*2),errors:e.errors.slice(t),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,o)}}static maxErrorsToSend(e){let t,r=0,o=0;const a=e.errors.length;for(t=0;t<a;t++){const c=e.failedRequests[2*t]||F.EMPTY_STRING,d=e.failedRequests[2*t+1]||F.EMPTY_STRING,h=e.errors[t]||F.EMPTY_STRING;if(o+=c.toString().length+d.toString().length+h.length+3,o<Wt.MAX_LAST_HEADER_BYTES)r+=1;else break}return r}getRegionDiscoveryFields(){const e=[];return e.push(this.regionUsed||F.EMPTY_STRING),e.push(this.regionSource||F.EMPTY_STRING),e.push(this.regionOutcome||F.EMPTY_STRING),e.join(",")}updateRegionDiscoveryMetadata(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome}setCacheOutcome(e){this.cacheOutcome=e}setNativeBrokerErrorCode(e){const t=this.getLastRequests();t.nativeBrokerErrorCode=e,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}getNativeBrokerErrorCode(){return this.getLastRequests().nativeBrokerErrorCode}clearNativeBrokerErrorCode(){const e=this.getLastRequests();delete e.nativeBrokerErrorCode,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e)}static makeExtraSkuString(e){return O2(e)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const $w="missing_kid_error",Kw="missing_alg_error";/*! @azure/msal-common v14.16.0 2024-11-05 */const M2={[$w]:"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.",[Kw]:"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."};class hm extends lt{constructor(e,t){super(e,t),this.name="JoseHeaderError",Object.setPrototypeOf(this,hm.prototype)}}function ry(n){return new hm(n,M2[n])}/*! @azure/msal-common v14.16.0 2024-11-05 */class fm{constructor(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}static getShrHeaderString(e){if(!e.kid)throw ry($w);if(!e.alg)throw ry(Kw);const t=new fm({typ:e.typ||$F.Pop,kid:e.kid,alg:e.alg});return JSON.stringify(t)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class oy{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class D2{generateId(){return"callback-id"}startMeasurement(e,t){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:_2.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:t||""},measurement:new oy}}startPerformanceMeasurement(){return new oy}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const mm="pkce_not_created",rf="crypto_nonexistent",hu="empty_navigate_uri",Ww="hash_empty_error",gm="no_state_in_hash",zw="hash_does_not_contain_known_properties",Gw="unable_to_parse_state",qw="state_interaction_type_mismatch",jw="interaction_in_progress",Yw="popup_window_error",Jw="empty_window_error",bi="user_cancelled",L2="monitor_popup_timeout",Qw="monitor_window_timeout",Xw="redirect_in_iframe",Zw="block_iframe_reload",eT="block_nested_popups",x2="iframe_closed_prematurely",fu="silent_logout_unsupported",tT="no_account_error",U2="silent_prompt_value_error",nT="no_token_request_cache_error",rT="unable_to_parse_token_request_cache_error",pm="no_cached_authority_error",B2="auth_request_not_set_error",F2="invalid_cache_type",mu="non_browser_environment",aa="database_not_open",Ll="no_network_connectivity",oT="post_request_failed",iT="get_request_failed",of="failed_to_parse_response",aT="unable_to_load_token",_m="crypto_key_not_found",sT="auth_code_required",cT="auth_code_or_nativeAccountId_required",lT="spa_code_and_nativeAccountId_present",vm="database_unavailable",uT="unable_to_acquire_token_from_native_platform",dT="native_handshake_timeout",hT="native_extension_not_installed",Ks="native_connection_not_established",fT="uninitialized_public_client_application",mT="native_prompt_not_supported",gT="invalid_base64_string",pT="invalid_pop_token_request",_T="failed_to_build_headers",vT="failed_to_parse_headers";/*! @azure/msal-browser v3.28.1 2025-01-14 */const io="For more visit: aka.ms/msaljs/browser-errors",V2={[mm]:"The PKCE code challenge and verifier could not be generated.",[rf]:"The crypto object or function is not available.",[hu]:"Navigation URI is empty. Please check stack trace for more info.",[Ww]:`Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. ${io}`,[gm]:"Hash does not contain state. Please verify that the request originated from msal.",[zw]:`Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. ${io}`,[Gw]:"Unable to parse state. Please verify that the request originated from msal.",[qw]:"Hash contains state but the interaction type does not match the caller.",[jw]:`Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. ${io}`,[Yw]:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.",[Jw]:"window.open returned null or undefined window object.",[bi]:"User cancelled the flow.",[L2]:`Token acquisition in popup failed due to timeout. ${io}`,[Qw]:`Token acquisition in iframe failed due to timeout. ${io}`,[Xw]:"Redirects are not supported for iframed or brokered applications. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs.",[Zw]:`Request was blocked inside an iframe because MSAL detected an authentication response. ${io}`,[eT]:"Request was blocked inside a popup because MSAL detected it was running in a popup.",[x2]:"The iframe being monitored was closed prematurely.",[fu]:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead.",[tT]:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.",[U2]:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'.",[nT]:"No token request found in cache.",[rT]:"The cached token request could not be parsed.",[pm]:"No cached authority found.",[B2]:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler",[F2]:"Invalid cache type",[mu]:"Login and token requests are not supported in non-browser environments.",[aa]:"Database is not open!",[Ll]:"No network connectivity. Check your internet connection.",[oT]:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'",[iT]:"Network request failed. Please check the network trace to determine root cause.",[of]:"Failed to parse network response. Check network trace.",[aT]:"Error loading token to cache.",[_m]:"Cryptographic Key or Keypair not found in browser storage.",[sT]:"An authorization code must be provided (as the `code` property on the request) to this flow.",[cT]:"An authorization code or nativeAccountId must be provided to this flow.",[lT]:"Request cannot contain both spa code and native account id.",[vm]:"IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts.",[uT]:`Unable to acquire token from native platform. ${io}`,[dT]:"Timed out while attempting to establish connection to browser extension",[hT]:"Native extension is not installed. If you think this is a mistake call the initialize function.",[Ks]:`Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). ${io}`,[fT]:`You must call and await the initialize function before attempting to call any other MSAL API. ${io}`,[mT]:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",[gT]:"Invalid base64 encoded string.",[pT]:"Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",[_T]:"Failed to build request headers object.",[vT]:"Failed to parse response headers"};class Ws extends lt{constructor(e,t){super(e,V2[e],t),Object.setPrototypeOf(this,Ws.prototype),this.name="BrowserAuthError"}}function ie(n,e){return new Ws(n,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Dn={INTERACTION_IN_PROGRESS_VALUE:"interaction_in_progress",INVALID_GRANT_ERROR:"invalid_grant",POPUP_WIDTH:483,POPUP_HEIGHT:600,POPUP_NAME_PREFIX:"msal",DEFAULT_POLL_INTERVAL_MS:30,MSAL_SKU:"msal.js.browser"},ma={CHANNEL_ID:"53ee284d-920a-4b59-9d30-a60315b26836",PREFERRED_EXTENSION_ID:"ppnbnpeolgkicgegkbkbjmhlideopiji",MATS_TELEMETRY:"MATS"},gi={HandshakeRequest:"Handshake",HandshakeResponse:"HandshakeResponse",GetToken:"GetToken",Response:"Response"},vn={LocalStorage:"localStorage",SessionStorage:"sessionStorage",MemoryStorage:"memoryStorage"},iy={GET:"GET",POST:"POST"},Ke={AUTHORITY:"authority",ACQUIRE_TOKEN_ACCOUNT:"acquireToken.account",SESSION_STATE:"session.state",REQUEST_STATE:"request.state",NONCE_IDTOKEN:"nonce.id_token",ORIGIN_URI:"request.origin",RENEW_STATUS:"token.renew.status",URL_HASH:"urlHash",REQUEST_PARAMS:"request.params",SCOPES:"scopes",INTERACTION_STATUS_KEY:"interaction.status",CCS_CREDENTIAL:"ccs.credential",CORRELATION_ID:"request.correlationId",NATIVE_REQUEST:"request.native",REDIRECT_CONTEXT:"request.redirect.context"},Po={ACCOUNT_KEYS:"msal.account.keys",TOKEN_KEYS:"msal.token.keys"},qc={WRAPPER_SKU:"wrapper.sku",WRAPPER_VER:"wrapper.version"},ot={acquireTokenRedirect:861,acquireTokenPopup:862,ssoSilent:863,acquireTokenSilent_authCode:864,handleRedirectPromise:865,acquireTokenByCode:866,acquireTokenSilent_silentFlow:61,logout:961,logoutPopup:962};var le;(function(n){n.Redirect="redirect",n.Popup="popup",n.Silent="silent",n.None="none"})(le||(le={}));const ay={scopes:Pa},yT="jwk",af="msal.db",H2=1,$2=`${af}.keys`,Pn={Default:0,AccessToken:1,AccessTokenAndRefreshToken:2,RefreshToken:3,RefreshTokenAndNetwork:4,Skip:5},K2=[Pn.Default,Pn.Skip,Pn.RefreshTokenAndNetwork],W2="msal.browser.log.level",z2="msal.browser.log.pii";/*! @azure/msal-browser v3.28.1 2025-01-14 */function jc(n){return encodeURIComponent(ym(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"))}function gu(n){return CT(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ym(n){return CT(new TextEncoder().encode(n))}function CT(n){const e=Array.from(n,t=>String.fromCodePoint(t)).join("");return btoa(e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const G2="RSASSA-PKCS1-v1_5",ET="SHA-256",q2=2048,j2=new Uint8Array([1,0,1]),sy="0123456789abcdef",cy=new Uint32Array(1),Y2="crypto_subtle_undefined",Cm={name:G2,hash:ET,modulusLength:q2,publicExponent:j2};function J2(n){if(!window)throw ie(mu);if(!window.crypto)throw ie(rf);if(!n&&!window.crypto.subtle)throw ie(rf,Y2)}async function wT(n,e,t){e==null||e.addQueueMeasurement(x.Sha256Digest,t);const o=new TextEncoder().encode(n);return window.crypto.subtle.digest(ET,o)}function Q2(n){return window.crypto.getRandomValues(n)}function sh(){return window.crypto.getRandomValues(cy),cy[0]}function go(){const n=Date.now(),e=sh()*1024+(sh()&1023),t=new Uint8Array(16),r=Math.trunc(e/2**30),o=e&2**30-1,a=sh();t[0]=n/2**40,t[1]=n/2**32,t[2]=n/2**24,t[3]=n/2**16,t[4]=n/2**8,t[5]=n,t[6]=112|r>>>8,t[7]=r,t[8]=128|o>>>24,t[9]=o>>>16,t[10]=o>>>8,t[11]=o,t[12]=a>>>24,t[13]=a>>>16,t[14]=a>>>8,t[15]=a;let c="";for(let d=0;d<t.length;d++)c+=sy.charAt(t[d]>>>4),c+=sy.charAt(t[d]&15),(d===3||d===5||d===7||d===9)&&(c+="-");return c}async function X2(n,e){return window.crypto.subtle.generateKey(Cm,n,e)}async function ch(n){return window.crypto.subtle.exportKey(yT,n)}async function Z2(n,e,t){return window.crypto.subtle.importKey(yT,n,Cm,e,t)}async function eH(n,e){return window.crypto.subtle.sign(Cm,n,e)}async function TT(n){const e=await wT(n),t=new Uint8Array(e);return gu(t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Ps="storage_not_supported",sf="stubbed_public_client_application_called",xl="in_mem_redirect_unavailable";/*! @azure/msal-browser v3.28.1 2025-01-14 */const gl={[Ps]:"Given storage configuration option was not supported.",[sf]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[xl]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};gl[Ps],gl[sf],gl[xl];class Em extends lt{constructor(e,t){super(e,t),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,Em.prototype)}}function wm(n){return new Em(n,gl[n])}/*! @azure/msal-browser v3.28.1 2025-01-14 */function tH(n){n.location.hash="",typeof n.history.replaceState=="function"&&n.history.replaceState(null,"",`${n.location.origin}${n.location.pathname}${n.location.search}`)}function nH(n){const e=n.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function Tm(){return window.parent!==window}function rH(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${Dn.POPUP_NAME_PREFIX}.`)===0}function lo(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function oH(){const e=new De(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function iH(){if(De.hashContainsKnownProperties(window.location.hash)&&Tm())throw ie(Zw)}function aH(n){if(Tm()&&!n)throw ie(Xw)}function sH(){if(rH())throw ie(eT)}function bT(){if(typeof window>"u")throw ie(mu)}function IT(n){if(!n)throw ie(fT)}function bm(n){bT(),iH(),sH(),IT(n)}function ly(n,e){if(bm(n),aH(e.system.allowRedirectInIframe),e.cache.cacheLocation===vn.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw wm(xl)}function ST(n){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(n).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function cH(){return go()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ul{navigateInternal(e,t){return Ul.defaultNavigateWindow(e,t)}navigateExternal(e,t){return Ul.defaultNavigateWindow(e,t)}static defaultNavigateWindow(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise(r=>{setTimeout(()=>{r(!0)},t.timeout)})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class lH{async sendGetRequestAsync(e,t){let r,o={},a=0;const c=uy(t);try{r=await fetch(e,{method:iy.GET,headers:c})}catch{throw ie(window.navigator.onLine?iT:Ll)}o=dy(r.headers);try{return a=r.status,{headers:o,body:await r.json(),status:a}}catch{throw Zv(ie(of),a,o)}}async sendPostRequestAsync(e,t){const r=t&&t.body||"",o=uy(t);let a,c=0,d={};try{a=await fetch(e,{method:iy.POST,headers:o,body:r})}catch{throw ie(window.navigator.onLine?oT:Ll)}d=dy(a.headers);try{return c=a.status,{headers:d,body:await a.json(),status:c}}catch{throw Zv(ie(of),c,d)}}}function uy(n){try{const e=new Headers;if(!(n&&n.headers))return e;const t=n.headers;return Object.entries(t).forEach(([r,o])=>{e.append(r,o)}),e}catch{throw ie(_T)}}function dy(n){try{const e={};return n.forEach((t,r)=>{e[r]=t}),e}catch{throw ie(vT)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const uH=6e4,cf=1e4,dH=3e4,hH=2e3;function fH({auth:n,cache:e,system:t,telemetry:r},o){const a={clientId:F.EMPTY_STRING,authority:`${F.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:F.EMPTY_STRING,authorityMetadata:F.EMPTY_STRING,redirectUri:typeof window<"u"?lo():"",postLogoutRedirectUri:F.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:fo.AAD,OIDCOptions:{serverResponseType:$s.FRAGMENT,defaultScopes:[F.OPENID_SCOPE,F.PROFILE_SCOPE,F.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:Xf.None,tenant:F.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1},c={cacheLocation:vn.SessionStorage,temporaryCacheLocation:vn.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===vn.LocalStorage),claimsBasedCachingEnabled:!1},d={loggerCallback:()=>{},logLevel:tt.Info,piiLoggingEnabled:!1},m={...{...Dw,loggerOptions:d,networkClient:o?new lH:R2,navigationClient:new Ul,loadFrameTimeout:0,windowHashTimeout:(t==null?void 0:t.loadFrameTimeout)||uH,iframeHashTimeout:(t==null?void 0:t.loadFrameTimeout)||cf,navigateFrameWait:0,redirectNavigationTimeout:dH,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:(t==null?void 0:t.nativeBrokerHandshakeTimeout)||hH,pollIntervalMilliseconds:Dn.DEFAULT_POLL_INTERVAL_MS},...t,loggerOptions:(t==null?void 0:t.loggerOptions)||d},g={application:{appName:F.EMPTY_STRING,appVersion:F.EMPTY_STRING},client:new D2};if((n==null?void 0:n.protocolMode)!==fo.OIDC&&(n!=null&&n.OIDCOptions)&&new Ko(m.loggerOptions).warning(JSON.stringify(Xe(Sw))),n!=null&&n.protocolMode&&n.protocolMode!==fo.AAD&&(m!=null&&m.allowNativeBroker))throw Xe(Aw);return{auth:{...a,...n,OIDCOptions:{...a.OIDCOptions,...n==null?void 0:n.OIDCOptions}},cache:{...c,...e},system:m,telemetry:{...g,...r}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const mH="@azure/msal-browser",pu="3.28.1";/*! @azure/msal-browser v3.28.1 2025-01-14 */class Im{static loggerCallback(e,t){switch(e){case tt.Error:console.error(t);return;case tt.Info:console.info(t);return;case tt.Verbose:console.debug(t);return;case tt.Warning:console.warn(t);return;default:console.log(t);return}}constructor(e){var h;this.browserEnvironment=typeof window<"u",this.config=fH(e,this.browserEnvironment);let t;try{t=window[vn.SessionStorage]}catch{}const r=t==null?void 0:t.getItem(W2),o=(h=t==null?void 0:t.getItem(z2))==null?void 0:h.toLowerCase(),a=o==="true"?!0:o==="false"?!1:void 0,c={...this.config.system.loggerOptions},d=r&&Object.keys(tt).includes(r)?tt[r]:void 0;d&&(c.loggerCallback=Im.loggerCallback,c.logLevel=d),a!==void 0&&(c.piiLoggingEnabled=a),this.logger=new Ko(c,mH,pu),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ii extends Im{getModuleName(){return Ii.MODULE_NAME}getId(){return Ii.ID}async initialize(){return this.available=typeof window<"u",this.available}}Ii.MODULE_NAME="";Ii.ID="StandardOperatingContext";/*! @azure/msal-browser v3.28.1 2025-01-14 */function Kr(n){return new TextDecoder().decode(gH(n))}function gH(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw ie(gT)}const t=atob(e);return Uint8Array.from(t,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class pH{constructor(){this.dbName=af,this.version=H2,this.tableName=$2,this.dbOpen=!1}async open(){return new Promise((e,t)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",o=>{o.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",o=>{const a=o;this.db=a.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>t(ie(vm)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(ie(aa));const c=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);c.addEventListener("success",d=>{const h=d;this.closeConnection(),t(h.target.result)}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async setItem(e,t){return await this.validateDbIsOpen(),new Promise((r,o)=>{if(!this.db)return o(ie(aa));const d=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(t,e);d.addEventListener("success",()=>{this.closeConnection(),r()}),d.addEventListener("error",h=>{this.closeConnection(),o(h)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(ie(aa));const c=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);c.addEventListener("success",()=>{this.closeConnection(),t()}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,t)=>{if(!this.db)return t(ie(aa));const a=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();a.addEventListener("success",c=>{const d=c;this.closeConnection(),e(d.target.result)}),a.addEventListener("error",c=>{this.closeConnection(),t(c)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(ie(aa));const c=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);c.addEventListener("success",d=>{const h=d;this.closeConnection(),t(h.target.result===1)}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,t)=>{const r=window.indexedDB.deleteDatabase(af),o=setTimeout(()=>t(!1),200);r.addEventListener("success",()=>(clearTimeout(o),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(o),e(!0))),r.addEventListener("error",()=>(clearTimeout(o),t(!1)))})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class lf{constructor(){this.cache=new Map}getItem(e){return this.cache.get(e)||null}setItem(e,t){this.cache.set(e,t)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((t,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class _H{constructor(e){this.inMemoryCache=new lf,this.indexedDBCache=new pH,this.logger=e}handleDatabaseAccessError(e){if(e instanceof Ws&&e.errorCode===vm)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const t=this.inMemoryCache.getItem(e);if(!t)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(r){this.handleDatabaseAccessError(r)}return t}async setItem(e,t){this.inMemoryCache.setItem(e,t);try{await this.indexedDBCache.setItem(e,t)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(t){this.handleDatabaseAccessError(t)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(t){this.handleDatabaseAccessError(t)}return e}async containsKey(e){const t=this.inMemoryCache.containsKey(e);if(!t)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(r){this.handleDatabaseAccessError(r)}return t}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ia{constructor(e,t,r){this.logger=e,J2(r??!1),this.cache=new _H(this.logger),this.performanceClient=t}createNewGuid(){return go()}base64Encode(e){return ym(e)}base64Decode(e){return Kr(e)}base64UrlEncode(e){return jc(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var g;const t=(g=this.performanceClient)==null?void 0:g.startMeasurement(x.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await X2(Ia.EXTRACTABLE,Ia.POP_KEY_USAGES),o=await ch(r.publicKey),a={e:o.e,kty:o.kty,n:o.n},c=hy(a),d=await this.hashString(c),h=await ch(r.privateKey),m=await Z2(h,!1,["sign"]);return await this.cache.setItem(d,{privateKey:m,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),t&&t.end({success:!0}),d}async removeTokenBindingKey(e){return await this.cache.removeItem(e),!await this.cache.containsKey(e)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,t,r,o){var D;const a=(D=this.performanceClient)==null?void 0:D.startMeasurement(x.CryptoOptsSignJwt,o),c=await this.cache.getItem(t);if(!c)throw ie(_m);const d=await ch(c.publicKey),h=hy(d),m=jc(JSON.stringify({kid:t})),g=fm.getShrHeaderString({...r==null?void 0:r.header,alg:d.alg,kid:m}),v=jc(g);e.cnf={jwk:JSON.parse(h)};const p=jc(JSON.stringify(e)),w=`${v}.${p}`,T=new TextEncoder().encode(w),k=await eH(c.privateKey,T),I=gu(new Uint8Array(k)),N=`${w}.${I}`;return a&&a.end({success:!0}),N}async hashString(e){return TT(e)}}Ia.POP_KEY_USAGES=["sign","verify"];Ia.EXTRACTABLE=!0;function hy(n){return JSON.stringify(n,Object.keys(n).sort())}/*! @azure/msal-browser v3.28.1 2025-01-14 */class vH{constructor(){if(!window.localStorage)throw wm(Ps)}getItem(e){return window.localStorage.getItem(e)}setItem(e,t){window.localStorage.setItem(e,t)}removeItem(e){window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class yH{constructor(){if(!window.sessionStorage)throw wm(Ps)}getItem(e){return window.sessionStorage.getItem(e)}setItem(e,t){window.sessionStorage.setItem(e,t)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function AT(n,e){if(!e)return null;try{return yr.parseRequestState(n,e).libraryState.meta}catch{throw Y(wa)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const CH=24*60*60*1e3;class EH{getItem(e){const t=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let o=0;o<r.length;o++){const a=r[o],[c,...d]=decodeURIComponent(a).trim().split("="),h=d.join("=");if(c===t)return h}return""}setItem(e,t,r,o=!0){let a=`${encodeURIComponent(e)}=${encodeURIComponent(t)};path=/;SameSite=Lax;`;if(r){const c=wH(r);a+=`expires=${c};`}o&&(a+="Secure;"),document.cookie=a}removeItem(e){this.setItem(e,"",-1)}getKeys(){const e=document.cookie.split(";"),t=[];return e.forEach(r=>{const o=decodeURIComponent(r).trim().split("=");t.push(o[0])}),t}containsKey(e){return this.getKeys().includes(e)}}function wH(n){const e=new Date;return new Date(e.getTime()+n*CH).toUTCString()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class uf extends Ta{constructor(e,t,r,o,a,c){super(e,r,o,a),this.cacheConfig=t,this.logger=o,this.internalStorage=new lf,this.browserStorage=this.setupBrowserStorage(this.cacheConfig.cacheLocation),this.temporaryCacheStorage=this.setupBrowserStorage(this.cacheConfig.temporaryCacheLocation),this.cookieStorage=new EH,t.cacheMigrationEnabled&&(this.migrateCacheEntries(),this.createKeyMaps()),this.performanceClient=c}setupBrowserStorage(e){try{switch(e){case vn.LocalStorage:return new vH;case vn.SessionStorage:return new yH;case vn.MemoryStorage:default:break}}catch(t){this.logger.error(t)}return this.cacheConfig.cacheLocation=vn.MemoryStorage,new lf}migrateCacheEntries(){const e=`${F.CACHE_PREFIX}.${Lt.ID_TOKEN}`,t=`${F.CACHE_PREFIX}.${Lt.CLIENT_INFO}`,r=`${F.CACHE_PREFIX}.${Lt.ERROR}`,o=`${F.CACHE_PREFIX}.${Lt.ERROR_DESC}`,a=this.browserStorage.getItem(e),c=this.browserStorage.getItem(t),d=this.browserStorage.getItem(r),h=this.browserStorage.getItem(o),m=[a,c,d,h];[Lt.ID_TOKEN,Lt.CLIENT_INFO,Lt.ERROR,Lt.ERROR_DESC].forEach((v,p)=>{const w=m[p];w&&this.setTemporaryCache(v,w,!0)})}createKeyMaps(){this.logger.trace("BrowserCacheManager - createKeyMaps called.");const e=this.getItem(Po.ACCOUNT_KEYS),t=this.getItem(`${Po.TOKEN_KEYS}.${this.clientId}`);if(e&&t){this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.");return}this.browserStorage.getKeys().forEach(o=>{if(this.isCredentialKey(o)){const a=this.getItem(o);if(a){const c=this.validateAndParseJson(a);if(c&&c.hasOwnProperty("credentialType"))switch(c.credentialType){case ge.ID_TOKEN:if(Kv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,ge.ID_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${o}`);break;case ge.ACCESS_TOKEN:case ge.ACCESS_TOKEN_WITH_AUTH_SCHEME:if($v(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,ge.ACCESS_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${o}`);break;case ge.REFRESH_TOKEN:if(Wv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,ge.REFRESH_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${o}`);break}}}if(this.isAccountKey(o)){const a=this.getItem(o);if(a){const c=this.validateAndParseJson(a);c&&Pt.isAccountEntity(c)&&(this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${o} found, saving key to account key map`),this.addAccountKeyToMap(o))}}})}validateAndParseJson(e){try{const t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}getItem(e){return this.browserStorage.getItem(e)}setItem(e,t){this.browserStorage.setItem(e,t)}getAccount(e,t){this.logger.trace("BrowserCacheManager.getAccount called");const r=this.getCachedAccountEntity(e);return this.updateOutdatedCachedAccount(e,r,t)}getCachedAccountEntity(e){const t=this.getItem(e);if(!t)return this.removeAccountKeyFromMap(e),null;const r=this.validateAndParseJson(t);return!r||!Pt.isAccountEntity(r)?(this.removeAccountKeyFromMap(e),null):Ta.toObject(new Pt,r)}setAccount(e){this.logger.trace("BrowserCacheManager.setAccount called");const t=e.generateAccountKey();this.setItem(t,JSON.stringify(e)),this.addAccountKeyToMap(t)}getAccountKeys(){this.logger.trace("BrowserCacheManager.getAccountKeys called");const e=this.getItem(Po.ACCOUNT_KEYS);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])}addAccountKeyToMap(e){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${e}`);const t=this.getAccountKeys();t.indexOf(e)===-1?(t.push(e),this.setItem(Po.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")}removeAccountKeyFromMap(e){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${e}`);const t=this.getAccountKeys(),r=t.indexOf(e);r>-1?(t.splice(r,1),this.setItem(Po.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")):this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}async removeAccount(e){super.removeAccount(e),this.removeAccountKeyFromMap(e)}removeOutdatedAccount(e){this.removeItem(e),this.removeAccountKeyFromMap(e)}removeIdToken(e){super.removeIdToken(e),this.removeTokenKey(e,ge.ID_TOKEN)}async removeAccessToken(e){super.removeAccessToken(e),this.removeTokenKey(e,ge.ACCESS_TOKEN)}removeRefreshToken(e){super.removeRefreshToken(e),this.removeTokenKey(e,ge.REFRESH_TOKEN)}getTokenKeys(){this.logger.trace("BrowserCacheManager.getTokenKeys called");const e=this.getItem(`${Po.TOKEN_KEYS}.${this.clientId}`);if(e){const t=this.validateAndParseJson(e);if(t&&t.hasOwnProperty("idToken")&&t.hasOwnProperty("accessToken")&&t.hasOwnProperty("refreshToken"))return t;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}}addTokenKey(e,t){this.logger.trace("BrowserCacheManager addTokenKey called");const r=this.getTokenKeys();switch(t){case ge.ID_TOKEN:r.idToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),r.idToken.push(e));break;case ge.ACCESS_TOKEN:r.accessToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map"),r.accessToken.push(e));break;case ge.REFRESH_TOKEN:r.refreshToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),r.refreshToken.push(e));break;default:throw this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${t}`),Y(Qh)}this.setItem(`${Po.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}removeTokenKey(e,t){this.logger.trace("BrowserCacheManager removeTokenKey called");const r=this.getTokenKeys();switch(t){case ge.ID_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${e} from map`);const o=r.idToken.indexOf(e);o>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),r.idToken.splice(o,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case ge.ACCESS_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: ${e} from map`);const a=r.accessToken.indexOf(e);a>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),r.accessToken.splice(a,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case ge.REFRESH_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: ${e} from map`);const c=r.refreshToken.indexOf(e);c>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),r.refreshToken.splice(c,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:throw this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${t}`),Y(Qh)}this.setItem(`${Po.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}getIdTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ID_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Kv(r)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ID_TOKEN),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),r)}setIdTokenCredential(e){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const t=ha(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,ge.ID_TOKEN)}getAccessTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ACCESS_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!$v(r)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ACCESS_TOKEN),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),r)}setAccessTokenCredential(e){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const t=ha(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,ge.ACCESS_TOKEN)}getRefreshTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.REFRESH_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Wv(r)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.REFRESH_TOKEN),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),r)}setRefreshTokenCredential(e){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const t=ha(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,ge.REFRESH_TOKEN)}getAppMetadata(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!fV(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e){this.logger.trace("BrowserCacheManager.setAppMetadata called");const t=hV(e);this.setItem(t,JSON.stringify(e))}getServerTelemetry(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!uV(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,t){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t))}getAuthorityMetadata(e){const t=this.internalStorage.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return r&&mV(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(t=>this.isAuthorityMetadata(t))}setWrapperMetadata(e,t){this.internalStorage.setItem(qc.WRAPPER_SKU,e),this.internalStorage.setItem(qc.WRAPPER_VER,t)}getWrapperMetadata(){const e=this.internalStorage.getItem(qc.WRAPPER_SKU)||F.EMPTY_STRING,t=this.internalStorage.getItem(qc.WRAPPER_VER)||F.EMPTY_STRING;return[e,t]}setAuthorityMetadata(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))}getActiveAccount(){const e=this.generateCacheKey(Lt.ACTIVE_ACCOUNT_FILTERS),t=this.getItem(e);if(!t){this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");const o=this.generateCacheKey(Lt.ACTIVE_ACCOUNT),a=this.getItem(o);if(!a)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null;const c=this.getAccountInfoFilteredBy({localAccountId:a});return c?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(c),c):null}const r=this.validateAndParseJson(t);return r?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:r.homeAccountId,localAccountId:r.localAccountId,tenantId:r.tenantId})):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e){const t=this.generateCacheKey(Lt.ACTIVE_ACCOUNT_FILTERS),r=this.generateCacheKey(Lt.ACTIVE_ACCOUNT);if(e){this.logger.verbose("setActiveAccount: Active account set");const o={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId};this.browserStorage.setItem(t,JSON.stringify(o)),this.browserStorage.setItem(r,e.localAccountId)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(t),this.browserStorage.removeItem(r)}getThrottlingCache(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!dV(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,t){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t))}getTemporaryCache(e,t){const r=t?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const a=this.cookieStorage.getItem(r);if(a)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),a}const o=this.temporaryCacheStorage.getItem(r);if(!o){if(this.cacheConfig.cacheLocation===vn.LocalStorage){const a=this.browserStorage.getItem(r);if(a)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),a}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),o}setTemporaryCache(e,t,r){const o=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(o,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(o,t,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}async clear(){await this.removeAllAccounts(),this.removeAppMetadata(),this.temporaryCacheStorage.getKeys().forEach(e=>{(e.indexOf(F.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(e)}),this.browserStorage.getKeys().forEach(e=>{(e.indexOf(F.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(e)}),this.internalStorage.clear()}async clearTokensAndKeysWithClaims(e,t){e.addQueueMeasurement(x.ClearTokensAndKeysWithClaims,t);const r=this.getTokenKeys(),o=[];r.accessToken.forEach(a=>{const c=this.getAccessTokenCredential(a);c!=null&&c.requestedClaimsHash&&a.includes(c.requestedClaimsHash.toLowerCase())&&o.push(this.removeAccessToken(a))}),await Promise.all(o),o.length>0&&this.logger.warning(`${o.length} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return this.validateAndParseJson(e)?JSON.stringify(e):vr.startsWith(e,F.CACHE_PREFIX)||vr.startsWith(e,Lt.ADAL_ID_TOKEN)?e:`${F.CACHE_PREFIX}.${this.clientId}.${e}`}generateAuthorityKey(e){const{libraryState:{id:t}}=yr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Ke.AUTHORITY}.${t}`)}generateNonceKey(e){const{libraryState:{id:t}}=yr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Ke.NONCE_IDTOKEN}.${t}`)}generateStateKey(e){const{libraryState:{id:t}}=yr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Ke.REQUEST_STATE}.${t}`)}getCachedAuthority(e){const t=this.generateStateKey(e),r=this.getTemporaryCache(t);if(!r)return null;const o=this.generateAuthorityKey(r);return this.getTemporaryCache(o)}updateCacheEntries(e,t,r,o,a){this.logger.trace("BrowserCacheManager.updateCacheEntries called");const c=this.generateStateKey(e);this.setTemporaryCache(c,e,!1);const d=this.generateNonceKey(e);this.setTemporaryCache(d,t,!1);const h=this.generateAuthorityKey(e);if(this.setTemporaryCache(h,r,!1),a){const m={credential:a.homeAccountId,type:Bn.HOME_ACCOUNT_ID};this.setTemporaryCache(Ke.CCS_CREDENTIAL,JSON.stringify(m),!0)}else if(o){const m={credential:o,type:Bn.UPN};this.setTemporaryCache(Ke.CCS_CREDENTIAL,JSON.stringify(m),!0)}}resetRequestCache(e){this.logger.trace("BrowserCacheManager.resetRequestCache called"),e&&(this.temporaryCacheStorage.getKeys().forEach(t=>{t.indexOf(e)!==-1&&this.removeTemporaryItem(t)}),this.removeTemporaryItem(this.generateStateKey(e)),this.removeTemporaryItem(this.generateNonceKey(e)),this.removeTemporaryItem(this.generateAuthorityKey(e))),this.removeTemporaryItem(this.generateCacheKey(Ke.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(Ke.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(Ke.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(Ke.CORRELATION_ID)),this.removeTemporaryItem(this.generateCacheKey(Ke.CCS_CREDENTIAL)),this.removeTemporaryItem(this.generateCacheKey(Ke.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cleanRequestByState(e){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e){const t=this.generateStateKey(e),r=this.temporaryCacheStorage.getItem(t);this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r||F.EMPTY_STRING)}}cleanRequestByInteractionType(e){this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.temporaryCacheStorage.getKeys().forEach(t=>{if(t.indexOf(Ke.REQUEST_STATE)===-1)return;const r=this.temporaryCacheStorage.getItem(t);if(!r)return;const o=AT(this.cryptoImpl,r);o&&o.interactionType===e&&(this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r))}),this.setInteractionInProgress(!1)}cacheCodeRequest(e){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");const t=ym(JSON.stringify(e));this.setTemporaryCache(Ke.REQUEST_PARAMS,t,!0)}getCachedRequest(e){this.logger.trace("BrowserCacheManager.getCachedRequest called");const t=this.getTemporaryCache(Ke.REQUEST_PARAMS,!0);if(!t)throw ie(nT);let r;try{r=JSON.parse(Kr(t))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${t}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),ie(rT)}if(this.removeTemporaryItem(this.generateCacheKey(Ke.REQUEST_PARAMS)),!r.authority){const o=this.generateAuthorityKey(e),a=this.getTemporaryCache(o);if(!a)throw ie(pm);r.authority=a}return r}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(Ke.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const t=this.validateAndParseJson(e);return t||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){const t=this.getInteractionInProgress();return e?t===this.clientId:!!t}getInteractionInProgress(){const e=`${F.CACHE_PREFIX}.${Ke.INTERACTION_STATUS_KEY}`;return this.getTemporaryCache(e,!1)}setInteractionInProgress(e){const t=`${F.CACHE_PREFIX}.${Ke.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw ie(jw);this.setTemporaryCache(t,this.clientId,!1)}else!e&&this.getInteractionInProgress()===this.clientId&&this.removeTemporaryItem(t)}getLegacyLoginHint(){const e=this.getTemporaryCache(Lt.ADAL_ID_TOKEN);e&&(this.browserStorage.removeItem(Lt.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved."));const t=this.getTemporaryCache(Lt.ID_TOKEN,!0);t&&(this.browserStorage.removeItem(this.generateCacheKey(Lt.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));const r=t||e;if(r){const o=Si(r,Kr);if(o.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),o.preferred_username;if(o.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),o.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null}updateCredentialCacheKey(e,t){const r=ha(t);if(e!==r){const o=this.getItem(e);if(o)return this.browserStorage.removeItem(e),this.setItem(r,o),this.logger.verbose(`Updated an outdated ${t.credentialType} cache key`),r;this.logger.error(`Attempted to update an outdated ${t.credentialType} cache key but no item matching the outdated key was found in storage`)}return e}async hydrateCache(e,t){var d,h,m;const r=au((d=e.account)==null?void 0:d.homeAccountId,(h=e.account)==null?void 0:h.environment,e.idToken,this.clientId,e.tenantId);let o;t.claims&&(o=await this.cryptoImpl.hashString(t.claims));const a=su((m=e.account)==null?void 0:m.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?e.expiresOn.getTime()/1e3:0,e.extExpiresOn?e.extExpiresOn.getTime()/1e3:0,Kr,void 0,e.tokenType,void 0,t.sshKid,t.claims,o),c={idToken:r,accessToken:a};return this.saveCacheRecord(c)}async saveCacheRecord(e,t,r){try{await super.saveCacheRecord(e,t,r)}catch(o){if(o instanceof pa&&this.performanceClient&&r)try{const a=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:a.refreshToken.length,cacheIdCount:a.idToken.length,cacheAtCount:a.accessToken.length},r)}catch{}throw o}}}const TH=(n,e)=>{const t={cacheLocation:vn.MemoryStorage,temporaryCacheLocation:vn.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new uf(n,t,Nl,e)};/*! @azure/msal-browser v3.28.1 2025-01-14 */function bH(n,e,t,r){return n.verbose("getAllAccounts called"),t?e.getAllAccounts(r):[]}function IH(n,e,t){if(e.trace("getAccount called"),Object.keys(n).length===0)return e.warning("getAccount: No accountFilter provided"),null;const r=t.getAccountInfoFilteredBy(n);return r?(e.verbose("getAccount: Account matching provided filter found, returning"),r):(e.verbose("getAccount: No matching account found, returning null"),null)}function SH(n,e,t){if(e.trace("getAccountByUsername called"),!n)return e.warning("getAccountByUsername: No username provided"),null;const r=t.getAccountInfoFilteredBy({username:n});return r?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${n}`),r):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function AH(n,e,t){if(e.trace("getAccountByHomeId called"),!n)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const r=t.getAccountInfoFilteredBy({homeAccountId:n});return r?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${n}`),r):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function kH(n,e,t){if(e.trace("getAccountByLocalId called"),!n)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const r=t.getAccountInfoFilteredBy({localAccountId:n});return r?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${n}`),r):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function NH(n,e){e.setActiveAccount(n)}function RH(n){return n.getActiveAccount()}/*! @azure/msal-browser v3.28.1 2025-01-14 */const me={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache"};/*! @azure/msal-browser v3.28.1 2025-01-14 */class OH{constructor(e){this.eventCallbacks=new Map,this.logger=e||new Ko({})}addEventCallback(e,t,r){if(typeof window<"u"){const o=r||cH();return this.eventCallbacks.has(o)?(this.logger.error(`Event callback with id: ${o} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(o,[e,t||[]]),this.logger.verbose(`Event callback registered with id: ${o}`),o)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,t,r,o){if(typeof window<"u"){const a={eventType:e,interactionType:t||null,payload:r||null,error:o||null,timestamp:Date.now()};this.eventCallbacks.forEach(([c,d],h)=>{(d.length===0||d.includes(e))&&(this.logger.verbose(`Emitting event to callback ${h}: ${e}`),c.apply(null,[a]))})}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class kT{constructor(e,t,r,o,a,c,d,h,m){this.config=e,this.browserStorage=t,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=a,this.navigationClient=c,this.nativeMessageHandler=h,this.correlationId=m||go(),this.logger=o.clone(Dn.MSAL_SKU,pu,this.correlationId),this.performanceClient=d}async clearCacheOnLogout(e){if(e){Pt.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null));try{await this.browserStorage.removeAccount(Pt.generateAccountCacheKey(e)),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),await this.browserStorage.clear(),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const t=e||this.config.auth.redirectUri;return De.getAbsoluteUrl(t,lo())}initializeServerTelemetryManager(e,t){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Os(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:t}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(x.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const o={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},a=e.requestAuthority||this.config.auth.authority,c=r!=null&&r.length?r==="true":this.config.auth.instanceAware,d=t&&c?this.config.auth.authority.replace(De.getDomainFromUrl(a),t.environment):a,h=Xt.generateAuthority(d,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),m=await Q(Uw,x.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(h,this.config.system.networkClient,this.browserStorage,o,this.logger,this.correlationId,this.performanceClient);if(t&&!m.isAlias(t.environment))throw Xe(kw);return m}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const PH=32;async function MH(n,e,t){n.addQueueMeasurement(x.GeneratePkceCodes,t);const r=Ai(DH,x.GenerateCodeVerifier,e,n,t)(n,e,t),o=await Q(LH,x.GenerateCodeChallengeFromVerifier,e,n,t)(r,n,e,t);return{verifier:r,challenge:o}}function DH(n,e,t){try{const r=new Uint8Array(PH);return Ai(Q2,x.GetRandomValues,e,n,t)(r),gu(r)}catch{throw ie(mm)}}async function LH(n,e,t,r){e.addQueueMeasurement(x.GenerateCodeChallengeFromVerifier,r);try{const o=await Q(wT,x.Sha256Digest,t,e,r)(n,e,r);return gu(new Uint8Array(o))}catch{throw ie(mm)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function Sm(n,e,t,r){t.addQueueMeasurement(x.InitializeBaseRequest,n.correlationId);const o=n.authority||e.auth.authority,a=[...n&&n.scopes||[]],c={...n,correlationId:n.correlationId,authority:o,scopes:a};if(!c.authenticationScheme)c.authenticationScheme=Ge.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(c.authenticationScheme===Ge.SSH){if(!n.sshJwk)throw Xe(cu);if(!n.sshKid)throw Xe(Iw)}r.verbose(`Authentication Scheme set to "${c.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&n.claims&&!vr.isEmptyObj(n.claims)&&(c.requestedClaimsHash=await TT(n.claims)),c}async function xH(n,e,t,r,o){r.addQueueMeasurement(x.InitializeSilentRequest,n.correlationId);const a=await Q(Sm,x.InitializeBaseRequest,o,r,n.correlationId)(n,t,r,o);return{...n,...a,account:e,forceRefresh:n.forceRefresh||!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ma extends kT{async initializeAuthorizationCodeRequest(e){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.correlationId);const t=await Q(MH,x.GeneratePkceCodes,this.logger,this.performanceClient,this.correlationId)(this.performanceClient,this.logger,this.correlationId),r={...e,redirectUri:e.redirectUri,code:F.EMPTY_STRING,codeVerifier:t.verifier};return e.codeChallenge=t.challenge,e.codeChallengeMethod=F.S256_CODE_CHALLENGE_METHOD,r}initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const t={correlationId:this.correlationId||go(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const r=this.getLogoutHintFromIdTokenClaims(e.account);r&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),t.logoutHint=r)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",t.correlationId),t.postLogoutRedirectUri=De.getAbsoluteUrl(e.postLogoutRedirectUri,lo())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",t.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",t.correlationId),t.postLogoutRedirectUri=De.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,lo())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",t.correlationId),t.postLogoutRedirectUri=De.getAbsoluteUrl(lo(),lo())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",t.correlationId),t}getLogoutHintFromIdTokenClaims(e){const t=e.idTokenClaims;if(t){if(t.login_hint)return t.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const t=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new Vw(t,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:t,requestAuthority:r,requestAzureCloudOptions:o,requestExtraQueryParameters:a,account:c}=e;this.performanceClient.addQueueMeasurement(x.StandardInteractionClientGetClientConfiguration,this.correlationId);const d=await Q(this.getDiscoveredAuthority.bind(this),x.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:o,requestExtraQueryParameters:a,account:c}),h=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:d,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:h.loggerCallback,piiLoggingEnabled:h.piiLoggingEnabled,logLevel:h.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:t,libraryInfo:{sku:Dn.MSAL_SKU,version:pu,cpu:F.EMPTY_STRING,os:F.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,t){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),o={interactionType:t},a=yr.setRequestState(this.browserCrypto,e&&e.state||F.EMPTY_STRING,o),d={...await Q(Sm,x.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:a,nonce:e.nonce||go(),responseMode:this.config.auth.OIDCOptions.serverResponseType};if(e.loginHint||e.sid)return d;const h=e.account||this.browserStorage.getActiveAccount();if(h&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${h.homeAccountId}`,this.correlationId),d.account=h),!d.loginHint&&!h){const m=this.browserStorage.getLegacyLoginHint();m&&(d.loginHint=m)}return d}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const UH="ContentError",NT="user_switch";/*! @azure/msal-browser v3.28.1 2025-01-14 */const BH="USER_INTERACTION_REQUIRED",FH="USER_CANCEL",VH="NO_NETWORK",HH="PERSISTENT_ERROR",$H="DISABLED",KH="ACCOUNT_UNAVAILABLE";/*! @azure/msal-browser v3.28.1 2025-01-14 */const WH=-2147186943,zH={[NT]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class Br extends lt{constructor(e,t,r){super(e,t),Object.setPrototypeOf(this,Br.prototype),this.name="NativeAuthError",this.ext=r}}function sa(n){if(n.ext&&n.ext.status&&(n.ext.status===HH||n.ext.status===$H)||n.ext&&n.ext.error&&n.ext.error===WH)return!0;switch(n.errorCode){case UH:return!0;default:return!1}}function df(n,e,t){if(t&&t.status)switch(t.status){case KH:return tf(Bw);case BH:return new Er(n,e);case FH:return ie(bi);case VH:return ie(Ll)}return new Br(n,zH[n]||e,t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class RT extends Ma{async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentCacheClientAcquireToken,e.correlationId);const t=this.initializeServerTelemetryManager(ot.acquireTokenSilent_silentFlow),r=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),o=new N2(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const c=(await Q(o.acquireCachedToken.bind(o),x.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),c}catch(a){throw a instanceof Ws&&a.errorCode===_m&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),a}}logout(e){this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(t==null?void 0:t.account)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class _a extends kT{constructor(e,t,r,o,a,c,d,h,m,g,v,p){var C;super(e,t,r,o,a,c,h,m,p),this.apiId=d,this.accountId=g,this.nativeMessageHandler=m,this.nativeStorageManager=v,this.silentCacheClient=new RT(e,this.nativeStorageManager,r,o,a,c,h,m,p),this.serverTelemetryManager=this.initializeServerTelemetryManager(this.apiId);const w=this.nativeMessageHandler.getExtensionId()===ma.PREFERRED_EXTENSION_ID?"chrome":(C=this.nativeMessageHandler.getExtensionId())!=null&&C.length?"unknown":void 0;this.skus=Os.makeExtraSkuString({libraryName:Dn.MSAL_SKU,libraryVersion:pu,extensionName:w,extensionVersion:this.nativeMessageHandler.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[h2]:this.skus}}async acquireToken(e){this.performanceClient.addQueueMeasurement(x.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const t=this.performanceClient.startMeasurement(x.NativeInteractionClientAcquireToken,e.correlationId),r=zr();try{const o=await this.initializeNativeRequest(e);try{const m=await this.acquireTokensFromCache(this.accountId,o);return t.end({success:!0,isNativeBroker:!1,fromCache:!0}),m}catch{this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const{...a}=o,c={method:gi.GetToken,request:a},d=await this.nativeMessageHandler.sendMessage(c),h=this.validateNativeResponse(d);return await this.handleNativeResponse(h,o,r).then(m=>(t.end({success:!0,isNativeBroker:!0,requestId:m.requestId}),this.serverTelemetryManager.clearNativeBrokerErrorCode(),m)).catch(m=>{throw t.end({success:!1,errorCode:m.errorCode,subErrorCode:m.subError,isNativeBroker:!0}),m})}catch(o){throw o instanceof Br&&this.serverTelemetryManager.setNativeBrokerErrorCode(o.errorCode),o}}createSilentCacheRequest(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:vt.fromString(e.scope).asArray(),account:t,forceRefresh:!1}}async acquireTokensFromCache(e,t){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),Y(Yh);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e});if(!r)throw Y(Yh);try{const o=this.createSilentCacheRequest(t,r),a=await this.silentCacheClient.acquireToken(o),c={...r,idTokenClaims:a==null?void 0:a.idTokenClaims,idToken:a==null?void 0:a.idToken};return{...a,account:c}}catch(o){throw o}}async acquireTokenRedirect(e,t){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const o=await this.initializeNativeRequest(r),a={method:gi.GetToken,request:o};try{const h=await this.nativeMessageHandler.sendMessage(a);this.validateNativeResponse(h)}catch(h){if(h instanceof Br&&(this.serverTelemetryManager.setNativeBrokerErrorCode(h.errorCode),sa(h)))throw h}this.browserStorage.setTemporaryCache(Ke.NATIVE_REQUEST,JSON.stringify(o),!0);const c={apiId:ot.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);t.end({success:!0}),await this.navigationClient.navigateExternal(d,c)}async handleRedirectPromise(e,t){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const r=this.browserStorage.getCachedNativeRequest();if(!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&t&&(e==null||e.addFields({errorCode:"no_cached_request"},t)),null;const{prompt:o,...a}=r;o&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(Ke.NATIVE_REQUEST));const c={method:gi.GetToken,request:a},d=zr();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const h=await this.nativeMessageHandler.sendMessage(c);this.validateNativeResponse(h);const m=this.handleNativeResponse(h,a,d);this.browserStorage.setInteractionInProgress(!1);const g=await m;return this.serverTelemetryManager.clearNativeBrokerErrorCode(),g}catch(h){throw this.browserStorage.setInteractionInProgress(!1),h}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,t,r){var g;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const o=Si(e.id_token,Kr),a=this.createHomeAccountIdentifier(e,o),c=(g=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:t.accountId}))==null?void 0:g.homeAccountId;if(a!==c&&e.account.id!==t.accountId)throw df(NT);const d=await this.getDiscoveredAuthority({requestAuthority:t.authority}),h=dm(this.browserStorage,d,a,Kr,o,e.client_info,void 0,o.tid,void 0,e.account.id,this.logger),m=await this.generateAuthenticationResult(e,t,o,h,d.canonicalAuthority,r);return this.cacheAccount(h),this.cacheNativeTokens(e,t,a,o,e.access_token,m.tenantId,r),m}createHomeAccountIdentifier(e,t){return Pt.generateHomeAccountId(e.client_info||F.EMPTY_STRING,mr.Default,this.logger,this.browserCrypto,t)}generateScopes(e,t){return e.scope?vt.fromString(e.scope):vt.fromString(t.scope)}async generatePopAccessToken(e,t){if(t.tokenType===Ge.POP&&t.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new ba(this.browserCrypto),o={resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,shrNonce:t.shrNonce};if(!t.keyId)throw Y(Jf);return r.signPopToken(e.access_token,t.keyId,o)}else return e.access_token}async generateAuthenticationResult(e,t,r,o,a,c){const d=this.addTelemetryFromNativeResponse(e),h=e.scope?vt.fromString(e.scope):vt.fromString(t.scope),m=e.account.properties||{},g=m.UID||r.oid||r.sub||F.EMPTY_STRING,v=m.TenantId||r.tid||F.EMPTY_STRING,p=im(o.getAccountInfo(),void 0,r,e.id_token);p.nativeAccountId!==e.account.id&&(p.nativeAccountId=e.account.id);const w=await this.generatePopAccessToken(e,t),C=t.tokenType===Ge.POP?Ge.POP:Ge.BEARER;return{authority:a,uniqueId:g,tenantId:v,scopes:h.asArray(),account:p,idToken:e.id_token,idTokenClaims:r,accessToken:w,fromCache:d?this.isResponseFromCache(d):!1,expiresOn:new Date(Number(c+e.expires_in)*1e3),tokenType:C,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}cacheAccount(e){this.browserStorage.setAccount(e),this.browserStorage.removeAccountContext(e).catch(t=>{this.logger.error(`Error occurred while removing account context from browser storage. ${t}`)})}cacheNativeTokens(e,t,r,o,a,c,d){const h=au(r,t.authority,e.id_token||"",t.clientId,o.tid||""),m=t.tokenType===Ge.POP?F.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,g=d+m,v=this.generateScopes(e,t),p=su(r,t.authority,a,t.clientId,o.tid||c,v.printScopes(),g,0,Kr,void 0,t.tokenType,void 0,t.keyId),w={idToken:h,accessToken:p};this.nativeStorageManager.saveCacheRecord(w,t.storeInCache)}addTelemetryFromNativeResponse(e){const t=this.getMATSFromResponse(e);return t?(this.performanceClient.addFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:t.broker_version,matsAccountJoinOnStart:t.account_join_on_start,matsAccountJoinOnEnd:t.account_join_on_end,matsDeviceJoin:t.device_join,matsPromptBehavior:t.prompt_behavior,matsApiErrorCode:t.api_error_code,matsUiVisible:t.ui_visible,matsSilentCode:t.silent_code,matsSilentBiSubCode:t.silent_bi_sub_code,matsSilentMessage:t.silent_message,matsSilentStatus:t.silent_status,matsHttpStatus:t.http_status,matsHttpEventCount:t.http_event_count},this.correlationId),t):null}validateNativeResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw jE(Wf,"Response missing expected properties.")}getMATSFromResponse(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const t=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:t,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new De(t);r.validateAsUri();const{scopes:o,...a}=e,c=new vt(o||[]);c.appendScopes(Pa);const d=()=>{switch(this.apiId){case ot.ssoSilent:case ot.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),Bt.NONE}if(!e.prompt){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e.prompt){case Bt.NONE:case Bt.CONSENT:case Bt.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e.prompt;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e.prompt} is not compatible with native flow`),ie(mT)}},h={...a,accountId:this.accountId,clientId:this.config.auth.clientId,authority:r.urlString,scope:c.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:d(),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(h.signPopToken&&e.popKid)throw ie(pT);if(this.handleExtraBrokerParams(h),h.extraParameters=h.extraParameters||{},h.extraParameters.telemetry=ma.MATS_TELEMETRY,e.authenticationScheme===Ge.POP){const m={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},g=new ba(this.browserCrypto);let v;if(h.keyId)v=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:h.keyId})),h.signPopToken=!1;else{const p=await Q(g.generateCnf.bind(g),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(m,this.logger);v=p.reqCnfString,h.keyId=p.kid,h.signPopToken=!0}h.reqCnf=v}return this.addRequestSKUs(h),h}handleExtraBrokerParams(e){var a;const t=e.extraParameters&&e.extraParameters.hasOwnProperty(cm)&&e.extraParameters.hasOwnProperty(ef)&&e.extraParameters.hasOwnProperty(wi);if(!e.embeddedClientId&&!t)return;let r="";const o=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[ef],r=e.extraParameters[wi]),e.extraParameters={child_client_id:r,child_redirect_uri:o},(a=this.performanceClient)==null||a.addFields({embeddedClientId:r,embeddedRedirectUri:o},e.correlationId)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Fr{constructor(e,t,r,o){this.logger=e,this.handshakeTimeoutMs=t,this.extensionId=o,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=r,this.handshakeEvent=r.startMeasurement(x.NativeMessageHandlerHandshake)}async sendMessage(e){this.logger.trace("NativeMessageHandler - sendMessage called.");const t={channel:ma.CHANNEL_ID,extensionId:this.extensionId,responseId:go(),body:e};return this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii(`NativeMessageHandler - Sending request to browser extension: ${JSON.stringify(t)}`),this.messageChannel.port1.postMessage(t),new Promise((r,o)=>{this.resolvers.set(t.responseId,{resolve:r,reject:o})})}static async createProvider(e,t,r){e.trace("NativeMessageHandler - createProvider called.");try{const o=new Fr(e,t,r,ma.PREFERRED_EXTENSION_ID);return await o.sendHandshakeRequest(),o}catch{const a=new Fr(e,t,r);return await a.sendHandshakeRequest(),a}}async sendHandshakeRequest(){this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:ma.CHANNEL_ID,extensionId:this.extensionId,responseId:go(),body:{method:gi.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=t=>{this.onChannelMessage(t)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((t,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:t,reject:r}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),r(ie(dT)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window)return;const t=e.data;if(!(!t.channel||t.channel!==ma.CHANNEL_ID)&&!(t.extensionId&&t.extensionId!==this.extensionId)&&t.body.method===gi.HandshakeRequest){const r=this.handshakeResolvers.get(t.responseId);if(!r){this.logger.trace(`NativeMessageHandler.onWindowMessage - resolver can't be found for request ${t.responseId}`);return}this.logger.verbose(t.extensionId?`Extension with id: ${t.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),r.reject(ie(hT))}}onChannelMessage(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");const t=e.data,r=this.resolvers.get(t.responseId),o=this.handshakeResolvers.get(t.responseId);try{const a=t.body.method;if(a===gi.Response){if(!r)return;const c=t.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii(`NativeMessageHandler - Received response from browser extension: ${JSON.stringify(c)}`),c.status!=="Success")r.reject(df(c.code,c.description,c.ext));else if(c.result)c.result.code&&c.result.description?r.reject(df(c.result.code,c.result.description,c.result.ext)):r.resolve(c.result);else throw jE(Wf,"Event does not contain result.");this.resolvers.delete(t.responseId)}else if(a===gi.HandshakeResponse){if(!o){this.logger.trace(`NativeMessageHandler.onChannelMessage - resolver can't be found for request ${t.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=t.extensionId,this.extensionVersion=t.body.version,this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),o.resolve(),this.handshakeResolvers.delete(t.responseId)}}catch(a){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${a}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(a):o&&o.reject(a)}}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}static isNativeAvailable(e,t,r,o){if(t.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return t.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!r)return t.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(o)switch(o){case Ge.BEARER:case Ge.POP:return t.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return t.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Am{constructor(e,t,r,o,a){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=a}async handleCodeResponse(e,t){this.performanceClient.addQueueMeasurement(x.HandleCodeResponse,t.correlationId);let r;try{r=this.authModule.handleFragmentResponse(e,t.state)}catch(o){throw o instanceof Wo&&o.subError===bi?ie(bi):o}return Q(this.handleCodeResponseFromServer.bind(this),x.HandleCodeResponseFromServer,this.logger,this.performanceClient,t.correlationId)(r,t)}async handleCodeResponseFromServer(e,t,r=!0){if(this.performanceClient.addQueueMeasurement(x.HandleCodeResponseFromServer,t.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await Q(this.authModule.updateAuthority.bind(this.authModule),x.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,t.correlationId)(e.cloud_instance_host_name,t.correlationId),r&&(e.nonce=t.nonce||void 0),e.state=t.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const a=this.createCcsCredentials(t);a&&(this.authCodeRequest.ccsCredential=a)}return await Q(this.authModule.acquireToken.bind(this.authModule),x.AuthClientAcquireToken,this.logger,this.performanceClient,t.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:Bn.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:Bn.UPN}:null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function OT(n,e,t){const r=Pl(n);if(!r)throw Rw(n)?(t.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),t.errorPii(`The ${e} detected is: ${n}`),ie(zw)):(t.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),ie(Ww));return r}function GH(n,e,t){if(!n.state)throw ie(gm);const r=AT(e,n.state);if(!r)throw ie(Gw);if(r.interactionType!==t)throw ie(qw)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class qH extends Ma{constructor(e,t,r,o,a,c,d,h,m,g){super(e,t,r,o,a,c,d,m,g),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=h}acquireToken(e){try{const r={popupName:this.generatePopupName(e.scopes||Pa,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(e,r))}catch(t){return Promise.reject(t)}}logout(e){try{this.logger.verbose("logoutPopup called");const t=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(t),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},o=e&&e.authority,a=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(t,r,o,a)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(t,r,o,a))}catch(t){return Promise.reject(t)}}async acquireTokenPopupAsync(e,t){var a;this.logger.verbose("acquireTokenPopupAsync called");const r=this.initializeServerTelemetryManager(ot.acquireTokenPopup),o=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,le.Popup);ST(o.authority);try{const c=await Q(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(o),d=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:o.authority,requestAzureCloudOptions:o.azureCloudOptions,requestExtraQueryParameters:o.extraQueryParameters,account:o.account}),h=Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme);let m;h&&(m=this.performanceClient.startMeasurement(x.FetchAccountIdWithNativeBroker,e.correlationId));const g=await d.getAuthCodeUrl({...o,nativeBroker:h}),v=new Am(d,this.browserStorage,c,this.logger,this.performanceClient),p=this.initiateAuthRequest(g,t);this.eventHandler.emitEvent(me.POPUP_OPENED,le.Popup,{popupWindow:p},null);const w=await this.monitorPopupForHash(p,t.popupWindowParent),C=Ai(OT,x.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(w,this.config.auth.OIDCOptions.serverResponseType,this.logger);if(Ur.removeThrottle(this.browserStorage,this.config.auth.clientId,c),C.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),m&&m.end({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw ie(Ks);const k=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,C.accountId,this.nativeStorage,o.correlationId),{userRequestState:I}=yr.parseRequestState(this.browserCrypto,o.state);return await k.acquireToken({...o,state:I,prompt:void 0})}return await v.handleCodeResponse(C,o)}catch(c){throw(a=t.popup)==null||a.close(),c instanceof lt&&(c.setCorrelationId(this.correlationId),r.cacheFailedRequest(c)),c}}async logoutPopupAsync(e,t,r,o){var c,d,h,m;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(me.LOGOUT_START,le.Popup,e);const a=this.initializeServerTelemetryManager(ot.logoutPopup);try{await this.clearCacheOnLogout(e.account);const g=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:a,requestAuthority:r,account:e.account||void 0});try{g.authority.endSessionEndpoint}catch{if((c=e.account)!=null&&c.homeAccountId&&e.postLogoutRedirectUri&&g.authority.protocolMode===fo.OIDC){if(this.browserStorage.removeAccount((d=e.account)==null?void 0:d.homeAccountId),this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Popup,e),o){const w={apiId:ot.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},C=De.getAbsoluteUrl(o,lo());await this.navigationClient.navigateInternal(C,w)}(h=t.popup)==null||h.close();return}}const v=g.getLogoutUri(e);this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Popup,e);const p=this.openPopup(v,t);if(this.eventHandler.emitEvent(me.POPUP_OPENED,le.Popup,{popupWindow:p},null),await this.monitorPopupForHash(p,t.popupWindowParent).catch(()=>{}),o){const w={apiId:ot.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},C=De.getAbsoluteUrl(o,lo());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${C}`),await this.navigationClient.navigateInternal(C,w)}else this.logger.verbose("No main window navigation requested")}catch(g){throw(m=t.popup)==null||m.close(),g instanceof lt&&(g.setCorrelationId(this.correlationId),a.cacheFailedRequest(g)),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(me.LOGOUT_FAILURE,le.Popup,null,g),this.eventHandler.emitEvent(me.LOGOUT_END,le.Popup),g}this.eventHandler.emitEvent(me.LOGOUT_END,le.Popup)}initiateAuthRequest(e,t){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,t);throw this.logger.error("Navigate url is empty"),ie(hu)}monitorPopupForHash(e,t){return new Promise((r,o)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const a=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(a),o(ie(bi));return}let c="";try{c=e.location.href}catch{}if(!c||c==="about:blank")return;clearInterval(a);let d="";const h=this.config.auth.OIDCOptions.serverResponseType;e&&(h===$s.QUERY?d=e.location.search:d=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(d)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,t)})}openPopup(e,t){try{let r;if(t.popup?(r=t.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof t.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,t)),!r)throw ie(Jw);return r.focus&&r.focus(),this.currentWindow=r,t.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),this.browserStorage.setInteractionInProgress(!1),ie(Yw)}}openSizedPopup(e,{popupName:t,popupWindowAttributes:r,popupWindowParent:o}){var w,C,T,k;const a=o.screenLeft?o.screenLeft:o.screenX,c=o.screenTop?o.screenTop:o.screenY,d=o.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,h=o.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let m=(w=r.popupSize)==null?void 0:w.width,g=(C=r.popupSize)==null?void 0:C.height,v=(T=r.popupPosition)==null?void 0:T.top,p=(k=r.popupPosition)==null?void 0:k.left;return(!m||m<0||m>d)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),m=Dn.POPUP_WIDTH),(!g||g<0||g>h)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),g=Dn.POPUP_HEIGHT),(!v||v<0||v>h)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),v=Math.max(0,h/2-Dn.POPUP_HEIGHT/2+c)),(!p||p<0||p>d)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),p=Math.max(0,d/2-Dn.POPUP_WIDTH/2+a)),o.open(e,t,`width=${m}, height=${g}, top=${v}, left=${p}, scrollbars=yes`)}unloadWindow(e){this.browserStorage.cleanRequestByInteractionType(le.Popup),this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,t){e.close(),t.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)}generatePopupName(e,t){return`${Dn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${t}.${this.correlationId}`}generateLogoutPopupName(e){const t=e.account&&e.account.homeAccountId;return`${Dn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${t}.${this.correlationId}`}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class fy{constructor(e,t,r,o,a){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=a}async initiateAuthRequest(e,t){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){t.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(Ke.ORIGIN_URI,t.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(Ke.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest),this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:ot.acquireTokenRedirect,timeout:t.redirectTimeout,noHistory:!1};if(typeof t.onRedirectNavigate=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),t.onRedirectNavigate(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await t.navigationClient.navigateExternal(e,r);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await t.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),ie(hu)}async handleCodeResponse(e,t){this.logger.verbose("RedirectHandler.handleCodeResponse called"),this.browserStorage.setInteractionInProgress(!1);const r=this.browserStorage.generateStateKey(t),o=this.browserStorage.getTemporaryCache(r);if(!o)throw Y(kl,"Cached State");let a;try{a=this.authModule.handleFragmentResponse(e,o)}catch(m){throw m instanceof Wo&&m.subError===bi?ie(bi):m}const c=this.browserStorage.generateNonceKey(o),d=this.browserStorage.getTemporaryCache(c);if(this.authCodeRequest.code=a.code,a.cloud_instance_host_name&&await Q(this.authModule.updateAuthority.bind(this.authModule),x.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,this.authCodeRequest.correlationId)(a.cloud_instance_host_name,this.authCodeRequest.correlationId),a.nonce=d||void 0,a.state=o,a.client_info)this.authCodeRequest.clientInfo=a.client_info;else{const m=this.checkCcsCredentials();m&&(this.authCodeRequest.ccsCredential=m)}const h=await this.authModule.acquireToken(this.authCodeRequest,a);return this.browserStorage.cleanRequestByState(t),h}checkCcsCredentials(){const e=this.browserStorage.getTemporaryCache(Ke.CCS_CREDENTIAL,!0);if(e)try{return JSON.parse(e)}catch{this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii(`Cache credential could not be parsed: ${e}`)}return null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function jH(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const n=window.performance.getEntriesByType("navigation"),e=n.length?n[0]:void 0;return e==null?void 0:e.type}class YH extends Ma{constructor(e,t,r,o,a,c,d,h,m,g){super(e,t,r,o,a,c,d,m,g),this.nativeStorage=h}async acquireToken(e){const t=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,le.Redirect);this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||"",t.account||null);const r=this.initializeServerTelemetryManager(ot.acquireTokenRedirect),o=a=>{a.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.cleanRequestByState(t.state),this.eventHandler.emitEvent(me.RESTORE_FROM_BFCACHE,le.Redirect))};try{const a=await Q(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(t),c=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),d=new fy(c,this.browserStorage,a,this.logger,this.performanceClient),h=await c.getAuthCodeUrl({...t,nativeBroker:Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme)}),m=this.getRedirectStartPage(e.redirectStartPage);return this.logger.verbosePii(`Redirect start page: ${m}`),window.addEventListener("pageshow",o),await d.initiateAuthRequest(h,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:m,onRedirectNavigate:e.onRedirectNavigate||this.config.auth.onRedirectNavigate})}catch(a){throw a instanceof lt&&(a.setCorrelationId(this.correlationId),r.cacheFailedRequest(a)),window.removeEventListener("pageshow",o),this.browserStorage.cleanRequestByState(t.state),a}}async handleRedirectPromise(e="",t){const r=this.initializeServerTelemetryManager(ot.handleRedirectPromise);try{if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const[o,a]=this.getRedirectResponse(e||"");if(!o)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(le.Redirect),jH()!=="back_forward"?t.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const c=this.browserStorage.getTemporaryCache(Ke.ORIGIN_URI,!0)||F.EMPTY_STRING,d=De.removeHashFromUrl(c),h=De.removeHashFromUrl(window.location.href);if(d===h&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),c.indexOf("#")>-1&&nH(c),await this.handleResponse(o,r);if(this.config.auth.navigateToLoginRequestUrl){if(!Tm()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(Ke.URL_HASH,a,!0);const m={apiId:ot.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let g=!0;if(!c||c==="null"){const v=oH();this.browserStorage.setTemporaryCache(Ke.ORIGIN_URI,v,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),g=await this.navigationClient.navigateInternal(v,m)}else this.logger.verbose(`Navigating to loginRequestUrl: ${c}`),g=await this.navigationClient.navigateInternal(c,m);if(!g)return await this.handleResponse(o,r)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(o,r);return null}catch(o){throw o instanceof lt&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),this.browserStorage.cleanRequestByInteractionType(le.Redirect),o}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let t=e;t||(this.config.auth.OIDCOptions.serverResponseType===$s.QUERY?t=window.location.search:t=window.location.hash);let r=Pl(t);if(r){try{GH(r,this.browserCrypto,le.Redirect)}catch(a){return a instanceof lt&&this.logger.error(`Interaction type validation failed due to ${a.errorCode}: ${a.errorMessage}`),[null,""]}return tH(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,t]}const o=this.browserStorage.getTemporaryCache(Ke.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(Ke.URL_HASH)),o&&(r=Pl(o),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,o]):[null,""]}async handleResponse(e,t){const r=e.state;if(!r)throw ie(gm);const o=this.browserStorage.getCachedRequest(r);if(this.logger.verbose("handleResponse called, retrieved cached request"),e.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw ie(Ks);const h=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,e.accountId,this.nativeStorage,o.correlationId),{userRequestState:m}=yr.parseRequestState(this.browserCrypto,r);return h.acquireToken({...o,state:m,prompt:void 0}).finally(()=>{this.browserStorage.cleanRequestByState(r)})}const a=this.browserStorage.getCachedAuthority(r);if(!a)throw ie(pm);const c=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:a});return Ur.removeThrottle(this.browserStorage,this.config.auth.clientId,o),new fy(c,this.browserStorage,o,this.logger,this.performanceClient).handleCodeResponse(e,r)}async logout(e){var o,a;this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(ot.logout);try{this.eventHandler.emitEvent(me.LOGOUT_START,le.Redirect,e),await this.clearCacheOnLogout(t.account);const c={apiId:ot.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(d.authority.protocolMode===fo.OIDC)try{d.authority.endSessionEndpoint}catch{if((o=t.account)!=null&&o.homeAccountId){this.browserStorage.removeAccount((a=t.account)==null?void 0:a.homeAccountId),this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Redirect,t);return}}const h=d.getLogoutUri(t);if(this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Redirect,t),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(h)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(h,c);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(h,c);return}}catch(c){throw c instanceof lt&&(c.setCorrelationId(this.correlationId),r.cacheFailedRequest(c)),this.eventHandler.emitEvent(me.LOGOUT_FAILURE,le.Redirect,null,c),this.eventHandler.emitEvent(me.LOGOUT_END,le.Redirect),c}this.eventHandler.emitEvent(me.LOGOUT_END,le.Redirect)}getRedirectStartPage(e){const t=e||window.location.href;return De.getAbsoluteUrl(t,lo())}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function JH(n,e,t,r,o){if(e.addQueueMeasurement(x.SilentHandlerInitiateAuthRequest,r),!n)throw t.info("Navigate url is empty"),ie(hu);return o?Q(XH,x.SilentHandlerLoadFrame,t,e,r)(n,o,e,r):Ai(ZH,x.SilentHandlerLoadFrameSync,t,e,r)(n)}async function QH(n,e,t,r,o,a,c){return r.addQueueMeasurement(x.SilentHandlerMonitorIframeForHash,a),new Promise((d,h)=>{e<cf&&o.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${e}ms) than the default (${cf}ms). This may result in timeouts.`);const m=window.setTimeout(()=>{window.clearInterval(g),h(ie(Qw))},e),g=window.setInterval(()=>{let v="";const p=n.contentWindow;try{v=p?p.location.href:""}catch{}if(!v||v==="about:blank")return;let w="";p&&(c===$s.QUERY?w=p.location.search:w=p.location.hash),window.clearTimeout(m),window.clearInterval(g),d(w)},t)}).finally(()=>{Ai(e$,x.RemoveHiddenIframe,o,r,a)(n)})}function XH(n,e,t,r){return t.addQueueMeasurement(x.SilentHandlerLoadFrame,r),new Promise((o,a)=>{const c=PT();window.setTimeout(()=>{if(!c){a("Unable to load iframe");return}c.src=n,o(c)},e)})}function ZH(n){const e=PT();return e.src=n,e}function PT(){const n=document.createElement("iframe");return n.className="msalSilentIframe",n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height="0",n.style.border="0",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(n),n}function e$(n){document.body===n.parentNode&&document.body.removeChild(n)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class t$ extends Ma{constructor(e,t,r,o,a,c,d,h,m,g,v){super(e,t,r,o,a,c,h,g,v),this.apiId=d,this.nativeStorage=m}async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const t={...e};t.prompt?t.prompt!==Bt.NONE&&t.prompt!==Bt.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${t.prompt} with ${Bt.NONE}`),t.prompt=Bt.NONE):t.prompt=Bt.NONE;const r=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,le.Silent);ST(r.authority);const o=this.initializeServerTelemetryManager(this.apiId);let a;try{return a=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:o,requestAuthority:r.authority,requestAzureCloudOptions:r.azureCloudOptions,requestExtraQueryParameters:r.extraQueryParameters,account:r.account}),await Q(this.silentTokenHelper.bind(this),x.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(a,r)}catch(c){if(c instanceof lt&&(c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c)),!a||!(c instanceof lt)||c.errorCode!==Dn.INVALID_GRANT_ERROR)throw c;this.performanceClient.addFields({retryError:c.errorCode},this.correlationId);const d=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,le.Silent);return await Q(this.silentTokenHelper.bind(this),x.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(a,d)}}logout(){return Promise.reject(ie(fu))}async silentTokenHelper(e,t){const r=t.correlationId;this.performanceClient.addQueueMeasurement(x.SilentIframeClientTokenHelper,r);const o=await Q(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,r)(t),a=await Q(e.getAuthCodeUrl.bind(e),x.GetAuthCodeUrl,this.logger,this.performanceClient,r)({...t,nativeBroker:Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,t.authenticationScheme)}),c=new Am(e,this.browserStorage,o,this.logger,this.performanceClient),d=await Q(JH,x.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(a,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait),h=this.config.auth.OIDCOptions.serverResponseType,m=await Q(QH,x.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(d,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,h),g=Ai(OT,x.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(m,h,this.logger);if(g.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw ie(Ks);const v=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,g.accountId,this.browserStorage,r),{userRequestState:p}=yr.parseRequestState(this.browserCrypto,t.state);return Q(v.acquireToken.bind(v),x.NativeInteractionClientAcquireToken,this.logger,this.performanceClient,r)({...t,state:p,prompt:t.prompt||Bt.NONE})}return Q(c.handleCodeResponse.bind(c),x.HandleCodeResponse,this.logger,this.performanceClient,r)(g,t)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class n$ extends Ma{async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentRefreshClientAcquireToken,e.correlationId);const t=await Q(Sm,x.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...t};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const o=this.initializeServerTelemetryManager(ot.acquireTokenSilent_silentFlow),a=await this.createRefreshTokenClient({serverTelemetryManager:o,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return Q(a.acquireTokenByRefreshToken.bind(a),x.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(c=>{throw c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c),c})}logout(){return Promise.reject(ie(fu))}async createRefreshTokenClient(e){const t=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new nf(t,this.performanceClient)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class r${constructor(e,t,r,o){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=t,this.logger=r,this.cryptoObj=o}loadExternalTokens(e,t,r){if(!this.isBrowserEnvironment)throw ie(mu);const o=t.id_token?Si(t.id_token,Kr):void 0,a={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},c=e.authority?new Xt(Xt.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,a,this.logger,e.correlationId||go()):void 0,d=this.loadAccount(e,r.clientInfo||t.client_info||"",o,c),h=this.loadIdToken(t,d.homeAccountId,d.environment,d.realm),m=this.loadAccessToken(e,t,d.homeAccountId,d.environment,d.realm,r),g=this.loadRefreshToken(t,d.homeAccountId,d.environment);return this.generateAuthenticationResult(e,{account:d,idToken:h,accessToken:m,refreshToken:g},o,c)}loadAccount(e,t,r,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const h=Pt.createFromAccountInfo(e.account);return this.storage.setAccount(h),h}else if(!o||!t&&!r)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),ie(aT);const a=Pt.generateHomeAccountId(t,o.authorityType,this.logger,this.cryptoObj,r),c=r==null?void 0:r.tid,d=dm(this.storage,o,a,Kr,r,t,o.hostnameAndPort,c,void 0,void 0,this.logger);return this.storage.setAccount(d),d}loadIdToken(e,t,r,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const a=au(t,r,e.id_token,this.config.auth.clientId,o);return this.storage.setIdTokenCredential(a),a}loadAccessToken(e,t,r,o,a,c){if(t.access_token)if(t.expires_in){if(!t.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const d=t.scope?vt.fromString(t.scope):new vt(e.scopes),h=c.expiresOn||t.expires_in+new Date().getTime()/1e3,m=c.extendedExpiresOn||(t.ext_expires_in||t.expires_in)+new Date().getTime()/1e3,g=su(r,o,t.access_token,this.config.auth.clientId,a,d.printScopes(),h,m,Kr);return this.storage.setAccessTokenCredential(g),g}loadRefreshToken(e,t,r){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=mw(t,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return this.storage.setRefreshTokenCredential(o),o}generateAuthenticationResult(e,t,r,o){var g,v,p;let a="",c=[],d=null,h;t!=null&&t.accessToken&&(a=t.accessToken.secret,c=vt.fromString(t.accessToken.target).asArray(),d=new Date(Number(t.accessToken.expiresOn)*1e3),h=new Date(Number(t.accessToken.extendedExpiresOn)*1e3));const m=t.account;return{authority:o?o.canonicalAuthority:"",uniqueId:t.account.localAccountId,tenantId:t.account.realm,scopes:c,account:m.getAccountInfo(),idToken:((g=t.idToken)==null?void 0:g.secret)||"",idTokenClaims:r||{},accessToken:a,fromCache:!0,expiresOn:d,correlationId:e.correlationId||"",requestId:"",extExpiresOn:h,familyId:((v=t.refreshToken)==null?void 0:v.familyId)||"",tokenType:((p=t==null?void 0:t.accessToken)==null?void 0:p.tokenType)||"",state:e.state||"",cloudGraphHostName:m.cloudGraphHostName||"",msGraphHost:m.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class o$ extends Vw{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class i$ extends Ma{constructor(e,t,r,o,a,c,d,h,m,g){super(e,t,r,o,a,c,h,m,g),this.apiId=d}async acquireToken(e){if(!e.code)throw ie(sT);const t=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,le.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const o={...t,code:e.code},a=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),c=new o$(a);this.logger.verbose("Auth code client created");const d=new Am(c,this.browserStorage,o,this.logger,this.performanceClient);return await Q(d.handleCodeResponseFromServer.bind(d),x.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},t,!1)}catch(o){throw o instanceof lt&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),o}}logout(){return Promise.reject(ie(fu))}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function Dr(n){const e=n==null?void 0:n.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function Yc(n,e){try{bm(n)}catch(t){throw e.end({success:!1},t),t}}class _u{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new Ia(this.logger,this.performanceClient):Nl,this.eventHandler=new OH(this.logger),this.browserStorage=this.isBrowserEnvironment?new uf(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,y2(this.config.auth),this.performanceClient):TH(this.config.auth.clientId,this.logger);const t={cacheLocation:vn.MemoryStorage,temporaryCacheLocation:vn.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new uf(this.config.auth.clientId,t,this.browserCrypto,this.logger,void 0,this.performanceClient),this.tokenCache=new r$(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this),this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}static async createController(e,t){const r=new _u(e);return await r.initialize(t),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(me.INITIALIZE_END);return}const t=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),r=this.config.system.allowNativeBroker,o=this.performanceClient.startMeasurement(x.InitializeClientApplication,t);if(this.eventHandler.emitEvent(me.INITIALIZE_START),r)try{this.nativeExtensionProvider=await Fr.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient)}catch(a){this.logger.verbose(a)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),await Q(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),x.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,t)(this.performanceClient,t)),this.initialized=!0,this.eventHandler.emitEvent(me.INITIALIZE_END),o.end({allowNativeBroker:r,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),IT(this.initialized),this.isBrowserEnvironment){const t=e||"";let r=this.redirectResponse.get(t);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(t,r),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),r}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){const t=this.getAllAccounts(),r=this.browserStorage.getCachedNativeRequest(),o=r&&Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!e,a=o?r==null?void 0:r.correlationId:this.browserStorage.getTemporaryCache(Ke.CORRELATION_ID,!0)||"",c=this.performanceClient.startMeasurement(x.AcquireTokenRedirect,a);this.eventHandler.emitEvent(me.HANDLE_REDIRECT_START,le.Redirect);let d;if(o&&this.nativeExtensionProvider){this.logger.trace("handleRedirectPromise - acquiring token from native platform");const h=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,r.accountId,this.nativeInternalStorage,r.correlationId);d=Q(h.handleRedirectPromise.bind(h),x.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,c.event.correlationId)(this.performanceClient,c.event.correlationId)}else{this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(a);d=Q(h.handleRedirectPromise.bind(h),x.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,c.event.correlationId)(e,c)}return d.then(h=>(h?(t.length<this.getAllAccounts().length?(this.eventHandler.emitEvent(me.LOGIN_SUCCESS,le.Redirect,h),this.logger.verbose("handleRedirectResponse returned result, login success")):(this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_SUCCESS,le.Redirect,h),this.logger.verbose("handleRedirectResponse returned result, acquire token success")),c.end({success:!0,accountType:Dr(h.account)})):c.event.errorCode?c.end({success:!1}):c.discard(),this.eventHandler.emitEvent(me.HANDLE_REDIRECT_END,le.Redirect),h)).catch(h=>{const m=h;throw t.length>0?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Redirect,null,m):this.eventHandler.emitEvent(me.LOGIN_FAILURE,le.Redirect,null,m),this.eventHandler.emitEvent(me.HANDLE_REDIRECT_END,le.Redirect),c.end({success:!1},m),h})}async acquireTokenRedirect(e){const t=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",t);const r=this.performanceClient.startMeasurement(x.AcquireTokenPreRedirect,t);r.add({accountType:Dr(e.account),scenarioId:e.scenarioId});const o=e.onRedirectNavigate;if(o)e.onRedirectNavigate=c=>{const d=typeof o=="function"?o(c):void 0;return d!==!1?r.end({success:!0}):r.discard(),d};else{const c=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=d=>{const h=typeof c=="function"?c(d):void 0;return h!==!1?r.end({success:!0}):r.discard(),h}}const a=this.getAllAccounts().length>0;try{ly(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),a?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_START,le.Redirect,e):this.eventHandler.emitEvent(me.LOGIN_START,le.Redirect,e);let c;return this.nativeExtensionProvider&&this.canUseNative(e)?c=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(e),this.nativeInternalStorage,t).acquireTokenRedirect(e,r).catch(h=>{if(h instanceof Br&&sa(h))return this.nativeExtensionProvider=void 0,this.createRedirectClient(t).acquireToken(e);if(h instanceof Er)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),h}):c=this.createRedirectClient(t).acquireToken(e),await c}catch(c){throw r.end({success:!1},c),a?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Redirect,null,c):this.eventHandler.emitEvent(me.LOGIN_FAILURE,le.Redirect,null,c),c}}acquireTokenPopup(e){const t=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(x.AcquireTokenPopup,t);r.add({scenarioId:e.scenarioId,accountType:Dr(e.account)});try{this.logger.verbose("acquireTokenPopup called",t),Yc(this.initialized,r),this.browserStorage.setInteractionInProgress(!0)}catch(c){return Promise.reject(c)}const o=this.getAllAccounts();o.length>0?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_START,le.Popup,e):this.eventHandler.emitEvent(me.LOGIN_START,le.Popup,e);let a;return this.canUseNative(e)?a=this.acquireTokenNative({...e,correlationId:t},ot.acquireTokenPopup).then(c=>(this.browserStorage.setInteractionInProgress(!1),r.end({success:!0,isNativeBroker:!0,accountType:Dr(c.account)}),c)).catch(c=>{if(c instanceof Br&&sa(c))return this.nativeExtensionProvider=void 0,this.createPopupClient(t).acquireToken(e);if(c instanceof Er)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),c}):a=this.createPopupClient(t).acquireToken(e),a.then(c=>(o.length<this.getAllAccounts().length?this.eventHandler.emitEvent(me.LOGIN_SUCCESS,le.Popup,c):this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_SUCCESS,le.Popup,c),r.end({success:!0,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Dr(c.account)}),c)).catch(c=>(o.length>0?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Popup,null,c):this.eventHandler.emitEvent(me.LOGIN_FAILURE,le.Popup,null,c),r.end({success:!1},c),Promise.reject(c)))}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){var a,c;const t=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:t};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(x.SsoSilent,t),(a=this.ssoSilentMeasurement)==null||a.add({scenarioId:e.scenarioId,accountType:Dr(e.account)}),Yc(this.initialized,this.ssoSilentMeasurement),(c=this.ssoSilentMeasurement)==null||c.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",t),this.eventHandler.emitEvent(me.SSO_SILENT_START,le.Silent,r);let o;return this.canUseNative(r)?o=this.acquireTokenNative(r,ot.ssoSilent).catch(d=>{if(d instanceof Br&&sa(d))return this.nativeExtensionProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw d}):o=this.createSilentIframeClient(r.correlationId).acquireToken(r),o.then(d=>{var h;return this.eventHandler.emitEvent(me.SSO_SILENT_SUCCESS,le.Silent,d),(h=this.ssoSilentMeasurement)==null||h.end({success:!0,isNativeBroker:d.fromNativeBroker,accessTokenSize:d.accessToken.length,idTokenSize:d.idToken.length,accountType:Dr(d.account)}),d}).catch(d=>{var h;throw this.eventHandler.emitEvent(me.SSO_SILENT_FAILURE,le.Silent,null,d),(h=this.ssoSilentMeasurement)==null||h.end({success:!1},d),d}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const t=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",t);const r=this.performanceClient.startMeasurement(x.AcquireTokenByCode,t);Yc(this.initialized,r),this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_START,le.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw ie(lT);if(e.code){const o=e.code;let a=this.hybridAuthCodeResponses.get(o);return a?(this.logger.verbose("Existing acquireTokenByCode request found",t),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",t),a=this.acquireTokenByCodeAsync({...e,correlationId:t}).then(c=>(this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_SUCCESS,le.Silent,c),this.hybridAuthCodeResponses.delete(o),r.end({success:!0,isNativeBroker:c.fromNativeBroker,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Dr(c.account)}),c)).catch(c=>{throw this.hybridAuthCodeResponses.delete(o),this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_FAILURE,le.Silent,null,c),r.end({success:!1},c),c}),this.hybridAuthCodeResponses.set(o,a)),await a}else if(e.nativeAccountId)if(this.canUseNative(e,e.nativeAccountId)){const o=await this.acquireTokenNative({...e,correlationId:t},ot.acquireTokenByCode,e.nativeAccountId).catch(a=>{throw a instanceof Br&&sa(a)&&(this.nativeExtensionProvider=void 0),a});return r.end({accountType:Dr(o.account),success:!0}),o}else throw ie(uT);else throw ie(cT)}catch(o){throw this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_FAILURE,le.Silent,null,o),r.end({success:!1},o),o}}async acquireTokenByCodeAsync(e){var o;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(x.AcquireTokenByCodeAsync,e.correlationId),(o=this.acquireTokenByCodeAsyncMeasurement)==null||o.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(a=>{var c;return(c=this.acquireTokenByCodeAsyncMeasurement)==null||c.end({success:!0,fromCache:a.fromCache,isNativeBroker:a.fromNativeBroker}),a}).catch(a=>{var c;throw(c=this.acquireTokenByCodeAsyncMeasurement)==null||c.end({success:!1},a),a}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,t){switch(this.performanceClient.addQueueMeasurement(x.AcquireTokenFromCache,e.correlationId),t){case Pn.Default:case Pn.AccessToken:case Pn.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return Q(r.acquireToken.bind(r),x.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Y(co)}}async acquireTokenByRefreshToken(e,t){switch(this.performanceClient.addQueueMeasurement(x.AcquireTokenByRefreshToken,e.correlationId),t){case Pn.Default:case Pn.AccessTokenAndRefreshToken:case Pn.RefreshToken:case Pn.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return Q(r.acquireToken.bind(r),x.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Y(co)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(x.AcquireTokenBySilentIframe,e.correlationId);const t=this.createSilentIframeClient(e.correlationId);return Q(t.acquireToken.bind(t),x.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const t=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),this.logoutRedirect({correlationId:t,...e})}async logoutRedirect(e){const t=this.getRequestCorrelationId(e);return ly(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),this.createRedirectClient(t).logout(e)}logoutPopup(e){try{const t=this.getRequestCorrelationId(e);return bm(this.initialized),this.browserStorage.setInteractionInProgress(!0),this.createPopupClient(t).logout(e)}catch(t){return Promise.reject(t)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const t=this.getRequestCorrelationId(e);return this.createSilentCacheClient(t).logout(e)}getAllAccounts(e){return bH(this.logger,this.browserStorage,this.isBrowserEnvironment,e)}getAccount(e){return IH(e,this.logger,this.browserStorage)}getAccountByUsername(e){return SH(e,this.logger,this.browserStorage)}getAccountByHomeId(e){return AH(e,this.logger,this.browserStorage)}getAccountByLocalId(e){return kH(e,this.logger,this.browserStorage)}setActiveAccount(e){NH(e,this.browserStorage)}getActiveAccount(){return RH(this.browserStorage)}async hydrateCache(e,t){this.logger.verbose("hydrateCache called");const r=Pt.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return this.browserStorage.setAccount(r),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,t)):this.browserStorage.hydrateCache(e,t)}async acquireTokenNative(e,t,r){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw ie(Ks);return new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,t,this.performanceClient,this.nativeExtensionProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e)}canUseNative(e,t){if(this.logger.trace("canUseNative called"),!Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case Bt.NONE:case Bt.CONSENT:case Bt.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace(`canUseNative: prompt = ${e.prompt} is not compatible with native flow, returning false`),!1}return!t&&!this.getNativeAccountId(e)?(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const t=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return t&&t.nativeAccountId||""}createPopupClient(e){return new qH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createRedirectClient(e){return new YH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentIframeClient(e){return new t$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentCacheClient(e){return new RT(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentRefreshClient(e){return new n$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentAuthCodeClient(e){return new i$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,e)}addEventCallback(e,t){return this.eventHandler.addEventCallback(e,t)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return bT(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))}disableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))}handleAccountCacheChange(e){var t;try{(t=e.key)!=null&&t.includes(Lt.ACTIVE_ACCOUNT_FILTERS)&&this.eventHandler.emitEvent(me.ACTIVE_ACCOUNT_CHANGED);const r=e.newValue||e.oldValue;if(!r)return;const o=JSON.parse(r);if(typeof o!="object"||!Pt.isAccountEntity(o))return;const c=Ta.toObject(new Pt,o).getAccountInfo();!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.eventHandler.emitEvent(me.ACCOUNT_ADDED,void 0,c)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.eventHandler.emitEvent(me.ACCOUNT_REMOVED,void 0,c))}catch{return}}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,t){this.browserStorage.setWrapperMetadata(e,t)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?go():F.EMPTY_STRING}async loginRedirect(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",t),this.acquireTokenRedirect({correlationId:t,...e||ay})}loginPopup(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup({correlationId:t,...e||ay})}async acquireTokenSilent(e){const t=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(x.AcquireTokenSilent,t);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),Yc(this.initialized,r),this.logger.verbose("acquireTokenSilent called",t);const o=e.account||this.getActiveAccount();if(!o)throw ie(tT);r.add({accountType:Dr(o)});const a={clientId:this.config.auth.clientId,authority:e.authority||F.EMPTY_STRING,scopes:e.scopes,homeAccountIdentifier:o.homeAccountId,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,shrOptions:e.shrOptions},c=JSON.stringify(a),d=this.activeSilentTokenRequests.get(c);if(typeof d>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",t);const h=Q(this.acquireTokenSilentAsync.bind(this),x.AcquireTokenSilentAsync,this.logger,this.performanceClient,t)({...e,correlationId:t},o).then(m=>(this.activeSilentTokenRequests.delete(c),r.end({success:!0,fromCache:m.fromCache,isNativeBroker:m.fromNativeBroker,cacheLookupPolicy:e.cacheLookupPolicy,accessTokenSize:m.accessToken.length,idTokenSize:m.idToken.length}),m)).catch(m=>{throw this.activeSilentTokenRequests.delete(c),r.end({success:!1},m),m});return this.activeSilentTokenRequests.set(c,h),{...await h,state:e.state}}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",t),r.discard(),{...await d,state:e.state}}async acquireTokenSilentAsync(e,t){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(x.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_START,le.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const o=await Q(xH,x.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,t,this.config,this.performanceClient,this.logger),a=e.cacheLookupPolicy||Pn.Default;return this.acquireTokenSilentNoIframe(o,a).catch(async d=>{if(a$(d,a))if(this.activeIframeRequest)if(a!==Pn.Skip){const[m,g]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${g}`,o.correlationId);const v=this.performanceClient.startMeasurement(x.AwaitConcurrentIframe,o.correlationId);v.add({awaitIframeCorrelationId:g});const p=await m;if(v.end({success:p}),p)return this.logger.verbose(`Parallel iframe request with correlationId: ${g} succeeded. Retrying cache and/or RT redemption`,o.correlationId),this.acquireTokenSilentNoIframe(o,a);throw this.logger.info(`Iframe request with correlationId: ${g} failed. Interaction is required.`),d}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",o.correlationId),Q(this.acquireTokenBySilentIframe.bind(this),x.AcquireTokenBySilentIframe,this.logger,this.performanceClient,o.correlationId)(o);else{let m;return this.activeIframeRequest=[new Promise(g=>{m=g}),o.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",o.correlationId),Q(this.acquireTokenBySilentIframe.bind(this),x.AcquireTokenBySilentIframe,this.logger,this.performanceClient,o.correlationId)(o).then(g=>(m(!0),g)).catch(g=>{throw m(!1),g}).finally(()=>{this.activeIframeRequest=void 0})}else throw d}).then(d=>(this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_SUCCESS,le.Silent,d),e.correlationId&&this.performanceClient.addFields({fromCache:d.fromCache,isNativeBroker:d.fromNativeBroker},e.correlationId),d)).catch(d=>{throw this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Silent,null,d),d}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,t){return Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,ot.acquireTokenSilent_silentFlow).catch(async r=>{throw r instanceof Br&&sa(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,Y(co)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),Q(this.acquireTokenFromCache.bind(this),x.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,t).catch(r=>{if(t===Pn.AccessToken)throw r;return this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_NETWORK_START,le.Silent,e),Q(this.acquireTokenByRefreshToken.bind(this),x.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,t)}))}}function a$(n,e){const t=!(n instanceof Er&&n.subError!==du),r=n.errorCode===Dn.INVALID_GRANT_ERROR||n.errorCode===co,o=t&&r||n.errorCode===Dl||n.errorCode===um,a=K2.includes(e);return o&&a}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function s$(n,e){const t=new Ii(n);return await t.initialize(),_u.createController(t,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class km{static async createPublicClientApplication(e){const t=await s$(e);return new km(e,t)}constructor(e,t){this.controller=t||new _u(new Ii(e))}async initialize(e){return this.controller.initialize(e)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,t){return this.controller.addEventCallback(e,t)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,t){return this.controller.initializeWrapperLibrary(e,t)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,t){return this.controller.hydrateCache(e,t)}clearCache(e){return this.controller.clearCache(e)}}const lh=process.env.JPLAN_WEBAPP__APP_PROXY_TENANT_NAME??"",c$=process.env.JPLAN_WEBAPP__APP_PROXY_CLIENT_ID??"",l$=process.env.JPLAN_WEBAPP__APP_PROXY_USER_FLOW??"",hf=process.env.JPLAN_WEBAPP__URL_AUTH??process.env.JPLAN_WEBAPP__URL_BASE??"",u$={auth:{clientId:c$,authority:`https://${lh}.b2clogin.com/${lh}.onmicrosoft.com/${l$}`,knownAuthorities:[`${lh}.b2clogin.com`],redirectUri:process.env.JPLAN_AUTOMATION_ENVIRONMENT?`${hf}/_/dashboard`:hf},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(n,e)=>{n===tt.Error&&console.error(e)},logLevel:tt.Warning}}},MT=(n,e)=>({scopes:["https://graph.microsoft.com/.default","openid","profile"],redirectStartPage:`${hf}${n}`,extraQueryParameters:e}),Gt=new km(u$),my=l.ref(null);function DT(){async function n(e){var t;if(e)try{const r=e.idTokenClaims;if(!(r!=null&&r.aud))throw new Error("User audience (aud) is missing in ID token claims");const o=localStorage.getItem(`msal.token.keys.${r.aud}`);if(!o)throw new Error(`Token keys para ${r.aud} não encontrados no localStorage`);const a=JSON.parse(o),c=(t=a==null?void 0:a.idToken)==null?void 0:t[0];if(!c)throw new Error("idToken não encontrado nos token keys");const d=localStorage.getItem(c);if(!d)throw new Error(`Dados do token para ID ${c} não encontrados no localStorage`);const h=JSON.parse(d),m=h==null?void 0:h.secret;if(!m)throw new Error("Secret não encontrado nos dados do token");sessionStorage.setItem("isAuthenticated","true"),my.value=m}catch(r){console.error("Erro ao obter token de acesso:",r)}}return{jToken:my,setJToken:n}}let Jc=null;const tr=l.ref(null),Ji=l.ref(null),LT=l.ref(Math.floor(Date.now()/1e3));ff.useIntervalFn(()=>d$(),1e3);function d$(){var r,o;if(!((o=(r=tr.value)==null?void 0:r.idTokenClaims)!=null&&o.exp))return;const n=Math.floor(Date.now()/1e3),e=300,t=tr.value.idTokenClaims.exp;LT.value=t-n-e}function Nm(){if(Jc)return Jc;const{setJToken:n,jToken:e}=DT(),t=l.computed(()=>!!tr.value),r=l.computed(()=>tr.value);let o;async function a(p,w){if(!t.value)switch(p){case"redirect":if(w){o=w,await h();break}case"tab":default:await c();break}}const c=async()=>new Promise((p,w)=>{try{localStorage.clear();const C=process.env.JPLAN_WEBAPP__URL_AUTH,T=window.open(C);if(!T){console.error("Failed to open authentication window"),w("Failed to open authentication window");return}const k=Date.now(),I=6e4,N=setInterval(()=>{if(Date.now()-k>I||T.closed){clearInterval(N),console.error("Authentication canceled or timeout reached."),w("Authentication canceled or timeout reached.");return}Object.keys(localStorage).some(L=>L.startsWith("msal.account.keys"))&&(clearInterval(N),d(),T.close(),p())},500)}catch(C){console.error("Error in handleRedirect:",C),w(C)}}),d=async()=>{try{await Gt.initialize();const p=Gt.getActiveAccount();if(p)tr.value=p;else{const w=await Gt.handleRedirectPromise();w?(Gt.setActiveAccount(w.account),tr.value=Gt.getActiveAccount()):console.error("Falha na autenticação")}}catch(p){console.error("Erro no processo de autenticação:",p)}tr.value&&await n(tr.value)},h=async()=>{try{await Gt.initialize();const p=await Gt.handleRedirectPromise();if(!p||Gt.getAllAccounts().length===0){const w=MT(o);await Gt.loginRedirect(w);return}Gt.setActiveAccount(p.account),tr.value=Gt.getActiveAccount(),tr.value&&await n(tr.value),Ji.value="updated"}catch(p){console.error("handleRedirect failed",p)}};async function m(){ve.value=!0,Ji.value="updating";try{const p=await Gt.acquireTokenSilent({scopes:["https://graph.microsoft.com/.default","openid","profile"]});Gt.setActiveAccount(p.account),await n(tr.value),Ji.value="updated"}catch(p){console.error("Failed to refresh token, forcing new login.",p),Ji.value="error",localStorage.clear(),window.location.reload()}ve.value=!1}const g=async()=>{try{await Gt.initialize(),localStorage.clear(),await Gt.logoutRedirect({postLogoutRedirectUri:"/"})}catch(p){console.error("Logout error",p)}};l.watch(LT,async p=>{p<=0&&Ji.value==="updated"&&await m()});const v=l.computed(()=>e.value);return Jc={isAuthenticated:t,authState:Ji,account:r,token:v,refreshToken:m,handleRedirect:a,logout:g},Jc}const{jToken:gy}=DT(),Rm=()=>{const n=dt.create({headers:{"Content-Type":"application/json"}});l.watch(gy,o=>{n.interceptors.request.use(a=>(o&&(a.headers.Authorization=`Bearer ${o}`),a))},{immediate:!0});let e=1;n.interceptors.response.use(async o=>o,async o=>{var a;if(o.config&&o.config.headers){const c=o.config;if(((a=o.response)==null?void 0:a.status)===401&&e>0){e--;try{return c.headers.Authorization=`Bearer ${gy.value}`,await n(c)}catch(d){return Promise.reject(d)}}}return Promise.reject(o)});async function t({url:o,method:a,header:c={},body:d,baseURL:h}){try{return h&&(n.defaults.baseURL=h),(await n({url:o,method:a,headers:c,data:d})).data}catch(m){if(console.error(`Request error [${a} ${o}]:`,m),dt.isAxiosError(m)){const{response:g,message:v}=m;throw new Error(`Axios error: ${v}, Status: ${g==null?void 0:g.status}, URL: ${o}`)}throw m}}async function r({url:o,method:a,header:c,body:d,baseURL:h}){try{h&&(n.defaults.baseURL=h);const m=await n({url:o,method:a,headers:c,data:d});return{status:m.status,header:m.headers,body:m.data}}catch(m){if(dt.isAxiosError(m)){const{response:g,message:v}=m;console.error(`Raw Request Error: ${v}, Status: ${g==null?void 0:g.status}`)}return Promise.reject(m)}}return Object.assign(n,{_request:t,rawRequest:r})},{request:py}=Rm(),_y=l.ref(null),vy=l.ref("default"),uh=l.ref(null),dh=l.ref({scope_type:"org"});function vu(){var v,p;const{handleRedirect:n,account:e,logout:t}=Nm();(p=(v=e.value)==null?void 0:v.idTokenClaims)==null||p.domain;const r=l.computed(()=>{var w,C;return{domain:(C=(w=e.value)==null?void 0:w.idTokenClaims)==null?void 0:C.domain,environment:vy.value,...dh.value}}),o=l.computed(()=>dh.value);async function a(){var w;(!e.value||!((w=e.value.idTokenClaims)!=null&&w.email))&&await n();try{await c(),await d()}catch{}}async function c(){var w,C;try{const T=(C=(w=e.value)==null?void 0:w.idTokenClaims)==null?void 0:C.email;if(!T)throw new Error("Email is undefined");const k=await py({url:`https://api.jplan.com.br/platform/user/profile/?email=${T}`,method:"GET"});uh.value=k.data??null}catch(T){console.error("Failed to fetch user profile:",T)}}async function d(){var w;try{if(!((w=uh.value)!=null&&w.email))throw new Error("User email is undefined");const C=await py({url:"https://api.jplan.com.br/platform/user/domain/",method:"GET"});_y.value=C.data.data??[]}catch(C){console.error("Failed to fetch user domains:",C)}}function h(w){dh.value=w}function m(w){vy.value=w,h(r.value)}async function g(w,C){const T=MT(w,{request_domain:C});await Gt.loginRedirect(T)}return{__init__:a,user:uh,userDomains:_y,setEnv:m,setScope:h,changeDomain:g,session:r,scope:o,logout:t}}const h$={path:"/_/dashboard",component:()=>Promise.resolve().then(()=>require("./AuthRoute-C1EDXO2a.js")),meta:{requiresAuth:!1}},f$={path:"/jplan-auth-fail",component:()=>Promise.resolve().then(()=>require("./AuthFailRoute-DHl-IhUQ.js")),meta:{requiresAuth:!1}},{isAuthenticated:yy,handleRedirect:m$}=Nm(),g$=vu();function p$(n,e){n.addRoute(h$),n.addRoute(f$),n.beforeEach(async(t,r,o)=>{function a(d){return d.matched.some(h=>h.meta.requiresAuth)}if(!a(t))return o();if(!yy.value){ve.value=!0;try{await m$(e,t.fullPath),await g$.__init__()}catch(d){console.error("Fail to authenticate",d),await n.push("/jplan-auth-fail")}ve.value=!1}if(yy.value){if(localStorage.getItem("returnRoute")&&localStorage.getItem("returnRoute")!==null){const d=localStorage.getItem("returnRoute")??"/";console.log("trying to go to saved route:",d),o(d),localStorage.removeItem("returnRoute");return}o()}})}const{scope:Cy}=vu();function _$(){const n=Rm(),e=l.ref({scope_type:"org"});async function t(r){e.value=r}return l.watch(Cy,()=>{n.interceptors.request.use(r=>{const o=r.headers,a=o.Authorization;a&&(o.Authorization=a);const c=Cy.value;return c&&(c.scope_type&&(o["j-scope-type"]=c.scope_type,c.organization&&(o["j-scope-organization"]=c.organization),c.team&&(o["j-scope-team"]=c.team)),c.environment&&(o["j-scope-environment"]=c.environment)),r})},{immediate:!0}),Object.assign(n,{setScope:t,scope:e})}function Da(n){const e=_$();e.defaults.baseURL=n;const t=l.ref({scope_type:"org"});async function r(o){t.value=o}return l.watch(t,()=>{e.interceptors.request.use(o=>{const a=t.value;return delete o.headers["j-scope-type"],delete o.headers["j-scope-organization"],delete o.headers["j-scope-team"],a!=null&&a.scope_type&&(o.headers["j-scope-type"]=a.scope_type),a!=null&&a.organization&&(o.headers["j-scope-organization"]=a.organization),a!=null&&a.team&&(o.headers["j-scope-team"]=a.team),o})},{immediate:!0}),Object.assign(e,{setScope:r,scope:t})}const Ey={enUS:{widget:"widget",spacer:"spacer"},ptBr:{widget:"widget",spacer:"Espaçador"}},Om={"pt-BR":{placeholders:{selectFilter:"Selecionar filtro",visualize:"Visualizar",actions:"Ações",search:"Pesquisar"},dialogs:{columnSettings:{title:"Configurações de coluna"},scope:{title:"Escopo",unknown:"Desconhecido",domain:"Domínio",environment:"Ambiente",organizational:"Organizacional",organization:"Organização",team:"Time",user:"Usuário",none:"Nenhum",selectOrganization:"Selecione uma Organização",selectTeam:"Selecione um Time"}},actions:{save:"Salvar",cancel:"Cancelar",edit:"Editar",delete:"Apagar",disable:"Desabilitar",confirm:"Confirmar",back:"Voltar"},forms:{metadata:{created:"Criado",updated:"Atualizado",modified:"Modificado",delegated:"Delegado"}},$vuetify:{dataFooter:{itemsPerPageAll:"Todos",itemsPerPageText:"Itens por página:",pageText:"{0}-{1} de {2}"}},toast:{error:{create_failed:"Falha ao criar {entity}",update_failed:"Falha ao atualizar {entity}",delete_failed:"Falha ao apagar {entity}",fetch_failed:"Falha ao buscar {entity}",activate_failed:"Falha ao ativar {entity}",deactivate_failed:"Falha ao desativar {entity}",link_failed:"Falha ao vincular {entity}",unlink_failed:"Falha ao desvincular {entity}"},success:{create_success:"{entity} criado com sucesso",update_success:"{entity} atualizado com sucesso",delete_success:"{entity} apagado com sucesso",activate_success:"{entity} ativado com sucesso",deactivate_success:"{entity} desativado com sucesso",link_success:"{entity} vinculado com sucesso",unlink_success:"{entity} desvinculado com sucesso"},info:{already_linked:"{entity} já está vinculado",select_valid_item:"Selecione um item válido"}},app:{widget:Ey.ptBr}},"en-US":{placeholders:{selectFilter:"Select a filter",visualize:"Visualize",actions:"Actions",search:"Search"},dialogs:{columnSettings:{title:"Column Settings"},scope:{title:"Scope",unknown:"Unknown",domain:"Domain",environment:"Environment",organizational:"Organizational",organization:"Organization",team:"Team",user:"User",none:"None",selectOrganization:"Select a organization",selectTeam:"Select a Team"}},actions:{save:"Save",cancel:"Cancel",edit:"Edit",delete:"Delete",disable:"Disable",back:"Back",confirm:"Confirm"},forms:{metadata:{created:"Created",updated:"Updated",modified:"Modified",delegated:"Delegated"}},$vuetify:{dataFooter:{itemsPerPageAll:"All",itemsPerPageText:"Items per page:",pageText:"{0}-{1} of {2}"}},toast:{error:{create_failed:"Failed to create {entity}",update_failed:"Failed to update {entity}",delete_failed:"Failed to delete {entity}",fetch_failed:"Failed to fetch {entity}",activate_failed:"Failed to activate {entity}",deactivate_failed:"Failed to deactivate {entity}",link_failed:"Failed to link {entity}",unlink_failed:"Failed to unlink {entity}"},success:{create_success:"{entity} created successfully",update_success:"{entity} updated successfully",delete_success:"{entity} deleted successfully",activate_success:"{entity} activated successfully",deactivate_success:"{entity} deactivated successfully",link_success:"{entity} linked successfully",unlink_success:"{entity} unlinked successfully"},info:{already_linked:"{entity} is already linked",select_valid_item:"Please select a valid item"}},app:{widget:Ey.ptBr}}},v$=Object.keys(Om),wy=navigator.language,y$=v$.includes(wy)?wy:"pt-BR",$=yx({locale:y$,fallbackLocale:"en-US",messages:Om});function C$(){const n=Da("https://api.jplan.com.br/management/organization"),{error:e}=wr();return{async getOrgList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Organization"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getOrgList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Organization"}));return}},async createOrg(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Organization"})),a}},async updateOrg(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e($.global.t("toast.error.update_failed",{entity:"Organization"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Organization"})),a}},async getOrg(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Organization"})),new Error(a.data.error);return a.data}catch(a){throw console.error("Error in getOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Organization"})),a}},async activateOrg(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"Organization"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Organization"})),a}},async deactivateOrg(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"Organization"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Organization"})),a}}}}const xo=C$();function E$(){const n=Da("https://api.jplan.com.br/management/branch/"),{error:e}=wr();return{async getBranchList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error){e($.global.t("toast.error.fetch_failed",{entity:"Branch"}));return}return o.data.data}catch(r){console.error("Error in getBranchList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Branch"}))}},async createBranch(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){console.error("Error in createBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Branch"}))}},async updateBranch(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error){e(a.data.error||$.global.t("toast.error.update_failed",{entity:"Branch"}));return}return a}catch(a){console.error("Error in updateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Branch"}))}},async getBranch(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error){e(a.data.error||$.global.t("toast.error.fetch_failed",{entity:"Branch"}));return}return a.data}catch(a){console.error("Error in getBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Branch"}))}},async activateBranch(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error){e(a.data.error||$.global.t("toast.error.activate_failed",{entity:"Branch"}));return}}catch(a){console.error("Error in activateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Branch"}))}},async deactivateBranch(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error){e(a.data.error||$.global.t("toast.error.deactivate_failed",{entity:"Branch"}));return}}catch(a){console.error("Error in deactivateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Branch"}))}}}}const Uo=E$();function w$(){const n=Da("https://api.jplan.com.br/management/team"),{error:e}=wr();return{async getTeamList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Team"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getTeamList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Team"}));return}},async createTeam(t){var r,o;try{const a=await n.post("/item",t);if(a.data.error)throw e($.global.t("toast.error.create_failed",{entity:"Team"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in createTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Team"})),a}},async updateTeam(t){var r,o;try{const a=await n.patch("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in updateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Team"})),a}},async getTeam(t){var r,o;try{const a=await n.get(`/item/${t}`);return a.data.error&&e($.global.t("toast.error.fetch_failed",{entity:"Team"})),a.data}catch(a){console.error("Error in getTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Team"}));return}},async activateTeam(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"Team"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Team"})),a}},async deactivateTeam(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"Team"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Team"})),a}},async getTeamUserList(t,r){try{const o=r?`?filter_query=${r}`:"",a=await n.get(`/item/${t}/user/list/${o}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(a.data.error);return a.data.data}catch(o){console.error("Error in getTeamUserList:",o),e($.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async linkManageUser(t,r){try{const o=await n.post(`/item/${t}/user/item/`,r);if(o.data.error)throw e($.global.t("toast.error.link_failed",{entity:"User"})),new Error(o.data.error);return o.data}catch(o){console.error("Error in link User:",o),e($.global.t("toast.error.link_failed",{entity:"User"}));return}},async updateManageUser(t,r){try{const o=await n.patch(`/item/${t}/user/item/`,r);if(o.data.error)throw e($.global.t("toast.error.update_failed",{entity:"User"})),new Error(o.data.error);return o.data.data}catch(o){throw console.error("Error in update User:",o),e($.global.t("toast.error.update_failed",{entity:"User"})),o}},async getManageUser(t,r,o){try{const a=o?`?filter_query=${o}`:"",c=await n.get(`/item/${t}/user/item/${r}/${a}`);if(c.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(c.data.error);return c.data.data}catch(a){console.error("Error in getUser:",a),e($.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async unlinkManageUser(t,r,o){try{const a=o?`?filter_query=${o}`:"";await n.delete(`/item/${t}/user/item/${r}/${a}`)}catch(a){throw console.error("Error in unlink User:",a),e($.global.t("toast.error.unlink_failed",{entity:"User"})),a}}}}const Mn=w$();let Qc=!1;const hh=l.ref(!1),jn=l.ref([]),Ty=l.ref([]),ft=l.ref(null),Qi=l.ref([]),Xi=l.ref([]),xT=()=>{const n=wr(),e=async C=>{hh.value=!0;const T=C?`_active eq true and ${C}`:"_active eq true",k=await xo.getOrgList(T);k&&(jn.value=k,Qc=!0),hh.value=!1},t=async C=>{var T;return(T=jn.value)!=null&&T.length||await e(C),jn.value};function r(C){if(!jn.value)throw new Error("Data not stored yet");const T=Oa(jn.value,C,["name","description"]);return C!==""?T:jn.value}const o=C=>{Ty.value=C},a=C=>{ft.value=Ra.cloneDeep(C)},c=async C=>await xo.getOrg(C),d=async()=>{if(ft.value!=null){const C=await xo.createOrg(ft.value);return C!=null&&C.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Organization"})),Qc&&jn.value.push(C.data)),C==null?void 0:C.data}},h=async()=>{if(ve.value=!0,ft.value&&ft.value.__id){const C=await xo.updateOrg(ft.value);if(Qc&&(C!=null&&C.data.__id)){const T=jn.value.findIndex(k=>k.__id===C.data.__id);return T!==-1?(jn.value[T]=C.data,n.success($.global.t("toast.success.update_success",{entity:"Organization"}))):n.error($.global.t("toast.error.update_failed",{entity:"Organization"})),ve.value=!1,C.data}}else ve.value=!1,n.error($.global.t("toast.error.update_failed",{entity:"Organization"}))},m=async()=>{if(ve.value=!0,ft.value&&ft.value.created_at){if(await xo.deactivateOrg(ft.value.__id),Qc){const C=jn.value.findIndex(T=>{var k;return T.__id===((k=ft.value)==null?void 0:k.__id)});if(C!==-1)return jn.value.splice(C,1),ft.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Organization"}))}ve.value=!1}};async function g(C){ve.value=!0;try{if(ft.value&&ft.value.__id){const T={...C,organization:ft.value.__id};if(!await Uo.updateBranch(T)){ve.value=!1;return}if(Qi.value.findIndex(N=>N.__id===C.__id)===-1)return n.success($.global.t("toast.success.link_success",{entity:"Branch"})),Qi.value.push(T),T;n.info($.global.t("toast.info.already_linked",{entity:"Branch"}))}}catch(T){console.error(T)}finally{ve.value=!1}}async function v(C){if(ve.value=!0,ft.value&&ft.value.__id){const T={...C,organization:null};if(!await Uo.updateBranch(T)){ve.value=!1;return}const I=Qi.value.findIndex(N=>N.__id===C.__id);if(I!==-1)return Qi.value.splice(I,1),ve.value=!1,Qi.value;throw new Error("Item not found to remove")}ve.value=!1}async function p(C){ve.value=!0;try{if(ft.value&&ft.value.__id){const T={...C,organization:ft.value.__id};if(!await Mn.updateTeam(T)){ve.value=!1;return}if(Xi.value.findIndex(N=>N.__id===C.__id)===-1)return n.success($.global.t("toast.success.link_success",{entity:"Team"})),Xi.value.push(T),T;n.info($.global.t("toast.info.already_linked",{entity:"Team"}))}}catch(T){console.error(T)}finally{ve.value=!1}}async function w(C){if(ve.value=!0,ft.value&&ft.value.__id){const T={...C,organization:null};if(!await Mn.updateTeam(T)){ve.value=!1;return}const I=Xi.value.findIndex(N=>N.__id===C.__id);if(I!==-1)return Xi.value.splice(I,1),ve.value=!1,Xi.value;throw new Error("Item not found to remove")}ve.value=!1}return{data:jn,loading:hh,columns:Ty,item:ft,filterData:r,__init__:e,getData:t,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,orgBranches:Qi,orgTeams:Xi,linkBranch:g,unlinkBranch:v,linkTeam:p,unlinkTeam:w}};let Xc=!1;const Yn=l.ref([]),by=l.ref([]),Nt=l.ref(null),fh=l.ref(!1),Zi=l.ref([]),UT=()=>{const n=wr(),e=async p=>{fh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await Mn.getTeamList(w);C&&(Yn.value=C,Xc=!0),fh.value=!1},t=async p=>(Yn.value.length||await e(p),Yn.value);function r(p){if(!Yn.value)throw new Error("Data not stored yet");const w=Oa(Yn.value,p,["name","description"]);return p!==""?w:Yn.value}const o=p=>{by.value=p},a=p=>{Nt.value=Ra.cloneDeep(p)},c=async p=>await Mn.getTeam(p),d=async()=>{if(Nt.value!=null){const p=await Mn.createTeam(Nt.value);return p!=null&&p.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Team"})),Xc&&Yn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(ve.value=!0,Nt.value&&Nt.value.__id){const p=await Mn.updateTeam(Nt.value);if(Xc&&(p!=null&&p.data.__id)){const w=Yn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Yn.value[w]=p.data,n.success($.global.t("toast.success.update_success",{entity:"Team"}))):n.error($.global.t("toast.error.update_failed",{entity:"Team"})),p.data}}else n.error($.global.t("toast.error.update_failed",{entity:"Team"}))},m=async()=>{if(Nt.value&&Nt.value.created_at&&(await Mn.deactivateTeam(Nt.value.__id),Xc)){const p=Yn.value.findIndex(w=>{var C;return w.__id===((C=Nt.value)==null?void 0:C.__id)});if(p!==-1)return Yn.value.splice(p,1),Nt.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Team"}))}};async function g(p){var w;if(ve.value=!0,(w=Nt.value)!=null&&w.__id)if(Zi.value.findIndex(T=>T.__id===p.__id)===-1)try{const T=await Mn.linkManageUser(Nt.value.__id,{team:Nt.value.__id,user:p.__id,role:"string",joined_at:"string",comments:"string"}),k=await Mn.getTeamUserList(Nt.value.__id);return k&&(Zi.value=k),n.success($.global.t("toast.success.link_success",{entity:"User"})),T}catch(T){console.error(T),n.error($.global.t("toast.error.link_failed",{entity:"User"}))}finally{ve.value=!1}else n.info($.global.t("toast.info.already_linked",{entity:"User"}));else console.warn("No item selected or item ID is missing."),n.info($.global.t("toast.info.select_valid_item"));ve.value=!1}async function v(p){if(ve.value=!0,Nt.value&&Nt.value.__id){const w=Zi.value.findIndex(C=>C.__id===p);if(w!==-1)return await Mn.unlinkManageUser(Nt.value.__id,p),Zi.value.splice(w,1),ve.value=!1,Zi.value;throw new Error("Item not found to remove")}ve.value=!1}return{data:Yn,loading:fh,columns:by,item:Nt,usersTeam:Zi,__init__:e,getData:t,filterData:r,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,linkUser:g,unlinkUser:v}},BT=l.defineComponent({__name:"GlobalScopeFilter",setup(n){var T,k,I;const{openDialog:e}=Ms("global-scope__J-"),{user:t,scope:r,session:o,setScope:a}=vu(),{getData:c,data:d}=xT(),{getData:h,data:m}=UT(),g=l.ref(!1);l.onBeforeMount(async()=>{g.value=!0,await c(),await h(),g.value=!1});const v=l.ref({scope_type:(T=r.value)==null?void 0:T.scope_type,organization:((k=r.value)==null?void 0:k.organization)??"org",team:(I=r.value)==null?void 0:I.team});function p(){var N,D,L;v.value={...r.value,scope_type:(N=r.value)==null?void 0:N.scope_type,organization:((D=r.value)==null?void 0:D.organization)??"",team:(L=r.value)==null?void 0:L.team},e()}const w=l.computed(()=>{var N;switch((N=r.value)==null?void 0:N.scope_type){case"user":return UF;case"org":return LF;case"team":return BF;default:return xF}});async function C(){var N;((N=r.value)==null?void 0:N.scope_type)!==""&&a(v.value)}return(N,D)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(it.VBtn,{onClick:p,icon:"",class:"text-secondary",color:"surface",rounded:"sm",size:"small",variant:"flat"},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(w.value),{size:"20"}))]),_:1}),l.createVNode(l.unref(Ls),{loading:g.value,title:l.unref($).global.t("dialogs.scope.title"),"dd-id":"global-scope__J-",onOnSave:C},{default:l.withCtx(()=>[l.createElementVNode("div",null,[l.createVNode(Qe.VRow,null,{default:l.withCtx(()=>[l.createVNode(Qe.VCol,{cols:"4",class:"d-flex flex-row align-center"},{default:l.withCtx(()=>[l.createVNode(Qt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.user")),1)]),_:1}),l.createVNode(Qt.VListItemSubtitle,null,{default:l.withCtx(()=>{var L;return[l.createTextVNode(l.toDisplayString(((L=l.unref(t))==null?void 0:L.name)||l.unref($).global.t("dialogs.scope.unknownUser")),1)]}),_:1})]),_:1})]),_:1}),l.createVNode(Qe.VCol,{cols:"4"},{default:l.withCtx(()=>[l.createVNode(Qt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.environment")),1)]),_:1}),l.createVNode(Qt.VListItemSubtitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o).domain),1)]),_:1})]),_:1})]),_:1}),l.createVNode(Qe.VCol,{cols:"4"},{default:l.withCtx(()=>[l.createVNode(Qt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.environment")),1)]),_:1}),l.createVNode(Qt.VListItemSubtitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o).environment),1)]),_:1})]),_:1})]),_:1})]),_:1}),l.createVNode(IO.VBtnToggle,{density:"compact",variant:"outlined",modelValue:v.value.scope_type,"onUpdate:modelValue":D[0]||(D[0]=L=>v.value.scope_type=L),class:"d-flex justify-center my-4"},{default:l.withCtx(()=>[l.createVNode(it.VBtn,{value:"org",label:l.unref($).global.t("dialogs.scope.organizational"),color:"secondary"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.organizational")),1)]),_:1},8,["label"]),l.createVNode(it.VBtn,{value:"team",label:l.unref($).global.t("dialogs.scope.team"),color:"secondary"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.team")),1)]),_:1},8,["label"]),l.createVNode(it.VBtn,{value:"user",label:l.unref($).global.t("dialogs.scope.user"),color:"secondary"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.user")),1)]),_:1},8,["label"]),l.createVNode(it.VBtn,{value:"",label:l.unref($).global.t("dialogs.scope.none"),color:"lightext"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.none")),1)]),_:1},8,["label"])]),_:1},8,["modelValue"]),l.createElementVNode("div",null,[l.createVNode(ys.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.organization")),1)]),_:1}),l.createVNode(ls.VSelect,{items:l.unref(d),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:l.unref($).global.t("dialogs.scope.selectOrganization"),class:"min-w-50",modelValue:v.value.organization,"onUpdate:modelValue":D[1]||(D[1]=L=>v.value.organization=L),clearable:""},null,8,["items","placeholder","modelValue"]),l.createVNode(ys.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.team")),1)]),_:1}),l.createVNode(ls.VSelect,{items:l.unref(m),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:l.unref($).global.t("dialogs.scope.selectTeam"),class:"min-w-50",modelValue:v.value.team,"onUpdate:modelValue":D[2]||(D[2]=L=>v.value.team=L),clearable:""},null,8,["items","placeholder","modelValue"])])])]),_:1},8,["loading","title"])],64))}}),T$={},b$={class:"double-ring-spinner-container"};function I$(n,e){return l.openBlock(),l.createElementBlock("div",b$,e[0]||(e[0]=[l.createElementVNode("div",{class:"spinner-loading"},[l.createElementVNode("div"),l.createElementVNode("div"),l.createElementVNode("div",null,[l.createElementVNode("div")]),l.createElementVNode("div",null,[l.createElementVNode("div")])],-1)]))}const FT=Sa(T$,[["render",I$],["__scopeId","data-v-00d7a69f"]]),S$={key:0,class:"_jspinner-overlay_jj"},VT=l.defineComponent({__name:"GlobalSpinner",setup(n){return(e,t)=>l.unref(ve)?(l.openBlock(),l.createElementBlock("div",S$,t[0]||(t[0]=[l.createElementVNode("div",{class:"j-double-ring-spinner-container"},[l.createElementVNode("div",{class:"j-global-spinner-loading"},[l.createElementVNode("div"),l.createElementVNode("div"),l.createElementVNode("div",null,[l.createElementVNode("div")]),l.createElementVNode("div",null,[l.createElementVNode("div")])])],-1)]))):l.createCommentVNode("",!0)}}),HT=l.defineComponent({__name:"SubMenu",props:{title:{}},setup(n,{expose:e}){return e({props:n}),(r,o)=>(l.openBlock(),l.createBlock(Qt.VListItem,{onClick:o[0]||(o[0]=()=>{}),density:"compact"},{append:l.withCtx(()=>[l.createVNode(l.unref(FF))]),default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(r.title),1)]),_:1}),l.createVNode(gf.VMenu,{activator:"parent","open-on-hover":"",submenu:"",density:"compact"},{default:l.withCtx(()=>[l.renderSlot(r.$slots,"default")]),_:3})]),_:3}))}}),A$=Object.freeze(Object.defineProperty({__proto__:null,AvatarPicture:fC,ColumnSettingsDialog:Uf,ConfirmDialog:dC,ContextMenu:mC,CopyButton:Bl,DeleteAllBtn:Cf,DotsMenu:uC,EditButton:lC,FormHeadless:GE,FormMetadata:ou,GlobalScopeFilter:BT,GlobalSpinner:VT,JAvatar:hC,JBtn:Oy,JDialog:Ls,JForm:WE,JIconBtn:Ry,JSelect:VE,JTextArea:HE,JTextField:gE,ParentCard:Kl,SearchFilter:Jl,SpinnerLoader:FT,SubMenu:HT,TabFormHeader:zE,TableAdvanced:XC,TableCard:Bf,TableCardsView:fE,TableHeader:ZC,UiTable:gC},Symbol.toStringTag,{value:"Module"})),k$=e0(),N$={transition:"Vue-Toastification__fade",maxToasts:20,newestOnTop:!0};let mh=!1;const gh=l.ref(!1),Jn=l.ref([]),Iy=l.ref([]),$t=l.ref(null),ea=l.ref([]),R$=()=>{const n=wr(),e=async p=>{gh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await Uo.getBranchList(w);C&&(Jn.value=C,mh=!0),gh.value=!1},t=async p=>(Jn.value.length||await e(p),Jn.value);function r(p){if(!Jn.value)throw new Error("Data not stored yet");const w=Oa(Jn.value,p,["name","description"]);return p!==""?w:Jn.value}const o=p=>{Iy.value=p},a=p=>{$t.value=Ra.cloneDeep(p)},c=async p=>await Uo.getBranch(p),d=async()=>{if($t.value!=null){const p=await Uo.createBranch($t.value);return p!=null&&p.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Branch"})),mh&&Jn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if($t.value&&$t.value.__id){const p=await Uo.updateBranch($t.value);if(mh&&p){const w=Jn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Jn.value[w]=p.data,n.success($.global.t("toast.success.update_success",{entity:"Branch"}))):n.error($.global.t("toast.error.update_failed",{entity:"Branch"})),p}}else n.error($.global.t("toast.error.update_failed",{entity:"Branch"}))},m=async()=>{if($t.value&&$t.value.created_at){await Uo.deactivateBranch($t.value.__id);const p=Jn.value.findIndex(w=>{var C;return w.__id===((C=$t.value)==null?void 0:C.__id)});if(p!==-1)return Jn.value.splice(p,1),$t.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Branch"}))}};async function g(p){ve.value=!0;try{if($t.value&&$t.value.__id){const w={...p,branch:$t.value.__id};if(!await Mn.updateTeam(w)){n.error($.global.t("toast.error.link_failed",{entity:"Team"}));return}if(ea.value.findIndex(k=>k.__id===p.__id)===-1)return n.success($.global.t("toast.success.link_success",{entity:"Team"})),ea.value.push(w),w;n.info($.global.t("toast.info.already_linked",{entity:"Team"}))}else throw new Error("Item is not defined")}catch(w){console.error(w)}finally{ve.value=!1}}async function v(p){if(ve.value=!0,$t.value&&$t.value.__id){const w={...p,branch:null};if(!await Mn.updateTeam(w))return;const T=ea.value.findIndex(k=>k.__id===p.__id);if(T!==-1)return ea.value.splice(T,1),ve.value=!1,ea.value;throw new Error("Item not found to remove")}ve.value=!1}return{data:Jn,columns:Iy,item:$t,loading:gh,__init__:e,getData:t,filterData:r,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,branchTeams:ea,linkTeam:g,unlinkTeam:v}};function O$(){const n=Da("https://api.jplan.com.br/management/division"),{error:e}=wr();return{async getDivisionList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Division"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getDivisionList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Division"}));return}},async createDivision(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Division"})),a}},async updateDivision(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e($.global.t("toast.error.update_failed",{entity:"Division"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Division"})),a}},async getDivision(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Division"})),new Error(a.data.error);return a.data}catch(a){throw console.error("Error in getDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Division"})),a}},async activateDivision(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"Division"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Division"})),a}},async deactivateDivision(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"Division"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Division"})),a}}}}const ca=O$();let ph=!1;const _h=l.ref(!1),Qn=l.ref([]),Sy=l.ref([]),Kt=l.ref(null),ta=l.ref([]),P$=()=>{const n=wr(),e=async p=>{_h.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await ca.getDivisionList(w);C&&(Qn.value=C,ph=!0),_h.value=!1},t=async p=>(Qn.value.length||await e(p),Qn.value);function r(p){if(!Qn.value)throw new Error("Data not stored yet");const w=Oa(Qn.value,p,["name","description"]);return p!==""?w:Qn.value}const o=p=>{Sy.value=p},a=p=>{Kt.value=Ra.cloneDeep(p)},c=async p=>await ca.getDivision(p),d=async()=>{if(Kt.value!=null){const p=await ca.createDivision(Kt.value);return p!=null&&p.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Division"})),ph&&Qn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(ve.value=!0,Kt.value&&Kt.value.__id){const p=await ca.updateDivision(Kt.value);if(ph&&(p!=null&&p.data.__id)){const w=Qn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Qn.value[w]=p.data,n.success($.global.t("toast.success.update_success",{entity:"Division"}))):n.error($.global.t("toast.error.update_failed",{entity:"Division"})),ve.value=!1,p}}else ve.value=!1,n.error($.global.t("toast.error.update_failed",{entity:"Division"}))},m=async()=>{if(ve.value=!0,Kt.value&&Kt.value.created_at){await ca.deactivateDivision(Kt.value.__id);const p=Qn.value.findIndex(w=>{var C;return w.__id===((C=Kt.value)==null?void 0:C.__id)});if(p!==-1)return Qn.value.splice(p,1),Kt.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Division"}))}ve.value=!1};async function g(p){ve.value=!0;try{if(Kt.value&&Kt.value.__id){const w={...p,division:Kt.value.__id};return await xo.updateOrg(w)?(ta.value.findIndex(k=>k.__id===p.__id)===-1?(n.success($.global.t("toast.success.link_success",{entity:"Organization"})),ta.value.push(w)):n.info($.global.t("toast.info.already_linked",{entity:"Organization"})),w):void 0}else throw new Error("Item is not defined")}catch(w){console.error(w)}finally{ve.value=!1}}async function v(p){if(ve.value=!0,Kt.value&&Kt.value.__id){const w={...p,division:null};if(!await xo.updateOrg(w))return;const T=ta.value.findIndex(k=>k.__id===p.__id);if(T!==-1)ta.value.splice(T,1);else throw new Error("Item not found to remove")}else throw new Error("Item is not defined");return ve.value=!1,ta.value}return{data:Qn,columns:Sy,item:Kt,loading:_h,__init__:e,filterData:r,getData:t,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,orgs:ta,linkDivision:g,unlinkDivision:v}};function M$(){const n=Da("https://api.jplan.com.br/management/user"),{error:e}=wr();return{async getManageUserList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getManageUserList:",r),e($.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async createManageUser(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"User"})),a}},async updateManageUser(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e($.global.t("toast.error.update_failed",{entity:"User"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"User"})),a}},async getManageUser(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(a.data.error);return a.data}catch(a){console.error("Error in getManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async activateManageUser(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"User"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"User"})),a}},async deactivateManageUser(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"User"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"User"})),a}}}}const la=M$();let vh=!1,yh=l.ref(!1);const Xn=l.ref([]),Ay=l.ref([]),Zn=l.ref(null),D$=l.ref(null),L$=l.ref([]),x$=()=>{const n=wr(),e=async g=>{yh.value=!0;const v=g?`_active eq true and ${g}`:"_active eq true",p=await la.getManageUserList(v);p&&(Xn.value=p,vh=!0),yh.value=!1},t=async g=>(Xn.value.length||await e(g),Xn.value);function r(g){if(!Xn.value)throw new Error("Data not stored yet");const v=Oa(Xn.value,g,["name","description"]);return g!==""?v:Xn.value}return{data:Xn,loading:yh,columns:Ay,item:Zn,filterData:r,__init__:e,getData:t,setColumns:g=>{Ay.value=g},setItem:g=>{Zn.value=Ra.cloneDeep(g)},getItem:async g=>await la.getManageUser(g),createItem:async()=>{if(Zn.value!=null){const g=crypto.randomUUID(),v=await la.createManageUser({...Zn.value,__id:g});return v!=null&&v.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"User"})),vh&&Xn.value.push(v.data)),v==null?void 0:v.data}},updateItem:async()=>{if(ve.value=!0,Zn.value&&Zn.value.created_at){const g=await la.updateManageUser(Zn.value);if(vh&&(g!=null&&g.data)){const v=Xn.value.findIndex(p=>p.__id===(g==null?void 0:g.data.__id));v!==-1?(Xn.value[v]=g==null?void 0:g.data,n.success($.global.t("toast.success.update_success",{entity:"User"}))):n.error($.global.t("toast.error.update_failed",{entity:"User"}))}return ve.value=!1,g==null?void 0:g.data}},removeItem:async()=>{if(Zn.value&&Zn.value.created_at){try{await la.deactivateManageUser(Zn.value.__id)}catch{n.error($.global.t("toast.error.deactivate_failed",{entity:"User"}));return}const g=Xn.value.findIndex(v=>{var p;return v.__id===((p=Zn.value)==null?void 0:p.__id)});if(g!==-1)return Xn.value.splice(g,1),n.success($.global.t("toast.success.deactivate_success",{entity:"User"})),Zn.value}},userOrg:D$,userTeams:L$}},Ch=Object.freeze({colNum:24,rowHeight:50,useCssTransforms:!0,responsive:!0,margin:[12,10]}),na=l.ref(!1),U$=l.ref([]);function B$(){const n=l.ref({...Ch,isResizable:!1,isDraggable:!1,useStyleCursor:!1,cursor:"default"});function e(){if(na.value=!na.value,n.value.isDraggable=na.value,n.value.isResizable=na.value,!na.value){n.value.useStyleCursor=!0,n.value.cursor="pointer";return}n.value.useStyleCursor=!1,n.value.cursor="move"}function t(){n.value={...Ch,isResizable:!1,isDraggable:!1,useStyleCursor:!1,cursor:"default"}}return{DEFAULT_CONFIG:Ch,config:n,layout:U$,edition:na,toggleEdit:e,resetLayout:t}}const F$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetTask-BSyenrFJ.js"))),V$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetImage-DhplL-E6.js"))),H$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetShortcut-DGMMiSLS.js"))),$$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetSpacer-DPXCTR7X.js"))),K$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetLabel-OgfRhxrv.js"))),W$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetChartBar-ChMg_dbz.js"))),z$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetChartPie-C2AIgVQ2.js"))),G$={WidgetSpacer:$$,WidgetLabel:K$,WidgetTask:F$,WidgetImage:V$,WidgetShortcut:H$,WidgetChartBar:W$,WidgetChartPie:z$},q$={defaultI18n:!0},j$=(n,e)=>{const t={...q$,...e};n.use(k$),n.use(nP,N$),t.defaultI18n&&n.use($),Object.entries(A$).forEach(([r,o])=>{n.component(r,o)}),Object.entries(AO).forEach(([r,o])=>{n.provide(r,o)})},Y$={install:j$};exports.ContextMenu=mC;exports.EmptyListImg=Lh;exports.EventBus=Hl;exports.FormHeadless=GE;exports.HttpCore=cF;exports.I18nMessages=Om;exports.SpinnerLoader=FT;exports.TableCardsView=fE;exports.TableHeader=ZC;exports.__spinner=ve;exports._export_sfc=Sa;exports._sfc_main=Ls;exports._sfc_main$1=gC;exports._sfc_main$10=Oy;exports._sfc_main$11=Cf;exports._sfc_main$12=lC;exports._sfc_main$13=Ry;exports._sfc_main$14=VE;exports._sfc_main$15=HE;exports._sfc_main$16=gE;exports._sfc_main$17=WE;exports._sfc_main$18=zE;exports._sfc_main$19=Kl;exports._sfc_main$2=XC;exports._sfc_main$20=hC;exports._sfc_main$21=fC;exports._sfc_main$22=HT;exports._sfc_main$23=BT;exports._sfc_main$24=VT;exports._sfc_main$3=Uf;exports._sfc_main$4=Bf;exports._sfc_main$5=Jl;exports._sfc_main$6=dC;exports._sfc_main$7=Bl;exports._sfc_main$8=uC;exports._sfc_main$9=ou;exports.branchInstance=Uo;exports.coreClient=Rm;exports.createToastInterface=ws;exports.dateFormat=us;exports.divisionInstance=ca;exports.filterQuery=Oa;exports.globalEventBus=yf;exports.i18n=$;exports.index=Y$;exports.manageUserInstance=la;exports.msal=Gt;exports.orgInstance=xo;exports.provideToast=tP;exports.scopedClient=Da;exports.setupAuthGuard=p$;exports.teamInstance=Mn;exports.toastInjectionKey=$l;exports.useAuth=Nm;exports.useBranchStore=R$;exports.useCustomizer=i0;exports.useDashboardStore=B$;exports.useDialog=Ms;exports.useDivisionStore=P$;exports.useManageUserStore=x$;exports.useOrganizationStore=xT;exports.useSession=vu;exports.useTeamStore=UT;exports.useToast=wr;exports.widgets=G$;
|
113
|
+
${c}`);return}throw ty(e.error,e.error_description,e.suberror)?new Er(e.error,e.error_description,e.suberror,e.timestamp||F.EMPTY_STRING,e.trace_id||F.EMPTY_STRING,e.correlation_id||F.EMPTY_STRING,e.claims||F.EMPTY_STRING,a):c}}async handleServerTokenResponse(e,t,r,o,a,c,d,h,m){var C;(C=this.performanceClient)==null||C.addQueueMeasurement(x.HandleServerTokenResponse,e.correlation_id);let g;if(e.id_token){if(g=Si(e.id_token||F.EMPTY_STRING,this.cryptoObj.base64Decode),a&&a.nonce&&g.nonce!==a.nonce)throw Y(tw);if(o.maxAge||o.maxAge===0){const T=g.auth_time;if(!T)throw Y(qf);fw(T,o.maxAge)}}this.homeAccountIdentifier=Pt.generateHomeAccountId(e.client_info||F.EMPTY_STRING,t.authorityType,this.logger,this.cryptoObj,g);let v;a&&a.state&&(v=yr.parseRequestState(this.cryptoObj,a.state)),e.key_id=e.key_id||o.sshKid||void 0;const p=this.generateCacheRecord(e,t,r,o,g,c,a);let w;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),w=new A2(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(w)),d&&!h&&p.account){const T=p.account.generateAccountKey();if(!this.cacheStorage.getAccount(T,this.logger))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await Ti.generateAuthenticationResult(this.cryptoObj,t,p,!1,o,g,v,void 0,m)}await this.cacheStorage.saveCacheRecord(p,o.storeInCache,o.correlationId)}finally{this.persistencePlugin&&this.serializableCache&&w&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(w))}return Ti.generateAuthenticationResult(this.cryptoObj,t,p,!1,o,g,v,e,m)}generateCacheRecord(e,t,r,o,a,c,d){const h=t.getPreferredCache();if(!h)throw Y(Yf);const m=Nw(a);let g,v;e.id_token&&a&&(g=au(this.homeAccountIdentifier,h,e.id_token,this.clientId,m||""),v=dm(this.cacheStorage,t,this.homeAccountIdentifier,this.cryptoObj.base64Decode,a,e.client_info,h,m,d,void 0,this.logger));let p=null;if(e.access_token){const T=e.scope?vt.fromString(e.scope):new vt(o.scopes||[]),k=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,I=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,N=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,D=r+k,L=D+I,K=N&&N>0?r+N:void 0;p=su(this.homeAccountIdentifier,h,e.access_token,this.clientId,m||t.tenant||"",T.printScopes(),D,L,this.cryptoObj.base64Decode,K,e.token_type,c,e.key_id,o.claims,o.requestedClaimsHash)}let w=null;if(e.refresh_token){let T;if(e.refresh_token_expires_in){const k=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;T=r+k}w=mw(this.homeAccountIdentifier,h,e.refresh_token,this.clientId,e.foci,c,T)}let C=null;return e.foci&&(C={clientId:this.clientId,environment:h,familyId:e.foci}),{account:v,idToken:g,accessToken:p,refreshToken:w,appMetadata:C}}static async generateAuthenticationResult(e,t,r,o,a,c,d,h,m){var D,L,K,q,M;let g=F.EMPTY_STRING,v=[],p=null,w,C,T=F.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===Ge.POP&&!a.popKid){const ce=new ba(e),{secret:ae,keyId:X}=r.accessToken;if(!X)throw Y(Jf);g=await ce.signPopToken(ae,X,a)}else g=r.accessToken.secret;v=vt.fromString(r.accessToken.target).asArray(),p=new Date(Number(r.accessToken.expiresOn)*1e3),w=new Date(Number(r.accessToken.extendedExpiresOn)*1e3),r.accessToken.refreshOn&&(C=new Date(Number(r.accessToken.refreshOn)*1e3))}r.appMetadata&&(T=r.appMetadata.familyId===ps?ps:"");const k=(c==null?void 0:c.oid)||(c==null?void 0:c.sub)||"",I=(c==null?void 0:c.tid)||"";h!=null&&h.spa_accountid&&r.account&&(r.account.nativeAccountId=h==null?void 0:h.spa_accountid);const N=r.account?im(r.account.getAccountInfo(),void 0,c,(D=r.idToken)==null?void 0:D.secret):null;return{authority:t.canonicalAuthority,uniqueId:k,tenantId:I,scopes:v,account:N,idToken:((L=r==null?void 0:r.idToken)==null?void 0:L.secret)||"",idTokenClaims:c||{},accessToken:g,fromCache:o,expiresOn:p,extExpiresOn:w,refreshOn:C,correlationId:a.correlationId,requestId:m||F.EMPTY_STRING,familyId:T,tokenType:((K=r.accessToken)==null?void 0:K.tokenType)||F.EMPTY_STRING,state:d?d.userRequestState:F.EMPTY_STRING,cloudGraphHostName:((q=r.account)==null?void 0:q.cloudGraphHostName)||F.EMPTY_STRING,msGraphHost:((M=r.account)==null?void 0:M.msGraphHost)||F.EMPTY_STRING,code:h==null?void 0:h.spa_code,fromNativeBroker:!1}}}function dm(n,e,t,r,o,a,c,d,h,m,g){g==null||g.verbose("setCachedAccount called");const p=n.getAccountKeys().find(I=>I.startsWith(t));let w=null;p&&(w=n.getAccount(p,g));const C=w||Pt.createAccount({homeAccountId:t,idTokenClaims:o,clientInfo:a,environment:c,cloudGraphHostName:h==null?void 0:h.cloud_graph_host_name,msGraphHost:h==null?void 0:h.msgraph_host,nativeAccountId:m},e,r),T=C.tenantProfiles||[],k=d||C.realm;if(k&&!T.find(I=>I.tenantId===k)){const I=om(t,C.localAccountId,k,o);T.push(I)}return C.tenantProfiles=T,C}/*! @azure/msal-common v14.16.0 2024-11-05 */async function Fw(n,e,t){return typeof n=="string"?n:n({clientId:e,tokenEndpoint:t})}/*! @azure/msal-common v14.16.0 2024-11-05 */class Vw extends lm{constructor(e,t){var r;super(e,t),this.includeRedirectUri=!0,this.oidcDefaultScopes=(r=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:r.defaultScopes}async getAuthCodeUrl(e){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(x.GetAuthCodeUrl,e.correlationId);const t=await Q(this.createAuthCodeUrlQueryString.bind(this),x.AuthClientCreateQueryString,this.logger,this.performanceClient,e.correlationId)(e);return De.appendQueryString(this.authority.authorizationEndpoint,t)}async acquireToken(e,t){var d,h;if((d=this.performanceClient)==null||d.addQueueMeasurement(x.AuthClientAcquireToken,e.correlationId),!e.code)throw Y(ow);const r=zr(),o=await Q(this.executeTokenRequest.bind(this),x.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),a=(h=o.headers)==null?void 0:h[dn.X_MS_REQUEST_ID],c=new Ti(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return c.validateTokenResponse(o.body),Q(c.handleServerTokenResponse.bind(c),x.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(o.body,this.authority,r,e,t,void 0,void 0,void 0,a)}handleFragmentResponse(e,t){if(new Ti(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null).validateServerAuthorizationCodeResponse(e,t),!e.code)throw Y(lw);return e}getLogoutUri(e){if(!e)throw Xe(Ew);const t=this.createLogoutUrlQueryString(e);return De.appendQueryString(this.authority.endSessionEndpoint,t)}async executeTokenRequest(e,t){var m,g;(m=this.performanceClient)==null||m.addQueueMeasurement(x.AuthClientExecuteTokenRequest,t.correlationId);const r=this.createTokenQueryParameters(t),o=De.appendQueryString(e.tokenEndpoint,r),a=await Q(this.createTokenRequestBody.bind(this),x.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,t.correlationId)(t);let c;if(t.clientInfo)try{const v=Rl(t.clientInfo,this.cryptoUtils.base64Decode);c={credential:`${v.uid}${tn.CLIENT_INFO_SEPARATOR}${v.utid}`,type:Bn.HOME_ACCOUNT_ID}}catch(v){this.logger.verbose("Could not parse client info for CCS Header: "+v)}const d=this.createTokenRequestHeaders(c||t.ccsCredential),h={clientId:((g=t.tokenBodyParameters)==null?void 0:g.clientId)||this.config.authOptions.clientId,authority:e.canonicalAuthority,scopes:t.scopes,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid};return Q(this.executePostToTokenEndpoint.bind(this),x.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,t.correlationId)(o,a,d,h,t.correlationId,x.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var o,a;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthClientCreateTokenRequestBody,e.correlationId);const t=new vs(e.correlationId,this.performanceClient);if(t.addClientId(e.embeddedClientId||((a=e.tokenBodyParameters)==null?void 0:a[wi])||this.config.authOptions.clientId),this.includeRedirectUri?t.addRedirectUri(e.redirectUri):ia.validateRedirectUri(e.redirectUri),t.addScopes(e.scopes,!0,this.oidcDefaultScopes),t.addAuthorizationCode(e.code),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addThrottling(),this.serverTelemetryManager&&!Zh(this.config)&&t.addServerTelemetry(this.serverTelemetryManager),e.codeVerifier&&t.addCodeVerifier(e.codeVerifier),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const c=this.config.clientCredentials.clientAssertion;t.addClientAssertion(await Fw(c.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),t.addClientAssertionType(c.assertionType)}if(t.addGrantType(qE.AUTHORIZATION_CODE_GRANT),t.addClientInfo(),e.authenticationScheme===Ge.POP){const c=new ba(this.cryptoUtils,this.performanceClient);let d;e.popKid?d=this.cryptoUtils.encodeKid(e.popKid):d=(await Q(c.generateCnf.bind(c),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,t.addPopToken(d)}else if(e.authenticationScheme===Ge.SSH)if(e.sshJwk)t.addSshJwk(e.sshJwk);else throw Xe(cu);(!vr.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const c=Rl(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${c.uid}${tn.CLIENT_INFO_SEPARATOR}${c.utid}`,type:Bn.HOME_ACCOUNT_ID}}catch(c){this.logger.verbose("Could not parse client info for CCS Header: "+c)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case Bn.HOME_ACCOUNT_ID:try{const c=fa(r.credential);t.addCcsOid(c)}catch(c){this.logger.verbose("Could not parse home account ID for CCS Header: "+c)}break;case Bn.UPN:t.addCcsUpn(r.credential);break}return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&t.addExtraQueryParameters(e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[Xv])&&t.addExtraQueryParameters({[Xv]:"1"}),t.createQueryString()}async createAuthCodeUrlQueryString(e){var a,c;const t=e.correlationId||this.config.cryptoInterface.createNewGuid();(a=this.performanceClient)==null||a.addQueueMeasurement(x.AuthClientCreateQueryString,t);const r=new vs(t,this.performanceClient);r.addClientId(e.embeddedClientId||((c=e.extraQueryParameters)==null?void 0:c[wi])||this.config.authOptions.clientId);const o=[...e.scopes||[],...e.extraScopesToConsent||[]];if(r.addScopes(o,!0,this.oidcDefaultScopes),r.addRedirectUri(e.redirectUri),r.addCorrelationId(t),r.addResponseMode(e.responseMode),r.addResponseTypeCode(),r.addLibraryInfo(this.config.libraryInfo),Zh(this.config)||r.addApplicationTelemetry(this.config.telemetry.application),r.addClientInfo(),e.codeChallenge&&e.codeChallengeMethod&&r.addCodeChallengeParams(e.codeChallenge,e.codeChallengeMethod),e.prompt&&r.addPrompt(e.prompt),e.domainHint&&r.addDomainHint(e.domainHint),e.prompt!==Bt.SELECT_ACCOUNT)if(e.sid&&e.prompt===Bt.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),r.addSid(e.sid);else if(e.account){const d=this.extractAccountSid(e.account);let h=this.extractLoginHint(e.account);if(h&&e.domainHint&&(this.logger.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),h=null),h){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),r.addLoginHint(h);try{const m=fa(e.account.homeAccountId);r.addCcsOid(m)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(d&&e.prompt===Bt.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),r.addSid(d);try{const m=fa(e.account.homeAccountId);r.addCcsOid(m)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),r.addLoginHint(e.loginHint),r.addCcsUpn(e.loginHint);else if(e.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),r.addLoginHint(e.account.username);try{const m=fa(e.account.homeAccountId);r.addCcsOid(m)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),r.addLoginHint(e.loginHint),r.addCcsUpn(e.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");if(e.nonce&&r.addNonce(e.nonce),e.state&&r.addState(e.state),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(e.claims,this.config.authOptions.clientCapabilities),e.embeddedClientId&&r.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),this.addExtraQueryParams(e,r),e.nativeBroker&&(r.addNativeBroker(),e.authenticationScheme===Ge.POP)){const d=new ba(this.cryptoUtils);let h;e.popKid?h=this.cryptoUtils.encodeKid(e.popKid):h=(await Q(d.generateCnf.bind(d),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,r.addPopToken(h)}return r.createQueryString()}createLogoutUrlQueryString(e){const t=new vs(e.correlationId,this.performanceClient);return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),this.addExtraQueryParams(e,t),t.createQueryString()}addExtraQueryParams(e,t){!(e.extraQueryParameters&&e.extraQueryParameters.hasOwnProperty("instance_aware"))&&this.config.authOptions.instanceAware&&(e.extraQueryParameters=e.extraQueryParameters||{},e.extraQueryParameters.instance_aware="true"),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters)}extractAccountSid(e){var t;return((t=e.idTokenClaims)==null?void 0:t.sid)||null}extractLoginHint(e){var t;return((t=e.idTokenClaims)==null?void 0:t.login_hint)||null}}/*! @azure/msal-common v14.16.0 2024-11-05 */const N2=300;class nf extends lm{constructor(e,t){super(e,t)}async acquireToken(e){var c,d;(c=this.performanceClient)==null||c.addQueueMeasurement(x.RefreshTokenClientAcquireToken,e.correlationId);const t=zr(),r=await Q(this.executeTokenRequest.bind(this),x.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),o=(d=r.headers)==null?void 0:d[dn.X_MS_REQUEST_ID],a=new Ti(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return a.validateTokenResponse(r.body),Q(a.handleServerTokenResponse.bind(a),x.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,t,e,void 0,void 0,!0,e.forceCache,o)}async acquireTokenByRefreshToken(e){var r;if(!e)throw Xe(Cw);if((r=this.performanceClient)==null||r.addQueueMeasurement(x.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw Y(jf);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await Q(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(o){const a=o instanceof Er&&o.errorCode===Dl,c=o instanceof Wo&&o.errorCode===Bv.INVALID_GRANT_ERROR&&o.subError===Bv.CLIENT_MISMATCH_ERROR;if(a||c)return Q(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw o}return Q(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=Ai(this.cacheManager.getRefreshToken.bind(this.cacheManager),x.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,t,void 0,this.performanceClient,e.correlationId);if(!r)throw tf(Dl);if(r.expiresOn&&Xh(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||N2))throw tf(um);const o={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||Ge.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:Bn.HOME_ACCOUNT_ID}};try{return await Q(this.acquireToken.bind(this),x.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(o)}catch(c){if(c instanceof Er&&c.subError===du){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const d=ha(r);this.cacheManager.removeRefreshToken(d)}throw c}}async executeTokenRequest(e,t){var h,m;(h=this.performanceClient)==null||h.addQueueMeasurement(x.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),o=De.appendQueryString(t.tokenEndpoint,r),a=await Q(this.createTokenRequestBody.bind(this),x.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),c=this.createTokenRequestHeaders(e.ccsCredential),d={clientId:((m=e.tokenBodyParameters)==null?void 0:m.clientId)||this.config.authOptions.clientId,authority:t.canonicalAuthority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid};return Q(this.executePostToTokenEndpoint.bind(this),x.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(o,a,c,d,e.correlationId,x.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var o,a,c;(o=this.performanceClient)==null||o.addQueueMeasurement(x.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const t=e.correlationId,r=new vs(t,this.performanceClient);if(r.addClientId(e.embeddedClientId||((a=e.tokenBodyParameters)==null?void 0:a[wi])||this.config.authOptions.clientId),e.redirectUri&&r.addRedirectUri(e.redirectUri),r.addScopes(e.scopes,!0,(c=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:c.defaultScopes),r.addGrantType(qE.REFRESH_TOKEN_GRANT),r.addClientInfo(),r.addLibraryInfo(this.config.libraryInfo),r.addApplicationTelemetry(this.config.telemetry.application),r.addThrottling(),this.serverTelemetryManager&&!Zh(this.config)&&r.addServerTelemetry(this.serverTelemetryManager),r.addRefreshToken(e.refreshToken),this.config.clientCredentials.clientSecret&&r.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const d=this.config.clientCredentials.clientAssertion;r.addClientAssertion(await Fw(d.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),r.addClientAssertionType(d.assertionType)}if(e.authenticationScheme===Ge.POP){const d=new ba(this.cryptoUtils,this.performanceClient);let h;e.popKid?h=this.cryptoUtils.encodeKid(e.popKid):h=(await Q(d.generateCnf.bind(d),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,r.addPopToken(h)}else if(e.authenticationScheme===Ge.SSH)if(e.sshJwk)r.addSshJwk(e.sshJwk);else throw Xe(cu);if((!vr.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case Bn.HOME_ACCOUNT_ID:try{const d=fa(e.ccsCredential.credential);r.addCcsOid(d)}catch(d){this.logger.verbose("Could not parse home account ID for CCS Header: "+d)}break;case Bn.UPN:r.addCcsUpn(e.ccsCredential.credential);break}return e.embeddedClientId&&r.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&r.addExtraQueryParameters(e.tokenBodyParameters),r.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */class R2 extends lm{constructor(e,t){super(e,t)}async acquireToken(e){var t;try{const[r,o]=await this.acquireCachedToken({...e,scopes:(t=e.scopes)!=null&&t.length?e.scopes:[...Pa]});return o===Mo.PROACTIVELY_REFRESHED&&(this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."),new nf(this.config,this.performanceClient).acquireTokenByRefreshToken(e).catch(()=>{})),r}catch(r){if(r instanceof iu&&r.errorCode===co)return new nf(this.config,this.performanceClient).acquireTokenByRefreshToken(e);throw r}}async acquireCachedToken(e){var h;(h=this.performanceClient)==null||h.addQueueMeasurement(x.SilentFlowClientAcquireCachedToken,e.correlationId);let t=Mo.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!vr.isEmptyObj(e.claims))throw this.setCacheOutcome(Mo.FORCE_REFRESH_OR_CLAIMS,e.correlationId),Y(co);if(!e.account)throw Y(jf);const r=e.account.tenantId||y2(e.authority),o=this.cacheManager.getTokenKeys(),a=this.cacheManager.getAccessToken(e.account,e,o,r,this.performanceClient,e.correlationId);if(a){if(iV(a.cachedAt)||Xh(a.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(Mo.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),Y(co);a.refreshOn&&Xh(a.refreshOn,0)&&(t=Mo.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(Mo.NO_CACHED_ACCESS_TOKEN,e.correlationId),Y(co);const c=e.authority||this.authority.getPreferredCache(),d={account:this.cacheManager.readAccountFromCache(e.account),accessToken:a,idToken:this.cacheManager.getIdToken(e.account,o,r,this.performanceClient,e.correlationId),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(c)};return this.setCacheOutcome(t,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await Q(this.generateResultFromCacheRecord.bind(this),x.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(d,e),t]}setCacheOutcome(e,t){var r,o;(r=this.serverTelemetryManager)==null||r.setCacheOutcome(e),(o=this.performanceClient)==null||o.addFields({cacheOutcome:e},t),e!==Mo.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,t){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(x.SilentFlowClientGenerateResultFromCacheRecord,t.correlationId);let r;if(e.idToken&&(r=Si(e.idToken.secret,this.config.cryptoInterface.base64Decode)),t.maxAge||t.maxAge===0){const a=r==null?void 0:r.auth_time;if(!a)throw Y(qf);fw(a,t.maxAge)}return Ti.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,t,r)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const O2={sendGetRequestAsync:()=>Promise.reject(Y(Ae)),sendPostRequestAsync:()=>Promise.reject(Y(Ae))};/*! @azure/msal-common v14.16.0 2024-11-05 */const ny=",",Hw="|";function P2(n){const{skus:e,libraryName:t,libraryVersion:r,extensionName:o,extensionVersion:a}=n,c=new Map([[0,[t,r]],[2,[o,a]]]);let d=[];if(e!=null&&e.length){if(d=e.split(ny),d.length<4)return e}else d=Array.from({length:4},()=>Hw);return c.forEach((h,m)=>{var g,v;h.length===2&&((g=h[0])!=null&&g.length)&&((v=h[1])!=null&&v.length)&&M2({skuArr:d,index:m,skuName:h[0],skuVersion:h[1]})}),d.join(ny)}function M2(n){const{skuArr:e,index:t,skuName:r,skuVersion:o}=n;t>=e.length||(e[t]=[r,o].join(Hw))}class Os{constructor(e,t){this.cacheOutcome=Mo.NOT_APPLICABLE,this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||F.EMPTY_STRING,this.wrapperVer=e.wrapperVer||F.EMPTY_STRING,this.telemetryCacheKey=Wt.CACHE_KEY+tn.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${Wt.VALUE_SEPARATOR}${this.cacheOutcome}`,t=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r!=null&&r.length&&t.push(`broker_error=${r}`);const o=t.join(Wt.VALUE_SEPARATOR),a=this.getRegionDiscoveryFields(),c=[e,a].join(Wt.VALUE_SEPARATOR);return[Wt.SCHEMA_VERSION,c,o].join(Wt.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),t=Os.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*t).join(Wt.VALUE_SEPARATOR),o=e.errors.slice(0,t).join(Wt.VALUE_SEPARATOR),a=e.errors.length,c=t<a?Wt.OVERFLOW_TRUE:Wt.OVERFLOW_FALSE,d=[a,c].join(Wt.VALUE_SEPARATOR);return[Wt.SCHEMA_VERSION,e.cacheHits,r,o,d].join(Wt.CATEGORY_SEPARATOR)}cacheFailedRequest(e){const t=this.getLastRequests();t.errors.length>=Wt.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof lt?e.subError?t.errors.push(e.subError):e.errorCode?t.errors.push(e.errorCode):t.errors.push(e.toString()):t.errors.push(e.toString()):t.errors.push(Wt.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),t=Os.maxErrorsToSend(e),r=e.errors.length;if(t===r)this.cacheManager.removeItem(this.telemetryCacheKey);else{const o={failedRequests:e.failedRequests.slice(t*2),errors:e.errors.slice(t),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,o)}}static maxErrorsToSend(e){let t,r=0,o=0;const a=e.errors.length;for(t=0;t<a;t++){const c=e.failedRequests[2*t]||F.EMPTY_STRING,d=e.failedRequests[2*t+1]||F.EMPTY_STRING,h=e.errors[t]||F.EMPTY_STRING;if(o+=c.toString().length+d.toString().length+h.length+3,o<Wt.MAX_LAST_HEADER_BYTES)r+=1;else break}return r}getRegionDiscoveryFields(){const e=[];return e.push(this.regionUsed||F.EMPTY_STRING),e.push(this.regionSource||F.EMPTY_STRING),e.push(this.regionOutcome||F.EMPTY_STRING),e.join(",")}updateRegionDiscoveryMetadata(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome}setCacheOutcome(e){this.cacheOutcome=e}setNativeBrokerErrorCode(e){const t=this.getLastRequests();t.nativeBrokerErrorCode=e,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}getNativeBrokerErrorCode(){return this.getLastRequests().nativeBrokerErrorCode}clearNativeBrokerErrorCode(){const e=this.getLastRequests();delete e.nativeBrokerErrorCode,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e)}static makeExtraSkuString(e){return P2(e)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const $w="missing_kid_error",Kw="missing_alg_error";/*! @azure/msal-common v14.16.0 2024-11-05 */const D2={[$w]:"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.",[Kw]:"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."};class hm extends lt{constructor(e,t){super(e,t),this.name="JoseHeaderError",Object.setPrototypeOf(this,hm.prototype)}}function ry(n){return new hm(n,D2[n])}/*! @azure/msal-common v14.16.0 2024-11-05 */class fm{constructor(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}static getShrHeaderString(e){if(!e.kid)throw ry($w);if(!e.alg)throw ry(Kw);const t=new fm({typ:e.typ||KF.Pop,kid:e.kid,alg:e.alg});return JSON.stringify(t)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class oy{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class L2{generateId(){return"callback-id"}startMeasurement(e,t){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:v2.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:t||""},measurement:new oy}}startPerformanceMeasurement(){return new oy}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const mm="pkce_not_created",rf="crypto_nonexistent",hu="empty_navigate_uri",Ww="hash_empty_error",gm="no_state_in_hash",zw="hash_does_not_contain_known_properties",Gw="unable_to_parse_state",qw="state_interaction_type_mismatch",jw="interaction_in_progress",Yw="popup_window_error",Jw="empty_window_error",bi="user_cancelled",x2="monitor_popup_timeout",Qw="monitor_window_timeout",Xw="redirect_in_iframe",Zw="block_iframe_reload",eT="block_nested_popups",U2="iframe_closed_prematurely",fu="silent_logout_unsupported",tT="no_account_error",B2="silent_prompt_value_error",nT="no_token_request_cache_error",rT="unable_to_parse_token_request_cache_error",pm="no_cached_authority_error",F2="auth_request_not_set_error",V2="invalid_cache_type",mu="non_browser_environment",aa="database_not_open",Ll="no_network_connectivity",oT="post_request_failed",iT="get_request_failed",of="failed_to_parse_response",aT="unable_to_load_token",_m="crypto_key_not_found",sT="auth_code_required",cT="auth_code_or_nativeAccountId_required",lT="spa_code_and_nativeAccountId_present",vm="database_unavailable",uT="unable_to_acquire_token_from_native_platform",dT="native_handshake_timeout",hT="native_extension_not_installed",Ks="native_connection_not_established",fT="uninitialized_public_client_application",mT="native_prompt_not_supported",gT="invalid_base64_string",pT="invalid_pop_token_request",_T="failed_to_build_headers",vT="failed_to_parse_headers";/*! @azure/msal-browser v3.28.1 2025-01-14 */const io="For more visit: aka.ms/msaljs/browser-errors",H2={[mm]:"The PKCE code challenge and verifier could not be generated.",[rf]:"The crypto object or function is not available.",[hu]:"Navigation URI is empty. Please check stack trace for more info.",[Ww]:`Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. ${io}`,[gm]:"Hash does not contain state. Please verify that the request originated from msal.",[zw]:`Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. ${io}`,[Gw]:"Unable to parse state. Please verify that the request originated from msal.",[qw]:"Hash contains state but the interaction type does not match the caller.",[jw]:`Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. ${io}`,[Yw]:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.",[Jw]:"window.open returned null or undefined window object.",[bi]:"User cancelled the flow.",[x2]:`Token acquisition in popup failed due to timeout. ${io}`,[Qw]:`Token acquisition in iframe failed due to timeout. ${io}`,[Xw]:"Redirects are not supported for iframed or brokered applications. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs.",[Zw]:`Request was blocked inside an iframe because MSAL detected an authentication response. ${io}`,[eT]:"Request was blocked inside a popup because MSAL detected it was running in a popup.",[U2]:"The iframe being monitored was closed prematurely.",[fu]:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead.",[tT]:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.",[B2]:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'.",[nT]:"No token request found in cache.",[rT]:"The cached token request could not be parsed.",[pm]:"No cached authority found.",[F2]:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler",[V2]:"Invalid cache type",[mu]:"Login and token requests are not supported in non-browser environments.",[aa]:"Database is not open!",[Ll]:"No network connectivity. Check your internet connection.",[oT]:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'",[iT]:"Network request failed. Please check the network trace to determine root cause.",[of]:"Failed to parse network response. Check network trace.",[aT]:"Error loading token to cache.",[_m]:"Cryptographic Key or Keypair not found in browser storage.",[sT]:"An authorization code must be provided (as the `code` property on the request) to this flow.",[cT]:"An authorization code or nativeAccountId must be provided to this flow.",[lT]:"Request cannot contain both spa code and native account id.",[vm]:"IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts.",[uT]:`Unable to acquire token from native platform. ${io}`,[dT]:"Timed out while attempting to establish connection to browser extension",[hT]:"Native extension is not installed. If you think this is a mistake call the initialize function.",[Ks]:`Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). ${io}`,[fT]:`You must call and await the initialize function before attempting to call any other MSAL API. ${io}`,[mT]:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",[gT]:"Invalid base64 encoded string.",[pT]:"Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",[_T]:"Failed to build request headers object.",[vT]:"Failed to parse response headers"};class Ws extends lt{constructor(e,t){super(e,H2[e],t),Object.setPrototypeOf(this,Ws.prototype),this.name="BrowserAuthError"}}function ie(n,e){return new Ws(n,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Dn={INTERACTION_IN_PROGRESS_VALUE:"interaction_in_progress",INVALID_GRANT_ERROR:"invalid_grant",POPUP_WIDTH:483,POPUP_HEIGHT:600,POPUP_NAME_PREFIX:"msal",DEFAULT_POLL_INTERVAL_MS:30,MSAL_SKU:"msal.js.browser"},ma={CHANNEL_ID:"53ee284d-920a-4b59-9d30-a60315b26836",PREFERRED_EXTENSION_ID:"ppnbnpeolgkicgegkbkbjmhlideopiji",MATS_TELEMETRY:"MATS"},gi={HandshakeRequest:"Handshake",HandshakeResponse:"HandshakeResponse",GetToken:"GetToken",Response:"Response"},vn={LocalStorage:"localStorage",SessionStorage:"sessionStorage",MemoryStorage:"memoryStorage"},iy={GET:"GET",POST:"POST"},Ke={AUTHORITY:"authority",ACQUIRE_TOKEN_ACCOUNT:"acquireToken.account",SESSION_STATE:"session.state",REQUEST_STATE:"request.state",NONCE_IDTOKEN:"nonce.id_token",ORIGIN_URI:"request.origin",RENEW_STATUS:"token.renew.status",URL_HASH:"urlHash",REQUEST_PARAMS:"request.params",SCOPES:"scopes",INTERACTION_STATUS_KEY:"interaction.status",CCS_CREDENTIAL:"ccs.credential",CORRELATION_ID:"request.correlationId",NATIVE_REQUEST:"request.native",REDIRECT_CONTEXT:"request.redirect.context"},Po={ACCOUNT_KEYS:"msal.account.keys",TOKEN_KEYS:"msal.token.keys"},qc={WRAPPER_SKU:"wrapper.sku",WRAPPER_VER:"wrapper.version"},ot={acquireTokenRedirect:861,acquireTokenPopup:862,ssoSilent:863,acquireTokenSilent_authCode:864,handleRedirectPromise:865,acquireTokenByCode:866,acquireTokenSilent_silentFlow:61,logout:961,logoutPopup:962};var le;(function(n){n.Redirect="redirect",n.Popup="popup",n.Silent="silent",n.None="none"})(le||(le={}));const ay={scopes:Pa},yT="jwk",af="msal.db",$2=1,K2=`${af}.keys`,Pn={Default:0,AccessToken:1,AccessTokenAndRefreshToken:2,RefreshToken:3,RefreshTokenAndNetwork:4,Skip:5},W2=[Pn.Default,Pn.Skip,Pn.RefreshTokenAndNetwork],z2="msal.browser.log.level",G2="msal.browser.log.pii";/*! @azure/msal-browser v3.28.1 2025-01-14 */function jc(n){return encodeURIComponent(ym(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"))}function gu(n){return CT(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ym(n){return CT(new TextEncoder().encode(n))}function CT(n){const e=Array.from(n,t=>String.fromCodePoint(t)).join("");return btoa(e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const q2="RSASSA-PKCS1-v1_5",ET="SHA-256",j2=2048,Y2=new Uint8Array([1,0,1]),sy="0123456789abcdef",cy=new Uint32Array(1),J2="crypto_subtle_undefined",Cm={name:q2,hash:ET,modulusLength:j2,publicExponent:Y2};function Q2(n){if(!window)throw ie(mu);if(!window.crypto)throw ie(rf);if(!n&&!window.crypto.subtle)throw ie(rf,J2)}async function wT(n,e,t){e==null||e.addQueueMeasurement(x.Sha256Digest,t);const o=new TextEncoder().encode(n);return window.crypto.subtle.digest(ET,o)}function X2(n){return window.crypto.getRandomValues(n)}function sh(){return window.crypto.getRandomValues(cy),cy[0]}function go(){const n=Date.now(),e=sh()*1024+(sh()&1023),t=new Uint8Array(16),r=Math.trunc(e/2**30),o=e&2**30-1,a=sh();t[0]=n/2**40,t[1]=n/2**32,t[2]=n/2**24,t[3]=n/2**16,t[4]=n/2**8,t[5]=n,t[6]=112|r>>>8,t[7]=r,t[8]=128|o>>>24,t[9]=o>>>16,t[10]=o>>>8,t[11]=o,t[12]=a>>>24,t[13]=a>>>16,t[14]=a>>>8,t[15]=a;let c="";for(let d=0;d<t.length;d++)c+=sy.charAt(t[d]>>>4),c+=sy.charAt(t[d]&15),(d===3||d===5||d===7||d===9)&&(c+="-");return c}async function Z2(n,e){return window.crypto.subtle.generateKey(Cm,n,e)}async function ch(n){return window.crypto.subtle.exportKey(yT,n)}async function eH(n,e,t){return window.crypto.subtle.importKey(yT,n,Cm,e,t)}async function tH(n,e){return window.crypto.subtle.sign(Cm,n,e)}async function TT(n){const e=await wT(n),t=new Uint8Array(e);return gu(t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Ps="storage_not_supported",sf="stubbed_public_client_application_called",xl="in_mem_redirect_unavailable";/*! @azure/msal-browser v3.28.1 2025-01-14 */const gl={[Ps]:"Given storage configuration option was not supported.",[sf]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[xl]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};gl[Ps],gl[sf],gl[xl];class Em extends lt{constructor(e,t){super(e,t),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,Em.prototype)}}function wm(n){return new Em(n,gl[n])}/*! @azure/msal-browser v3.28.1 2025-01-14 */function nH(n){n.location.hash="",typeof n.history.replaceState=="function"&&n.history.replaceState(null,"",`${n.location.origin}${n.location.pathname}${n.location.search}`)}function rH(n){const e=n.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function Tm(){return window.parent!==window}function oH(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${Dn.POPUP_NAME_PREFIX}.`)===0}function lo(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function iH(){const e=new De(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function aH(){if(De.hashContainsKnownProperties(window.location.hash)&&Tm())throw ie(Zw)}function sH(n){if(Tm()&&!n)throw ie(Xw)}function cH(){if(oH())throw ie(eT)}function bT(){if(typeof window>"u")throw ie(mu)}function IT(n){if(!n)throw ie(fT)}function bm(n){bT(),aH(),cH(),IT(n)}function ly(n,e){if(bm(n),sH(e.system.allowRedirectInIframe),e.cache.cacheLocation===vn.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw wm(xl)}function ST(n){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(n).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function lH(){return go()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ul{navigateInternal(e,t){return Ul.defaultNavigateWindow(e,t)}navigateExternal(e,t){return Ul.defaultNavigateWindow(e,t)}static defaultNavigateWindow(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise(r=>{setTimeout(()=>{r(!0)},t.timeout)})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class uH{async sendGetRequestAsync(e,t){let r,o={},a=0;const c=uy(t);try{r=await fetch(e,{method:iy.GET,headers:c})}catch{throw ie(window.navigator.onLine?iT:Ll)}o=dy(r.headers);try{return a=r.status,{headers:o,body:await r.json(),status:a}}catch{throw Zv(ie(of),a,o)}}async sendPostRequestAsync(e,t){const r=t&&t.body||"",o=uy(t);let a,c=0,d={};try{a=await fetch(e,{method:iy.POST,headers:o,body:r})}catch{throw ie(window.navigator.onLine?oT:Ll)}d=dy(a.headers);try{return c=a.status,{headers:d,body:await a.json(),status:c}}catch{throw Zv(ie(of),c,d)}}}function uy(n){try{const e=new Headers;if(!(n&&n.headers))return e;const t=n.headers;return Object.entries(t).forEach(([r,o])=>{e.append(r,o)}),e}catch{throw ie(_T)}}function dy(n){try{const e={};return n.forEach((t,r)=>{e[r]=t}),e}catch{throw ie(vT)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const dH=6e4,cf=1e4,hH=3e4,fH=2e3;function mH({auth:n,cache:e,system:t,telemetry:r},o){const a={clientId:F.EMPTY_STRING,authority:`${F.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:F.EMPTY_STRING,authorityMetadata:F.EMPTY_STRING,redirectUri:typeof window<"u"?lo():"",postLogoutRedirectUri:F.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:fo.AAD,OIDCOptions:{serverResponseType:$s.FRAGMENT,defaultScopes:[F.OPENID_SCOPE,F.PROFILE_SCOPE,F.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:Xf.None,tenant:F.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1},c={cacheLocation:vn.SessionStorage,temporaryCacheLocation:vn.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===vn.LocalStorage),claimsBasedCachingEnabled:!1},d={loggerCallback:()=>{},logLevel:tt.Info,piiLoggingEnabled:!1},m={...{...Dw,loggerOptions:d,networkClient:o?new uH:O2,navigationClient:new Ul,loadFrameTimeout:0,windowHashTimeout:(t==null?void 0:t.loadFrameTimeout)||dH,iframeHashTimeout:(t==null?void 0:t.loadFrameTimeout)||cf,navigateFrameWait:0,redirectNavigationTimeout:hH,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:(t==null?void 0:t.nativeBrokerHandshakeTimeout)||fH,pollIntervalMilliseconds:Dn.DEFAULT_POLL_INTERVAL_MS},...t,loggerOptions:(t==null?void 0:t.loggerOptions)||d},g={application:{appName:F.EMPTY_STRING,appVersion:F.EMPTY_STRING},client:new L2};if((n==null?void 0:n.protocolMode)!==fo.OIDC&&(n!=null&&n.OIDCOptions)&&new Ko(m.loggerOptions).warning(JSON.stringify(Xe(Sw))),n!=null&&n.protocolMode&&n.protocolMode!==fo.AAD&&(m!=null&&m.allowNativeBroker))throw Xe(Aw);return{auth:{...a,...n,OIDCOptions:{...a.OIDCOptions,...n==null?void 0:n.OIDCOptions}},cache:{...c,...e},system:m,telemetry:{...g,...r}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const gH="@azure/msal-browser",pu="3.28.1";/*! @azure/msal-browser v3.28.1 2025-01-14 */class Im{static loggerCallback(e,t){switch(e){case tt.Error:console.error(t);return;case tt.Info:console.info(t);return;case tt.Verbose:console.debug(t);return;case tt.Warning:console.warn(t);return;default:console.log(t);return}}constructor(e){var h;this.browserEnvironment=typeof window<"u",this.config=mH(e,this.browserEnvironment);let t;try{t=window[vn.SessionStorage]}catch{}const r=t==null?void 0:t.getItem(z2),o=(h=t==null?void 0:t.getItem(G2))==null?void 0:h.toLowerCase(),a=o==="true"?!0:o==="false"?!1:void 0,c={...this.config.system.loggerOptions},d=r&&Object.keys(tt).includes(r)?tt[r]:void 0;d&&(c.loggerCallback=Im.loggerCallback,c.logLevel=d),a!==void 0&&(c.piiLoggingEnabled=a),this.logger=new Ko(c,gH,pu),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ii extends Im{getModuleName(){return Ii.MODULE_NAME}getId(){return Ii.ID}async initialize(){return this.available=typeof window<"u",this.available}}Ii.MODULE_NAME="";Ii.ID="StandardOperatingContext";/*! @azure/msal-browser v3.28.1 2025-01-14 */function Kr(n){return new TextDecoder().decode(pH(n))}function pH(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw ie(gT)}const t=atob(e);return Uint8Array.from(t,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class _H{constructor(){this.dbName=af,this.version=$2,this.tableName=K2,this.dbOpen=!1}async open(){return new Promise((e,t)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",o=>{o.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",o=>{const a=o;this.db=a.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>t(ie(vm)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(ie(aa));const c=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);c.addEventListener("success",d=>{const h=d;this.closeConnection(),t(h.target.result)}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async setItem(e,t){return await this.validateDbIsOpen(),new Promise((r,o)=>{if(!this.db)return o(ie(aa));const d=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(t,e);d.addEventListener("success",()=>{this.closeConnection(),r()}),d.addEventListener("error",h=>{this.closeConnection(),o(h)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(ie(aa));const c=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);c.addEventListener("success",()=>{this.closeConnection(),t()}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,t)=>{if(!this.db)return t(ie(aa));const a=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();a.addEventListener("success",c=>{const d=c;this.closeConnection(),e(d.target.result)}),a.addEventListener("error",c=>{this.closeConnection(),t(c)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(ie(aa));const c=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);c.addEventListener("success",d=>{const h=d;this.closeConnection(),t(h.target.result===1)}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,t)=>{const r=window.indexedDB.deleteDatabase(af),o=setTimeout(()=>t(!1),200);r.addEventListener("success",()=>(clearTimeout(o),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(o),e(!0))),r.addEventListener("error",()=>(clearTimeout(o),t(!1)))})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class lf{constructor(){this.cache=new Map}getItem(e){return this.cache.get(e)||null}setItem(e,t){this.cache.set(e,t)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((t,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class vH{constructor(e){this.inMemoryCache=new lf,this.indexedDBCache=new _H,this.logger=e}handleDatabaseAccessError(e){if(e instanceof Ws&&e.errorCode===vm)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const t=this.inMemoryCache.getItem(e);if(!t)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(r){this.handleDatabaseAccessError(r)}return t}async setItem(e,t){this.inMemoryCache.setItem(e,t);try{await this.indexedDBCache.setItem(e,t)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(t){this.handleDatabaseAccessError(t)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(t){this.handleDatabaseAccessError(t)}return e}async containsKey(e){const t=this.inMemoryCache.containsKey(e);if(!t)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(r){this.handleDatabaseAccessError(r)}return t}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ia{constructor(e,t,r){this.logger=e,Q2(r??!1),this.cache=new vH(this.logger),this.performanceClient=t}createNewGuid(){return go()}base64Encode(e){return ym(e)}base64Decode(e){return Kr(e)}base64UrlEncode(e){return jc(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var g;const t=(g=this.performanceClient)==null?void 0:g.startMeasurement(x.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await Z2(Ia.EXTRACTABLE,Ia.POP_KEY_USAGES),o=await ch(r.publicKey),a={e:o.e,kty:o.kty,n:o.n},c=hy(a),d=await this.hashString(c),h=await ch(r.privateKey),m=await eH(h,!1,["sign"]);return await this.cache.setItem(d,{privateKey:m,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),t&&t.end({success:!0}),d}async removeTokenBindingKey(e){return await this.cache.removeItem(e),!await this.cache.containsKey(e)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,t,r,o){var D;const a=(D=this.performanceClient)==null?void 0:D.startMeasurement(x.CryptoOptsSignJwt,o),c=await this.cache.getItem(t);if(!c)throw ie(_m);const d=await ch(c.publicKey),h=hy(d),m=jc(JSON.stringify({kid:t})),g=fm.getShrHeaderString({...r==null?void 0:r.header,alg:d.alg,kid:m}),v=jc(g);e.cnf={jwk:JSON.parse(h)};const p=jc(JSON.stringify(e)),w=`${v}.${p}`,T=new TextEncoder().encode(w),k=await tH(c.privateKey,T),I=gu(new Uint8Array(k)),N=`${w}.${I}`;return a&&a.end({success:!0}),N}async hashString(e){return TT(e)}}Ia.POP_KEY_USAGES=["sign","verify"];Ia.EXTRACTABLE=!0;function hy(n){return JSON.stringify(n,Object.keys(n).sort())}/*! @azure/msal-browser v3.28.1 2025-01-14 */class yH{constructor(){if(!window.localStorage)throw wm(Ps)}getItem(e){return window.localStorage.getItem(e)}setItem(e,t){window.localStorage.setItem(e,t)}removeItem(e){window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class CH{constructor(){if(!window.sessionStorage)throw wm(Ps)}getItem(e){return window.sessionStorage.getItem(e)}setItem(e,t){window.sessionStorage.setItem(e,t)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function AT(n,e){if(!e)return null;try{return yr.parseRequestState(n,e).libraryState.meta}catch{throw Y(wa)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const EH=24*60*60*1e3;class wH{getItem(e){const t=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let o=0;o<r.length;o++){const a=r[o],[c,...d]=decodeURIComponent(a).trim().split("="),h=d.join("=");if(c===t)return h}return""}setItem(e,t,r,o=!0){let a=`${encodeURIComponent(e)}=${encodeURIComponent(t)};path=/;SameSite=Lax;`;if(r){const c=TH(r);a+=`expires=${c};`}o&&(a+="Secure;"),document.cookie=a}removeItem(e){this.setItem(e,"",-1)}getKeys(){const e=document.cookie.split(";"),t=[];return e.forEach(r=>{const o=decodeURIComponent(r).trim().split("=");t.push(o[0])}),t}containsKey(e){return this.getKeys().includes(e)}}function TH(n){const e=new Date;return new Date(e.getTime()+n*EH).toUTCString()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class uf extends Ta{constructor(e,t,r,o,a,c){super(e,r,o,a),this.cacheConfig=t,this.logger=o,this.internalStorage=new lf,this.browserStorage=this.setupBrowserStorage(this.cacheConfig.cacheLocation),this.temporaryCacheStorage=this.setupBrowserStorage(this.cacheConfig.temporaryCacheLocation),this.cookieStorage=new wH,t.cacheMigrationEnabled&&(this.migrateCacheEntries(),this.createKeyMaps()),this.performanceClient=c}setupBrowserStorage(e){try{switch(e){case vn.LocalStorage:return new yH;case vn.SessionStorage:return new CH;case vn.MemoryStorage:default:break}}catch(t){this.logger.error(t)}return this.cacheConfig.cacheLocation=vn.MemoryStorage,new lf}migrateCacheEntries(){const e=`${F.CACHE_PREFIX}.${Lt.ID_TOKEN}`,t=`${F.CACHE_PREFIX}.${Lt.CLIENT_INFO}`,r=`${F.CACHE_PREFIX}.${Lt.ERROR}`,o=`${F.CACHE_PREFIX}.${Lt.ERROR_DESC}`,a=this.browserStorage.getItem(e),c=this.browserStorage.getItem(t),d=this.browserStorage.getItem(r),h=this.browserStorage.getItem(o),m=[a,c,d,h];[Lt.ID_TOKEN,Lt.CLIENT_INFO,Lt.ERROR,Lt.ERROR_DESC].forEach((v,p)=>{const w=m[p];w&&this.setTemporaryCache(v,w,!0)})}createKeyMaps(){this.logger.trace("BrowserCacheManager - createKeyMaps called.");const e=this.getItem(Po.ACCOUNT_KEYS),t=this.getItem(`${Po.TOKEN_KEYS}.${this.clientId}`);if(e&&t){this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.");return}this.browserStorage.getKeys().forEach(o=>{if(this.isCredentialKey(o)){const a=this.getItem(o);if(a){const c=this.validateAndParseJson(a);if(c&&c.hasOwnProperty("credentialType"))switch(c.credentialType){case ge.ID_TOKEN:if(Kv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,ge.ID_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${o}`);break;case ge.ACCESS_TOKEN:case ge.ACCESS_TOKEN_WITH_AUTH_SCHEME:if($v(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,ge.ACCESS_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${o}`);break;case ge.REFRESH_TOKEN:if(Wv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,ge.REFRESH_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${o}`);break}}}if(this.isAccountKey(o)){const a=this.getItem(o);if(a){const c=this.validateAndParseJson(a);c&&Pt.isAccountEntity(c)&&(this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${o} found, saving key to account key map`),this.addAccountKeyToMap(o))}}})}validateAndParseJson(e){try{const t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}getItem(e){return this.browserStorage.getItem(e)}setItem(e,t){this.browserStorage.setItem(e,t)}getAccount(e,t){this.logger.trace("BrowserCacheManager.getAccount called");const r=this.getCachedAccountEntity(e);return this.updateOutdatedCachedAccount(e,r,t)}getCachedAccountEntity(e){const t=this.getItem(e);if(!t)return this.removeAccountKeyFromMap(e),null;const r=this.validateAndParseJson(t);return!r||!Pt.isAccountEntity(r)?(this.removeAccountKeyFromMap(e),null):Ta.toObject(new Pt,r)}setAccount(e){this.logger.trace("BrowserCacheManager.setAccount called");const t=e.generateAccountKey();this.setItem(t,JSON.stringify(e)),this.addAccountKeyToMap(t)}getAccountKeys(){this.logger.trace("BrowserCacheManager.getAccountKeys called");const e=this.getItem(Po.ACCOUNT_KEYS);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])}addAccountKeyToMap(e){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${e}`);const t=this.getAccountKeys();t.indexOf(e)===-1?(t.push(e),this.setItem(Po.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")}removeAccountKeyFromMap(e){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${e}`);const t=this.getAccountKeys(),r=t.indexOf(e);r>-1?(t.splice(r,1),this.setItem(Po.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")):this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}async removeAccount(e){super.removeAccount(e),this.removeAccountKeyFromMap(e)}removeOutdatedAccount(e){this.removeItem(e),this.removeAccountKeyFromMap(e)}removeIdToken(e){super.removeIdToken(e),this.removeTokenKey(e,ge.ID_TOKEN)}async removeAccessToken(e){super.removeAccessToken(e),this.removeTokenKey(e,ge.ACCESS_TOKEN)}removeRefreshToken(e){super.removeRefreshToken(e),this.removeTokenKey(e,ge.REFRESH_TOKEN)}getTokenKeys(){this.logger.trace("BrowserCacheManager.getTokenKeys called");const e=this.getItem(`${Po.TOKEN_KEYS}.${this.clientId}`);if(e){const t=this.validateAndParseJson(e);if(t&&t.hasOwnProperty("idToken")&&t.hasOwnProperty("accessToken")&&t.hasOwnProperty("refreshToken"))return t;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}}addTokenKey(e,t){this.logger.trace("BrowserCacheManager addTokenKey called");const r=this.getTokenKeys();switch(t){case ge.ID_TOKEN:r.idToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),r.idToken.push(e));break;case ge.ACCESS_TOKEN:r.accessToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map"),r.accessToken.push(e));break;case ge.REFRESH_TOKEN:r.refreshToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),r.refreshToken.push(e));break;default:throw this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${t}`),Y(Qh)}this.setItem(`${Po.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}removeTokenKey(e,t){this.logger.trace("BrowserCacheManager removeTokenKey called");const r=this.getTokenKeys();switch(t){case ge.ID_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${e} from map`);const o=r.idToken.indexOf(e);o>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),r.idToken.splice(o,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case ge.ACCESS_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: ${e} from map`);const a=r.accessToken.indexOf(e);a>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),r.accessToken.splice(a,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case ge.REFRESH_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: ${e} from map`);const c=r.refreshToken.indexOf(e);c>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),r.refreshToken.splice(c,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:throw this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${t}`),Y(Qh)}this.setItem(`${Po.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}getIdTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ID_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Kv(r)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ID_TOKEN),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),r)}setIdTokenCredential(e){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const t=ha(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,ge.ID_TOKEN)}getAccessTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ACCESS_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!$v(r)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ACCESS_TOKEN),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),r)}setAccessTokenCredential(e){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const t=ha(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,ge.ACCESS_TOKEN)}getRefreshTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.REFRESH_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Wv(r)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.REFRESH_TOKEN),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),r)}setRefreshTokenCredential(e){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const t=ha(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,ge.REFRESH_TOKEN)}getAppMetadata(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!mV(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e){this.logger.trace("BrowserCacheManager.setAppMetadata called");const t=fV(e);this.setItem(t,JSON.stringify(e))}getServerTelemetry(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!dV(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,t){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t))}getAuthorityMetadata(e){const t=this.internalStorage.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return r&&gV(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(t=>this.isAuthorityMetadata(t))}setWrapperMetadata(e,t){this.internalStorage.setItem(qc.WRAPPER_SKU,e),this.internalStorage.setItem(qc.WRAPPER_VER,t)}getWrapperMetadata(){const e=this.internalStorage.getItem(qc.WRAPPER_SKU)||F.EMPTY_STRING,t=this.internalStorage.getItem(qc.WRAPPER_VER)||F.EMPTY_STRING;return[e,t]}setAuthorityMetadata(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))}getActiveAccount(){const e=this.generateCacheKey(Lt.ACTIVE_ACCOUNT_FILTERS),t=this.getItem(e);if(!t){this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");const o=this.generateCacheKey(Lt.ACTIVE_ACCOUNT),a=this.getItem(o);if(!a)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null;const c=this.getAccountInfoFilteredBy({localAccountId:a});return c?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(c),c):null}const r=this.validateAndParseJson(t);return r?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:r.homeAccountId,localAccountId:r.localAccountId,tenantId:r.tenantId})):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e){const t=this.generateCacheKey(Lt.ACTIVE_ACCOUNT_FILTERS),r=this.generateCacheKey(Lt.ACTIVE_ACCOUNT);if(e){this.logger.verbose("setActiveAccount: Active account set");const o={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId};this.browserStorage.setItem(t,JSON.stringify(o)),this.browserStorage.setItem(r,e.localAccountId)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(t),this.browserStorage.removeItem(r)}getThrottlingCache(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!hV(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,t){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t))}getTemporaryCache(e,t){const r=t?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const a=this.cookieStorage.getItem(r);if(a)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),a}const o=this.temporaryCacheStorage.getItem(r);if(!o){if(this.cacheConfig.cacheLocation===vn.LocalStorage){const a=this.browserStorage.getItem(r);if(a)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),a}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),o}setTemporaryCache(e,t,r){const o=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(o,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(o,t,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}async clear(){await this.removeAllAccounts(),this.removeAppMetadata(),this.temporaryCacheStorage.getKeys().forEach(e=>{(e.indexOf(F.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(e)}),this.browserStorage.getKeys().forEach(e=>{(e.indexOf(F.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(e)}),this.internalStorage.clear()}async clearTokensAndKeysWithClaims(e,t){e.addQueueMeasurement(x.ClearTokensAndKeysWithClaims,t);const r=this.getTokenKeys(),o=[];r.accessToken.forEach(a=>{const c=this.getAccessTokenCredential(a);c!=null&&c.requestedClaimsHash&&a.includes(c.requestedClaimsHash.toLowerCase())&&o.push(this.removeAccessToken(a))}),await Promise.all(o),o.length>0&&this.logger.warning(`${o.length} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return this.validateAndParseJson(e)?JSON.stringify(e):vr.startsWith(e,F.CACHE_PREFIX)||vr.startsWith(e,Lt.ADAL_ID_TOKEN)?e:`${F.CACHE_PREFIX}.${this.clientId}.${e}`}generateAuthorityKey(e){const{libraryState:{id:t}}=yr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Ke.AUTHORITY}.${t}`)}generateNonceKey(e){const{libraryState:{id:t}}=yr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Ke.NONCE_IDTOKEN}.${t}`)}generateStateKey(e){const{libraryState:{id:t}}=yr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Ke.REQUEST_STATE}.${t}`)}getCachedAuthority(e){const t=this.generateStateKey(e),r=this.getTemporaryCache(t);if(!r)return null;const o=this.generateAuthorityKey(r);return this.getTemporaryCache(o)}updateCacheEntries(e,t,r,o,a){this.logger.trace("BrowserCacheManager.updateCacheEntries called");const c=this.generateStateKey(e);this.setTemporaryCache(c,e,!1);const d=this.generateNonceKey(e);this.setTemporaryCache(d,t,!1);const h=this.generateAuthorityKey(e);if(this.setTemporaryCache(h,r,!1),a){const m={credential:a.homeAccountId,type:Bn.HOME_ACCOUNT_ID};this.setTemporaryCache(Ke.CCS_CREDENTIAL,JSON.stringify(m),!0)}else if(o){const m={credential:o,type:Bn.UPN};this.setTemporaryCache(Ke.CCS_CREDENTIAL,JSON.stringify(m),!0)}}resetRequestCache(e){this.logger.trace("BrowserCacheManager.resetRequestCache called"),e&&(this.temporaryCacheStorage.getKeys().forEach(t=>{t.indexOf(e)!==-1&&this.removeTemporaryItem(t)}),this.removeTemporaryItem(this.generateStateKey(e)),this.removeTemporaryItem(this.generateNonceKey(e)),this.removeTemporaryItem(this.generateAuthorityKey(e))),this.removeTemporaryItem(this.generateCacheKey(Ke.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(Ke.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(Ke.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(Ke.CORRELATION_ID)),this.removeTemporaryItem(this.generateCacheKey(Ke.CCS_CREDENTIAL)),this.removeTemporaryItem(this.generateCacheKey(Ke.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cleanRequestByState(e){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e){const t=this.generateStateKey(e),r=this.temporaryCacheStorage.getItem(t);this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r||F.EMPTY_STRING)}}cleanRequestByInteractionType(e){this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.temporaryCacheStorage.getKeys().forEach(t=>{if(t.indexOf(Ke.REQUEST_STATE)===-1)return;const r=this.temporaryCacheStorage.getItem(t);if(!r)return;const o=AT(this.cryptoImpl,r);o&&o.interactionType===e&&(this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r))}),this.setInteractionInProgress(!1)}cacheCodeRequest(e){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");const t=ym(JSON.stringify(e));this.setTemporaryCache(Ke.REQUEST_PARAMS,t,!0)}getCachedRequest(e){this.logger.trace("BrowserCacheManager.getCachedRequest called");const t=this.getTemporaryCache(Ke.REQUEST_PARAMS,!0);if(!t)throw ie(nT);let r;try{r=JSON.parse(Kr(t))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${t}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),ie(rT)}if(this.removeTemporaryItem(this.generateCacheKey(Ke.REQUEST_PARAMS)),!r.authority){const o=this.generateAuthorityKey(e),a=this.getTemporaryCache(o);if(!a)throw ie(pm);r.authority=a}return r}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(Ke.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const t=this.validateAndParseJson(e);return t||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){const t=this.getInteractionInProgress();return e?t===this.clientId:!!t}getInteractionInProgress(){const e=`${F.CACHE_PREFIX}.${Ke.INTERACTION_STATUS_KEY}`;return this.getTemporaryCache(e,!1)}setInteractionInProgress(e){const t=`${F.CACHE_PREFIX}.${Ke.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw ie(jw);this.setTemporaryCache(t,this.clientId,!1)}else!e&&this.getInteractionInProgress()===this.clientId&&this.removeTemporaryItem(t)}getLegacyLoginHint(){const e=this.getTemporaryCache(Lt.ADAL_ID_TOKEN);e&&(this.browserStorage.removeItem(Lt.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved."));const t=this.getTemporaryCache(Lt.ID_TOKEN,!0);t&&(this.browserStorage.removeItem(this.generateCacheKey(Lt.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));const r=t||e;if(r){const o=Si(r,Kr);if(o.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),o.preferred_username;if(o.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),o.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null}updateCredentialCacheKey(e,t){const r=ha(t);if(e!==r){const o=this.getItem(e);if(o)return this.browserStorage.removeItem(e),this.setItem(r,o),this.logger.verbose(`Updated an outdated ${t.credentialType} cache key`),r;this.logger.error(`Attempted to update an outdated ${t.credentialType} cache key but no item matching the outdated key was found in storage`)}return e}async hydrateCache(e,t){var d,h,m;const r=au((d=e.account)==null?void 0:d.homeAccountId,(h=e.account)==null?void 0:h.environment,e.idToken,this.clientId,e.tenantId);let o;t.claims&&(o=await this.cryptoImpl.hashString(t.claims));const a=su((m=e.account)==null?void 0:m.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?e.expiresOn.getTime()/1e3:0,e.extExpiresOn?e.extExpiresOn.getTime()/1e3:0,Kr,void 0,e.tokenType,void 0,t.sshKid,t.claims,o),c={idToken:r,accessToken:a};return this.saveCacheRecord(c)}async saveCacheRecord(e,t,r){try{await super.saveCacheRecord(e,t,r)}catch(o){if(o instanceof pa&&this.performanceClient&&r)try{const a=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:a.refreshToken.length,cacheIdCount:a.idToken.length,cacheAtCount:a.accessToken.length},r)}catch{}throw o}}}const bH=(n,e)=>{const t={cacheLocation:vn.MemoryStorage,temporaryCacheLocation:vn.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new uf(n,t,Nl,e)};/*! @azure/msal-browser v3.28.1 2025-01-14 */function IH(n,e,t,r){return n.verbose("getAllAccounts called"),t?e.getAllAccounts(r):[]}function SH(n,e,t){if(e.trace("getAccount called"),Object.keys(n).length===0)return e.warning("getAccount: No accountFilter provided"),null;const r=t.getAccountInfoFilteredBy(n);return r?(e.verbose("getAccount: Account matching provided filter found, returning"),r):(e.verbose("getAccount: No matching account found, returning null"),null)}function AH(n,e,t){if(e.trace("getAccountByUsername called"),!n)return e.warning("getAccountByUsername: No username provided"),null;const r=t.getAccountInfoFilteredBy({username:n});return r?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${n}`),r):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function kH(n,e,t){if(e.trace("getAccountByHomeId called"),!n)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const r=t.getAccountInfoFilteredBy({homeAccountId:n});return r?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${n}`),r):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function NH(n,e,t){if(e.trace("getAccountByLocalId called"),!n)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const r=t.getAccountInfoFilteredBy({localAccountId:n});return r?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${n}`),r):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function RH(n,e){e.setActiveAccount(n)}function OH(n){return n.getActiveAccount()}/*! @azure/msal-browser v3.28.1 2025-01-14 */const me={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache"};/*! @azure/msal-browser v3.28.1 2025-01-14 */class PH{constructor(e){this.eventCallbacks=new Map,this.logger=e||new Ko({})}addEventCallback(e,t,r){if(typeof window<"u"){const o=r||lH();return this.eventCallbacks.has(o)?(this.logger.error(`Event callback with id: ${o} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(o,[e,t||[]]),this.logger.verbose(`Event callback registered with id: ${o}`),o)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,t,r,o){if(typeof window<"u"){const a={eventType:e,interactionType:t||null,payload:r||null,error:o||null,timestamp:Date.now()};this.eventCallbacks.forEach(([c,d],h)=>{(d.length===0||d.includes(e))&&(this.logger.verbose(`Emitting event to callback ${h}: ${e}`),c.apply(null,[a]))})}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class kT{constructor(e,t,r,o,a,c,d,h,m){this.config=e,this.browserStorage=t,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=a,this.navigationClient=c,this.nativeMessageHandler=h,this.correlationId=m||go(),this.logger=o.clone(Dn.MSAL_SKU,pu,this.correlationId),this.performanceClient=d}async clearCacheOnLogout(e){if(e){Pt.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null));try{await this.browserStorage.removeAccount(Pt.generateAccountCacheKey(e)),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),await this.browserStorage.clear(),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const t=e||this.config.auth.redirectUri;return De.getAbsoluteUrl(t,lo())}initializeServerTelemetryManager(e,t){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Os(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:t}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(x.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const o={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},a=e.requestAuthority||this.config.auth.authority,c=r!=null&&r.length?r==="true":this.config.auth.instanceAware,d=t&&c?this.config.auth.authority.replace(De.getDomainFromUrl(a),t.environment):a,h=Xt.generateAuthority(d,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),m=await Q(Uw,x.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(h,this.config.system.networkClient,this.browserStorage,o,this.logger,this.correlationId,this.performanceClient);if(t&&!m.isAlias(t.environment))throw Xe(kw);return m}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const MH=32;async function DH(n,e,t){n.addQueueMeasurement(x.GeneratePkceCodes,t);const r=Ai(LH,x.GenerateCodeVerifier,e,n,t)(n,e,t),o=await Q(xH,x.GenerateCodeChallengeFromVerifier,e,n,t)(r,n,e,t);return{verifier:r,challenge:o}}function LH(n,e,t){try{const r=new Uint8Array(MH);return Ai(X2,x.GetRandomValues,e,n,t)(r),gu(r)}catch{throw ie(mm)}}async function xH(n,e,t,r){e.addQueueMeasurement(x.GenerateCodeChallengeFromVerifier,r);try{const o=await Q(wT,x.Sha256Digest,t,e,r)(n,e,r);return gu(new Uint8Array(o))}catch{throw ie(mm)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function Sm(n,e,t,r){t.addQueueMeasurement(x.InitializeBaseRequest,n.correlationId);const o=n.authority||e.auth.authority,a=[...n&&n.scopes||[]],c={...n,correlationId:n.correlationId,authority:o,scopes:a};if(!c.authenticationScheme)c.authenticationScheme=Ge.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(c.authenticationScheme===Ge.SSH){if(!n.sshJwk)throw Xe(cu);if(!n.sshKid)throw Xe(Iw)}r.verbose(`Authentication Scheme set to "${c.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&n.claims&&!vr.isEmptyObj(n.claims)&&(c.requestedClaimsHash=await TT(n.claims)),c}async function UH(n,e,t,r,o){r.addQueueMeasurement(x.InitializeSilentRequest,n.correlationId);const a=await Q(Sm,x.InitializeBaseRequest,o,r,n.correlationId)(n,t,r,o);return{...n,...a,account:e,forceRefresh:n.forceRefresh||!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ma extends kT{async initializeAuthorizationCodeRequest(e){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.correlationId);const t=await Q(DH,x.GeneratePkceCodes,this.logger,this.performanceClient,this.correlationId)(this.performanceClient,this.logger,this.correlationId),r={...e,redirectUri:e.redirectUri,code:F.EMPTY_STRING,codeVerifier:t.verifier};return e.codeChallenge=t.challenge,e.codeChallengeMethod=F.S256_CODE_CHALLENGE_METHOD,r}initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const t={correlationId:this.correlationId||go(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const r=this.getLogoutHintFromIdTokenClaims(e.account);r&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),t.logoutHint=r)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",t.correlationId),t.postLogoutRedirectUri=De.getAbsoluteUrl(e.postLogoutRedirectUri,lo())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",t.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",t.correlationId),t.postLogoutRedirectUri=De.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,lo())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",t.correlationId),t.postLogoutRedirectUri=De.getAbsoluteUrl(lo(),lo())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",t.correlationId),t}getLogoutHintFromIdTokenClaims(e){const t=e.idTokenClaims;if(t){if(t.login_hint)return t.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const t=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new Vw(t,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:t,requestAuthority:r,requestAzureCloudOptions:o,requestExtraQueryParameters:a,account:c}=e;this.performanceClient.addQueueMeasurement(x.StandardInteractionClientGetClientConfiguration,this.correlationId);const d=await Q(this.getDiscoveredAuthority.bind(this),x.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:o,requestExtraQueryParameters:a,account:c}),h=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:d,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:h.loggerCallback,piiLoggingEnabled:h.piiLoggingEnabled,logLevel:h.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:t,libraryInfo:{sku:Dn.MSAL_SKU,version:pu,cpu:F.EMPTY_STRING,os:F.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,t){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),o={interactionType:t},a=yr.setRequestState(this.browserCrypto,e&&e.state||F.EMPTY_STRING,o),d={...await Q(Sm,x.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:a,nonce:e.nonce||go(),responseMode:this.config.auth.OIDCOptions.serverResponseType};if(e.loginHint||e.sid)return d;const h=e.account||this.browserStorage.getActiveAccount();if(h&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${h.homeAccountId}`,this.correlationId),d.account=h),!d.loginHint&&!h){const m=this.browserStorage.getLegacyLoginHint();m&&(d.loginHint=m)}return d}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const BH="ContentError",NT="user_switch";/*! @azure/msal-browser v3.28.1 2025-01-14 */const FH="USER_INTERACTION_REQUIRED",VH="USER_CANCEL",HH="NO_NETWORK",$H="PERSISTENT_ERROR",KH="DISABLED",WH="ACCOUNT_UNAVAILABLE";/*! @azure/msal-browser v3.28.1 2025-01-14 */const zH=-2147186943,GH={[NT]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class Br extends lt{constructor(e,t,r){super(e,t),Object.setPrototypeOf(this,Br.prototype),this.name="NativeAuthError",this.ext=r}}function sa(n){if(n.ext&&n.ext.status&&(n.ext.status===$H||n.ext.status===KH)||n.ext&&n.ext.error&&n.ext.error===zH)return!0;switch(n.errorCode){case BH:return!0;default:return!1}}function df(n,e,t){if(t&&t.status)switch(t.status){case WH:return tf(Bw);case FH:return new Er(n,e);case VH:return ie(bi);case HH:return ie(Ll)}return new Br(n,GH[n]||e,t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class RT extends Ma{async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentCacheClientAcquireToken,e.correlationId);const t=this.initializeServerTelemetryManager(ot.acquireTokenSilent_silentFlow),r=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),o=new R2(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const c=(await Q(o.acquireCachedToken.bind(o),x.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),c}catch(a){throw a instanceof Ws&&a.errorCode===_m&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),a}}logout(e){this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(t==null?void 0:t.account)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class _a extends kT{constructor(e,t,r,o,a,c,d,h,m,g,v,p){var C;super(e,t,r,o,a,c,h,m,p),this.apiId=d,this.accountId=g,this.nativeMessageHandler=m,this.nativeStorageManager=v,this.silentCacheClient=new RT(e,this.nativeStorageManager,r,o,a,c,h,m,p),this.serverTelemetryManager=this.initializeServerTelemetryManager(this.apiId);const w=this.nativeMessageHandler.getExtensionId()===ma.PREFERRED_EXTENSION_ID?"chrome":(C=this.nativeMessageHandler.getExtensionId())!=null&&C.length?"unknown":void 0;this.skus=Os.makeExtraSkuString({libraryName:Dn.MSAL_SKU,libraryVersion:pu,extensionName:w,extensionVersion:this.nativeMessageHandler.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[f2]:this.skus}}async acquireToken(e){this.performanceClient.addQueueMeasurement(x.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const t=this.performanceClient.startMeasurement(x.NativeInteractionClientAcquireToken,e.correlationId),r=zr();try{const o=await this.initializeNativeRequest(e);try{const m=await this.acquireTokensFromCache(this.accountId,o);return t.end({success:!0,isNativeBroker:!1,fromCache:!0}),m}catch{this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const{...a}=o,c={method:gi.GetToken,request:a},d=await this.nativeMessageHandler.sendMessage(c),h=this.validateNativeResponse(d);return await this.handleNativeResponse(h,o,r).then(m=>(t.end({success:!0,isNativeBroker:!0,requestId:m.requestId}),this.serverTelemetryManager.clearNativeBrokerErrorCode(),m)).catch(m=>{throw t.end({success:!1,errorCode:m.errorCode,subErrorCode:m.subError,isNativeBroker:!0}),m})}catch(o){throw o instanceof Br&&this.serverTelemetryManager.setNativeBrokerErrorCode(o.errorCode),o}}createSilentCacheRequest(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:vt.fromString(e.scope).asArray(),account:t,forceRefresh:!1}}async acquireTokensFromCache(e,t){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),Y(Yh);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e});if(!r)throw Y(Yh);try{const o=this.createSilentCacheRequest(t,r),a=await this.silentCacheClient.acquireToken(o),c={...r,idTokenClaims:a==null?void 0:a.idTokenClaims,idToken:a==null?void 0:a.idToken};return{...a,account:c}}catch(o){throw o}}async acquireTokenRedirect(e,t){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const o=await this.initializeNativeRequest(r),a={method:gi.GetToken,request:o};try{const h=await this.nativeMessageHandler.sendMessage(a);this.validateNativeResponse(h)}catch(h){if(h instanceof Br&&(this.serverTelemetryManager.setNativeBrokerErrorCode(h.errorCode),sa(h)))throw h}this.browserStorage.setTemporaryCache(Ke.NATIVE_REQUEST,JSON.stringify(o),!0);const c={apiId:ot.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);t.end({success:!0}),await this.navigationClient.navigateExternal(d,c)}async handleRedirectPromise(e,t){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const r=this.browserStorage.getCachedNativeRequest();if(!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&t&&(e==null||e.addFields({errorCode:"no_cached_request"},t)),null;const{prompt:o,...a}=r;o&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(Ke.NATIVE_REQUEST));const c={method:gi.GetToken,request:a},d=zr();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const h=await this.nativeMessageHandler.sendMessage(c);this.validateNativeResponse(h);const m=this.handleNativeResponse(h,a,d);this.browserStorage.setInteractionInProgress(!1);const g=await m;return this.serverTelemetryManager.clearNativeBrokerErrorCode(),g}catch(h){throw this.browserStorage.setInteractionInProgress(!1),h}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,t,r){var g;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const o=Si(e.id_token,Kr),a=this.createHomeAccountIdentifier(e,o),c=(g=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:t.accountId}))==null?void 0:g.homeAccountId;if(a!==c&&e.account.id!==t.accountId)throw df(NT);const d=await this.getDiscoveredAuthority({requestAuthority:t.authority}),h=dm(this.browserStorage,d,a,Kr,o,e.client_info,void 0,o.tid,void 0,e.account.id,this.logger),m=await this.generateAuthenticationResult(e,t,o,h,d.canonicalAuthority,r);return this.cacheAccount(h),this.cacheNativeTokens(e,t,a,o,e.access_token,m.tenantId,r),m}createHomeAccountIdentifier(e,t){return Pt.generateHomeAccountId(e.client_info||F.EMPTY_STRING,mr.Default,this.logger,this.browserCrypto,t)}generateScopes(e,t){return e.scope?vt.fromString(e.scope):vt.fromString(t.scope)}async generatePopAccessToken(e,t){if(t.tokenType===Ge.POP&&t.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new ba(this.browserCrypto),o={resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,shrNonce:t.shrNonce};if(!t.keyId)throw Y(Jf);return r.signPopToken(e.access_token,t.keyId,o)}else return e.access_token}async generateAuthenticationResult(e,t,r,o,a,c){const d=this.addTelemetryFromNativeResponse(e),h=e.scope?vt.fromString(e.scope):vt.fromString(t.scope),m=e.account.properties||{},g=m.UID||r.oid||r.sub||F.EMPTY_STRING,v=m.TenantId||r.tid||F.EMPTY_STRING,p=im(o.getAccountInfo(),void 0,r,e.id_token);p.nativeAccountId!==e.account.id&&(p.nativeAccountId=e.account.id);const w=await this.generatePopAccessToken(e,t),C=t.tokenType===Ge.POP?Ge.POP:Ge.BEARER;return{authority:a,uniqueId:g,tenantId:v,scopes:h.asArray(),account:p,idToken:e.id_token,idTokenClaims:r,accessToken:w,fromCache:d?this.isResponseFromCache(d):!1,expiresOn:new Date(Number(c+e.expires_in)*1e3),tokenType:C,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}cacheAccount(e){this.browserStorage.setAccount(e),this.browserStorage.removeAccountContext(e).catch(t=>{this.logger.error(`Error occurred while removing account context from browser storage. ${t}`)})}cacheNativeTokens(e,t,r,o,a,c,d){const h=au(r,t.authority,e.id_token||"",t.clientId,o.tid||""),m=t.tokenType===Ge.POP?F.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,g=d+m,v=this.generateScopes(e,t),p=su(r,t.authority,a,t.clientId,o.tid||c,v.printScopes(),g,0,Kr,void 0,t.tokenType,void 0,t.keyId),w={idToken:h,accessToken:p};this.nativeStorageManager.saveCacheRecord(w,t.storeInCache)}addTelemetryFromNativeResponse(e){const t=this.getMATSFromResponse(e);return t?(this.performanceClient.addFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:t.broker_version,matsAccountJoinOnStart:t.account_join_on_start,matsAccountJoinOnEnd:t.account_join_on_end,matsDeviceJoin:t.device_join,matsPromptBehavior:t.prompt_behavior,matsApiErrorCode:t.api_error_code,matsUiVisible:t.ui_visible,matsSilentCode:t.silent_code,matsSilentBiSubCode:t.silent_bi_sub_code,matsSilentMessage:t.silent_message,matsSilentStatus:t.silent_status,matsHttpStatus:t.http_status,matsHttpEventCount:t.http_event_count},this.correlationId),t):null}validateNativeResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw jE(Wf,"Response missing expected properties.")}getMATSFromResponse(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const t=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:t,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new De(t);r.validateAsUri();const{scopes:o,...a}=e,c=new vt(o||[]);c.appendScopes(Pa);const d=()=>{switch(this.apiId){case ot.ssoSilent:case ot.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),Bt.NONE}if(!e.prompt){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e.prompt){case Bt.NONE:case Bt.CONSENT:case Bt.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e.prompt;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e.prompt} is not compatible with native flow`),ie(mT)}},h={...a,accountId:this.accountId,clientId:this.config.auth.clientId,authority:r.urlString,scope:c.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:d(),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(h.signPopToken&&e.popKid)throw ie(pT);if(this.handleExtraBrokerParams(h),h.extraParameters=h.extraParameters||{},h.extraParameters.telemetry=ma.MATS_TELEMETRY,e.authenticationScheme===Ge.POP){const m={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},g=new ba(this.browserCrypto);let v;if(h.keyId)v=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:h.keyId})),h.signPopToken=!1;else{const p=await Q(g.generateCnf.bind(g),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(m,this.logger);v=p.reqCnfString,h.keyId=p.kid,h.signPopToken=!0}h.reqCnf=v}return this.addRequestSKUs(h),h}handleExtraBrokerParams(e){var a;const t=e.extraParameters&&e.extraParameters.hasOwnProperty(cm)&&e.extraParameters.hasOwnProperty(ef)&&e.extraParameters.hasOwnProperty(wi);if(!e.embeddedClientId&&!t)return;let r="";const o=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[ef],r=e.extraParameters[wi]),e.extraParameters={child_client_id:r,child_redirect_uri:o},(a=this.performanceClient)==null||a.addFields({embeddedClientId:r,embeddedRedirectUri:o},e.correlationId)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Fr{constructor(e,t,r,o){this.logger=e,this.handshakeTimeoutMs=t,this.extensionId=o,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=r,this.handshakeEvent=r.startMeasurement(x.NativeMessageHandlerHandshake)}async sendMessage(e){this.logger.trace("NativeMessageHandler - sendMessage called.");const t={channel:ma.CHANNEL_ID,extensionId:this.extensionId,responseId:go(),body:e};return this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii(`NativeMessageHandler - Sending request to browser extension: ${JSON.stringify(t)}`),this.messageChannel.port1.postMessage(t),new Promise((r,o)=>{this.resolvers.set(t.responseId,{resolve:r,reject:o})})}static async createProvider(e,t,r){e.trace("NativeMessageHandler - createProvider called.");try{const o=new Fr(e,t,r,ma.PREFERRED_EXTENSION_ID);return await o.sendHandshakeRequest(),o}catch{const a=new Fr(e,t,r);return await a.sendHandshakeRequest(),a}}async sendHandshakeRequest(){this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:ma.CHANNEL_ID,extensionId:this.extensionId,responseId:go(),body:{method:gi.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=t=>{this.onChannelMessage(t)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((t,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:t,reject:r}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),r(ie(dT)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window)return;const t=e.data;if(!(!t.channel||t.channel!==ma.CHANNEL_ID)&&!(t.extensionId&&t.extensionId!==this.extensionId)&&t.body.method===gi.HandshakeRequest){const r=this.handshakeResolvers.get(t.responseId);if(!r){this.logger.trace(`NativeMessageHandler.onWindowMessage - resolver can't be found for request ${t.responseId}`);return}this.logger.verbose(t.extensionId?`Extension with id: ${t.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),r.reject(ie(hT))}}onChannelMessage(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");const t=e.data,r=this.resolvers.get(t.responseId),o=this.handshakeResolvers.get(t.responseId);try{const a=t.body.method;if(a===gi.Response){if(!r)return;const c=t.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii(`NativeMessageHandler - Received response from browser extension: ${JSON.stringify(c)}`),c.status!=="Success")r.reject(df(c.code,c.description,c.ext));else if(c.result)c.result.code&&c.result.description?r.reject(df(c.result.code,c.result.description,c.result.ext)):r.resolve(c.result);else throw jE(Wf,"Event does not contain result.");this.resolvers.delete(t.responseId)}else if(a===gi.HandshakeResponse){if(!o){this.logger.trace(`NativeMessageHandler.onChannelMessage - resolver can't be found for request ${t.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=t.extensionId,this.extensionVersion=t.body.version,this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),o.resolve(),this.handshakeResolvers.delete(t.responseId)}}catch(a){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${a}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(a):o&&o.reject(a)}}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}static isNativeAvailable(e,t,r,o){if(t.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return t.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!r)return t.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(o)switch(o){case Ge.BEARER:case Ge.POP:return t.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return t.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Am{constructor(e,t,r,o,a){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=a}async handleCodeResponse(e,t){this.performanceClient.addQueueMeasurement(x.HandleCodeResponse,t.correlationId);let r;try{r=this.authModule.handleFragmentResponse(e,t.state)}catch(o){throw o instanceof Wo&&o.subError===bi?ie(bi):o}return Q(this.handleCodeResponseFromServer.bind(this),x.HandleCodeResponseFromServer,this.logger,this.performanceClient,t.correlationId)(r,t)}async handleCodeResponseFromServer(e,t,r=!0){if(this.performanceClient.addQueueMeasurement(x.HandleCodeResponseFromServer,t.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await Q(this.authModule.updateAuthority.bind(this.authModule),x.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,t.correlationId)(e.cloud_instance_host_name,t.correlationId),r&&(e.nonce=t.nonce||void 0),e.state=t.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const a=this.createCcsCredentials(t);a&&(this.authCodeRequest.ccsCredential=a)}return await Q(this.authModule.acquireToken.bind(this.authModule),x.AuthClientAcquireToken,this.logger,this.performanceClient,t.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:Bn.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:Bn.UPN}:null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function OT(n,e,t){const r=Pl(n);if(!r)throw Rw(n)?(t.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),t.errorPii(`The ${e} detected is: ${n}`),ie(zw)):(t.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),ie(Ww));return r}function qH(n,e,t){if(!n.state)throw ie(gm);const r=AT(e,n.state);if(!r)throw ie(Gw);if(r.interactionType!==t)throw ie(qw)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class jH extends Ma{constructor(e,t,r,o,a,c,d,h,m,g){super(e,t,r,o,a,c,d,m,g),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=h}acquireToken(e){try{const r={popupName:this.generatePopupName(e.scopes||Pa,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(e,r))}catch(t){return Promise.reject(t)}}logout(e){try{this.logger.verbose("logoutPopup called");const t=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(t),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},o=e&&e.authority,a=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(t,r,o,a)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(t,r,o,a))}catch(t){return Promise.reject(t)}}async acquireTokenPopupAsync(e,t){var a;this.logger.verbose("acquireTokenPopupAsync called");const r=this.initializeServerTelemetryManager(ot.acquireTokenPopup),o=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,le.Popup);ST(o.authority);try{const c=await Q(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(o),d=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:o.authority,requestAzureCloudOptions:o.azureCloudOptions,requestExtraQueryParameters:o.extraQueryParameters,account:o.account}),h=Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme);let m;h&&(m=this.performanceClient.startMeasurement(x.FetchAccountIdWithNativeBroker,e.correlationId));const g=await d.getAuthCodeUrl({...o,nativeBroker:h}),v=new Am(d,this.browserStorage,c,this.logger,this.performanceClient),p=this.initiateAuthRequest(g,t);this.eventHandler.emitEvent(me.POPUP_OPENED,le.Popup,{popupWindow:p},null);const w=await this.monitorPopupForHash(p,t.popupWindowParent),C=Ai(OT,x.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(w,this.config.auth.OIDCOptions.serverResponseType,this.logger);if(Ur.removeThrottle(this.browserStorage,this.config.auth.clientId,c),C.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),m&&m.end({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw ie(Ks);const k=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,C.accountId,this.nativeStorage,o.correlationId),{userRequestState:I}=yr.parseRequestState(this.browserCrypto,o.state);return await k.acquireToken({...o,state:I,prompt:void 0})}return await v.handleCodeResponse(C,o)}catch(c){throw(a=t.popup)==null||a.close(),c instanceof lt&&(c.setCorrelationId(this.correlationId),r.cacheFailedRequest(c)),c}}async logoutPopupAsync(e,t,r,o){var c,d,h,m;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(me.LOGOUT_START,le.Popup,e);const a=this.initializeServerTelemetryManager(ot.logoutPopup);try{await this.clearCacheOnLogout(e.account);const g=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:a,requestAuthority:r,account:e.account||void 0});try{g.authority.endSessionEndpoint}catch{if((c=e.account)!=null&&c.homeAccountId&&e.postLogoutRedirectUri&&g.authority.protocolMode===fo.OIDC){if(this.browserStorage.removeAccount((d=e.account)==null?void 0:d.homeAccountId),this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Popup,e),o){const w={apiId:ot.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},C=De.getAbsoluteUrl(o,lo());await this.navigationClient.navigateInternal(C,w)}(h=t.popup)==null||h.close();return}}const v=g.getLogoutUri(e);this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Popup,e);const p=this.openPopup(v,t);if(this.eventHandler.emitEvent(me.POPUP_OPENED,le.Popup,{popupWindow:p},null),await this.monitorPopupForHash(p,t.popupWindowParent).catch(()=>{}),o){const w={apiId:ot.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},C=De.getAbsoluteUrl(o,lo());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${C}`),await this.navigationClient.navigateInternal(C,w)}else this.logger.verbose("No main window navigation requested")}catch(g){throw(m=t.popup)==null||m.close(),g instanceof lt&&(g.setCorrelationId(this.correlationId),a.cacheFailedRequest(g)),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(me.LOGOUT_FAILURE,le.Popup,null,g),this.eventHandler.emitEvent(me.LOGOUT_END,le.Popup),g}this.eventHandler.emitEvent(me.LOGOUT_END,le.Popup)}initiateAuthRequest(e,t){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,t);throw this.logger.error("Navigate url is empty"),ie(hu)}monitorPopupForHash(e,t){return new Promise((r,o)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const a=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(a),o(ie(bi));return}let c="";try{c=e.location.href}catch{}if(!c||c==="about:blank")return;clearInterval(a);let d="";const h=this.config.auth.OIDCOptions.serverResponseType;e&&(h===$s.QUERY?d=e.location.search:d=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(d)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,t)})}openPopup(e,t){try{let r;if(t.popup?(r=t.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof t.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,t)),!r)throw ie(Jw);return r.focus&&r.focus(),this.currentWindow=r,t.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),this.browserStorage.setInteractionInProgress(!1),ie(Yw)}}openSizedPopup(e,{popupName:t,popupWindowAttributes:r,popupWindowParent:o}){var w,C,T,k;const a=o.screenLeft?o.screenLeft:o.screenX,c=o.screenTop?o.screenTop:o.screenY,d=o.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,h=o.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let m=(w=r.popupSize)==null?void 0:w.width,g=(C=r.popupSize)==null?void 0:C.height,v=(T=r.popupPosition)==null?void 0:T.top,p=(k=r.popupPosition)==null?void 0:k.left;return(!m||m<0||m>d)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),m=Dn.POPUP_WIDTH),(!g||g<0||g>h)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),g=Dn.POPUP_HEIGHT),(!v||v<0||v>h)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),v=Math.max(0,h/2-Dn.POPUP_HEIGHT/2+c)),(!p||p<0||p>d)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),p=Math.max(0,d/2-Dn.POPUP_WIDTH/2+a)),o.open(e,t,`width=${m}, height=${g}, top=${v}, left=${p}, scrollbars=yes`)}unloadWindow(e){this.browserStorage.cleanRequestByInteractionType(le.Popup),this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,t){e.close(),t.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)}generatePopupName(e,t){return`${Dn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${t}.${this.correlationId}`}generateLogoutPopupName(e){const t=e.account&&e.account.homeAccountId;return`${Dn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${t}.${this.correlationId}`}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class fy{constructor(e,t,r,o,a){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=a}async initiateAuthRequest(e,t){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){t.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(Ke.ORIGIN_URI,t.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(Ke.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest),this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:ot.acquireTokenRedirect,timeout:t.redirectTimeout,noHistory:!1};if(typeof t.onRedirectNavigate=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),t.onRedirectNavigate(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await t.navigationClient.navigateExternal(e,r);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await t.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),ie(hu)}async handleCodeResponse(e,t){this.logger.verbose("RedirectHandler.handleCodeResponse called"),this.browserStorage.setInteractionInProgress(!1);const r=this.browserStorage.generateStateKey(t),o=this.browserStorage.getTemporaryCache(r);if(!o)throw Y(kl,"Cached State");let a;try{a=this.authModule.handleFragmentResponse(e,o)}catch(m){throw m instanceof Wo&&m.subError===bi?ie(bi):m}const c=this.browserStorage.generateNonceKey(o),d=this.browserStorage.getTemporaryCache(c);if(this.authCodeRequest.code=a.code,a.cloud_instance_host_name&&await Q(this.authModule.updateAuthority.bind(this.authModule),x.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,this.authCodeRequest.correlationId)(a.cloud_instance_host_name,this.authCodeRequest.correlationId),a.nonce=d||void 0,a.state=o,a.client_info)this.authCodeRequest.clientInfo=a.client_info;else{const m=this.checkCcsCredentials();m&&(this.authCodeRequest.ccsCredential=m)}const h=await this.authModule.acquireToken(this.authCodeRequest,a);return this.browserStorage.cleanRequestByState(t),h}checkCcsCredentials(){const e=this.browserStorage.getTemporaryCache(Ke.CCS_CREDENTIAL,!0);if(e)try{return JSON.parse(e)}catch{this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii(`Cache credential could not be parsed: ${e}`)}return null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function YH(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const n=window.performance.getEntriesByType("navigation"),e=n.length?n[0]:void 0;return e==null?void 0:e.type}class JH extends Ma{constructor(e,t,r,o,a,c,d,h,m,g){super(e,t,r,o,a,c,d,m,g),this.nativeStorage=h}async acquireToken(e){const t=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,le.Redirect);this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||"",t.account||null);const r=this.initializeServerTelemetryManager(ot.acquireTokenRedirect),o=a=>{a.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.cleanRequestByState(t.state),this.eventHandler.emitEvent(me.RESTORE_FROM_BFCACHE,le.Redirect))};try{const a=await Q(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(t),c=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),d=new fy(c,this.browserStorage,a,this.logger,this.performanceClient),h=await c.getAuthCodeUrl({...t,nativeBroker:Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme)}),m=this.getRedirectStartPage(e.redirectStartPage);return this.logger.verbosePii(`Redirect start page: ${m}`),window.addEventListener("pageshow",o),await d.initiateAuthRequest(h,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:m,onRedirectNavigate:e.onRedirectNavigate||this.config.auth.onRedirectNavigate})}catch(a){throw a instanceof lt&&(a.setCorrelationId(this.correlationId),r.cacheFailedRequest(a)),window.removeEventListener("pageshow",o),this.browserStorage.cleanRequestByState(t.state),a}}async handleRedirectPromise(e="",t){const r=this.initializeServerTelemetryManager(ot.handleRedirectPromise);try{if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const[o,a]=this.getRedirectResponse(e||"");if(!o)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(le.Redirect),YH()!=="back_forward"?t.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const c=this.browserStorage.getTemporaryCache(Ke.ORIGIN_URI,!0)||F.EMPTY_STRING,d=De.removeHashFromUrl(c),h=De.removeHashFromUrl(window.location.href);if(d===h&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),c.indexOf("#")>-1&&rH(c),await this.handleResponse(o,r);if(this.config.auth.navigateToLoginRequestUrl){if(!Tm()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(Ke.URL_HASH,a,!0);const m={apiId:ot.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let g=!0;if(!c||c==="null"){const v=iH();this.browserStorage.setTemporaryCache(Ke.ORIGIN_URI,v,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),g=await this.navigationClient.navigateInternal(v,m)}else this.logger.verbose(`Navigating to loginRequestUrl: ${c}`),g=await this.navigationClient.navigateInternal(c,m);if(!g)return await this.handleResponse(o,r)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(o,r);return null}catch(o){throw o instanceof lt&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),this.browserStorage.cleanRequestByInteractionType(le.Redirect),o}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let t=e;t||(this.config.auth.OIDCOptions.serverResponseType===$s.QUERY?t=window.location.search:t=window.location.hash);let r=Pl(t);if(r){try{qH(r,this.browserCrypto,le.Redirect)}catch(a){return a instanceof lt&&this.logger.error(`Interaction type validation failed due to ${a.errorCode}: ${a.errorMessage}`),[null,""]}return nH(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,t]}const o=this.browserStorage.getTemporaryCache(Ke.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(Ke.URL_HASH)),o&&(r=Pl(o),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,o]):[null,""]}async handleResponse(e,t){const r=e.state;if(!r)throw ie(gm);const o=this.browserStorage.getCachedRequest(r);if(this.logger.verbose("handleResponse called, retrieved cached request"),e.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw ie(Ks);const h=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,e.accountId,this.nativeStorage,o.correlationId),{userRequestState:m}=yr.parseRequestState(this.browserCrypto,r);return h.acquireToken({...o,state:m,prompt:void 0}).finally(()=>{this.browserStorage.cleanRequestByState(r)})}const a=this.browserStorage.getCachedAuthority(r);if(!a)throw ie(pm);const c=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:a});return Ur.removeThrottle(this.browserStorage,this.config.auth.clientId,o),new fy(c,this.browserStorage,o,this.logger,this.performanceClient).handleCodeResponse(e,r)}async logout(e){var o,a;this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(ot.logout);try{this.eventHandler.emitEvent(me.LOGOUT_START,le.Redirect,e),await this.clearCacheOnLogout(t.account);const c={apiId:ot.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(d.authority.protocolMode===fo.OIDC)try{d.authority.endSessionEndpoint}catch{if((o=t.account)!=null&&o.homeAccountId){this.browserStorage.removeAccount((a=t.account)==null?void 0:a.homeAccountId),this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Redirect,t);return}}const h=d.getLogoutUri(t);if(this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Redirect,t),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(h)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(h,c);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(h,c);return}}catch(c){throw c instanceof lt&&(c.setCorrelationId(this.correlationId),r.cacheFailedRequest(c)),this.eventHandler.emitEvent(me.LOGOUT_FAILURE,le.Redirect,null,c),this.eventHandler.emitEvent(me.LOGOUT_END,le.Redirect),c}this.eventHandler.emitEvent(me.LOGOUT_END,le.Redirect)}getRedirectStartPage(e){const t=e||window.location.href;return De.getAbsoluteUrl(t,lo())}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function QH(n,e,t,r,o){if(e.addQueueMeasurement(x.SilentHandlerInitiateAuthRequest,r),!n)throw t.info("Navigate url is empty"),ie(hu);return o?Q(ZH,x.SilentHandlerLoadFrame,t,e,r)(n,o,e,r):Ai(e$,x.SilentHandlerLoadFrameSync,t,e,r)(n)}async function XH(n,e,t,r,o,a,c){return r.addQueueMeasurement(x.SilentHandlerMonitorIframeForHash,a),new Promise((d,h)=>{e<cf&&o.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${e}ms) than the default (${cf}ms). This may result in timeouts.`);const m=window.setTimeout(()=>{window.clearInterval(g),h(ie(Qw))},e),g=window.setInterval(()=>{let v="";const p=n.contentWindow;try{v=p?p.location.href:""}catch{}if(!v||v==="about:blank")return;let w="";p&&(c===$s.QUERY?w=p.location.search:w=p.location.hash),window.clearTimeout(m),window.clearInterval(g),d(w)},t)}).finally(()=>{Ai(t$,x.RemoveHiddenIframe,o,r,a)(n)})}function ZH(n,e,t,r){return t.addQueueMeasurement(x.SilentHandlerLoadFrame,r),new Promise((o,a)=>{const c=PT();window.setTimeout(()=>{if(!c){a("Unable to load iframe");return}c.src=n,o(c)},e)})}function e$(n){const e=PT();return e.src=n,e}function PT(){const n=document.createElement("iframe");return n.className="msalSilentIframe",n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height="0",n.style.border="0",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(n),n}function t$(n){document.body===n.parentNode&&document.body.removeChild(n)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class n$ extends Ma{constructor(e,t,r,o,a,c,d,h,m,g,v){super(e,t,r,o,a,c,h,g,v),this.apiId=d,this.nativeStorage=m}async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const t={...e};t.prompt?t.prompt!==Bt.NONE&&t.prompt!==Bt.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${t.prompt} with ${Bt.NONE}`),t.prompt=Bt.NONE):t.prompt=Bt.NONE;const r=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,le.Silent);ST(r.authority);const o=this.initializeServerTelemetryManager(this.apiId);let a;try{return a=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:o,requestAuthority:r.authority,requestAzureCloudOptions:r.azureCloudOptions,requestExtraQueryParameters:r.extraQueryParameters,account:r.account}),await Q(this.silentTokenHelper.bind(this),x.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(a,r)}catch(c){if(c instanceof lt&&(c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c)),!a||!(c instanceof lt)||c.errorCode!==Dn.INVALID_GRANT_ERROR)throw c;this.performanceClient.addFields({retryError:c.errorCode},this.correlationId);const d=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,le.Silent);return await Q(this.silentTokenHelper.bind(this),x.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(a,d)}}logout(){return Promise.reject(ie(fu))}async silentTokenHelper(e,t){const r=t.correlationId;this.performanceClient.addQueueMeasurement(x.SilentIframeClientTokenHelper,r);const o=await Q(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,r)(t),a=await Q(e.getAuthCodeUrl.bind(e),x.GetAuthCodeUrl,this.logger,this.performanceClient,r)({...t,nativeBroker:Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,t.authenticationScheme)}),c=new Am(e,this.browserStorage,o,this.logger,this.performanceClient),d=await Q(QH,x.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(a,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait),h=this.config.auth.OIDCOptions.serverResponseType,m=await Q(XH,x.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(d,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,h),g=Ai(OT,x.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(m,h,this.logger);if(g.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw ie(Ks);const v=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,g.accountId,this.browserStorage,r),{userRequestState:p}=yr.parseRequestState(this.browserCrypto,t.state);return Q(v.acquireToken.bind(v),x.NativeInteractionClientAcquireToken,this.logger,this.performanceClient,r)({...t,state:p,prompt:t.prompt||Bt.NONE})}return Q(c.handleCodeResponse.bind(c),x.HandleCodeResponse,this.logger,this.performanceClient,r)(g,t)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class r$ extends Ma{async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentRefreshClientAcquireToken,e.correlationId);const t=await Q(Sm,x.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...t};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const o=this.initializeServerTelemetryManager(ot.acquireTokenSilent_silentFlow),a=await this.createRefreshTokenClient({serverTelemetryManager:o,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return Q(a.acquireTokenByRefreshToken.bind(a),x.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(c=>{throw c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c),c})}logout(){return Promise.reject(ie(fu))}async createRefreshTokenClient(e){const t=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new nf(t,this.performanceClient)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class o${constructor(e,t,r,o){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=t,this.logger=r,this.cryptoObj=o}loadExternalTokens(e,t,r){if(!this.isBrowserEnvironment)throw ie(mu);const o=t.id_token?Si(t.id_token,Kr):void 0,a={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},c=e.authority?new Xt(Xt.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,a,this.logger,e.correlationId||go()):void 0,d=this.loadAccount(e,r.clientInfo||t.client_info||"",o,c),h=this.loadIdToken(t,d.homeAccountId,d.environment,d.realm),m=this.loadAccessToken(e,t,d.homeAccountId,d.environment,d.realm,r),g=this.loadRefreshToken(t,d.homeAccountId,d.environment);return this.generateAuthenticationResult(e,{account:d,idToken:h,accessToken:m,refreshToken:g},o,c)}loadAccount(e,t,r,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const h=Pt.createFromAccountInfo(e.account);return this.storage.setAccount(h),h}else if(!o||!t&&!r)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),ie(aT);const a=Pt.generateHomeAccountId(t,o.authorityType,this.logger,this.cryptoObj,r),c=r==null?void 0:r.tid,d=dm(this.storage,o,a,Kr,r,t,o.hostnameAndPort,c,void 0,void 0,this.logger);return this.storage.setAccount(d),d}loadIdToken(e,t,r,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const a=au(t,r,e.id_token,this.config.auth.clientId,o);return this.storage.setIdTokenCredential(a),a}loadAccessToken(e,t,r,o,a,c){if(t.access_token)if(t.expires_in){if(!t.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const d=t.scope?vt.fromString(t.scope):new vt(e.scopes),h=c.expiresOn||t.expires_in+new Date().getTime()/1e3,m=c.extendedExpiresOn||(t.ext_expires_in||t.expires_in)+new Date().getTime()/1e3,g=su(r,o,t.access_token,this.config.auth.clientId,a,d.printScopes(),h,m,Kr);return this.storage.setAccessTokenCredential(g),g}loadRefreshToken(e,t,r){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=mw(t,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return this.storage.setRefreshTokenCredential(o),o}generateAuthenticationResult(e,t,r,o){var g,v,p;let a="",c=[],d=null,h;t!=null&&t.accessToken&&(a=t.accessToken.secret,c=vt.fromString(t.accessToken.target).asArray(),d=new Date(Number(t.accessToken.expiresOn)*1e3),h=new Date(Number(t.accessToken.extendedExpiresOn)*1e3));const m=t.account;return{authority:o?o.canonicalAuthority:"",uniqueId:t.account.localAccountId,tenantId:t.account.realm,scopes:c,account:m.getAccountInfo(),idToken:((g=t.idToken)==null?void 0:g.secret)||"",idTokenClaims:r||{},accessToken:a,fromCache:!0,expiresOn:d,correlationId:e.correlationId||"",requestId:"",extExpiresOn:h,familyId:((v=t.refreshToken)==null?void 0:v.familyId)||"",tokenType:((p=t==null?void 0:t.accessToken)==null?void 0:p.tokenType)||"",state:e.state||"",cloudGraphHostName:m.cloudGraphHostName||"",msGraphHost:m.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class i$ extends Vw{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class a$ extends Ma{constructor(e,t,r,o,a,c,d,h,m,g){super(e,t,r,o,a,c,h,m,g),this.apiId=d}async acquireToken(e){if(!e.code)throw ie(sT);const t=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,le.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const o={...t,code:e.code},a=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),c=new i$(a);this.logger.verbose("Auth code client created");const d=new Am(c,this.browserStorage,o,this.logger,this.performanceClient);return await Q(d.handleCodeResponseFromServer.bind(d),x.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},t,!1)}catch(o){throw o instanceof lt&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),o}}logout(){return Promise.reject(ie(fu))}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function Dr(n){const e=n==null?void 0:n.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function Yc(n,e){try{bm(n)}catch(t){throw e.end({success:!1},t),t}}class _u{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new Ia(this.logger,this.performanceClient):Nl,this.eventHandler=new PH(this.logger),this.browserStorage=this.isBrowserEnvironment?new uf(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,C2(this.config.auth),this.performanceClient):bH(this.config.auth.clientId,this.logger);const t={cacheLocation:vn.MemoryStorage,temporaryCacheLocation:vn.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new uf(this.config.auth.clientId,t,this.browserCrypto,this.logger,void 0,this.performanceClient),this.tokenCache=new o$(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this),this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}static async createController(e,t){const r=new _u(e);return await r.initialize(t),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(me.INITIALIZE_END);return}const t=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),r=this.config.system.allowNativeBroker,o=this.performanceClient.startMeasurement(x.InitializeClientApplication,t);if(this.eventHandler.emitEvent(me.INITIALIZE_START),r)try{this.nativeExtensionProvider=await Fr.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient)}catch(a){this.logger.verbose(a)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),await Q(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),x.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,t)(this.performanceClient,t)),this.initialized=!0,this.eventHandler.emitEvent(me.INITIALIZE_END),o.end({allowNativeBroker:r,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),IT(this.initialized),this.isBrowserEnvironment){const t=e||"";let r=this.redirectResponse.get(t);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(t,r),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),r}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){const t=this.getAllAccounts(),r=this.browserStorage.getCachedNativeRequest(),o=r&&Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!e,a=o?r==null?void 0:r.correlationId:this.browserStorage.getTemporaryCache(Ke.CORRELATION_ID,!0)||"",c=this.performanceClient.startMeasurement(x.AcquireTokenRedirect,a);this.eventHandler.emitEvent(me.HANDLE_REDIRECT_START,le.Redirect);let d;if(o&&this.nativeExtensionProvider){this.logger.trace("handleRedirectPromise - acquiring token from native platform");const h=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,r.accountId,this.nativeInternalStorage,r.correlationId);d=Q(h.handleRedirectPromise.bind(h),x.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,c.event.correlationId)(this.performanceClient,c.event.correlationId)}else{this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(a);d=Q(h.handleRedirectPromise.bind(h),x.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,c.event.correlationId)(e,c)}return d.then(h=>(h?(t.length<this.getAllAccounts().length?(this.eventHandler.emitEvent(me.LOGIN_SUCCESS,le.Redirect,h),this.logger.verbose("handleRedirectResponse returned result, login success")):(this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_SUCCESS,le.Redirect,h),this.logger.verbose("handleRedirectResponse returned result, acquire token success")),c.end({success:!0,accountType:Dr(h.account)})):c.event.errorCode?c.end({success:!1}):c.discard(),this.eventHandler.emitEvent(me.HANDLE_REDIRECT_END,le.Redirect),h)).catch(h=>{const m=h;throw t.length>0?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Redirect,null,m):this.eventHandler.emitEvent(me.LOGIN_FAILURE,le.Redirect,null,m),this.eventHandler.emitEvent(me.HANDLE_REDIRECT_END,le.Redirect),c.end({success:!1},m),h})}async acquireTokenRedirect(e){const t=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",t);const r=this.performanceClient.startMeasurement(x.AcquireTokenPreRedirect,t);r.add({accountType:Dr(e.account),scenarioId:e.scenarioId});const o=e.onRedirectNavigate;if(o)e.onRedirectNavigate=c=>{const d=typeof o=="function"?o(c):void 0;return d!==!1?r.end({success:!0}):r.discard(),d};else{const c=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=d=>{const h=typeof c=="function"?c(d):void 0;return h!==!1?r.end({success:!0}):r.discard(),h}}const a=this.getAllAccounts().length>0;try{ly(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),a?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_START,le.Redirect,e):this.eventHandler.emitEvent(me.LOGIN_START,le.Redirect,e);let c;return this.nativeExtensionProvider&&this.canUseNative(e)?c=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(e),this.nativeInternalStorage,t).acquireTokenRedirect(e,r).catch(h=>{if(h instanceof Br&&sa(h))return this.nativeExtensionProvider=void 0,this.createRedirectClient(t).acquireToken(e);if(h instanceof Er)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),h}):c=this.createRedirectClient(t).acquireToken(e),await c}catch(c){throw r.end({success:!1},c),a?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Redirect,null,c):this.eventHandler.emitEvent(me.LOGIN_FAILURE,le.Redirect,null,c),c}}acquireTokenPopup(e){const t=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(x.AcquireTokenPopup,t);r.add({scenarioId:e.scenarioId,accountType:Dr(e.account)});try{this.logger.verbose("acquireTokenPopup called",t),Yc(this.initialized,r),this.browserStorage.setInteractionInProgress(!0)}catch(c){return Promise.reject(c)}const o=this.getAllAccounts();o.length>0?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_START,le.Popup,e):this.eventHandler.emitEvent(me.LOGIN_START,le.Popup,e);let a;return this.canUseNative(e)?a=this.acquireTokenNative({...e,correlationId:t},ot.acquireTokenPopup).then(c=>(this.browserStorage.setInteractionInProgress(!1),r.end({success:!0,isNativeBroker:!0,accountType:Dr(c.account)}),c)).catch(c=>{if(c instanceof Br&&sa(c))return this.nativeExtensionProvider=void 0,this.createPopupClient(t).acquireToken(e);if(c instanceof Er)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),c}):a=this.createPopupClient(t).acquireToken(e),a.then(c=>(o.length<this.getAllAccounts().length?this.eventHandler.emitEvent(me.LOGIN_SUCCESS,le.Popup,c):this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_SUCCESS,le.Popup,c),r.end({success:!0,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Dr(c.account)}),c)).catch(c=>(o.length>0?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Popup,null,c):this.eventHandler.emitEvent(me.LOGIN_FAILURE,le.Popup,null,c),r.end({success:!1},c),Promise.reject(c)))}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){var a,c;const t=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:t};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(x.SsoSilent,t),(a=this.ssoSilentMeasurement)==null||a.add({scenarioId:e.scenarioId,accountType:Dr(e.account)}),Yc(this.initialized,this.ssoSilentMeasurement),(c=this.ssoSilentMeasurement)==null||c.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",t),this.eventHandler.emitEvent(me.SSO_SILENT_START,le.Silent,r);let o;return this.canUseNative(r)?o=this.acquireTokenNative(r,ot.ssoSilent).catch(d=>{if(d instanceof Br&&sa(d))return this.nativeExtensionProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw d}):o=this.createSilentIframeClient(r.correlationId).acquireToken(r),o.then(d=>{var h;return this.eventHandler.emitEvent(me.SSO_SILENT_SUCCESS,le.Silent,d),(h=this.ssoSilentMeasurement)==null||h.end({success:!0,isNativeBroker:d.fromNativeBroker,accessTokenSize:d.accessToken.length,idTokenSize:d.idToken.length,accountType:Dr(d.account)}),d}).catch(d=>{var h;throw this.eventHandler.emitEvent(me.SSO_SILENT_FAILURE,le.Silent,null,d),(h=this.ssoSilentMeasurement)==null||h.end({success:!1},d),d}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const t=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",t);const r=this.performanceClient.startMeasurement(x.AcquireTokenByCode,t);Yc(this.initialized,r),this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_START,le.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw ie(lT);if(e.code){const o=e.code;let a=this.hybridAuthCodeResponses.get(o);return a?(this.logger.verbose("Existing acquireTokenByCode request found",t),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",t),a=this.acquireTokenByCodeAsync({...e,correlationId:t}).then(c=>(this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_SUCCESS,le.Silent,c),this.hybridAuthCodeResponses.delete(o),r.end({success:!0,isNativeBroker:c.fromNativeBroker,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Dr(c.account)}),c)).catch(c=>{throw this.hybridAuthCodeResponses.delete(o),this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_FAILURE,le.Silent,null,c),r.end({success:!1},c),c}),this.hybridAuthCodeResponses.set(o,a)),await a}else if(e.nativeAccountId)if(this.canUseNative(e,e.nativeAccountId)){const o=await this.acquireTokenNative({...e,correlationId:t},ot.acquireTokenByCode,e.nativeAccountId).catch(a=>{throw a instanceof Br&&sa(a)&&(this.nativeExtensionProvider=void 0),a});return r.end({accountType:Dr(o.account),success:!0}),o}else throw ie(uT);else throw ie(cT)}catch(o){throw this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_FAILURE,le.Silent,null,o),r.end({success:!1},o),o}}async acquireTokenByCodeAsync(e){var o;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(x.AcquireTokenByCodeAsync,e.correlationId),(o=this.acquireTokenByCodeAsyncMeasurement)==null||o.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(a=>{var c;return(c=this.acquireTokenByCodeAsyncMeasurement)==null||c.end({success:!0,fromCache:a.fromCache,isNativeBroker:a.fromNativeBroker}),a}).catch(a=>{var c;throw(c=this.acquireTokenByCodeAsyncMeasurement)==null||c.end({success:!1},a),a}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,t){switch(this.performanceClient.addQueueMeasurement(x.AcquireTokenFromCache,e.correlationId),t){case Pn.Default:case Pn.AccessToken:case Pn.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return Q(r.acquireToken.bind(r),x.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Y(co)}}async acquireTokenByRefreshToken(e,t){switch(this.performanceClient.addQueueMeasurement(x.AcquireTokenByRefreshToken,e.correlationId),t){case Pn.Default:case Pn.AccessTokenAndRefreshToken:case Pn.RefreshToken:case Pn.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return Q(r.acquireToken.bind(r),x.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Y(co)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(x.AcquireTokenBySilentIframe,e.correlationId);const t=this.createSilentIframeClient(e.correlationId);return Q(t.acquireToken.bind(t),x.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const t=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),this.logoutRedirect({correlationId:t,...e})}async logoutRedirect(e){const t=this.getRequestCorrelationId(e);return ly(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),this.createRedirectClient(t).logout(e)}logoutPopup(e){try{const t=this.getRequestCorrelationId(e);return bm(this.initialized),this.browserStorage.setInteractionInProgress(!0),this.createPopupClient(t).logout(e)}catch(t){return Promise.reject(t)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const t=this.getRequestCorrelationId(e);return this.createSilentCacheClient(t).logout(e)}getAllAccounts(e){return IH(this.logger,this.browserStorage,this.isBrowserEnvironment,e)}getAccount(e){return SH(e,this.logger,this.browserStorage)}getAccountByUsername(e){return AH(e,this.logger,this.browserStorage)}getAccountByHomeId(e){return kH(e,this.logger,this.browserStorage)}getAccountByLocalId(e){return NH(e,this.logger,this.browserStorage)}setActiveAccount(e){RH(e,this.browserStorage)}getActiveAccount(){return OH(this.browserStorage)}async hydrateCache(e,t){this.logger.verbose("hydrateCache called");const r=Pt.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return this.browserStorage.setAccount(r),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,t)):this.browserStorage.hydrateCache(e,t)}async acquireTokenNative(e,t,r){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw ie(Ks);return new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,t,this.performanceClient,this.nativeExtensionProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e)}canUseNative(e,t){if(this.logger.trace("canUseNative called"),!Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case Bt.NONE:case Bt.CONSENT:case Bt.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace(`canUseNative: prompt = ${e.prompt} is not compatible with native flow, returning false`),!1}return!t&&!this.getNativeAccountId(e)?(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const t=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return t&&t.nativeAccountId||""}createPopupClient(e){return new jH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createRedirectClient(e){return new JH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentIframeClient(e){return new n$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentCacheClient(e){return new RT(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentRefreshClient(e){return new r$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentAuthCodeClient(e){return new a$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,e)}addEventCallback(e,t){return this.eventHandler.addEventCallback(e,t)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return bT(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))}disableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))}handleAccountCacheChange(e){var t;try{(t=e.key)!=null&&t.includes(Lt.ACTIVE_ACCOUNT_FILTERS)&&this.eventHandler.emitEvent(me.ACTIVE_ACCOUNT_CHANGED);const r=e.newValue||e.oldValue;if(!r)return;const o=JSON.parse(r);if(typeof o!="object"||!Pt.isAccountEntity(o))return;const c=Ta.toObject(new Pt,o).getAccountInfo();!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.eventHandler.emitEvent(me.ACCOUNT_ADDED,void 0,c)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.eventHandler.emitEvent(me.ACCOUNT_REMOVED,void 0,c))}catch{return}}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,t){this.browserStorage.setWrapperMetadata(e,t)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?go():F.EMPTY_STRING}async loginRedirect(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",t),this.acquireTokenRedirect({correlationId:t,...e||ay})}loginPopup(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup({correlationId:t,...e||ay})}async acquireTokenSilent(e){const t=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(x.AcquireTokenSilent,t);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),Yc(this.initialized,r),this.logger.verbose("acquireTokenSilent called",t);const o=e.account||this.getActiveAccount();if(!o)throw ie(tT);r.add({accountType:Dr(o)});const a={clientId:this.config.auth.clientId,authority:e.authority||F.EMPTY_STRING,scopes:e.scopes,homeAccountIdentifier:o.homeAccountId,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,shrOptions:e.shrOptions},c=JSON.stringify(a),d=this.activeSilentTokenRequests.get(c);if(typeof d>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",t);const h=Q(this.acquireTokenSilentAsync.bind(this),x.AcquireTokenSilentAsync,this.logger,this.performanceClient,t)({...e,correlationId:t},o).then(m=>(this.activeSilentTokenRequests.delete(c),r.end({success:!0,fromCache:m.fromCache,isNativeBroker:m.fromNativeBroker,cacheLookupPolicy:e.cacheLookupPolicy,accessTokenSize:m.accessToken.length,idTokenSize:m.idToken.length}),m)).catch(m=>{throw this.activeSilentTokenRequests.delete(c),r.end({success:!1},m),m});return this.activeSilentTokenRequests.set(c,h),{...await h,state:e.state}}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",t),r.discard(),{...await d,state:e.state}}async acquireTokenSilentAsync(e,t){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(x.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_START,le.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const o=await Q(UH,x.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,t,this.config,this.performanceClient,this.logger),a=e.cacheLookupPolicy||Pn.Default;return this.acquireTokenSilentNoIframe(o,a).catch(async d=>{if(s$(d,a))if(this.activeIframeRequest)if(a!==Pn.Skip){const[m,g]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${g}`,o.correlationId);const v=this.performanceClient.startMeasurement(x.AwaitConcurrentIframe,o.correlationId);v.add({awaitIframeCorrelationId:g});const p=await m;if(v.end({success:p}),p)return this.logger.verbose(`Parallel iframe request with correlationId: ${g} succeeded. Retrying cache and/or RT redemption`,o.correlationId),this.acquireTokenSilentNoIframe(o,a);throw this.logger.info(`Iframe request with correlationId: ${g} failed. Interaction is required.`),d}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",o.correlationId),Q(this.acquireTokenBySilentIframe.bind(this),x.AcquireTokenBySilentIframe,this.logger,this.performanceClient,o.correlationId)(o);else{let m;return this.activeIframeRequest=[new Promise(g=>{m=g}),o.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",o.correlationId),Q(this.acquireTokenBySilentIframe.bind(this),x.AcquireTokenBySilentIframe,this.logger,this.performanceClient,o.correlationId)(o).then(g=>(m(!0),g)).catch(g=>{throw m(!1),g}).finally(()=>{this.activeIframeRequest=void 0})}else throw d}).then(d=>(this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_SUCCESS,le.Silent,d),e.correlationId&&this.performanceClient.addFields({fromCache:d.fromCache,isNativeBroker:d.fromNativeBroker},e.correlationId),d)).catch(d=>{throw this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Silent,null,d),d}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,t){return Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,ot.acquireTokenSilent_silentFlow).catch(async r=>{throw r instanceof Br&&sa(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,Y(co)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),Q(this.acquireTokenFromCache.bind(this),x.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,t).catch(r=>{if(t===Pn.AccessToken)throw r;return this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_NETWORK_START,le.Silent,e),Q(this.acquireTokenByRefreshToken.bind(this),x.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,t)}))}}function s$(n,e){const t=!(n instanceof Er&&n.subError!==du),r=n.errorCode===Dn.INVALID_GRANT_ERROR||n.errorCode===co,o=t&&r||n.errorCode===Dl||n.errorCode===um,a=W2.includes(e);return o&&a}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function c$(n,e){const t=new Ii(n);return await t.initialize(),_u.createController(t,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class km{static async createPublicClientApplication(e){const t=await c$(e);return new km(e,t)}constructor(e,t){this.controller=t||new _u(new Ii(e))}async initialize(e){return this.controller.initialize(e)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,t){return this.controller.addEventCallback(e,t)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,t){return this.controller.initializeWrapperLibrary(e,t)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,t){return this.controller.hydrateCache(e,t)}clearCache(e){return this.controller.clearCache(e)}}const lh=process.env.JPLAN_WEBAPP__APP_PROXY_TENANT_NAME??"",l$=process.env.JPLAN_WEBAPP__APP_PROXY_CLIENT_ID??"",u$=process.env.JPLAN_WEBAPP__APP_PROXY_USER_FLOW??"",hf=process.env.JPLAN_WEBAPP__URL_AUTH??process.env.JPLAN_WEBAPP__URL_BASE??"",d$={auth:{clientId:l$,authority:`https://${lh}.b2clogin.com/${lh}.onmicrosoft.com/${u$}`,knownAuthorities:[`${lh}.b2clogin.com`],redirectUri:process.env.JPLAN_AUTOMATION_ENVIRONMENT?`${hf}/_/dashboard`:hf},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(n,e)=>{n===tt.Error&&console.error(e)},logLevel:tt.Warning}}},MT=(n,e)=>({scopes:["https://graph.microsoft.com/.default","openid","profile"],redirectStartPage:`${hf}${n}`,extraQueryParameters:e}),Gt=new km(d$),my=l.ref(null);function DT(){async function n(e){var t;if(e)try{const r=e.idTokenClaims;if(!(r!=null&&r.aud))throw new Error("User audience (aud) is missing in ID token claims");const o=localStorage.getItem(`msal.token.keys.${r.aud}`);if(!o)throw new Error(`Token keys para ${r.aud} não encontrados no localStorage`);const a=JSON.parse(o),c=(t=a==null?void 0:a.idToken)==null?void 0:t[0];if(!c)throw new Error("idToken não encontrado nos token keys");const d=localStorage.getItem(c);if(!d)throw new Error(`Dados do token para ID ${c} não encontrados no localStorage`);const h=JSON.parse(d),m=h==null?void 0:h.secret;if(!m)throw new Error("Secret não encontrado nos dados do token");sessionStorage.setItem("isAuthenticated","true"),my.value=m}catch(r){console.error("Erro ao obter token de acesso:",r)}}return{jToken:my,setJToken:n}}let Jc=null;const tr=l.ref(null),Ji=l.ref(null),LT=l.ref(Math.floor(Date.now()/1e3));ff.useIntervalFn(()=>h$(),1e3);function h$(){var r,o;if(!((o=(r=tr.value)==null?void 0:r.idTokenClaims)!=null&&o.exp))return;const n=Math.floor(Date.now()/1e3),e=300,t=tr.value.idTokenClaims.exp;LT.value=t-n-e}function Nm(){if(Jc)return Jc;const{setJToken:n,jToken:e}=DT(),t=l.computed(()=>!!tr.value),r=l.computed(()=>tr.value);let o;async function a(p,w){if(!t.value)switch(p){case"redirect":if(w){o=w,await h();break}case"tab":default:await c();break}}const c=async()=>new Promise((p,w)=>{try{localStorage.clear();const C=process.env.JPLAN_WEBAPP__URL_AUTH,T=window.open(C);if(!T){console.error("Failed to open authentication window"),w("Failed to open authentication window");return}const k=Date.now(),I=6e4,N=setInterval(()=>{if(Date.now()-k>I||T.closed){clearInterval(N),console.error("Authentication canceled or timeout reached."),w("Authentication canceled or timeout reached.");return}Object.keys(localStorage).some(L=>L.startsWith("msal.account.keys"))&&(clearInterval(N),d(),T.close(),p())},500)}catch(C){console.error("Error in handleRedirect:",C),w(C)}}),d=async()=>{try{await Gt.initialize();const p=Gt.getActiveAccount();if(p)tr.value=p;else{const w=await Gt.handleRedirectPromise();w?(Gt.setActiveAccount(w.account),tr.value=Gt.getActiveAccount()):console.error("Falha na autenticação")}}catch(p){console.error("Erro no processo de autenticação:",p)}tr.value&&await n(tr.value)},h=async()=>{try{await Gt.initialize();const p=await Gt.handleRedirectPromise();if(!p||Gt.getAllAccounts().length===0){const w=MT(o);await Gt.loginRedirect(w);return}Gt.setActiveAccount(p.account),tr.value=Gt.getActiveAccount(),tr.value&&await n(tr.value),Ji.value="updated"}catch(p){console.error("handleRedirect failed",p)}};async function m(){ve.value=!0,Ji.value="updating";try{const p=await Gt.acquireTokenSilent({scopes:["https://graph.microsoft.com/.default","openid","profile"]});Gt.setActiveAccount(p.account),await n(tr.value),Ji.value="updated"}catch(p){console.error("Failed to refresh token, forcing new login.",p),Ji.value="error",localStorage.clear(),window.location.reload()}ve.value=!1}const g=async()=>{try{await Gt.initialize(),localStorage.clear(),await Gt.logoutRedirect({postLogoutRedirectUri:"/"})}catch(p){console.error("Logout error",p)}};l.watch(LT,async p=>{p<=0&&Ji.value==="updated"&&await m()});const v=l.computed(()=>e.value);return Jc={isAuthenticated:t,authState:Ji,account:r,token:v,refreshToken:m,handleRedirect:a,logout:g},Jc}const{jToken:gy}=DT(),Rm=()=>{const n=dt.create({headers:{"Content-Type":"application/json"}});l.watch(gy,o=>{n.interceptors.request.use(a=>(o&&(a.headers.Authorization=`Bearer ${o}`),a))},{immediate:!0});let e=1;n.interceptors.response.use(async o=>o,async o=>{var a;if(o.config&&o.config.headers){const c=o.config;if(((a=o.response)==null?void 0:a.status)===401&&e>0){e--;try{return c.headers.Authorization=`Bearer ${gy.value}`,await n(c)}catch(d){return Promise.reject(d)}}}return Promise.reject(o)});async function t({url:o,method:a,header:c={},body:d,baseURL:h}){try{return h&&(n.defaults.baseURL=h),(await n({url:o,method:a,headers:c,data:d})).data}catch(m){if(console.error(`Request error [${a} ${o}]:`,m),dt.isAxiosError(m)){const{response:g,message:v}=m;throw new Error(`Axios error: ${v}, Status: ${g==null?void 0:g.status}, URL: ${o}`)}throw m}}async function r({url:o,method:a,header:c,body:d,baseURL:h}){try{h&&(n.defaults.baseURL=h);const m=await n({url:o,method:a,headers:c,data:d});return{status:m.status,header:m.headers,body:m.data}}catch(m){if(dt.isAxiosError(m)){const{response:g,message:v}=m;console.error(`Raw Request Error: ${v}, Status: ${g==null?void 0:g.status}`)}return Promise.reject(m)}}return Object.assign(n,{_request:t,rawRequest:r})},{request:py}=Rm(),_y=l.ref(null),vy=l.ref("default"),uh=l.ref(null),dh=l.ref({scope_type:"org"});function vu(){var v,p;const{handleRedirect:n,account:e,logout:t}=Nm();(p=(v=e.value)==null?void 0:v.idTokenClaims)==null||p.domain;const r=l.computed(()=>{var w,C;return{domain:(C=(w=e.value)==null?void 0:w.idTokenClaims)==null?void 0:C.domain,environment:vy.value,...dh.value}}),o=l.computed(()=>dh.value);async function a(){var w;(!e.value||!((w=e.value.idTokenClaims)!=null&&w.email))&&await n();try{await c(),await d()}catch{}}async function c(){var w,C;try{const T=(C=(w=e.value)==null?void 0:w.idTokenClaims)==null?void 0:C.email;if(!T)throw new Error("Email is undefined");const k=await py({url:`https://api.jplan.com.br/platform/user/profile/?email=${T}`,method:"GET"});uh.value=k.data??null}catch(T){console.error("Failed to fetch user profile:",T)}}async function d(){var w;try{if(!((w=uh.value)!=null&&w.email))throw new Error("User email is undefined");const C=await py({url:"https://api.jplan.com.br/platform/user/domain/",method:"GET"});_y.value=C.data.data??[]}catch(C){console.error("Failed to fetch user domains:",C)}}function h(w){dh.value=w}function m(w){vy.value=w,h(r.value)}async function g(w,C){const T=MT(w,{request_domain:C});await Gt.loginRedirect(T)}return{__init__:a,user:uh,userDomains:_y,setEnv:m,setScope:h,changeDomain:g,session:r,scope:o,logout:t}}const f$={path:"/_/dashboard",component:()=>Promise.resolve().then(()=>require("./AuthRoute-B-o0KMOq.js")),meta:{requiresAuth:!1}},m$={path:"/jplan-auth-fail",component:()=>Promise.resolve().then(()=>require("./AuthFailRoute-DHl-IhUQ.js")),meta:{requiresAuth:!1}},{isAuthenticated:yy,handleRedirect:g$}=Nm(),p$=vu();function _$(n,e){n.addRoute(f$),n.addRoute(m$),n.beforeEach(async(t,r,o)=>{function a(d){return d.matched.some(h=>h.meta.requiresAuth)}if(!a(t))return o();if(!yy.value){ve.value=!0;try{await g$(e,t.fullPath),await p$.__init__()}catch(d){console.error("Fail to authenticate",d),await n.push("/jplan-auth-fail")}ve.value=!1}if(yy.value){if(localStorage.getItem("returnRoute")&&localStorage.getItem("returnRoute")!==null){const d=localStorage.getItem("returnRoute")??"/";console.log("trying to go to saved route:",d),o(d),localStorage.removeItem("returnRoute");return}o()}})}const{scope:Cy}=vu();function v$(){const n=Rm(),e=l.ref({scope_type:"org"});async function t(r){e.value=r}return l.watch(Cy,()=>{n.interceptors.request.use(r=>{const o=r.headers,a=o.Authorization;a&&(o.Authorization=a);const c=Cy.value;return c&&(c.scope_type&&(o["j-scope-type"]=c.scope_type,c.organization&&(o["j-scope-organization"]=c.organization),c.team&&(o["j-scope-team"]=c.team)),c.environment&&(o["j-scope-environment"]=c.environment)),r})},{immediate:!0}),Object.assign(n,{setScope:t,scope:e})}function Da(n){const e=v$();e.defaults.baseURL=n;const t=l.ref({scope_type:"org"});async function r(o){t.value=o}return l.watch(t,()=>{e.interceptors.request.use(o=>{const a=t.value;return delete o.headers["j-scope-type"],delete o.headers["j-scope-organization"],delete o.headers["j-scope-team"],a!=null&&a.scope_type&&(o.headers["j-scope-type"]=a.scope_type),a!=null&&a.organization&&(o.headers["j-scope-organization"]=a.organization),a!=null&&a.team&&(o.headers["j-scope-team"]=a.team),o})},{immediate:!0}),Object.assign(e,{setScope:r,scope:t})}const Ey={enUS:{widget:"widget",spacer:"spacer"},ptBr:{widget:"widget",spacer:"Espaçador"}},Om={"pt-BR":{placeholders:{selectFilter:"Selecionar filtro",visualize:"Visualizar",actions:"Ações",search:"Pesquisar"},dialogs:{columnSettings:{title:"Configurações de coluna"},scope:{title:"Escopo",unknown:"Desconhecido",domain:"Domínio",environment:"Ambiente",organizational:"Organizacional",organization:"Organização",team:"Time",user:"Usuário",none:"Nenhum",selectOrganization:"Selecione uma Organização",selectTeam:"Selecione um Time"}},actions:{save:"Salvar",cancel:"Cancelar",edit:"Editar",delete:"Apagar",disable:"Desabilitar",confirm:"Confirmar",back:"Voltar"},forms:{metadata:{created:"Criado",updated:"Atualizado",modified:"Modificado",delegated:"Delegado"}},$vuetify:{dataFooter:{itemsPerPageAll:"Todos",itemsPerPageText:"Itens por página:",pageText:"{0}-{1} de {2}"}},toast:{error:{create_failed:"Falha ao criar {entity}",update_failed:"Falha ao atualizar {entity}",delete_failed:"Falha ao apagar {entity}",fetch_failed:"Falha ao buscar {entity}",activate_failed:"Falha ao ativar {entity}",deactivate_failed:"Falha ao desativar {entity}",link_failed:"Falha ao vincular {entity}",unlink_failed:"Falha ao desvincular {entity}"},success:{create_success:"{entity} criado com sucesso",update_success:"{entity} atualizado com sucesso",delete_success:"{entity} apagado com sucesso",activate_success:"{entity} ativado com sucesso",deactivate_success:"{entity} desativado com sucesso",link_success:"{entity} vinculado com sucesso",unlink_success:"{entity} desvinculado com sucesso"},info:{already_linked:"{entity} já está vinculado",select_valid_item:"Selecione um item válido"}},app:{widget:Ey.ptBr}},"en-US":{placeholders:{selectFilter:"Select a filter",visualize:"Visualize",actions:"Actions",search:"Search"},dialogs:{columnSettings:{title:"Column Settings"},scope:{title:"Scope",unknown:"Unknown",domain:"Domain",environment:"Environment",organizational:"Organizational",organization:"Organization",team:"Team",user:"User",none:"None",selectOrganization:"Select a organization",selectTeam:"Select a Team"}},actions:{save:"Save",cancel:"Cancel",edit:"Edit",delete:"Delete",disable:"Disable",back:"Back",confirm:"Confirm"},forms:{metadata:{created:"Created",updated:"Updated",modified:"Modified",delegated:"Delegated"}},$vuetify:{dataFooter:{itemsPerPageAll:"All",itemsPerPageText:"Items per page:",pageText:"{0}-{1} of {2}"}},toast:{error:{create_failed:"Failed to create {entity}",update_failed:"Failed to update {entity}",delete_failed:"Failed to delete {entity}",fetch_failed:"Failed to fetch {entity}",activate_failed:"Failed to activate {entity}",deactivate_failed:"Failed to deactivate {entity}",link_failed:"Failed to link {entity}",unlink_failed:"Failed to unlink {entity}"},success:{create_success:"{entity} created successfully",update_success:"{entity} updated successfully",delete_success:"{entity} deleted successfully",activate_success:"{entity} activated successfully",deactivate_success:"{entity} deactivated successfully",link_success:"{entity} linked successfully",unlink_success:"{entity} unlinked successfully"},info:{already_linked:"{entity} is already linked",select_valid_item:"Please select a valid item"}},app:{widget:Ey.ptBr}}},y$=Object.keys(Om),wy=navigator.language,C$=y$.includes(wy)?wy:"pt-BR",$=yx({locale:C$,fallbackLocale:"en-US",messages:Om});function E$(){const n=Da("https://api.jplan.com.br/management/organization"),{error:e}=wr();return{async getOrgList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Organization"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getOrgList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Organization"}));return}},async createOrg(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Organization"})),a}},async updateOrg(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e($.global.t("toast.error.update_failed",{entity:"Organization"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Organization"})),a}},async getOrg(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Organization"})),new Error(a.data.error);return a.data}catch(a){throw console.error("Error in getOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Organization"})),a}},async activateOrg(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"Organization"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Organization"})),a}},async deactivateOrg(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"Organization"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Organization"})),a}}}}const xo=E$();function w$(){const n=Da("https://api.jplan.com.br/management/branch/"),{error:e}=wr();return{async getBranchList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error){e($.global.t("toast.error.fetch_failed",{entity:"Branch"}));return}return o.data.data}catch(r){console.error("Error in getBranchList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Branch"}))}},async createBranch(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){console.error("Error in createBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Branch"}))}},async updateBranch(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error){e(a.data.error||$.global.t("toast.error.update_failed",{entity:"Branch"}));return}return a}catch(a){console.error("Error in updateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Branch"}))}},async getBranch(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error){e(a.data.error||$.global.t("toast.error.fetch_failed",{entity:"Branch"}));return}return a.data}catch(a){console.error("Error in getBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Branch"}))}},async activateBranch(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error){e(a.data.error||$.global.t("toast.error.activate_failed",{entity:"Branch"}));return}}catch(a){console.error("Error in activateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Branch"}))}},async deactivateBranch(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error){e(a.data.error||$.global.t("toast.error.deactivate_failed",{entity:"Branch"}));return}}catch(a){console.error("Error in deactivateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Branch"}))}}}}const Uo=w$();function T$(){const n=Da("https://api.jplan.com.br/management/team"),{error:e}=wr();return{async getTeamList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Team"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getTeamList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Team"}));return}},async createTeam(t){var r,o;try{const a=await n.post("/item",t);if(a.data.error)throw e($.global.t("toast.error.create_failed",{entity:"Team"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in createTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Team"})),a}},async updateTeam(t){var r,o;try{const a=await n.patch("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in updateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Team"})),a}},async getTeam(t){var r,o;try{const a=await n.get(`/item/${t}`);return a.data.error&&e($.global.t("toast.error.fetch_failed",{entity:"Team"})),a.data}catch(a){console.error("Error in getTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Team"}));return}},async activateTeam(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"Team"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Team"})),a}},async deactivateTeam(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"Team"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Team"})),a}},async getTeamUserList(t,r){try{const o=r?`?filter_query=${r}`:"",a=await n.get(`/item/${t}/user/list/${o}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(a.data.error);return a.data.data}catch(o){console.error("Error in getTeamUserList:",o),e($.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async linkManageUser(t,r){try{const o=await n.post(`/item/${t}/user/item/`,r);if(o.data.error)throw e($.global.t("toast.error.link_failed",{entity:"User"})),new Error(o.data.error);return o.data}catch(o){console.error("Error in link User:",o),e($.global.t("toast.error.link_failed",{entity:"User"}));return}},async updateManageUser(t,r){try{const o=await n.patch(`/item/${t}/user/item/`,r);if(o.data.error)throw e($.global.t("toast.error.update_failed",{entity:"User"})),new Error(o.data.error);return o.data.data}catch(o){throw console.error("Error in update User:",o),e($.global.t("toast.error.update_failed",{entity:"User"})),o}},async getManageUser(t,r,o){try{const a=o?`?filter_query=${o}`:"",c=await n.get(`/item/${t}/user/item/${r}/${a}`);if(c.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(c.data.error);return c.data.data}catch(a){console.error("Error in getUser:",a),e($.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async unlinkManageUser(t,r,o){try{const a=o?`?filter_query=${o}`:"";await n.delete(`/item/${t}/user/item/${r}/${a}`)}catch(a){throw console.error("Error in unlink User:",a),e($.global.t("toast.error.unlink_failed",{entity:"User"})),a}}}}const Mn=T$();let Qc=!1;const hh=l.ref(!1),jn=l.ref([]),Ty=l.ref([]),ft=l.ref(null),Qi=l.ref([]),Xi=l.ref([]),xT=()=>{const n=wr(),e=async C=>{hh.value=!0;const T=C?`_active eq true and ${C}`:"_active eq true",k=await xo.getOrgList(T);k&&(jn.value=k,Qc=!0),hh.value=!1},t=async C=>{var T;return(T=jn.value)!=null&&T.length||await e(C),jn.value};function r(C){if(!jn.value)throw new Error("Data not stored yet");const T=Oa(jn.value,C,["name","description"]);return C!==""?T:jn.value}const o=C=>{Ty.value=C},a=C=>{ft.value=Ra.cloneDeep(C)},c=async C=>await xo.getOrg(C),d=async()=>{if(ft.value!=null){const C=await xo.createOrg(ft.value);return C!=null&&C.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Organization"})),Qc&&jn.value.push(C.data)),C==null?void 0:C.data}},h=async()=>{if(ve.value=!0,ft.value&&ft.value.__id){const C=await xo.updateOrg(ft.value);if(Qc&&(C!=null&&C.data.__id)){const T=jn.value.findIndex(k=>k.__id===C.data.__id);return T!==-1?(jn.value[T]=C.data,n.success($.global.t("toast.success.update_success",{entity:"Organization"}))):n.error($.global.t("toast.error.update_failed",{entity:"Organization"})),ve.value=!1,C.data}}else ve.value=!1,n.error($.global.t("toast.error.update_failed",{entity:"Organization"}))},m=async()=>{if(ve.value=!0,ft.value&&ft.value.created_at){if(await xo.deactivateOrg(ft.value.__id),Qc){const C=jn.value.findIndex(T=>{var k;return T.__id===((k=ft.value)==null?void 0:k.__id)});if(C!==-1)return jn.value.splice(C,1),ft.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Organization"}))}ve.value=!1}};async function g(C){ve.value=!0;try{if(ft.value&&ft.value.__id){const T={...C,organization:ft.value.__id};if(!await Uo.updateBranch(T)){ve.value=!1;return}if(Qi.value.findIndex(N=>N.__id===C.__id)===-1)return n.success($.global.t("toast.success.link_success",{entity:"Branch"})),Qi.value.push(T),T;n.info($.global.t("toast.info.already_linked",{entity:"Branch"}))}}catch(T){console.error(T)}finally{ve.value=!1}}async function v(C){if(ve.value=!0,ft.value&&ft.value.__id){const T={...C,organization:null};if(!await Uo.updateBranch(T)){ve.value=!1;return}const I=Qi.value.findIndex(N=>N.__id===C.__id);if(I!==-1)return Qi.value.splice(I,1),ve.value=!1,Qi.value;throw new Error("Item not found to remove")}ve.value=!1}async function p(C){ve.value=!0;try{if(ft.value&&ft.value.__id){const T={...C,organization:ft.value.__id};if(!await Mn.updateTeam(T)){ve.value=!1;return}if(Xi.value.findIndex(N=>N.__id===C.__id)===-1)return n.success($.global.t("toast.success.link_success",{entity:"Team"})),Xi.value.push(T),T;n.info($.global.t("toast.info.already_linked",{entity:"Team"}))}}catch(T){console.error(T)}finally{ve.value=!1}}async function w(C){if(ve.value=!0,ft.value&&ft.value.__id){const T={...C,organization:null};if(!await Mn.updateTeam(T)){ve.value=!1;return}const I=Xi.value.findIndex(N=>N.__id===C.__id);if(I!==-1)return Xi.value.splice(I,1),ve.value=!1,Xi.value;throw new Error("Item not found to remove")}ve.value=!1}return{data:jn,loading:hh,columns:Ty,item:ft,filterData:r,__init__:e,getData:t,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,orgBranches:Qi,orgTeams:Xi,linkBranch:g,unlinkBranch:v,linkTeam:p,unlinkTeam:w}};let Xc=!1;const Yn=l.ref([]),by=l.ref([]),Nt=l.ref(null),fh=l.ref(!1),Zi=l.ref([]),UT=()=>{const n=wr(),e=async p=>{fh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await Mn.getTeamList(w);C&&(Yn.value=C,Xc=!0),fh.value=!1},t=async p=>(Yn.value.length||await e(p),Yn.value);function r(p){if(!Yn.value)throw new Error("Data not stored yet");const w=Oa(Yn.value,p,["name","description"]);return p!==""?w:Yn.value}const o=p=>{by.value=p},a=p=>{Nt.value=Ra.cloneDeep(p)},c=async p=>await Mn.getTeam(p),d=async()=>{if(Nt.value!=null){const p=await Mn.createTeam(Nt.value);return p!=null&&p.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Team"})),Xc&&Yn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(ve.value=!0,Nt.value&&Nt.value.__id){const p=await Mn.updateTeam(Nt.value);if(Xc&&(p!=null&&p.data.__id)){const w=Yn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Yn.value[w]=p.data,n.success($.global.t("toast.success.update_success",{entity:"Team"}))):n.error($.global.t("toast.error.update_failed",{entity:"Team"})),p.data}}else n.error($.global.t("toast.error.update_failed",{entity:"Team"}))},m=async()=>{if(Nt.value&&Nt.value.created_at&&(await Mn.deactivateTeam(Nt.value.__id),Xc)){const p=Yn.value.findIndex(w=>{var C;return w.__id===((C=Nt.value)==null?void 0:C.__id)});if(p!==-1)return Yn.value.splice(p,1),Nt.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Team"}))}};async function g(p){var w;if(ve.value=!0,(w=Nt.value)!=null&&w.__id)if(Zi.value.findIndex(T=>T.__id===p.__id)===-1)try{const T=await Mn.linkManageUser(Nt.value.__id,{team:Nt.value.__id,user:p.__id,role:"string",joined_at:"string",comments:"string"}),k=await Mn.getTeamUserList(Nt.value.__id);return k&&(Zi.value=k),n.success($.global.t("toast.success.link_success",{entity:"User"})),T}catch(T){console.error(T),n.error($.global.t("toast.error.link_failed",{entity:"User"}))}finally{ve.value=!1}else n.info($.global.t("toast.info.already_linked",{entity:"User"}));else console.warn("No item selected or item ID is missing."),n.info($.global.t("toast.info.select_valid_item"));ve.value=!1}async function v(p){if(ve.value=!0,Nt.value&&Nt.value.__id){const w=Zi.value.findIndex(C=>C.__id===p);if(w!==-1)return await Mn.unlinkManageUser(Nt.value.__id,p),Zi.value.splice(w,1),ve.value=!1,Zi.value;throw new Error("Item not found to remove")}ve.value=!1}return{data:Yn,loading:fh,columns:by,item:Nt,usersTeam:Zi,__init__:e,getData:t,filterData:r,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,linkUser:g,unlinkUser:v}},BT=l.defineComponent({__name:"GlobalScopeFilter",setup(n){var T,k,I;const{openDialog:e}=Ms("global-scope__J-"),{user:t,scope:r,session:o,setScope:a}=vu(),{getData:c,data:d}=xT(),{getData:h,data:m}=UT(),g=l.ref(!1);l.onBeforeMount(async()=>{g.value=!0,await c(),await h(),g.value=!1});const v=l.ref({scope_type:(T=r.value)==null?void 0:T.scope_type,organization:((k=r.value)==null?void 0:k.organization)??"org",team:(I=r.value)==null?void 0:I.team});function p(){var N,D,L;v.value={...r.value,scope_type:(N=r.value)==null?void 0:N.scope_type,organization:((D=r.value)==null?void 0:D.organization)??"",team:(L=r.value)==null?void 0:L.team},e()}const w=l.computed(()=>{var N;switch((N=r.value)==null?void 0:N.scope_type){case"user":return BF;case"org":return xF;case"team":return FF;default:return UF}});async function C(){var N;((N=r.value)==null?void 0:N.scope_type)!==""&&a(v.value)}return(N,D)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(it.VBtn,{onClick:p,icon:"",class:"text-secondary",color:"surface",rounded:"sm",size:"small",variant:"flat"},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(w.value),{size:"20"}))]),_:1}),l.createVNode(l.unref(Ls),{loading:g.value,title:l.unref($).global.t("dialogs.scope.title"),"dd-id":"global-scope__J-",onOnSave:C},{default:l.withCtx(()=>[l.createElementVNode("div",null,[l.createVNode(Qe.VRow,null,{default:l.withCtx(()=>[l.createVNode(Qe.VCol,{cols:"4",class:"d-flex flex-row align-center"},{default:l.withCtx(()=>[l.createVNode(Qt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.user")),1)]),_:1}),l.createVNode(Qt.VListItemSubtitle,null,{default:l.withCtx(()=>{var L;return[l.createTextVNode(l.toDisplayString(((L=l.unref(t))==null?void 0:L.name)||l.unref($).global.t("dialogs.scope.unknownUser")),1)]}),_:1})]),_:1})]),_:1}),l.createVNode(Qe.VCol,{cols:"4"},{default:l.withCtx(()=>[l.createVNode(Qt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.environment")),1)]),_:1}),l.createVNode(Qt.VListItemSubtitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o).domain),1)]),_:1})]),_:1})]),_:1}),l.createVNode(Qe.VCol,{cols:"4"},{default:l.withCtx(()=>[l.createVNode(Qt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.environment")),1)]),_:1}),l.createVNode(Qt.VListItemSubtitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o).environment),1)]),_:1})]),_:1})]),_:1})]),_:1}),l.createVNode(IO.VBtnToggle,{density:"compact",variant:"outlined",modelValue:v.value.scope_type,"onUpdate:modelValue":D[0]||(D[0]=L=>v.value.scope_type=L),class:"d-flex justify-center my-4"},{default:l.withCtx(()=>[l.createVNode(it.VBtn,{value:"org",label:l.unref($).global.t("dialogs.scope.organizational"),color:"secondary"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.organizational")),1)]),_:1},8,["label"]),l.createVNode(it.VBtn,{value:"team",label:l.unref($).global.t("dialogs.scope.team"),color:"secondary"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.team")),1)]),_:1},8,["label"]),l.createVNode(it.VBtn,{value:"user",label:l.unref($).global.t("dialogs.scope.user"),color:"secondary"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.user")),1)]),_:1},8,["label"]),l.createVNode(it.VBtn,{value:"",label:l.unref($).global.t("dialogs.scope.none"),color:"lightext"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.none")),1)]),_:1},8,["label"])]),_:1},8,["modelValue"]),l.createElementVNode("div",null,[l.createVNode(ys.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.organization")),1)]),_:1}),l.createVNode(ls.VSelect,{items:l.unref(d),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:l.unref($).global.t("dialogs.scope.selectOrganization"),class:"min-w-50",modelValue:v.value.organization,"onUpdate:modelValue":D[1]||(D[1]=L=>v.value.organization=L),clearable:""},null,8,["items","placeholder","modelValue"]),l.createVNode(ys.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.team")),1)]),_:1}),l.createVNode(ls.VSelect,{items:l.unref(m),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:l.unref($).global.t("dialogs.scope.selectTeam"),class:"min-w-50",modelValue:v.value.team,"onUpdate:modelValue":D[2]||(D[2]=L=>v.value.team=L),clearable:""},null,8,["items","placeholder","modelValue"])])])]),_:1},8,["loading","title"])],64))}}),b$={},I$={class:"double-ring-spinner-container"};function S$(n,e){return l.openBlock(),l.createElementBlock("div",I$,e[0]||(e[0]=[l.createElementVNode("div",{class:"spinner-loading"},[l.createElementVNode("div"),l.createElementVNode("div"),l.createElementVNode("div",null,[l.createElementVNode("div")]),l.createElementVNode("div",null,[l.createElementVNode("div")])],-1)]))}const FT=Sa(b$,[["render",S$],["__scopeId","data-v-00d7a69f"]]),A$={key:0,class:"_jspinner-overlay_jj"},VT=l.defineComponent({__name:"GlobalSpinner",setup(n){return(e,t)=>l.unref(ve)?(l.openBlock(),l.createElementBlock("div",A$,t[0]||(t[0]=[l.createElementVNode("div",{class:"j-double-ring-spinner-container"},[l.createElementVNode("div",{class:"j-global-spinner-loading"},[l.createElementVNode("div"),l.createElementVNode("div"),l.createElementVNode("div",null,[l.createElementVNode("div")]),l.createElementVNode("div",null,[l.createElementVNode("div")])])],-1)]))):l.createCommentVNode("",!0)}}),HT=l.defineComponent({__name:"SubMenu",props:{title:{}},setup(n,{expose:e}){return e({props:n}),(r,o)=>(l.openBlock(),l.createBlock(Qt.VListItem,{onClick:o[0]||(o[0]=()=>{}),density:"compact"},{append:l.withCtx(()=>[l.createVNode(l.unref(VF))]),default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(r.title),1)]),_:1}),l.createVNode(gf.VMenu,{activator:"parent","open-on-hover":"",submenu:"",density:"compact"},{default:l.withCtx(()=>[l.renderSlot(r.$slots,"default")]),_:3})]),_:3}))}}),k$=Object.freeze(Object.defineProperty({__proto__:null,AvatarPicture:fC,ColumnSettingsDialog:Uf,ConfirmDialog:dC,ContextMenu:mC,CopyButton:Bl,DeleteAllBtn:Cf,DotsMenu:uC,EditButton:lC,FormHeadless:GE,FormMetadata:ou,GlobalScopeFilter:BT,GlobalSpinner:VT,JAvatar:hC,JBtn:Oy,JDialog:Ls,JForm:WE,JIconBtn:Ry,JSelect:VE,JTextArea:HE,JTextField:gE,ParentCard:Kl,SearchFilter:Jl,SpinnerLoader:FT,SubMenu:HT,TabFormHeader:zE,TableAdvanced:XC,TableCard:Bf,TableCardsView:fE,TableHeader:ZC,UiTable:gC},Symbol.toStringTag,{value:"Module"})),N$=e0(),R$={transition:"Vue-Toastification__fade",maxToasts:20,newestOnTop:!0};let mh=!1;const gh=l.ref(!1),Jn=l.ref([]),Iy=l.ref([]),$t=l.ref(null),ea=l.ref([]),O$=()=>{const n=wr(),e=async p=>{gh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await Uo.getBranchList(w);C&&(Jn.value=C,mh=!0),gh.value=!1},t=async p=>(Jn.value.length||await e(p),Jn.value);function r(p){if(!Jn.value)throw new Error("Data not stored yet");const w=Oa(Jn.value,p,["name","description"]);return p!==""?w:Jn.value}const o=p=>{Iy.value=p},a=p=>{$t.value=Ra.cloneDeep(p)},c=async p=>await Uo.getBranch(p),d=async()=>{if($t.value!=null){const p=await Uo.createBranch($t.value);return p!=null&&p.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Branch"})),mh&&Jn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if($t.value&&$t.value.__id){const p=await Uo.updateBranch($t.value);if(mh&&p){const w=Jn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Jn.value[w]=p.data,n.success($.global.t("toast.success.update_success",{entity:"Branch"}))):n.error($.global.t("toast.error.update_failed",{entity:"Branch"})),p}}else n.error($.global.t("toast.error.update_failed",{entity:"Branch"}))},m=async()=>{if($t.value&&$t.value.created_at){await Uo.deactivateBranch($t.value.__id);const p=Jn.value.findIndex(w=>{var C;return w.__id===((C=$t.value)==null?void 0:C.__id)});if(p!==-1)return Jn.value.splice(p,1),$t.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Branch"}))}};async function g(p){ve.value=!0;try{if($t.value&&$t.value.__id){const w={...p,branch:$t.value.__id};if(!await Mn.updateTeam(w)){n.error($.global.t("toast.error.link_failed",{entity:"Team"}));return}if(ea.value.findIndex(k=>k.__id===p.__id)===-1)return n.success($.global.t("toast.success.link_success",{entity:"Team"})),ea.value.push(w),w;n.info($.global.t("toast.info.already_linked",{entity:"Team"}))}else throw new Error("Item is not defined")}catch(w){console.error(w)}finally{ve.value=!1}}async function v(p){if(ve.value=!0,$t.value&&$t.value.__id){const w={...p,branch:null};if(!await Mn.updateTeam(w))return;const T=ea.value.findIndex(k=>k.__id===p.__id);if(T!==-1)return ea.value.splice(T,1),ve.value=!1,ea.value;throw new Error("Item not found to remove")}ve.value=!1}return{data:Jn,columns:Iy,item:$t,loading:gh,__init__:e,getData:t,filterData:r,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,branchTeams:ea,linkTeam:g,unlinkTeam:v}};function P$(){const n=Da("https://api.jplan.com.br/management/division"),{error:e}=wr();return{async getDivisionList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Division"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getDivisionList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Division"}));return}},async createDivision(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Division"})),a}},async updateDivision(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e($.global.t("toast.error.update_failed",{entity:"Division"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Division"})),a}},async getDivision(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Division"})),new Error(a.data.error);return a.data}catch(a){throw console.error("Error in getDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Division"})),a}},async activateDivision(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"Division"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Division"})),a}},async deactivateDivision(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"Division"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Division"})),a}}}}const ca=P$();let ph=!1;const _h=l.ref(!1),Qn=l.ref([]),Sy=l.ref([]),Kt=l.ref(null),ta=l.ref([]),M$=()=>{const n=wr(),e=async p=>{_h.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await ca.getDivisionList(w);C&&(Qn.value=C,ph=!0),_h.value=!1},t=async p=>(Qn.value.length||await e(p),Qn.value);function r(p){if(!Qn.value)throw new Error("Data not stored yet");const w=Oa(Qn.value,p,["name","description"]);return p!==""?w:Qn.value}const o=p=>{Sy.value=p},a=p=>{Kt.value=Ra.cloneDeep(p)},c=async p=>await ca.getDivision(p),d=async()=>{if(Kt.value!=null){const p=await ca.createDivision(Kt.value);return p!=null&&p.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Division"})),ph&&Qn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(ve.value=!0,Kt.value&&Kt.value.__id){const p=await ca.updateDivision(Kt.value);if(ph&&(p!=null&&p.data.__id)){const w=Qn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Qn.value[w]=p.data,n.success($.global.t("toast.success.update_success",{entity:"Division"}))):n.error($.global.t("toast.error.update_failed",{entity:"Division"})),ve.value=!1,p}}else ve.value=!1,n.error($.global.t("toast.error.update_failed",{entity:"Division"}))},m=async()=>{if(ve.value=!0,Kt.value&&Kt.value.created_at){await ca.deactivateDivision(Kt.value.__id);const p=Qn.value.findIndex(w=>{var C;return w.__id===((C=Kt.value)==null?void 0:C.__id)});if(p!==-1)return Qn.value.splice(p,1),Kt.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Division"}))}ve.value=!1};async function g(p){ve.value=!0;try{if(Kt.value&&Kt.value.__id){const w={...p,division:Kt.value.__id};return await xo.updateOrg(w)?(ta.value.findIndex(k=>k.__id===p.__id)===-1?(n.success($.global.t("toast.success.link_success",{entity:"Organization"})),ta.value.push(w)):n.info($.global.t("toast.info.already_linked",{entity:"Organization"})),w):void 0}else throw new Error("Item is not defined")}catch(w){console.error(w)}finally{ve.value=!1}}async function v(p){if(ve.value=!0,Kt.value&&Kt.value.__id){const w={...p,division:null};if(!await xo.updateOrg(w))return;const T=ta.value.findIndex(k=>k.__id===p.__id);if(T!==-1)ta.value.splice(T,1);else throw new Error("Item not found to remove")}else throw new Error("Item is not defined");return ve.value=!1,ta.value}return{data:Qn,columns:Sy,item:Kt,loading:_h,__init__:e,filterData:r,getData:t,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,orgs:ta,linkDivision:g,unlinkDivision:v}};function D$(){const n=Da("https://api.jplan.com.br/management/user"),{error:e}=wr();return{async getManageUserList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getManageUserList:",r),e($.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async createManageUser(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"User"})),a}},async updateManageUser(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e($.global.t("toast.error.update_failed",{entity:"User"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"User"})),a}},async getManageUser(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(a.data.error);return a.data}catch(a){console.error("Error in getManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async activateManageUser(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"User"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"User"})),a}},async deactivateManageUser(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"User"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"User"})),a}}}}const la=D$();let vh=!1,yh=l.ref(!1);const Xn=l.ref([]),Ay=l.ref([]),Zn=l.ref(null),L$=l.ref(null),x$=l.ref([]),U$=()=>{const n=wr(),e=async g=>{yh.value=!0;const v=g?`_active eq true and ${g}`:"_active eq true",p=await la.getManageUserList(v);p&&(Xn.value=p,vh=!0),yh.value=!1},t=async g=>(Xn.value.length||await e(g),Xn.value);function r(g){if(!Xn.value)throw new Error("Data not stored yet");const v=Oa(Xn.value,g,["name","description"]);return g!==""?v:Xn.value}return{data:Xn,loading:yh,columns:Ay,item:Zn,filterData:r,__init__:e,getData:t,setColumns:g=>{Ay.value=g},setItem:g=>{Zn.value=Ra.cloneDeep(g)},getItem:async g=>await la.getManageUser(g),createItem:async()=>{if(Zn.value!=null){const g=crypto.randomUUID(),v=await la.createManageUser({...Zn.value,__id:g});return v!=null&&v.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"User"})),vh&&Xn.value.push(v.data)),v==null?void 0:v.data}},updateItem:async()=>{if(ve.value=!0,Zn.value&&Zn.value.created_at){const g=await la.updateManageUser(Zn.value);if(vh&&(g!=null&&g.data)){const v=Xn.value.findIndex(p=>p.__id===(g==null?void 0:g.data.__id));v!==-1?(Xn.value[v]=g==null?void 0:g.data,n.success($.global.t("toast.success.update_success",{entity:"User"}))):n.error($.global.t("toast.error.update_failed",{entity:"User"}))}return ve.value=!1,g==null?void 0:g.data}},removeItem:async()=>{if(Zn.value&&Zn.value.created_at){try{await la.deactivateManageUser(Zn.value.__id)}catch{n.error($.global.t("toast.error.deactivate_failed",{entity:"User"}));return}const g=Xn.value.findIndex(v=>{var p;return v.__id===((p=Zn.value)==null?void 0:p.__id)});if(g!==-1)return Xn.value.splice(g,1),n.success($.global.t("toast.success.deactivate_success",{entity:"User"})),Zn.value}},userOrg:L$,userTeams:x$}},Ch=Object.freeze({colNum:24,rowHeight:50,useCssTransforms:!0,responsive:!0,margin:[12,10]}),na=l.ref(!1),B$=l.ref([]);function F$(){const n=l.ref({...Ch,isResizable:!1,isDraggable:!1,useStyleCursor:!1,cursor:"default"});function e(){if(na.value=!na.value,n.value.isDraggable=na.value,n.value.isResizable=na.value,!na.value){n.value.useStyleCursor=!0,n.value.cursor="pointer";return}n.value.useStyleCursor=!1,n.value.cursor="move"}function t(){n.value={...Ch,isResizable:!1,isDraggable:!1,useStyleCursor:!1,cursor:"default"}}return{DEFAULT_CONFIG:Ch,config:n,layout:B$,edition:na,toggleEdit:e,resetLayout:t}}const V$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetTask-DBOPJn8Y.js"))),H$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetImage-DhplL-E6.js"))),$$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetShortcut-Dii5WJRf.js"))),K$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetSpacer-vOrBACiY.js"))),W$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetLabel-CVusUB7j.js"))),z$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetChartBar-ChMg_dbz.js"))),G$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetChartPie-C2AIgVQ2.js"))),q$={WidgetSpacer:K$,WidgetLabel:W$,WidgetTask:V$,WidgetImage:H$,WidgetShortcut:$$,WidgetChartBar:z$,WidgetChartPie:G$},j$={defaultI18n:!0},Y$=(n,e)=>{const t={...j$,...e};n.use(N$),n.use(nP,R$),t.defaultI18n&&n.use($),Object.entries(k$).forEach(([r,o])=>{n.component(r,o)}),Object.entries(AO).forEach(([r,o])=>{n.provide(r,o)})},J$={install:Y$};exports.ContextMenu=mC;exports.EmptyListImg=Lh;exports.EventBus=Hl;exports.FormHeadless=GE;exports.HttpCore=cF;exports.I18nMessages=Om;exports.SpinnerLoader=FT;exports.TableCardsView=fE;exports.TableHeader=ZC;exports.__spinner=ve;exports._export_sfc=Sa;exports._sfc_main=Ls;exports._sfc_main$1=gC;exports._sfc_main$10=Oy;exports._sfc_main$11=Cf;exports._sfc_main$12=lC;exports._sfc_main$13=Ry;exports._sfc_main$14=VE;exports._sfc_main$15=HE;exports._sfc_main$16=gE;exports._sfc_main$17=WE;exports._sfc_main$18=zE;exports._sfc_main$19=Kl;exports._sfc_main$2=XC;exports._sfc_main$20=hC;exports._sfc_main$21=fC;exports._sfc_main$22=HT;exports._sfc_main$23=BT;exports._sfc_main$24=VT;exports._sfc_main$3=Uf;exports._sfc_main$4=Bf;exports._sfc_main$5=Jl;exports._sfc_main$6=dC;exports._sfc_main$7=Bl;exports._sfc_main$8=uC;exports._sfc_main$9=ou;exports.branchInstance=Uo;exports.coreClient=Rm;exports.createToastInterface=ws;exports.dateFormat=us;exports.divisionInstance=ca;exports.filterQuery=Oa;exports.globalEventBus=yf;exports.i18n=$;exports.index=J$;exports.manageUserInstance=la;exports.msal=Gt;exports.orgInstance=xo;exports.provideToast=tP;exports.scopedClient=Da;exports.setupAuthGuard=_$;exports.teamInstance=Mn;exports.toastInjectionKey=$l;exports.useAuth=Nm;exports.useBranchStore=O$;exports.useCustomizer=i0;exports.useDashboardStore=F$;exports.useDialog=Ms;exports.useDivisionStore=M$;exports.useManageUserStore=U$;exports.useOrganizationStore=xT;exports.useSession=vu;exports.useTeamStore=UT;exports.useToast=wr;exports.widgets=q$;
|