1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,44215,e=>{"use strict";let t="esbicm:impersonation:active",r="esbicm:impersonation:meta";class n extends Error{payload;constructor(e,t){super(t??e.reason??"Account access restricted"),this.name="AccountAccessError",this.payload=e}}let a="esbicm:account-access-restricted";function i(){return"1"===window.sessionStorage.getItem(t)&&!o().startsWith("/admin")}function s(){let e=window.location.pathname;return"/members"===e||e.startsWith("/members/")?"/members":""}function o(){let e=s();return e&&window.location.pathname.startsWith(e)?window.location.pathname.slice(e.length)||"/":window.location.pathname}function l(e){let t=e.startsWith("/")?e:`/${e}`;return`${s()}${t}`}function c(){return i()?window.sessionStorage:window.localStorage}function u(){let e=c();e&&(e.removeItem("accessToken"),e.removeItem("refreshToken"),e===window.sessionStorage&&(e.removeItem(t),e.removeItem(r)))}function d(e){let t=t=>{e(t.detail)};return window.addEventListener(a,t),()=>window.removeEventListener(a,t)}let h=new Set(["account_suspended","account_blocked","account_locked"]),f=new class{baseUrl;refreshPromise=null;constructor(e="https://esbicm.org/members/api/v1"){this.baseUrl=e}clearTokens(){u()}getStoredAccessToken(){return c()?.getItem("accessToken")??null}isTokenExpiringSoon(e,t=90){try{let r=e.split(".")[1];if(!r)return!0;let n=r.replace(/-/g,"+").replace(/_/g,"/"),a=n.padEnd(4*Math.ceil(n.length/4),"="),i=JSON.parse(atob(a));if(!i.exp)return!0;return 1e3*i.exp<=Date.now()+1e3*t}catch{return!0}}async getFreshAccessToken(e=300){let t=this.getStoredAccessToken();return t?this.isTokenExpiringSoon(t,e)?await this.refreshAccessToken()??this.getStoredAccessToken():t:null}async refreshAccessToken(){let e=c(),t=e?.getItem("refreshToken");return e&&t?(this.refreshPromise||(this.refreshPromise=(async()=>{try{let r=await fetch(`${this.baseUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})}),n=await r.json().catch(()=>null);if(!r.ok)return this.clearTokens(),null;let a=n?.data?.accessToken;if(!a||"string"!=typeof a)return this.clearTokens(),null;return e.setItem("accessToken",a),a}catch{return this.clearTokens(),null}})().finally(()=>{this.refreshPromise=null})),this.refreshPromise):null}async refreshAuthToken(){return this.refreshAccessToken()}async request(e,t={},r=!0){let i=`${this.baseUrl}${e}`,s={"Content-Type":"application/json"};if(t.headers&&Object.assign(s,t.headers),"/auth/refresh"!==e){let e=await this.getFreshAccessToken();e&&(s.Authorization=`Bearer ${e}`)}let o={...t,headers:s};try{let s=await fetch(i,o),u=await s.json();if(401===s.status&&r&&"/auth/refresh"!==e&&await this.refreshAccessToken())return this.request(e,t,!1);if(403===s.status){let e=function(e){if(!e||"object"!=typeof e)return null;let t=e.code;if("string"!=typeof t||!h.has(t))return null;let r="string"==typeof e.status?e.status:t.replace("account_","");return{code:t,status:r,email:"string"==typeof e.email?e.email:void 0,fullName:"string"==typeof e.fullName?e.fullName:void 0,reason:"string"==typeof e.reason?e.reason:null,contactEmail:"string"==typeof e.contactEmail?e.contactEmail:"[email protected]",occurredAt:"string"==typeof e.occurredAt?e.occurredAt:null,lockedUntil:"string"==typeof e.lockedUntil?e.lockedUntil:null}}(u);if(e){var l;let t=!!c()?.getItem("accessToken");throw t&&this.clearTokens(),l={...e,fromAuthenticatedSession:t},window.dispatchEvent(new CustomEvent(a,{detail:l})),new n(e)}}if(!s.ok)throw Error(u.message||"API request failed");return u}catch(e){if(e instanceof Error)throw e;throw Error("Network error")}}async get(e,t){return this.request(e,{...t,method:"GET"})}async post(e,t,r){return this.request(e,{...r,method:"POST",body:JSON.stringify(t)})}async put(e,t,r){return this.request(e,{...r,method:"PUT",body:JSON.stringify(t)})}async patch(e,t,r){return this.request(e,{...r,method:"PATCH",body:JSON.stringify(t)})}async delete(e,t){return this.request(e,{...t,method:"DELETE"})}async downloadFile(e,t={},r=!0){let n=`${this.baseUrl}${e}`,a={};t.headers&&Object.assign(a,t.headers);{let e=await this.getFreshAccessToken();e&&(a.Authorization=`Bearer ${e}`)}let i=await fetch(n,{...t,headers:a});if(401===i.status&&r&&await this.refreshAccessToken())return this.downloadFile(e,t,!1);if(!i.ok){let e=await i.json().catch(()=>null);throw Error(e?.message||"File download failed")}let s=i.headers.get("content-disposition"),o=s?.match(/filename="?([^"]+)"?/i);return{blob:await i.blob(),filename:o?.[1]??null}}recordUploadClientDiagnostic(e,t,r,n,a,i,s){let o=t.get("file"),l=o instanceof File?o:null,c=navigator.connection,u=l?.name?.includes(".")?l.name.split(".").pop()?.toLowerCase():null,d={endpoint:e,eventType:r,status:n.status||null,readyState:n.readyState,attempt:Math.max(1,3-i),retriesLeft:i,elapsedMs:Math.round(performance.now()-s),fileName:l?.name??null,fileSize:l?.size??null,fileType:l?.type||null,fileExtension:u||null,online:navigator.onLine,visibilityState:document.visibilityState,effectiveType:c?.effectiveType??null,downlink:c?.downlink??null,rtt:c?.rtt??null};fetch(`${this.baseUrl}/upload/client-diagnostic`,{method:"POST",headers:{"Content-Type":"application/json",...a?{Authorization:`Bearer ${a}`}:{}},body:JSON.stringify(d),keepalive:!0}
1).catch(()=>void 0)}async uploadFile(e,t,r,n=!0,a=2,i){let s=`${this.baseUrl}${e}`,o=await this.getFreshAccessToken(600),l="u">typeof performance?performance.now():Date.now();return new Promise((c,u)=>{if(i?.aborted)return void u(new DOMException("Upload cancelled","AbortError"));let d=new XMLHttpRequest,h=()=>d.abort();d.open("POST",s),d.timeout=18e4,o&&d.setRequestHeader("Authorization",`Bearer ${o}`),i?.addEventListener("abort",h,{once:!0});let f=()=>i?.removeEventListener("abort",h);r&&d.upload.addEventListener("progress",e=>{e.lengthComputable&&r(Math.round(e.loaded/e.total*100))}),d.onload=()=>{try{let s=d.responseText?JSON.parse(d.responseText):null;if(d.status>=200&&d.status<300){f(),c(s);return}if(401===d.status&&n&&1)return void this.refreshAccessToken().then(n=>{n?this.uploadFile(e,t,r,!1,a,i).then(c).catch(u):u(Error(s?.message||"Upload authorization expired. Please login again."))}).catch(()=>u(Error("Upload authorization expired. Please retry.")));f(),u(Error(s?.message||"Upload failed"))}catch{if(401===d.status&&n&&1)return void this.refreshAccessToken().then(n=>{n?this.uploadFile(e,t,r,!1,a,i).then(c).catch(u):u(Error("Upload authorization expired. Please login again."))}).catch(()=>u(Error("Upload authorization expired. Please retry.")));f(),u(Error("Invalid server response"))}},d.onerror=()=>{(f(),this.recordUploadClientDiagnostic(e,t,"error",d,o,a,l),a>0)?window.setTimeout(()=>{this.uploadFile(e,t,r,n,a-1,i).then(c).catch(u)},(3-a)*1e3):u(Error("Upload connection was interrupted before the server could confirm the file. Please keep this page open and try again. If the file is close to 5MB, compress it slightly and upload again."))},d.onabort=()=>{(f(),this.recordUploadClientDiagnostic(e,t,"abort",d,o,a,l),i?.aborted)?u(new DOMException("Upload cancelled","AbortError")):a>0?window.setTimeout(()=>{this.uploadFile(e,t,r,n,a-1,i).then(c).catch(u)},(3-a)*1e3):u(Error("Upload was cancelled before it completed. Please keep this page open while files are uploading and try again."))},d.ontimeout=()=>{(f(),this.recordUploadClientDiagnostic(e,t,"timeout",d,o,a,l),a>0)?window.setTimeout(()=>{this.uploadFile(e,t,r,n,a-1,i).then(c).catch(u)},(3-a)*1e3):u(Error("Upload timed out before the server could confirm the file. Please keep this page open and retry from a stable connection."))},d.send(t)})}};e.s(["AccountAccessError",()=>n,"IMPERSONATION_SESSION_FLAG",0,t,"IMPERSONATION_SESSION_META",0,r,"apiClient",0,f,"clearActiveAuthStorage",()=>u,"getAppRoutePath",()=>o,"getAuthStorage",()=>c,"isImpersonationSessionActive",()=>i,"onAccountAccessRestricted",()=>d,"withAppBasePath",()=>l])},18566,(e,t,r)=>{t.exports=e.r(76562)},13559,58089,e=>{"use strict";e.i(47167);var t=e.i(43476),r=e.i(71645);let n={siteName:"ESBICM",logoUrl:"/members/images/esbicm-logo-final-v6-tagline-blank.png",faviconUrl:"/members/favicon.svg",updatedAt:""},a="esbicm:branding-updated",i="esbicm_branding_updated_at",s="esbicm_branding_state";function o(e){let t=Array.isArray(e)?Object.fromEntries(e.map(e=>[e.key,e.value??""])):e;return{siteName:t.site_name?.trim()||n.siteName,logoUrl:t.branding_logo_url?.trim()||n.logoUrl,faviconUrl:t.branding_favicon_url?.trim()||n.faviconUrl,updatedAt:t.branding_updated_at?.trim()||""}}function l(e){return!!e.updatedAt?.trim()}
1function c(e,t){if(!t||/^(data:|blob:)/i.test(e))return e;let r=e.includes("?")?"&":"?";return`${e}${r}v=${encodeURIComponent(t)}`}function u(){let e=String(Date.now());window.localStorage.setItem(i,e),window.dispatchEvent(new CustomEvent(a,{detail:e}))}e.s(["BRANDING_STATE_STORAGE_KEY",0,s,"BRANDING_UPDATED_EVENT",0,a,"BRANDING_UPDATED_STORAGE_KEY",0,i,"DEFAULT_BRANDING",0,n,"isOfficialBranding",()=>l,"notifyBrandingUpdated",()=>u,"resolveBranding",()=>o,"withBrandingVersion",()=>c],58089);var d=e.i(18566);let h="data-esbicm-managed-favicon",f=(0,r.createContext)({branding:n,refreshBranding:async()=>void 0});function m({children:e,initialBranding:u}){let m=(0,d.usePathname)(),[p,g]=(0,r.useState)(u&&l(u)?u:n),w=(0,r.useCallback)(async()=>{try{let e=await fetch(`https://esbicm.org/members/api/v1/settings/public?scope=branding&t=${Date.now()}`,{cache:"no-store"});if(!e.ok)return;let t=await e.json();g(o(Array.isArray(t.data)?t.data:[]))}catch{}},[]);(0,r.useEffect)(()=>{w();let e=window.setInterval(()=>{w()},6e4),t=()=>{w()},r=e=>{e.key===i&&w()};return window.addEventListener(a,t),window.addEventListener("storage",r),()=>{window.clearInterval(e),window.removeEventListener(a,t),window.removeEventListener("storage",r)}},[w]),(0,r.useEffect)(()=>{let e,t;e=c(p.faviconUrl,p.updatedAt),document.querySelectorAll('link[rel~="icon"], link[rel="apple-touch-icon"]').forEach(t=>{t.href=e,"icon"===t.rel&&(t.type=e.endsWith(".svg")?"image/svg+xml":"")}),(t=t=>{let r=document.querySelector(`link[${h}="${t}"]`);r||((r=document.createElement("link")).rel=t,r.setAttribute(h,t),document.head.appendChild(r)),r.href=e,"icon"===t&&(r.type=e.endsWith(".svg")?"image/svg+xml":"")})("icon"),t("apple-touch-icon"),l(p)&&window.localStorage.setItem(s,JSON.stringify(p))},[p,m]);let y=(0,r.useMemo)(()=>({branding:p,refreshBranding:w}),[p,w]);return(0,t.jsx)(f.Provider,{value:y,children:e})}function p(){return(0,r.useContext)(f)}e.s(["BrandingProvider",()=>m,"useBranding",()=>p],13559)},83642,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(18566),a=e.i(44215);let i="esbicm:account-access-notice";function s(){let e=sessionStorage.getItem(i);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function o(){sessionStorage.removeItem(i)}let l=(0,r.createContext)(void 0);function c(){(0,a.clearActiveAuthStorage)()}function u({children:e}){let s=(0,n.useRouter)(),o=(0,n.usePathname)(),[u,d]=(0,r.useState)(null),[h,f]=(0,r.useState)(!0),m=(0,r.useCallback)(e=>{d(t=>!function(e,t){if(e===t)return!0;if(!e||!t)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(t,e)?e:t)},[]);(0,r.useEffect)(()=>(0,a.onAccountAccessRestricted)(e=>{if(!e.fromAuthenticatedSession)return;sessionStorage.setItem(i,JSON.stringify(e)),m(null);let t=(0,a.getAppRoutePath)().startsWith("/admin")?"/admin/login":"/auth/login";o!==t&&s.replace(t)}),[o,s,m]),(0,r.useEffect)(()=>{let e=setTimeout(()=>{f(e=>!e&&e)},25e3);return()=>clearTimeout(e)},[m]),(0,r.useEffect)(()=>{w()},[]);let p=async()=>{try{let e=(0,a.getAuthStorage)();if(!e)return!1;let t=e?.getItem("refreshToken");if(!t)return!1;let r=await a.apiClient.post("/auth/refresh",{refreshToken:t});return e.setItem("accessToken",r.data.accessToken),!0}catch{return!1}},g=(0,r.useCallback)(async e=>{try{if(!(0,a.getAuthStorage)()?.getItem("accessToken"))return e&&f(!1),null;let t=await a.apiClient.get("/users/me");return m(t.data),t.data}catch{if(!await p())return c(),m(null),null;try{let e=await a.apiClient.get("/users/me");return m(e.data),e.data}catch{return c(),m(null),null}}finally{e&&f(!1)}},[m]),w=async()=>{(0,a.getAppRoutePath)().startsWith("/auth/impersonate")?f(!1):await g(!0)},y=async e=>{let t=(0,a.getAuthStorage)()??localStorage;t.setItem("accessToken",e.accessToken),t.setItem("refreshToken",e.refreshToken);let r=await g(!1);if(!r)throw Error("Unable to load your member profile. Please try again.");return r},v=async e=>{let t=await a.apiClient.post("/auth/login",e);if("requiresTwoFactor"in t.data)return t.data;let r=await y(t.data);return{...t.data,user:r}},A=async(e,t)=>y((await a.apiClient.post("/auth/login/2fa",{twoFactorToken:e,code:t})).data),b=async e=>{let t=await a.apiClient.post("/auth/register",e),r=(0,a.getAuthStorage)()??localStorage;r.setItem("accessToken",t.data.accessToken),r.setItem("refreshToken",t.data.refreshToken),await g(!1)},T=async()=>{let e=(0,a.getAuthStorage)();if(!e)throw Error("No auth storage");let t=e?.getItem("refreshToken");if(!t)throw Error("No refresh token");let r=await a.apiClient.post("/auth/refresh",{refreshToken:t});e.setItem("accessToken",r.data.accessToken)},E=async()=>{await g(!1)};return(0,r.useEffect)(()=>
1{if(!u||(0,a.isImpersonationSessionActive)())return;let e=()=>{g(!1)},t=()=>{"visible"===document.visibilityState&&e()},r=setInterval(e,3e5);return window.addEventListener("focus",e),document.addEventListener("visibilitychange",t),()=>{clearInterval(r),window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",t)}},[u,g]),(0,t.jsx)(l.Provider,{value:{user:u,isLoading:h,isAuthenticated:!!u,login:v,verifyTwoFactorLogin:A,register:b,logout:()=>{c(),m(null)},refreshUser:E,refreshToken:T},children:e})}function d(){let e=(0,r.useContext)(l);if(!e)throw Error("useAuth must be used within AuthProvider");return e}e.s(["AuthProvider",()=>u,"clearPendingAccessNotice",()=>o,"readPendingAccessNotice",()=>s,"useAuth",()=>d])}]);
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.