'use strict';
'use client';
import { c } from 'react/compiler-runtime';
import { useEffect } from 'react';
import { useRouter, useSearchParams } from '../../../meta/client/framework/hooks.js';
import { setMicrosoftAuthParams } from '../../../fd-app-toolbox/auth-forms/login-form/microsoft-login.js';
import { initMicrosoftPage } from './MicrosoftPage.funcs.js';
import { oauthCallbackQueryParams } from '../../../../base-repo/constants/internal-query-constants.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
function MicrosoftPage() {
  const $ = c(10);
  const router = useRouter();
  const searchParams = useSearchParams();
  let code;
  let t0;
  if ($[0] !== searchParams) {
    code = searchParams?.get(oauthCallbackQueryParams.code) ?? void 0;
    t0 = setMicrosoftAuthParams(code);
    $[0] = searchParams;
    $[1] = code;
    $[2] = t0;
  } else {
    code = $[1];
    t0 = $[2];
  }
  const params = t0;
  let t1;
  if ($[3] !== params || $[4] !== router) {
    t1 = () => {
      initMicrosoftPage(router, params);
    };
    $[3] = params;
    $[4] = router;
    $[5] = t1;
  } else {
    t1 = $[5];
  }
  let t2;
  if ($[6] !== code || $[7] !== params || $[8] !== router) {
    t2 = [code, params, router];
    $[6] = code;
    $[7] = params;
    $[8] = router;
    $[9] = t2;
  } else {
    t2 = $[9];
  }
  useEffect(t1, t2);
  return void 0;
}
__name(MicrosoftPage, "MicrosoftPage");

export { MicrosoftPage as default };
