1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,258659,68959,710734,869355,e=>{"use strict";let t=Symbol("static-key"),r=new WeakMap,n=0;e.s(["addStaticKeyToTransport",0,function(e,r){return{...e,[t]:r}},"createTransportKey",0,function(e){if(void 0!==e[t])return e[t];let o=r.get(e);return void 0===o&&(o=`t${++n}`,r.set(e,o)),o}],258659);var o=e.i(493705);e.s(["applyBrowserTransportAcceptLanguage",0,function(e,t){e.get("Accept-Language")||e.set("Accept-Language",function({supportedLocales:e,sources:t,fallback:r="en"}){let n,a,i,s=(n=globalThis,a="string"==typeof n.location?.pathname?n.location.pathname:"",i="string"==typeof n.document?.documentElement?.lang?n.document.documentElement.lang:"",{pathname:a,htmlLang:i,navigatorLanguages:Array.isArray(n.navigator?.languages)?n.navigator.languages:[],navigatorLanguage:"string"==typeof n.navigator?.language?n.navigator.language:""});return(0,o.resolveAcceptLanguageFromSources)({pathname:t?.pathname??s.pathname,htmlLang:t?.htmlLang??s.htmlLang,navigatorLanguages:t?.navigatorLanguages??s.navigatorLanguages,navigatorLanguage:t?.navigatorLanguage??s.navigatorLanguage,supportedLocales:e,fallback:r})}(t))}],68959);let a="api:access",i="/auth/oauth/callback",s=["offline_access",a],c={admin:"maxmove-admin",adminOps:"maxmove-admin-ops",apiBff:"maxmove-api-bff",dashboard:"maxmove-dashboard",demoSeeder:"maxmove-demo-seeder",desktopDashboard:"maxmove-desktop-dashboard",mobileCustomer:"maxmove-mobile-customer",mobileDriver:"maxmove-mobile-driver",mobileDriverTracking:"maxmove-mobile-driver-tracking",mobileOps:"maxmove-mobile-ops",web:"maxmove-web"};function u(e){let t=e.trim();if(!t)throw Error("Expected a non-empty API base URL for the OAuth resource.");let r=new URL(t);if("http:"!==r.protocol&&"https:"!==r.protocol)throw Error("Expected an HTTP(S) API base URL for the OAuth resource.");return r.origin}function l(e){return e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}c.admin,c.adminOps,c.mobileOps,c.mobileDriverTracking,c.adminOps,c.mobileOps,[...s],c.admin,c.adminOps,c.apiBff,c.dashboard,c.desktopDashboard,c.demoSeeder,c.mobileCustomer,c.mobileDriver,c.mobileDriverTracking,c.mobileOps,c.web,e.s(["firstPartyApiAccessScope",0,a,"firstPartyOAuthCallbackPath",0,i,"firstPartyOAuthClientIds",0,c,"firstPartyOAuthScopes",0,s,"resolveApiOAuthResource",0,u],710734);let d={encode(e,t={}){let r=l(!1);return function(e,t,r){let n="",o=0,a=0;for(let r of e)for(o=o<<8|r,a+=8;a>=6;)a-=6,n+=t[o>>a&63];if(a>0&&(n+=t[o<<6-a&63]),r){let e=(4-n.length%4)%4;n+="=".repeat(e)}return n}("string"==typeof e?new TextEncoder().encode(e):new Uint8Array(e),r,t.padding??!0)},decode(e){"string"!=typeof e&&(e=new TextDecoder().decode(e));let t=l(e.includes("-")||e.includes("_"));return function(e,t){let r=new Map;for(let e=0;e<t.length;e++)r.set(t[e],e);let n=[],o=0,a=0;for(let t of e){if("="===t)break;let e=r.get(t);if(void 0===e)throw Error(`Invalid Base64 character: ${t}`);o=o<<6|e,(a+=6)>=8&&(a-=8,n.push(o>>a&255))}return Uint8Array.from(n)}(e,t)}};function h(e){return new URLSearchParams({v:e}).toString().slice(2)}e.i(201524),e.i(429939),new TextEncoder;new TextDecoder;Symbol.asyncIterator;async function p({getClientAssertion:e,context:t}){return{client_assertion:await e(t),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}function f(e,t,r){if(t.clientSecret||r.has("client_secret"))throw Error(`${e} token endpoint authentication cannot be combined with clientSecret`)}function w(e,t){t&&e.set("client_id",t)}function m(e,t){if(!t.clientSecret)throw Error(`${e} token endpoint authentication requires clientSecret`)}function g(e,t){if(!t)throw Error(`${e} token endpoint authentication requires clientId`)}async function y({body:e,headers:t,options:r,tokenEndpoint:n,grantType:o,tokenEndpointAuth:a,authentication:i}){var s;let c;if(e.has("client_assertion")!==e.has("client_assertion_type"))throw Error("client_assertion and client_assertion_type must both be provided");let u="string"==typeof(c=Array.isArray(s=r.clientId)?s[0]:s)&&c.length>0?c:void 0;if(e.has("client_assertion")){if(a)throw Error("client_assertion body parameters cannot be combined with tokenEndpointAuth");f("private_key_jwt",r,e),w(e,u);return}let l=a??("basic"===i?{method:"client_secret_basic"}:r.clientSecret?{method:"client_secret_post"}:{method:"none"});if("private_key_jwt"===l.method){if(f(l.method,r,e),g(l.method,u),!n)throw Error("private_key_jwt token endpoint authentication requires tokenEndpoint");let t=await p({getClientAssertion:l.getClientAssertion,context:{clientId:u,tokenEndpoint:n,grantType:
1o}});for(let[r,n]of(w(e,u),Object.entries(t)))e.set(r,n);return}if("none"===l.method){if(f(l.method,r,e),"client_credentials"===o)throw Error("none token endpoint authentication cannot be used with client_credentials grant");g(l.method,u),w(e,u);return}"client_secret_basic"===l.method?function({headers:e,options:t,clientId:r,body:n}){var o;let a;if(n.has("client_secret"))throw Error("client_secret_basic token endpoint authentication cannot be combined with client_secret body parameters");m("client_secret_basic",t),g("client_secret_basic",r),o=t.clientSecret,a=`${h(r)}:${h(o)}`,e.authorization=`Basic ${d.encode(a)}`}({headers:t,options:r,clientId:u,body:e}):function({body:e,options:t,clientId:r,requireClientSecret:n}){n&&m("client_secret_post",t),t.clientSecret&&(g("client_secret_post",r),w(e,r),e.set("client_secret",t.clientSecret))}({body:e,options:r,clientId:u,requireClientSecret:a?.method==="client_secret_post"})}Symbol();async function _({code:e,codeVerifier:t,redirectURI:r,options:n,authentication:o,tokenEndpointAuth:a,tokenEndpoint:i,deviceId:s,headers:c,additionalParams:u={},resource:l}){let d=function({code:e,codeVerifier:t,redirectURI:r,options:n,deviceId:o,headers:a,additionalParams:i={},resource:s}){let c=new URLSearchParams,u={"content-type":"application/x-www-form-urlencoded",accept:"application/json",...a};if(c.set("grant_type","authorization_code"),c.set("code",e),t&&c.set("code_verifier",t),n.clientKey&&c.set("client_key",n.clientKey),o&&c.set("device_id",o),c.set("redirect_uri",n.redirectURI||r),s)if("string"==typeof s)c.append("resource",s);else for(let e of s)c.append("resource",e);for(let[e,t]of Object.entries(i))c.has(e)||c.append(e,t);return{body:c,headers:u}}({code:e,codeVerifier:t,redirectURI:r,options:n="function"==typeof n?await n():n,deviceId:s,headers:c,additionalParams:u,resource:l});return await y({body:d.body,headers:d.headers,options:n,tokenEndpoint:i??"",grantType:"authorization_code",tokenEndpointAuth:a,authentication:o}),d}"u"<typeof navigator||navigator.userAgent?.startsWith?.("Mozilla/5.0 "),Symbol(),Symbol();let k=new Set(["grant_type","refresh_token","__proto__","constructor","prototype"]);async function b({refreshToken:e,options:t,authentication:r,tokenEndpointAuth:n,tokenEndpoint:o,extraParams:a,resource:i}){let s=function({refreshToken:e,options:t,extraParams:r,resource:n}){let o=new URLSearchParams;if(o.set("grant_type","refresh_token"),o.set("refresh_token",e),n)if("string"==typeof n)o.append("resource",n);else for(let e of n)o.append("resource",e);return r&&function(e,t){if(t)for(let[r,n]of Object.entries(t))k.has(r)||e.set(r,n)}(o,r),{body:o,headers:{"content-type":"application/x-www-form-urlencoded",accept:"application/json"}}}({refreshToken:e,options:t="function"==typeof t?await t():t,extraParams:a,resource:i});return await y({body:s.body,headers:s.headers,options:t,tokenEndpoint:o??"",grantType:"refresh_token",tokenEndpointAuth:n,authentication:r}),s}var v=e.i(589091);function A(e,t){return!t||e.organizationId===t}var O=e.i(956376);function S(e,t=O.Buffer){return t.from(e).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}class T extends Error{oauthError;status;constructor(e,t={}){super(e,{cause:t.cause}),this.name="OAuthAccessTokenError",this.oauthError=t.oauthError,this.status=t.status}}let E=new WeakMap;function P(e){if(!e.pathname.endsWith("/api"))throw Error("authBaseUrl must end in the Better Auth /api base-path segment.");return new URL(e.pathname.slice(0,-4),e.origin).toString().replace(/\/$/,"")}function U(e){return"string"==typeof e&&e.length>0?e:void 0}function L(e){return Array.isArray(e)&&e.every(e=>"string"==typeof e)?e:void 0}async function x(e){let t=await e.json();if(!("object"==typeof t&&null!==t&&!Array.isArray(t)))throw new T("The OAuth endpoint returned a non-object JSON response.",{status:e.status});return t}async function R(e){await e.body?.cancel().catch(()=>void 0)}function z(e,t,r){let n=new URL(e);if(n.origin!==t.origin||n.protocol!==t.protocol)throw new T(`${r} must share the configured OAuth issuer origin.`);return n.toString()}async function q(e,t,r){let n,o=(n=new URL(P(e)).pathname,new URL(`/.well-known/oauth-authorization-server${n}`,e.origin).toString()),a=P(e),i=E.get(t);i||(i=new Map,E.set(t,i));let s=i.get(o);s||(s=(async()=>
1{let e=await t(o,{credentials:"omit",headers:{Accept:"application/json"},redirect:"error"});if(!e.ok)throw await R(e),new T("Unable to discover the OAuth authorization server.",{status:e.status});return function(e,t){let r=U(e.issuer),n=U(e.authorization_endpoint),o=U(e.token_endpoint);if(!r||!n||!o)throw new T("OAuth metadata is missing its issuer or token endpoints.");let a=new URL(r);if("https:"!==a.protocol&&"http:"!==a.protocol)throw new T("OAuth metadata issuer must use HTTP(S).");if(r!==t)throw new T("OAuth metadata issuer does not match the configured authorization server.");let i=z(n,a,"authorization_endpoint"),s=z(o,a,"token_endpoint"),c=L(e.code_challenge_methods_supported),u=L(e.grant_types_supported),l=L(e.token_endpoint_auth_methods_supported),d=L(e.scopes_supported);if(!c?.includes("S256"))throw new T("The OAuth server does not advertise S256 PKCE.");if(!u?.includes("authorization_code")||!u.includes("refresh_token"))throw new T("The OAuth server does not advertise the required grants.");if(!l?.includes("none"))throw new T("The OAuth server does not support public clients.");if(!0!==e.authorization_response_iss_parameter_supported)throw new T("The OAuth server does not advertise RFC 9207 issuer responses.");return{authorization_endpoint:i,authorization_response_iss_parameter_supported:!0,code_challenge_methods_supported:c,grant_types_supported:u,issuer:a.toString().replace(/\/$/,""),scopes_supported:d,token_endpoint:s,token_endpoint_auth_methods_supported:l}}(await x(e),a)})(),i.set(o,s),s.catch(()=>{i?.get(o)===s&&i.delete(o)}));let c=await s;if(!r.every(e=>c.scopes_supported?.includes(e)))throw new T("The OAuth server does not advertise the requested scopes.");return c}function j(e){return{code:U(e.code),error:U(e.error),error_description:U(e.error_description),iss:U(e.iss),state:U(e.state)}}function C(e,t){let r=new URL(t),n=new URL(e,r);if(n.origin!==r.origin||n.pathname!==r.pathname||n.username||n.password||n.hash)throw new T("The OAuth authorization response escaped its callback.");return j(Object.fromEntries(n.searchParams))}async function I(e,t){if(e.status>=300&&e.status<400)try{if(e.status<300||e.status>=400)throw new T("The OAuth authorization endpoint did not redirect.",{status:e.status});let r=e.headers.get("location");if(!r)throw new T("The OAuth authorization redirect is missing its location.");return C(r,t)}finally{await R(e)}if(!e.ok)throw await R(e),new T("The OAuth authorization request failed.",{status:e.status});var r=await x(e);if(Object.hasOwn(r,"redirect")||Object.hasOwn(r,"url")){let n=U(r.url);if(!0!==r.redirect||!n)throw new T("The OAuth authorization endpoint returned an invalid redirect response.",{status:e.status});return C(n,t)}return e.redirected&&e.url&&C(e.url,t),j(r)}function M(){return{cause:Error("OAuth request superseded"),ok:!1,reason:"request-failed"}}e.s(["createFirstPartyOAuthAccessTokenCache",0,function(e){var t;let r,n,o,c,l,d,h,p=function(e){let t=function(e,t){let r=e.trim();if(!r)throw Error("authBaseUrl is required.");let n=new URL(r);if(n.username||n.password||n.search||n.hash)throw Error("authBaseUrl must not contain credentials, a query, or a fragment.");if("https:"!==n.protocol&&!(t&&"http:"===n.protocol))throw Error("authBaseUrl must use HTTPS unless insecure development HTTP is explicitly enabled.");return new URL(n.pathname.replace(/\/$/,""),n.origin)}(e.authBaseUrl,!0===e.allowInsecureDevelopmentHttp),r=e.fetch??globalThis.fetch;if(!r)throw Error("A fetch implementation is required.");let n=e.pkce??{randomBytes(e){let t=globalThis.crypto;if(!t?.getRandomValues)throw Error("A cryptographically secure random-number generator is required for PKCE.");return t.getRandomValues(new Uint8Array(e))},async sha256(e){let t=globalThis.crypto;if(!t?.subtle)throw Error("Web Crypto SHA-256 support is required for PKCE.");let r=new Uint8Array(new ArrayBuffer(e.byteLength));return r.set(e),new Uint8Array(await t.subtle.digest("SHA-256",r))}},o=u(e.resource),c=e.scopes??s,l=e.requiredScope??a,d=null,h=0,p=null,f=async(t,r,n)=>{let a=await x(t);if(!t.ok){let e;throw e=U(a.error),new T(U(a.error_description)??e??"The OAuth token request failed.",{oauthError:e,status:t.status})}let i={access_token:U(a.access_token),expires_in:"number"==typeof a.expires_in?a.expires_in:void 0,refresh_token:U(a.refresh_token),scope:U(a.scope),token_type:U(a.token_type)};if(!i.access_token)return{ok:!1,reason:"missing-token"};if(i.token_type?.toLowerCase()!=="bearer")return{ok:!1,reason:"invalid-token",cause:new T("The OAuth server returned an unexpected token type.")};try{!function(e,t,r,n){let o=(0,v.decodeGatewayJwtHeader)(e),a=(0,v.decodeGatewayJwtPayload)(e);if(!o||!a||"at+jwt"!==o.typ)throw new T("OAuth access tokens must use the RFC 9068 at+jwt type.");if(!(a.aud===r||Array.isArray(a.aud)&&a.aud.some(e=>e===r)))throw new T("OAuth access token audience does not match the API resource.");if((U(a.client_id)??U(a.azp))!==t)throw new T("OAuth access token client does not match this application.");
1if(!(U(a.scope)?.split(/\s+/)??[]).includes(n))throw new T(`OAuth access token is missing the required scope ${n}.`);if(!U(a.organization_id))throw new T("OAuth access token is missing its organization boundary.");if(!U(a.sub))throw new T("OAuth access token is missing its user subject.")}(i.access_token,e.clientId,o,l)}catch(e){return{ok:!1,reason:"invalid-token",cause:e}}if(n!==h)return M();void(d=i.refresh_token??r);return{ok:!0,token:i.access_token}},w=async a=>{let s=await q(t,r,c),u=new URL(i,`${o}/`).toString(),l=S(await n.randomBytes(64)),d=S(await n.sha256(Uint8Array.from(l,e=>e.charCodeAt(0)))),p=S(await n.randomBytes(32)),w=new URL(s.authorization_endpoint);w.searchParams.set("client_id",e.clientId),w.searchParams.set("code_challenge",d),w.searchParams.set("code_challenge_method","S256"),w.searchParams.set("prompt","none"),w.searchParams.set("redirect_uri",u),w.searchParams.set("resource",o),w.searchParams.set("response_type","code"),w.searchParams.set("scope",c.join(" ")),w.searchParams.set("state",p);let m=new Headers({Accept:"application/json"}),g=(await e.getCookie?.())?.trim();g&&m.set("Cookie",g);let y=await r(w,{credentials:g?"omit":"include",headers:m,redirect:e.authorizationResponseMode??"follow",referrerPolicy:"no-referrer"}),k=await I(y,u);if(k.state!==p)throw new T("OAuth authorization state validation failed.");if(k.iss!==s.issuer)throw new T("OAuth authorization issuer validation failed.");if(k.error)throw new T(k.error_description??k.error,{oauthError:k.error});if(!k.code)return{ok:!1,reason:"missing-token"};let b=await _({code:k.code,codeVerifier:l,options:{clientId:e.clientId,redirectURI:u},redirectURI:u,resource:o,tokenEndpoint:s.token_endpoint,tokenEndpointAuth:{method:"none"}});return a!==h?M():f(await r(s.token_endpoint,{body:b.body.toString(),credentials:"omit",headers:b.headers,method:"POST",redirect:"error"}),null,a)},m=async(n,a)=>{let i=await q(t,r,c),s=await b({options:{clientId:e.clientId},refreshToken:n,resource:o,tokenEndpoint:i.token_endpoint,tokenEndpointAuth:{method:"none"}});return a!==h?M():f(await r(i.token_endpoint,{body:s.body.toString(),credentials:"omit",headers:s.headers,method:"POST",redirect:"error"}),n,a)},g=async()=>{let t=h;try{let r;if(e.getSession){let r=await e.getSession();if(t!==h)return M();if(r.error)throw new T(r.error.message??"Session renewal failed.",{status:r.error.status});if(!r.data?.session||!r.data.user)throw new T("An active login session is required.",{oauthError:"login_required",status:401})}if(d)try{r=await m(d,t)}catch(e){if(e instanceof T&&("invalid_grant"===e.oauthError||"invalid_token"===e.oauthError))d=null,r=await w(t);else throw e}else r=await w(t);if(t!==h)return M();return r}catch(e){return{ok:!1,reason:"request-failed",cause:e}}};return{invalidate(){h+=1,d=null,p=null},requestToken(){if(!p){let e=g();p=e,e.finally(()=>{p===e&&(p=null)})}return p}}}(e),f=(r=(t={expirySkewMs:e.expirySkewMs,now:e.now,refreshMaxAgeMs:e.refreshMaxAgeMs,requestToken:p.requestToken}).expirySkewMs??3e4,n=t.now??(()=>Date.now()),o=t.refreshMaxAgeMs??3e5,c=null,l=0,d=new Map,{async get(e){let t=await h(e);return t.ok?t.token:null},getResult:h=async e=>{let a=n(),i=c;if(i&&i.refreshAfterMs>a&&A(i,e))return{ok:!0,token:i.value};let s=e??"",u=d.get(s);if(!u){let e=l,r=t.requestToken();u={generation:e,promise:r},d.set(s,u),r.finally(()=>{d.get(s)?.promise===r&&d.delete(s)})}let h=await u.promise;if(u.generation!==l)return{ok:!1,reason:"request-superseded"};
1if(!h.ok)return"request-failed"===h.reason&&function(e){if(e instanceof TypeError)return!0;if(!e||"object"!=typeof e)return!1;let t=Reflect.get(e,"status")??Reflect.get(e,"statusCode");return"number"==typeof t&&(408===t||429===t||t>=500)}(h.cause)&&i&&i.usableUntilMs>n()&&A(i,e)?{ok:!0,token:i.value}:(c=null,h);let p=(e=>{let t=(0,v.decodeGatewayJwtPayload)(e);if(!t)return null;let a=n(),i=(0,v.readGatewayJwtExpiryMs)(t);if(null===i)return null;let s=i-r;return s<=a?null:{value:e,organizationId:(0,v.readGatewayOrganizationId)(t),refreshAfterMs:Math.min(a+o,s),usableUntilMs:s}})(h.token);return p?A(p,e)?(c=p,{ok:!0,token:p.value}):(c=null,{ok:!1,reason:"organization-mismatch"}):(c=null,{ok:!1,reason:"invalid-token"})},invalidate(){c=null,l+=1,d.clear()}});return{get:f.get,getResult:f.getResult,invalidate(){p.invalidate(),f.invalidate()}}}],869355)}]);
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.