1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,330257,e=>{"use strict";let t,s;var r,i,a,l,n,o=e.i(843476),d=e.i(111672),c=e.i(764205),u=e.i(135214),h=e.i(271645);let f=({setPage:e,defaultSelectedKey:t,sidebarCollapsed:s})=>{let{accessToken:r}=(0,u.default)(),[i,a]=(0,h.useState)(null),[l,n]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{(async()=>{if(!r)return console.log("[SidebarProvider] No access token, skipping UI settings fetch");try{console.log("[SidebarProvider] Fetching UI settings from /get/ui_settings");let e=await (0,c.getUISettings)(r);console.log("[SidebarProvider] UI settings response:",e),e?.values?.enabled_ui_pages_internal_users!==void 0?(console.log("[SidebarProvider] Setting enabled pages:",e.values.enabled_ui_pages_internal_users),a(e.values.enabled_ui_pages_internal_users)):console.log("[SidebarProvider] No enabled_ui_pages_internal_users in response (all pages visible by default)"),e?.values?.enable_projects_ui!==void 0&&n(!!e.values.enable_projects_ui)}catch(e){console.error("[SidebarProvider] Failed to fetch UI settings:",e)}})()},[r]),(0,o.jsx)(d.default,{setPage:e,defaultSelectedKey:t,collapsed:s,enabledPagesInternalUsers:i,enableProjectsUI:l})};var m=e.i(213970),g=e.i(708347);let x=async(e,t,s,r,i)=>{let a;(0,g.isAdminRole)(s)?(a="Admin"!=s&&"Admin Viewer"!=s?await (0,c.teamListCall)(e,r?.organization_id||null,t):await (0,c.teamListCall)(e,r?.organization_id||null),console.log(`givenTeams: ${a}`),i(a)):i([])};var p=e.i(936578),w=e.i(402874),y=e.i(757512),b=e.i(268004),v=e.i(797305),j=e.i(460294),N=e.i(702597),E=e.i(526612),C=e.i(596115),P=e.i(918290),S=e.i(2781),k=e.i(948401);e.i(247167);var M=e.i(931067);let A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M744 62H280c-35.3 0-64 28.7-64 64v768c0 35.3 28.7 64 64 64h464c35.3 0 64-28.7 64-64V126c0-35.3-28.7-64-64-64zm-8 824H288V134h448v752zM472 784a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"mobile",theme:"outlined"};var R=e.i(9583),_=h.forwardRef(function(e,t){return h.createElement(R.default,(0,M.default)({},e,{ref:t,icon:A}))}),F=e.i(771674),I=e.i(808613),z=e.i(311451),L=e.i(998573),O=e.i(212931),T=e.i(592968),U=e.i(898586),D=Object.defineProperty,B=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,V=(e,t,s)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Q=(e,t)=>{for(var s in t||(t={}))$.call(t,s)&&V(e,s,t[s]);if(B)for(var s of B(t))H.call(t,s)&&V(e,s,t[s]);return e},K=(e,t)=>{var s={};for(var r in e)$.call(e,r)&&0>t.indexOf(r)&&(s[r]=e[r]);if(null!=e&&B)for(var r of B(e))0>t.indexOf(r)&&H.call(e,r)&&(s[r]=e[r]);return s};(e=>{let t=class t{constructor(e,s,r,a){if(this.version=e,this.errorCorrectionLevel=s,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError("Version value out of range");if(a<-1||a>7)throw RangeError("Mask value out of range");this.size=4*e+17;let l=[];for(let e=0;e<this.size;e++)l.push(!1);for(let e=0;e<this.size;e++)this.modules.push(l.slice()),this.isFunction.push(l.slice());this.drawFunctionPatterns();const n=this.addEccAndInterleave(r);if(this.drawCodewords(n),-1==a){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);const s=this.getPenaltyScore();s<e&&(a=t,e=s),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(s,r){let i=e.QrSegment.makeSegments(s);return t.encodeSegments(i,r)}static encodeBinary(s,r){let i=e.QrSegment.makeBytes(s);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,n=40,o=-1,d=!0){let c,u;if(!(t.MIN_VERSION<=a&&a<=n&&n<=t.MAX_VERSION)||o<-1||o>7)throw RangeError("Invalid value");for(c=a;;c++){let s=8*t.getNumDataCodewords(c,r),i=l.getTotalBits(e,c);if(i<=s){u=i;break}if(c>=n)throw RangeError("Data too long")}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])d&&u<=8*t.getNumDataCodewords(c,e)&&(r=e);let h=[];for(let t of e)for(let e of(s(t.mode.modeBits,4,h),s(t.numChars,t.mode.numCharCountBits(c),h),t.getData()))h.push(e);i(h.length==u);let f=8*t.getNumDataCodewords(c,r);i(h.length<=f),s(0,Math.min(4,f-h.length),h),s(0,(8-h.length%8)%8,h),i(h.length%8==0);for(let e=236;h.length<f;e^=253)s(e,8,h);let m=[];for(;8*m.length<h.length;)m.push(0);return h.forEach((e,t)=>m[t>>>3]|=e<<7-(7&t)),new t(c,r,m,o)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let s=0;s<t;s++)for(let r=0;r<t;r++)(0!=s||0!=r)&&(0!=s||r!=t-1)&&(s!=t-1||0!=r)&&this.drawAlignmentPattern(e[s],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,s=t;
vendor: 9,815 bytes, line 1
1for(let e=0;e<10;e++)s=s<<1^(s>>>9)*1335;let a=(t<<10|s)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let s=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,s),this.setFunctionModule(a,i,s)}}drawFinderPattern(e,t){for(let s=-4;s<=4;s++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(s)),a=e+r,l=t+s;0<=a&&a<this.size&&0<=l&&l<this.size&&this.setFunctionModule(a,l,2!=i&&4!=i)}}drawAlignmentPattern(e,t){for(let s=-2;s<=2;s++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+s,1!=Math.max(Math.abs(r),Math.abs(s)))}setFunctionModule(e,t,s){this.modules[t][e]=s,this.isFunction[t][e]=!0}addEccAndInterleave(e){let s=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(s,r))throw RangeError("Invalid argument");let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][s],l=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][s],n=Math.floor(t.getNumRawDataModules(s)/8),o=a-n%a,d=Math.floor(n/a),c=[],u=t.reedSolomonComputeDivisor(l);for(let s=0,r=0;s<a;s++){let i=e.slice(r,r+d-l+(s<o?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,u);s<o&&i.push(0),c.push(i.concat(a))}let h=[];for(let e=0;e<c[0].length;e++)c.forEach((t,s)=>{(e!=d-l||s>=o)&&h.push(t[e])});return i(h.length==n),h}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError("Invalid argument");let s=0;for(let t=this.size-1;t>=1;t-=2){6==t&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let l=t-a,n=(t+1&2)==0?this.size-1-i:i;!this.isFunction[n][l]&&s<8*e.length&&(this.modules[n][l]=r(e[s>>>3],7-(7&s)),s++)}}i(s==8*e.length)}applyMask(e){if(e<0||e>7)throw RangeError("Mask value out of range");for(let t=0;t<this.size;t++)for(let s=0;s<this.size;s++){let r;switch(e){case 0:r=(s+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=s%3==0;break;case 3:r=(s+t)%3==0;break;case 4:r=(Math.floor(s/3)+Math.floor(t/2))%2==0;break;case 5:r=s*t%2+s*t%3==0;break;case 6:r=(s*t%2+s*t%3)%2==0;break;case 7:r=((s+t)%2+s*t%3)%2==0;break;default:throw Error("Unreachable")}!this.isFunction[t][s]&&r&&(this.modules[t][s]=!this.modules[t][s])}}getPenaltyScore(){let e=0;for(let s=0;s<this.size;s++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let l=0;l<this.size;l++)this.modules[s][l]==r?5==++i?e+=t.PENALTY_N1:i>5&&e++:(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[s][l],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let s=0;s<this.size;s++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let l=0;l<this.size;l++)this.modules[l][s]==r?5==++i?e+=t.PENALTY_N1:i>5&&e++:(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[l][s],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let s=0;s<this.size-1;s++)for(let r=0;r<this.size-1;r++){let i=this.modules[s][r];i==this.modules[s][r+1]&&i==this.modules[s+1][r]&&i==this.modules[s+1][r+1]&&(e+=t.PENALTY_N2)}let s=0;for(let e of this.modules)s=e.reduce((e,t)=>e+ +!!t,s);let r=this.size*this.size,a=Math.ceil(Math.abs(20*s-10*r)/r)-1;return i(0<=a&&a<=9),i(0<=(e+=a*t.PENALTY_N4)&&e<=2568888),e}getAlignmentPatternPositions(){if(1==this.version)return[];{let e=Math.floor(this.version/7)+2,t=32==this.version?26:2*Math.ceil((4*this.version+4)/(2*e-2)),s=[6];for(let r=this.size-7;s.length<e;r-=t)s.splice(1,0,r);return s}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError("Version number out of range");let s=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;s-=(25*t-10)*t-55,e>=7&&(s-=36)}return i(208<=s&&s<=29648),s}static getNumDataCodewords(e,s){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[s.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError("Degree out of range");let s=[];for(let t=0;t<e-1;t++)s.push(0);s.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<s.length;e++)s[e]=t.reedSolomonMultiply(s[e],r),e+1<s.length&&(s[e]^=s[e+1]);r=t.reedSolomonMultiply(r,2)}return s}static reedSolomonComputeRemainder(e,s){let r=s.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),s.forEach((s,i)=>r[i]^=t.reedSolomonMultiply(s,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8!=0||t>>>8!=0)throw RangeError("Byte out of range");let s=0;for(let r=7;r>=0;r--)s=s<<1^(s>>>7)*285^(t>>>r&1)*e;return i(s>>>8==0),s}finderPenaltyCountPatterns(e){let t=e[1];i(t<=3*this.size);let s=t>0&&e[2]==t&&e[3]==3*t&&e[4]==t&&e[5]==t;return(s&&e[0]>=4*t&&e[6]>=t?1:0)+(s&&e[6]>=4*t&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,s){return e&&(this.finderPenaltyAddHistory(t,s),t=0),t+=this.size,this.finderPenaltyAddHistory(t,s),this.finderPenaltyCountPatterns(s)}finderPenaltyAddHistory(e,t){0==t[0]&&(e+=this.size),t.pop(),t.unshift(e)}};function s(e,t,s){if(t<0||t>31||e>>>t!=0)throw RangeError("Value out of range");for(let r=t-1;r>=0;r--)s.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error("Assertion error")}t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;let a=class e{constructor(e,t,s){if(this.mode=e,this.numChars=t,this.bitData=s,t<0)throw RangeError("Invalid argument");this.bitData=s.slice()}static makeBytes(t){let r=[];for(let e of t)s(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError("String contains non-numeric characters");let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);s(parseInt(t.substring(e,e+i),10),3*i+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){let r;if(!e.isAlphanumeric(t))throw RangeError("String contains unencodable characters in alphanumeric mode");let i=[];for(r=0;r+2<=t.length;r+=2){let a=45*e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(r));s(a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(r+1)),11,i)}return r<t.length&&s(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(r)),6,i),new e(e.Mode.ALPHANUMERIC,t.length,i)}static makeSegments(t){return""==t?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError("ECI assignment value out of range");if(t<128)s(t,8,r);else if(t<16384)s(2,2,r),s(t,14,r);else if(t<1e6)s(6,3,r),s(t,21,r);else throw RangeError("ECI assignment value out of range");return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let s=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;s+=4+e+r.bitData.length}return s}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let s=0;s<e.length;s++)"%"!=e.charAt(s)?t.push(e.charCodeAt(s)):(t.push(parseInt(e.substring(s+1,s+3),16)),s+=2);return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let l=a;e.QrSegment=a})(n||(n={})),i=(r=n||(n={})).QrCode||(r.QrCode={}),(t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}}).LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),i.Ecc=t,l=(a=n||(n={})).QrSegment||(a.QrSegment={}),(s=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}}).NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),l.Mode=s;var W=n,Y={L:W.QrCode.Ecc.LOW,M:W.QrCode.Ecc.MEDIUM,Q:W.QrCode.Ecc.QUARTILE,H:W.QrCode.Ecc.HIGH},G="#FFFFFF",X="#000000";function J(e,t=0){let s=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,l){if(!a&&null!==i){s.push(`M${i+t} ${r+t}h${l-i}v1H${i+t}z`),i=null;return}if(l===e.length-1){if(!a)return;null===i?s.push(`M${l+t},${r+t} h1v1H${l+t}z`):s.push(`M${i+t},${r+t} h${l+1-i}v1H${i+t}z`);return}a&&null===i&&(i=l)})}),s.join("")}function q(e,t){return e.slice().map((e,s)=>s<t.y||s>=t.y+t.h?e:e.map((e,s)=>(s<t.x||s>=t.x+t.w)&&e))}function Z({value:e,level:t,minVersion:s,includeMargin:r,marginSize:i,imageSettings:a,size:l,boostLevel:n}){let o=h.default.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>
1(e.push(...W.QrSegment.makeSegments(t)),e),[]);return W.QrCode.encodeSegments(r,Y[t],s,void 0,void 0,n)},[e,t,s,n]),{cells:d,margin:c,numCells:u,calculatedImageSettings:f}=h.default.useMemo(()=>{let e=o.getModules(),t=null!=i?Math.max(Math.floor(i),0):4*!!r,s=e.length+2*t,n=function(e,t,s,r){if(null==r)return null;let i=e.length+2*s,a=Math.floor(.1*t),l=i/t,n=(r.width||a)*l,o=(r.height||a)*l,d=null==r.x?e.length/2-n/2:r.x*l,c=null==r.y?e.length/2-o/2:r.y*l,u=null==r.opacity?1:r.opacity,h=null;if(r.excavate){let e=Math.floor(d),t=Math.floor(c),s=Math.ceil(n+d-e),r=Math.ceil(o+c-t);h={x:e,y:t,w:s,h:r}}return{x:d,y:c,h:o,w:n,excavation:h,opacity:u,crossOrigin:r.crossOrigin}}(e,l,t,a);return{cells:e,margin:t,numCells:s,calculatedImageSettings:n}},[o,l,a,r,i]);return{qrcode:o,margin:c,cells:d,numCells:u,calculatedImageSettings:f}}var ee=function(){try{new Path2D().addPath(new Path2D)}catch(e){return!1}return!0}();h.default.forwardRef(function(e,t){let{value:s,size:r=128,level:i="L",bgColor:a=G,fgColor:l=X,includeMargin:n=!1,minVersion:o=1,boostLevel:d,marginSize:c,imageSettings:u}=e,f=K(e,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:m}=f,g=K(f,["style"]),x=null==u?void 0:u.src,p=h.default.useRef(null),w=h.default.useRef(null),y=h.default.useCallback(e=>{p.current=e,"function"==typeof t?t(e):t&&(t.current=e)},[t]),[b,v]=h.default.useState(!1),{margin:j,cells:N,numCells:E,calculatedImageSettings:C}=Z({value:s,level:i,minVersion:o,boostLevel:d,includeMargin:n,marginSize:c,imageSettings:u,size:r});h.default.useEffect(()=>{if(null!=p.current){let e=p.current,t=e.getContext("2d");if(!t)return;let s=N,i=w.current,n=null!=C&&null!==i&&i.complete&&0!==i.naturalHeight&&0!==i.naturalWidth;n&&null!=C.excavation&&(s=q(N,C.excavation));let o=window.devicePixelRatio||1;e.height=e.width=r*o;let d=r/E*o;t.scale(d,d),t.fillStyle=a,t.fillRect(0,0,E,E),t.fillStyle=l,ee?t.fill(new Path2D(J(s,j))):N.forEach(function(e,s){e.forEach(function(e,r){e&&t.fillRect(r+j,s+j,1,1)})}),C&&(t.globalAlpha=C.opacity),n&&t.drawImage(i,C.x+j,C.y+j,C.w,C.h)}}),h.default.useEffect(()=>{v(!1)},[x]);let P=Q({height:r,width:r},m),S=null;return null!=x&&(S=h.default.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{v(!0)},ref:w,crossOrigin:null==C?void 0:C.crossOrigin})),h.default.createElement(h.default.Fragment,null,h.default.createElement("canvas",Q({style:P,height:r,width:r,ref:y,role:"img"},g)),S)}).displayName="QRCodeCanvas";var et=h.default.forwardRef(function(e,t){let{value:s,size:r=128,level:i="L",bgColor:a=G,fgColor:l=X,includeMargin:n=!1,minVersion:o=1,boostLevel:d,title:c,marginSize:u,imageSettings:f}=e,m=K(e,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:g,cells:x,numCells:p,calculatedImageSettings:w}=Z({value:s,level:i,minVersion:o,boostLevel:d,includeMargin:n,marginSize:u,imageSettings:f,size:r}),y=x,b=null;null!=f&&null!=w&&(null!=w.excavation&&(y=q(x,w.excavation)),b=h.default.createElement("image",{href:f.src,height:w.h,width:w.w,x:w.x+g,y:w.y+g,preserveAspectRatio:"none",opacity:w.opacity,crossOrigin:w.crossOrigin}));let v=J(y,g);return h.default.createElement("svg",Q({height:r,width:r,viewBox:`0 0 ${p} ${p}`,ref:t,role:"img"},m),!!c&&h.default.createElement("title",null,c),h.default.createElement("path",{fill:a,d:`M0,0 h${p}v${p}H0z`,shapeRendering:"crispEdges"}),h.default.createElement("path",{fill:l,d:v,shapeRendering:"crispEdges"}),b)});et.displayName="QRCodeSVG";var es=e.i(852351);function er({value:e,onChange:t,onComplete:s,disabled:r}){let i=(0,h.useRef)([]);return(0,o.jsx)("div",{className:"flex gap-2 justify-center",children:e.map((a,l)=>(0,o.jsx)("input",{ref:e=>{i.current[l]=e},type:"text",inputMode:"numeric",maxLength:6,value:a,disabled:r,autoFocus:0===l,onChange:r=>((r,a)=>{if(a.length>1){let r=a.replace(/\D/g,"").slice(0,6);if(r.length>0){let a=[...e];for(let e=0;e<6;e++)a[e]=r[e]||"";t(a);let l=Math.min(r.length,5);i.current[l]?.focus(),6===r.length&&s?.(r)}return}let l=a.replace(/\D/g,"").slice(-1),n=[...e];if(n[r]=l,t(n),l&&r<5&&i.current[r+1]?.focus(),l&&5===r){let e=n.join("");/^\d{6}$/.test(e)&&s?.(e)}})(l,r.target.value),onKeyDown:s=>((s,r)=>{if("Backspace"===r.key){if(e[s]){let r=[...e];r[s]="",t(r)}else if(s>0){i.current[s-1]?.focus();let r=[...e];r[s-1]="",t(r)}}else"ArrowLeft"===r.key&&s>0?i.current[s-1]?.focus():"ArrowRight"===r.key&&s<5&&i.current[s+1]?.focus()})(l,s),onFocus:e=>e.target.select(),className:["text-center text-xl font-semibold font-mono border rounded-xl outline-none transition-all duration-150 bg-gray-50 text-gray-900 caret-indigo-500",a?"border-indigo-400 bg-white shadow-[0_0_0_3px_rgba(99,102,241,0.12)]":"border-gray-200","focus:border-indigo-500 focus:bg-white focus:shadow-[0_0_0_3px_rgba(99,102,241,0.15)] disabled:opacity-50 disabled:cursor-not-allowed"].join(" "),style:{height:"52px",width:"44px"}},l))})}let{Text:ei}=U.Typography;async function ea(e,t,s){let r=(0,c.buildApiUrl)("/email/set-password"),i=await (0,es.apiFetch)(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({password:t,confirm_password:s})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.detail||e?.message||"Failed to set password")}return i.json()}async function el(e){let t=(0,c.buildApiUrl)("/2fa/status"),s=await (0,es.apiFetch)(t,{headers:{Authorization:`Bearer ${e}`}});if(!s.ok)throw Error("Failed to fetch 2FA status");return s.json()}async function en(e){let t=(0,c.buildApiUrl)("/2fa/setup"),s=await (0,es.apiFetch)(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error(e?.detail||e?.message||"Failed to setup 2FA")}return s.json()}async function eo(e,t){let s=(0,c.buildApiUrl)("/2fa/setup/confirm"),r=await (0,es.apiFetch)(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({totp_code:t})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e?.detail||e?.message||"Invalid code")}}async function ed(e,t){let s=(0,c.buildApiUrl)("/2fa/disable"),r=await (0,es.apiFetch)(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({totp_code:t})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e?.detail||e?.message||"Invalid code")}}function ec({userId:e,userEmail:t}){let{t:s}=(0,P.useI18n)();return(0,o.jsxs)("div",{className:"space-y-3",children:[(0,o.jsxs)("div",{className:"flex items-center gap-4 px-4 py-3.5 rounded-xl bg-gray-50 border border-gray-100",children:[(0,o.jsx)("div",{className:"w-8 h-8 rounded-lg bg-white border border-gray-200 flex items-center justify-center shrink-0 shadow-sm",children:(0,o.jsx)(k.MailOutlined,{className:"text-gray-400",style:{fontSize:13}})}),(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsx)("p",{className:"text-xs text-gray-400 mb-0.5",children:s("userDropdown.userEmail")}),(0,o.jsx)("p",{className:"text-sm font-medium text-gray-800 truncate",children:t||"â"})]})]}),(0,o.jsxs)("div",{className:"flex items-center gap-4 px-4 py-3.5 rounded-xl bg-gray-50 border border-gray-100",children:[(0,o.jsx)("div",{className:"w-8 h-8 rounded-lg bg-white border border-gray-200 flex items-center justify-center shrink-0 shadow-sm",children:(0,o.jsx)(F.UserOutlined,{className:"text-gray-400",style:{fontSize:13}})}),(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsx)("p",{className:"text-xs text-gray-400 mb-0.5",children:s("userDropdown.userId")}),(0,o.jsx)(T.Tooltip,{title:e||"â",children:(0,o.jsx)(ei,{copyable:!!e&&{text:e,tooltips:[s("userDropdown.copyUserId"),"Copied"]},className:"font-mono text-sm text-indigo-600 bg-indigo-50 px-2 py-0.5 rounded-md border border-indigo-100 inline-block max-w-full truncate",children:e?e.length>24?`${e.slice(0,12)}â¦${e.slice(-6)}`:e:"â"})})]})]})]})}function eu({accessToken:e}){let{t}=(0,P.useI18n)(),[s]=I.Form.useForm(),[r,i]=(0,h.useState)(!1),[a,l]=(0,h.useState)(!1),[n,d]=(0,h.useState)(!1),[c,u]=(0,h.useState)("idle"),[f,m]=(0,h.useState)(""),[g,x]=(0,h.useState)(!1),[p,w]=(0,h.useState)(["","","","","",""]),[y,b]=(0,h.useState)(null);(0,h.useEffect)(()=>{e&&el(e).then(e=>d(e.is_enabled)).catch(()=>{})},[e]);let v=()=>{w(["","","","","",""]),b(null)},j=async r=>{if(e){i(!0);try{await ea(e,r.password,r.confirm_password),L.message.success(t("userProfile.passwordSuccess")),s.resetFields(),l(!1)}catch(e){L.message.error(e instanceof Error?e.message:t("userProfile.passwordFailed"))}finally{i(!1)}}},N=async()=>
1{if(e){x(!0);try{let t=await en(e);m(t.provisioning_uri),u("setup-qr")}catch(e){L.message.error(e instanceof Error?e.message:t("userProfile.twoFASetupFailed"))}finally{x(!1)}}},E=async s=>{if(e&&!g){x(!0),b(null);try{await eo(e,s),d(!0),v(),u("idle"),L.message.success(t("userProfile.twoFAEnabledSuccess"))}catch(e){b(e instanceof Error?e.message:t("userProfile.twoFAInvalidCode")),w(["","","","","",""])}finally{x(!1)}}},C=async s=>{if(e&&!g){x(!0),b(null);try{await ed(e,s),d(!1),u("idle"),v(),L.message.success(t("userProfile.twoFADisabledSuccess"))}catch(e){b(e instanceof Error?e.message:t("userProfile.twoFAInvalidCode")),w(["","","","","",""])}finally{x(!1)}}},k=()=>{u("idle"),v()},M=6===p.join("").length&&/^\d{6}$/.test(p.join(""));return(0,o.jsxs)("div",{className:"space-y-3",children:[(0,o.jsxs)("div",{className:"flex items-center gap-4 px-4 py-3.5 rounded-xl bg-gray-50 border border-gray-100",children:[(0,o.jsx)("div",{className:"w-8 h-8 rounded-lg bg-white border border-gray-200 flex items-center justify-center shrink-0 shadow-sm",children:(0,o.jsx)(S.LockOutlined,{className:"text-gray-400",style:{fontSize:13}})}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)("p",{className:"text-sm font-medium text-gray-800 leading-tight",children:t("userProfile.password")}),(0,o.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:t("userProfile.passwordDesc")})]}),(0,o.jsx)("button",{onClick:()=>{l(!0),s.resetFields()},className:"shrink-0 text-xs font-medium text-indigo-600 hover:text-indigo-700 bg-indigo-50 hover:bg-indigo-100 px-3 py-1.5 rounded-lg transition-colors",children:t("userProfile.passwordUpdate")})]}),(0,o.jsxs)("div",{className:"flex items-center gap-4 px-4 py-3.5 rounded-xl bg-gray-50 border border-gray-100",children:[(0,o.jsx)("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 border shadow-sm ${n?"bg-green-50 border-green-100":"bg-white border-gray-200"}`,children:(0,o.jsx)(_,{className:n?"text-green-500":"text-gray-400",style:{fontSize:13}})}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("p",{className:"text-sm font-medium text-gray-800 leading-tight",children:t("userProfile.twoFAApp")}),n&&(0,o.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-green-600 bg-green-50 border border-green-100 px-1.5 py-0.5 rounded-full",children:[(0,o.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 inline-block"}),t("userProfile.twoFAEnabled")]})]}),(0,o.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:t("userProfile.twoFAHint")})]}),(0,o.jsx)("button",{onClick:n?()=>u("disable-verify"):N,disabled:g&&"idle"===c,className:`shrink-0 text-xs font-medium px-3 py-1.5 rounded-lg transition-colors disabled:opacity-50 ${n?"text-red-600 hover:text-red-700 bg-red-50 hover:bg-red-100":"text-indigo-600 hover:text-indigo-700 bg-indigo-50 hover:bg-indigo-100"}`,children:g&&"idle"===c?(0,o.jsxs)("svg",{className:"w-3.5 h-3.5 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,o.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,o.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):n?t("userProfile.twoFADisable"):t("userProfile.twoFAEnable")})]}),(0,o.jsx)(O.Modal,{open:a,onCancel:()=>{l(!1),s.resetFields()},footer:null,title:t("userProfile.passwordUpdate"),centered:!0,width:400,children:(0,o.jsx)("div",{className:"py-2",children:(0,o.jsxs)(I.Form,{form:s,layout:"vertical",onFinish:j,children:[(0,o.jsx)(I.Form.Item,{name:"password",label:(0,o.jsx)("span",{className:"text-sm text-gray-600",children:t("userProfile.passwordNew")}),rules:[{required:!0,message:t("userProfile.passwordRequired")},{min:8,message:t("userProfile.passwordMin")}],children:(0,o.jsx)(z.Input.Password,{prefix:(0,o.jsx)(S.LockOutlined,{className:"text-gray-300"}),placeholder:t("userProfile.passwordNewPlaceholder"),size:"large"})}),(0,o.jsx)(I.Form.Item,{name:"confirm_password",label:(0,o.jsx)("span",{className:"text-sm text-gray-600",children:t("userProfile.passwordConfirm")}),dependencies:["password"],rules:[{required:!0,message:t("userProfile.passwordConfirmRequired")},({getFieldValue:e})=>({validator:(s,r)=>r&&e("password")!==r?Promise.reject(Error(t("userProfile.passwordMismatch"))):Promise.resolve()})],children:(0,o.jsx)(z.Input.Password,{prefix:(0,o.jsx)(S.LockOutlined,{className:"text-gray-300"}),placeholder:t("userProfile.passwordConfirmPlaceholder"),size:"large"})}),(0,o.jsx)(I.Form.Item,{className:"mb-0",children:(0,o.jsxs)("button",{type:"submit",disabled:r,className:"relative w-full h-11 rounded-lg font-medium text-white overflow-hidden group transition-all duration-200 bg-indigo-500 hover:bg-indigo-600 disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,o.jsxs)("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[r&&(0,o.jsxs)("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,o.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,o.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),t("userProfile.passwordSave")]}),(0,o.jsx)("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/30 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-500 ease-out"})]})})]})})}),(0,o.jsx)(O.Modal,{open:"setup-qr"===c,onCancel:k,footer:null,centered:!0,width:400,title:(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("div",{className:"w-7 h-7 rounded-lg bg-indigo-50 flex items-center justify-center",children:(0,o.jsx)("svg",{className:"w-4 h-4 text-indigo-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})})}),(0,o.jsx)("span",{children:t("userProfile.twoFASetupTitle")})]}),children:(0,o.jsxs)("div",{className:"py-2 space-y-4",children:[(0,o.jsx)("p",{className:"text-sm text-gray-500",children:t("userProfile.twoFASetupDesc")}),(0,o.jsx)("div",{className:"flex justify-center py-2",children:(0,o.jsx)("div",{className:"p-3 bg-white border border-gray-200 rounded-xl inline-block shadow-sm",children:(0,o.jsx)(et,{value:f||"otpauth://totp/placeholder",size:160})})}),(0,o.jsxs)("button",{onClick:()=>{v(),u("setup-verify")},className:"relative w-full h-11 rounded-lg font-medium text-white overflow-hidden group transition-all duration-200 bg-indigo-500 hover:bg-indigo-600",children:[(0,o.jsx)("span",{className:"relative z-10",children:t("userProfile.twoFANext")}),(0,o.jsx)("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/30 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-500 ease-out"})]})]})}),(0,o.jsx)(O.Modal,{open:"setup-verify"===c,onCancel:k,footer:null,centered:!0,width:400,title:(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("div",{className:"w-7 h-7 rounded-lg bg-indigo-50 flex items-center justify-center",children:(0,o.jsx)("svg",{className:"w-4 h-4 text-indigo-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})})}),(0,o.jsx)("span",{children:t("userProfile.twoFAVerifyTitle")})]}),children:(0,o.jsxs)("div",{className:"py-3 space-y-5",children:[(0,o.jsx)("p",{className:"text-sm text-gray-500",children:t("userProfile.twoFAVerifyDesc")}),(0,o.jsx)(er,{value:p,onChange:w,onComplete:E,disabled:g}),y&&(0,o.jsxs)("div",{className:"flex items-center gap-2 bg-red-50 border border-red-100 rounded-lg px-3 py-2",children:[(0,o.jsx)("svg",{className:"w-4 h-4 text-red-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75
1a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})}),(0,o.jsx)("p",{className:"text-red-600 text-sm",children:y})]}),(0,o.jsxs)("button",{onClick:()=>E(p.join("")),disabled:!M||g,className:"relative w-full h-11 rounded-lg font-medium text-white overflow-hidden group transition-all duration-200 bg-indigo-500 hover:bg-indigo-600 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-indigo-500",children:[(0,o.jsxs)("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[g&&(0,o.jsxs)("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,o.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,o.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),t("userProfile.twoFAConfirm")]}),(0,o.jsx)("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/30 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-500 ease-out"})]})]})}),(0,o.jsx)(O.Modal,{open:"disable-verify"===c,onCancel:k,footer:null,centered:!0,width:400,title:(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("div",{className:"w-7 h-7 rounded-lg bg-red-50 flex items-center justify-center",children:(0,o.jsx)("svg",{className:"w-4 h-4 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})})}),(0,o.jsx)("span",{children:t("userProfile.twoFADisableTitle")})]}),children:(0,o.jsxs)("div",{className:"py-3 space-y-5",children:[(0,o.jsx)("p",{className:"text-sm text-gray-500",children:t("userProfile.twoFADisableDesc")}),(0,o.jsx)(er,{value:p,onChange:w,onComplete:C,disabled:g}),y&&(0,o.jsxs)("div",{className:"flex items-center gap-2 bg-red-50 border border-red-100 rounded-lg px-3 py-2",children:[(0,o.jsx)("svg",{className:"w-4 h-4 text-red-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})}),(0,o.jsx)("p",{className:"text-red-600 text-sm",children:y})]}),(0,o.jsxs)("button",{onClick:()=>C(p.join("")),disabled:!M||g,className:"relative w-full h-11 rounded-lg font-medium text-white overflow-hidden group transition-all duration-200 bg-red-500 hover:bg-red-600 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-red-500",children:[(0,o.jsxs)("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[g&&(0,o.jsxs)("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,o.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,o.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),t("userProfile.twoFADisableBtn")]}),(0,o.jsx)("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/30 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-500 ease-out"})]})]})})]})}function eh(){let{t:e}=(0,P.useI18n)(),{userId:t,userEmail:s,accessToken:r,userRole:i}=(0,u.default)(),[a,l]=(0,h.useState)("profile"),n=[{key:"profile",label:e("userProfile.tabProfile"),icon:(0,o.jsx)(F.UserOutlined,{})},{key:"security",label:e("userProfile.tabSecurity"),icon:(0,o.jsx)(S.LockOutlined,{})}];return(0,o.jsxs)("div",{className:"w-full p-4 sm:p-8",children:[(0,o.jsxs)("div",{className:"mb-6",children:[(0,o.jsx)("h1",{className:"text-xl font-semibold text-gray-900",children:e("userProfile.accountSettings")}),(0,o.jsx)("p",{className:"text-sm text-gray-500 mt-0.5",children:e("userProfile.accountSettingsDesc")})]}),(0,o.jsxs)("div",{className:"bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden min-h-[420px]",children:[(0,o.jsx)("div",{className:"flex md:hidden border-b border-gray-100 px-3 pt-3 gap-1",children:n.map(e=>(0,o.jsxs)("button",{onClick:()=>l(e.key),className:`flex items-center gap-1.5 px-3 py-2 rounded-t-lg text-sm font-medium transition-colors ${a===e.ke
1y?"bg-indigo-50 text-[#6366f1] border-b-2 border-[#6366f1]":"text-gray-500 hover:text-gray-700"}`,children:[(0,o.jsx)("span",{children:e.icon}),(0,o.jsx)("span",{className:"hidden xs:inline",children:e.label})]},e.key))}),(0,o.jsxs)("div",{className:"flex",children:[(0,o.jsx)("div",{className:"hidden md:block w-48 border-r border-gray-100 p-3 flex-shrink-0",children:(0,o.jsx)("nav",{className:"space-y-0.5",children:n.map(e=>(0,o.jsxs)("button",{onClick:()=>l(e.key),className:`w-full flex items-center gap-2.5 px-3 py-2.5 rounded-lg text-sm font-medium transition-colors text-left ${a===e.key?"bg-indigo-50 text-[#6366f1]":"text-gray-600 hover:bg-gray-50 hover:text-gray-900"}`,children:[(0,o.jsx)("span",{className:a===e.key?"text-[#6366f1]":"text-gray-400",children:e.icon}),e.label]},e.key))})}),(0,o.jsxs)("div",{className:"flex-1 p-4 sm:p-8",children:[(0,o.jsx)("div",{className:"profile"===a?void 0:"hidden",children:(0,o.jsx)(ec,{userId:t,userEmail:s})}),(0,o.jsx)("div",{className:"security"===a?void 0:"hidden",children:(0,o.jsx)(eu,{accessToken:r})})]})]})]})]})}var ef=e.i(693569),em=e.i(936190),eg=e.i(275144),ex=e.i(91998),ep=e.i(463422),ew=e.i(714655),ey=e.i(202772),eb=e.i(811060),ev=e.i(161281),ej=e.i(705944),eN=e.i(947293),eE=e.i(618566),eC=e.i(592143),eP=e.i(368869);function eS(e,t="/"){document.cookie=`${e}=; Max-Age=0; Path=${t}`}function ek({onInvitationChange:e,onPageChange:t}){let s=(0,eE.useSearchParams)();return(0,h.useEffect)(()=>{e(s.get("invitation_id")),t(s.get("page")||"api-keys")},[s,e,t]),null}function eM(){let e=(0,eE.useRouter)();(0,eE.usePathname)(),(0,h.useEffect)(()=>{let t=(0,ej.getSiteMode)();("partner"===t||"business"===t)&&e.replace("/dashboard/reseller")},[e]);let[t,s]=(0,h.useState)(""),[r,i]=(0,h.useState)(!1),[a,l]=(0,h.useState)(!1),[n,d]=(0,h.useState)(null),[u,P]=(0,h.useState)(null),[S,k]=(0,h.useState)([]),[M,A]=(0,h.useState)([]),[R,_]=(0,h.useState)([]),[F,I]=(0,h.useState)({PROXY_BASE_URL:"",PROXY_LOGOUT_URL:""}),[z,L]=(0,h.useState)(!0),[O,T]=(0,h.useState)(()=>new URLSearchParams(window.location.search).get("invitation_id")),[U,D]=(0,h.useState)({data:[]}),[B,$]=(0,h.useState)(null),[H,V]=(0,h.useState)(!1),[Q,K]=(0,h.useState)(!0),[W,Y]=(0,h.useState)(!0),[G,X]=(0,h.useState)(null),[J,q]=(0,h.useState)(!0),[Z,ee]=(0,h.useState)(!1),[et,es]=(0,h.useState)(!1),[er,ei]=(0,h.useState)(!1),[ea,el]=(0,h.useState)(!1),[en,eo]=(0,h.useState)(!1),[ed,ec]=(0,h.useState)(()=>new URLSearchParams(window.location.search).get("page")||"api-keys"),eu=e=>{let t=new URLSearchParams(window.location.search);t.set("page",e),window.history.pushState(null,"",`/dashboard?${t.toString()}`),ec(e)},[eM,eA]=(0,h.useState)(null),[eR,e_]=(0,h.useState)(!1),[eF,eI]=(0,h.useState)(!1),ez=()=>eI(!1),eL=e=>{k(t=>t?[...t,e]:[e]),V(()=>!H)},eO=!1===Q&&null===B&&null===O;return((0,h.useEffect)(()=>{let e=!1;return(async()=>{try{await (0,c.getUiConfig)()}catch{}if(e)return;let t=function(e){let t=document.cookie.split("; ").find(t=>t.startsWith(e+"="));if(!t)return null;let s=t.slice(e.length+1);try{return decodeURIComponent(s)}catch{return s}}("token"),s=t&&!(0,ev.isJwtExpired)(t)?t:null;t&&!s&&eS("token","/"),e||($(s),K(!1))})(),()=>{e=!0}},[]),(0,h.useEffect)(()=>{if(eO){let e=new URLSearchParams(window.location.search).get("invitekey"),t=(0,y.getLoginPath)(),s=e?`${t}?invitekey=${e}`:t;window.location.replace(s)}},[eO]),(0,h.useEffect)(()=>{if(!B)return;if((0,ev.isJwtExpired)(B)){eS("token","/"),$(null);return}let t=null;try{t=(0,eN.jwtDecode)(B)}catch{eS("token","/"),$(null);return}if(t){if(eA(t.key),l(t.disabled_non_admin_personal_key_creation),t.user_role){let r=(0,g.formatUserRole)(t.user_role),i=(0,ej.getSiteMode)(),a=window.location.hostname;if("user"===i&&"localhost"!==a&&"127.0.0.1"!==a&&!a.startsWith("192.168.")&&!a.startsWith("10.")&&((0,g.isAgentRole)(r)||(0,g.isBusinessAdminRole)(r))){(0,b.clearTokenCookies)(),e.replace((0,y.getLoginPath)());return}s(r),"Admin Viewer"==r&&ec("usage")}t.user_email&&d(t.user_email),t.login_method&&L("username_password"==t.login_method),t.premium_user&&i(t.premium_user),t.auth_header_name&&(0,c.setGlobalLitellmHeaderName)(t.auth_header_name),t.user_id&&X(t.user_id)}},[B]),(0,h.useEffect)(()=>{eM&&(0,c.getAccountContext)(eM).catch(()=>{}).finally(()=>Y(!1))},[eM]),(0,h.useEffect)(()=>{eM&&G&&t&&((0,N.fetchUserModels)(G,t,eM,_),(0,g.isAdminRole)(t)?x(eM,G,t,null,P):P([]))},[eM,G,t]),(0,h.useEffect)(()=>{eM&&B&&(async()=>{try{let e=await (0,c.getInProductNudgesCall)(eM),t=e?.is_claude_code_enabled||!1;es(t),t&&(ei(!0),q(!1))}catch{}})()},[eM,B]),(0,h.useEffect)(()=>
1{if(J&&!Z){let e=setTimeout(()=>q(!1),15e3);return()=>clearTimeout(e)}},[J,Z]),(0,h.useEffect)(()=>{if(er&&!ea){let e=setTimeout(()=>ei(!1),15e3);return()=>clearTimeout(e)}},[er,ea]),(0,g.isBusinessAdminRole)(t)||(0,g.isAgentRole)(t),Q||eO||W)?(0,o.jsx)(p.default,{}):(new URLSearchParams(window.location.search),(0,o.jsxs)(h.Suspense,{fallback:(0,o.jsx)(p.default,{}),children:[(0,o.jsx)(h.Suspense,{fallback:null,children:(0,o.jsx)(ek,{onInvitationChange:T,onPageChange:ec})}),(0,o.jsx)(eC.ConfigProvider,{theme:{algorithm:en?eP.theme.darkAlgorithm:eP.theme.defaultAlgorithm},children:(0,o.jsx)(eg.ThemeProvider,{accessToken:eM,children:(0,o.jsx)(ey.AccountProvider,{accessToken:eM,children:(0,o.jsxs)(eb.OrgProvider,{accessToken:eM,userId:G,children:[(0,o.jsx)(h.Suspense,{fallback:null,children:(0,o.jsx)(ex.default,{})}),(0,o.jsx)(h.Suspense,{fallback:null,children:(0,o.jsx)(ep.default,{})}),(0,o.jsx)(ew.default,{accessToken:eM}),O?(0,o.jsx)(ef.default,{userID:G,userRole:t,premiumUser:r,teams:u,keys:S,setUserRole:s,userEmail:n,setUserEmail:d,setTeams:P,setKeys:k,organizations:M,addKey:eL,createClicked:H}):(0,o.jsxs)("div",{className:"flex flex-col min-h-screen overflow-x-hidden",children:[(0,o.jsx)(w.default,{userID:G,userRole:t,premiumUser:r,userEmail:n,setProxySettings:I,proxySettings:F,accessToken:eM,isPublicPage:!1,sidebarCollapsed:eR,onToggleSidebar:()=>{window.innerWidth<768?eI(e=>!e):e_(e=>!e)},isDarkMode:en,toggleDarkMode:()=>eo(!en)}),(0,o.jsxs)("div",{className:"flex flex-1",children:[eF&&(0,o.jsx)("div",{className:"fixed inset-0 bg-black/40 z-20 md:hidden",onClick:ez}),(0,o.jsx)("div",{className:"hidden md:block",children:(0,o.jsx)(f,{setPage:eu,defaultSelectedKey:ed,sidebarCollapsed:eR})}),eF&&(0,o.jsx)("div",{className:"fixed top-14 left-0 h-[calc(100vh-3.5rem)] z-30 md:hidden shadow-xl bg-white overflow-y-auto",children:(0,o.jsx)(f,{setPage:e=>{eu(e),ez()},defaultSelectedKey:ed,sidebarCollapsed:!1})}),(0,o.jsx)("div",{className:"flex-1 overflow-x-hidden pl-0",children:"api-keys"==ed?(0,o.jsx)(ef.default,{userID:G,userRole:t,premiumUser:r,teams:u,keys:S,setUserRole:s,userEmail:n,setUserEmail:d,setTeams:P,setKeys:k,organizations:M,addKey:eL,createClicked:H}):"admin-api-keys"==ed?(0,o.jsx)(o.Fragment,{}):"billing"==ed?(0,o.jsx)(j.default,{}):"llm-playground"==ed?(0,o.jsx)(m.default,{}):"user-profile"==ed?(0,o.jsx)(eh,{}):"logs"==ed?(0,o.jsx)(em.default,{userID:G,userRole:t,token:B,accessToken:eM,allTeams:u??[],premiumUser:r}):"organizations"==ed?(0,o.jsx)(E.default,{}):"teams"==ed?(0,o.jsx)(C.default,{}):"new_usage"==ed?(0,o.jsx)(v.default,{teams:u??[],organizations:M??[]}):(0,o.jsx)(ef.default,{userID:G,userRole:t,premiumUser:r,teams:u,keys:S,setUserRole:s,userEmail:n,setUserEmail:d,setTeams:P,setKeys:k,organizations:M,addKey:eL,createClicked:H})})]})]})]})})})})]}))}function eA(){return(0,o.jsx)(h.Suspense,{fallback:(0,o.jsx)(p.default,{}),children:(0,o.jsx)(eM,{})})}e.s(["default",()=>eA,"dynamic",0,"force-dynamic"],330257)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.