() => {
        // Update config (propagated internally)
        configProvider.setConfig({
            gitpodURL: gitpodUrlInput.value || undefined,
            openAsPopup: gitpodPopupInput.checked
        });
        if (timeout) {
            window.clearTimeout(timeout);
            timeout = undefined;
        }
        messageElement.innerText = "Saved.";
        timeout = window.setTimeout(() => { messageElement.innerText = ""; timeout = undefined }, 3000);
    }


() => { messageElement.innerText = ""; timeout = undefined }


(event: KeyboardEvent) => {
        if (event.isComposing || event.keyCode === 229) {
            return;
        }
        save()
    }


err => console.error(err)


function Pagination({
  totalElements,
  size,
  page,
  setPage,
}: PaginationProps): ReactElement {
  return (
    <PaginationWrapper>
      <PaginationComponent
        activePage={page} // 현재 페이지
        itemsCountPerPage={size} // 한 페이지당 보여줄 리스트 아이템의 개수
        totalItemsCount={totalElements} // 총 북마크의 개수
        pageRangeDisplayed={5} // Paginator 내에서 보여줄 페이지의 범위
        prevPageText={<ArrowLeft16Icon />}


(props) => props.theme.color.gray


(props) => props.theme.color.black


interface PaginationProps {
  totalElements: number;
  size: number;
  page: number;
  setPage: (page: number) => void;
}


export function configure<T extends Test>(test: T, options?: SetupOptions & ResetOptions): T {
  test.before(() => {
    setup(options)
  })

  test.before.each(() => reset(options))

  test.after(destroy)

  return test
}


export function setup({
  html = '<!DOCTYPE html>',
  url = 'http://localhost',
  console = global.console,
}: SetupOptions = {}): JSDOM {
  const dom = new JSDOM(html, {
    pretendToBeVisual: true,
    runScripts: 'dangerously',
    url,
    virtualConsole: new VirtualConsole().sendTo(console),
  })

  const { defaultView } = dom.window.document
  if (!defaultView) {
    throw new TypeError('JSDOM did not return a Window object')
  }

  Object.defineProperty(global, kDefaultView, {
    configurable: true,
    get: () => defaultView,
  })

  defaultView.addEventListener('error', (event) => {
    process.emit('uncaughtException', event.error)
  })

  GLOBAL_PROPERTIES.forEach((property) =>
    Object.defineProperty(global, property, {
      enumerable: true,
      configurable: true,
      get: () => defaultView[property],
    }),
  )

  return dom
}


export function reset({ title = '', head = '', body = '' }: ResetOptions = {}): void {
  document.title = title
  document.head.innerHTML = head
  document.body.innerHTML = body
}


export function destroy(): void {
  GLOBAL_PROPERTIES.forEach((property) => Reflect.deleteProperty(global, property))

  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  const defaultView = (global as any)[kDefaultView] as WindowProxy & typeof globalThis

  if (defaultView) {
    // Dispose "document" to prevent "load" event from triggering.
    Object.defineProperty(defaultView, 'document', { value: null })

    defaultView.close()
  }
}


() => {
    setup(options)
  }


() => reset(options)


() => defaultView


(event) => {
    process.emit('uncaughtException', event.error)
  }


(property) =>
    Object.defineProperty(global, property, {
      enumerable: true,
      configurable: true,
      get: () => defaultView[property],
    })


() => defaultView[property]


(property) => Reflect.deleteProperty(global, property)


export interface SetupOptions {
  html?: string
  url?: string
  console?: Console
}


export interface ResetOptions {
  title?: string
  head?: string
  body?: string
}


export function newGUITransform(name: string, object: Transform, parent = gui) {
  const c = parent.addFolder(name)
  const pos = c.addFolder('position')
  pos.add(object.position, 'x').step(0.1)
  pos.add(object.position, 'y').step(0.1)
  pos.add(object.position, 'z').step(0.1)

  const rot = c.addFolder('rotation')
  rot.add(object.rotation, 'x').step(0.1)
  rot.add(object.rotation, 'y').step(0.1)
  rot.add(object.rotation, 'z').step(0.1)

  const sca = c.addFolder('scale')
  sca.add(object.scale, 'x').step(0.1)
  sca.add(object.scale, 'y').step(0.1)
  sca.add(object.scale, 'z').step(0.1)

  return c
}


export function newGUIScreenTransform(
  name: string,
  object: Transform,
  camera: Camera,
  resolution: Vec2,
  parent = gui,
) {
  const c = parent.addFolder(name)

  const size = new Vec3()
  getWorldMatrix(object, size)
  getScaleFromCameraDistance(camera, size, size)

  const tmp: any = {
    reset: () => {
      tmp.position.right = 0
      tmp.position.bottom = 0

      onChange()
    },
    position: {
      top: 0,
      left: 0,
      right: 0,
      bottom: 0,
    },
    size: 1 / size.x,
  }

  const onChange = () => {
    if (tmp.position.bottom) tmp.position.top = null
    if (tmp.position.right) tmp.position.left = null

    getWorldPositionFromViewportRectPerc(
      camera,
      tmp.position,
      resolution,
      tmp_vec_3,
    )
    tmp_vec_3.z = object.position.z
    object.position.copy(tmp_vec_3)
    object.updateMatrixWorld()

    // compute object size to fit in viewport
    getWorldMatrix(object, tmp_vec_3)
    getScaleFromCameraDistance(camera, tmp_vec_3, tmp_vec_3)

    object.scale.set(
      tmp.size * tmp_vec_3.x,
      tmp.size * tmp_vec_3.x,
      tmp.size * tmp_vec_3.x,
    )
  }

  c.add(tmp, 'reset')

  c.add(tmp.position, 'top').step(0.1).onChange(onChange)
  c.add(tmp.position, 'left').step(0.1).onChange(onChange)
  c.add(object.position, 'z', -2, 2, 0.01).listen()
  c.add(tmp.position, 'right').step(0.1).onChange(onChange)
  c.add(tmp.position, 'bottom').step(0.1).onChange(onChange)

  c.add(tmp, 'size', 0, 1, 0.01).onChange(onChange)

  const rot = c.addFolder('rotation')
  rot.add(object.rotation, 'x', 0, Math.PI * 2, 0.01)
  rot.add(object.rotation, 'y', 0, Math.PI * 2, 0.01)
  rot.add(object.rotation, 'z', 0, Math.PI * 2, 0.01)

  return c
}


() => {
      tmp.position.right = 0
      tmp.position.bottom = 0

      onChange()
    }


() => {
    if (tmp.position.bottom) tmp.position.top = null
    if (tmp.position.right) tmp.position.left = null

    getWorldPositionFromViewportRectPerc(
      camera,
      tmp.position,
      resolution,
      tmp_vec_3,
    )
    tmp_vec_3.z = object.position.z
    object.position.copy(tmp_vec_3)
    object.updateMatrixWorld()

    // compute object size to fit in viewport
    getWorldMatrix(object, tmp_vec_3)
    getScaleFromCameraDistance(camera, tmp_vec_3, tmp_vec_3)

    object.scale.set(
      tmp.size * tmp_vec_3.x,
      tmp.size * tmp_vec_3.x,
      tmp.size * tmp_vec_3.x,
    )
  }


props => {
    const { size, withHoverEffect, color, margin, ...restProps } = props;
    return (
        <SvgIcon {...{ size, withHoverEffect, color, margin, ...restProps }}>
            <CutIconSvg {...restProps} width="1em" height="1em" />
        </SvgIcon>


(): JSX.Element => {
    return
Página no encontrada

}


@NgModule({
  declarations: [
    AppComponent,
    RootsearchComponent,
    ConjugationGroupComponent,
    TrilateralConjugationPanelComponent,
    QuadilateralConjugationPanelComponent,
    StartComponent,
    NotFoundComponent,
    InitialSarfComponent,
    ActiveVerbsComponent,
    SarfVerbPronounsComponent,
    PassiveVerbsComponent,
    DerivedNounsComponent,
    NounsListingComponent,
    GerundsComponent,
    AboutComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    ReactiveFormsModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    AppMaterialModule,
    FlexLayoutModule,
    HttpClientModule,
    RouterModule.forRoot(appRoutes, {onSameUrlNavigation: 'reload'})
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }


/**
 * Returns `account` asset holding of `assetID`. Returns undefined if the account is not
 * opt-in to the given asset id.
 * @param deployer algob deployer
 * @param accountAddress account to return assetholding info
 * @param assetID asset index
 */
export async function balanceOf (
  deployer: Deployer,
  accountAddress: AccountAddress,
  assetID: number
): Promise<AssetHolding | undefined> {
  const accountInfo = await deployer.algodClient.accountInformation(accountAddress).do();
  for (const asset of accountInfo.assets) {
    if (asset['asset-id'] === assetID) {
      console.log("Asset Holding Info:", asset);
      return asset;
    }
  }
  return undefined;
}


/**
 * fetches and returns the global state of application.
 * @param deployer Deployer
 * @param creator Account from which call needs to be made
 * @param appId ID of the application being configured or empty if creating
 */
export async function readGlobalStateSSC (
  deployer: Deployer,
  creator: AccountAddress,
  appId: number): Promise<SSCStateSchema[] | undefined> {
  const accountInfoResponse = await deployer.algodClient.accountInformation(creator).do();
  for (const app of accountInfoResponse['created-apps']) {
    if (app.id === appId) { return app.params['global-state']; }
  }
  return undefined;
}


/**
 * Read and return the local state of application from an account.
 * @param deployer Deployer
 * @param account account from the which the local state has to be read
 * @param appId ID of the application being configured or empty if creating
 */
export async function readLocalStateSSC (
  deployer: Deployer,
  account: AccountAddress,
  appId: number): Promise<SSCStateSchema[] | undefined> {
  const accountInfoResponse = await deployer.algodClient.accountInformation(account).do();
  for (const app of accountInfoResponse['apps-local-state']) {
    if (app.id === appId) { return app[`key-value`]; }
  }
  return undefined;
}


/**
 * Prints account asset holdings and ALGO balance (in microalgos)
 * @param deployer algob deployer object
 * @param account account whose asset holding to print
 */
export async function printAssets (deployer: Deployer, account: string): Promise<void> {
  const accountInfo = await deployer.algodClient.accountInformation(account).do();
  console.log("Asset Holding Info:", accountInfo.assets);
  console.log("Account's ALGO (microalgos):", accountInfo["amount-without-pending-rewards"]);
}


/**
 * print account's local state of a stateful smart contract
 * @param deployer algob deployer
 * @param accountAddr account address to print local state
 * @param appId application index of smart contract
 */
export async function printLocalStateSSC (
  deployer: Deployer,
  accountAddr: AccountAddress,
  appId: number): Promise<void> {
  const localState = await readLocalStateSSC(deployer, accountAddr, appId);
  if (localState === undefined) { return; }
  console.log("User's local state:");
  for (let n = 0; n < localState.length; n++) {
    console.log(localState[n]);
  }
}


/**
 * print global state of a stateful smart contract
 * @param deployer algob deployer
 * @param creatorAddr creator address of stateful smart contract
 * @param appId application index of smart contract
 */
export async function printGlobalStateSSC (
  deployer: Deployer,
  creatorAddr: AccountAddress,
  appId: number): Promise<void> {
  const globalState = await readGlobalStateSSC(deployer, creatorAddr, appId);
  if (globalState === undefined) { return; }
  console.log("Application's global state:");
  for (let n = 0; n < globalState.length; n++) {
    console.log(globalState[n]);
  }
}


(v: number): string => this.convertWithUnit(v)


() => {
                    const maxTickValue = getMaxTickValue(data, 1);

                    return maxTickValue === 0 ? this.defaultYMax : maxTickValue;
                }


export class ApplicationTotalThreadCountChartContainer implements IInspectorChartContainer {
    private apiUrl = 'getApplicationStat/totalThreadCount/chart.pinpoint';
    private minAgentIdList: string[];
    private maxAgentIdList: string[];

    defaultYMax = 100;
    title = 'Total Thread';

    constructor(
        private inspectorChartDataService: InspectorChartDataService,
        private inspectorChartThemeService: InspectorChartThemeService,
    ) {}

    getData(range: number[]): Observable<IInspectorChartData> {
        return this.inspectorChartDataService.getData(this.apiUrl, range);
    }

    makeChartData({charts}: IInspectorChartData): PrimitiveArray[] {
        this.minAgentIdList = makeYData(charts.y['TOTAL_THREAD_COUNT'], 1) as string[];
        this.maxAgentIdList = makeYData(charts.y['TOTAL_THREAD_COUNT'], 3) as string[];

        return [
            ['x', ...makeXData(charts.x)],
            ['max', ...makeYData(charts.y['TOTAL_THREAD_COUNT'], 2)],
            ['avg', ...makeYData(charts.y['TOTAL_THREAD_COUNT'], 4)],
            ['min', ...makeYData(charts.y['TOTAL_THREAD_COUNT'], 0)],
        ];
    }

    makeDataOption(): Data {
        return {
            type: spline(),
            names: {
                min: 'Min',
                avg: 'Avg',
                max: 'Max',
            },
            colors: {
                ...this.inspectorChartThemeService.getMinAvgMaxColors()
            }
        };
    }

    makeElseOption(): {[key: string]: any} {
        return {
            line: {
                classes: ['min', 'avg', 'max']
            }
        };
    }

    makeYAxisOptions(data: PrimitiveArray[]): {[key: string]: any} {
        return {
            y: {
                label: {
                    text: 'Total Thread (count)',
                    position: 'outer-middle'
                },
                tick: {
                    count: 5,
                    format: (v: number): string => this.convertWithUnit(v)
                },
                padding: {
                    top: 0,
                    bottom: 0
                },
                min: 0,
                max: (() => {
                    const maxTickValue = getMaxTickValue(data, 1);

                    return maxTickValue === 0 ? this.defaultYMax : maxTickValue;
                })(),
                default: [0, this.defaultYMax]
            }
        };
    }

    makeTooltipOptions(): {[key: string]: any} {
        return {};
    }

    convertWithUnit(value: number): string {
        return value.toString();
    }

    getTooltipFormat(v: number, columnId: string, i: number): string {
        return `${this.convertWithUnit(v)} ${getAgentId(columnId, i, this.minAgentIdList, this.maxAgentIdList)}`;
    }
}


getData(range: number[]): Observable<IInspectorChartData> {
        return this.inspectorChartDataService.getData(this.apiUrl, range);
    }


makeChartData({charts}: IInspectorChartData): PrimitiveArray[] {
        this.minAgentIdList = makeYData(charts.y['TOTAL_THREAD_COUNT'], 1) as string[];
        this.maxAgentIdList = makeYData(charts.y['TOTAL_THREAD_COUNT'], 3) as string[];

        return [
            ['x', ...makeXData(charts.x)],
            ['max', ...makeYData(charts.y['TOTAL_THREAD_COUNT'], 2)],
            ['avg', ...makeYData(charts.y['TOTAL_THREAD_COUNT'], 4)],
            ['min', ...makeYData(charts.y['TOTAL_THREAD_COUNT'], 0)],
        ];
    }


makeDataOption(): Data {
        return {
            type: spline(),
            names: {
                min: 'Min',
                avg: 'Avg',
                max: 'Max',
            },
            colors: {
                ...this.inspectorChartThemeService.getMinAvgMaxColors()
            }
        };
    }


makeElseOption(): {[key: string]: any} {
        return {
            line: {
                classes: ['min', 'avg', 'max']
            }
        };
    }


makeYAxisOptions(data: PrimitiveArray[]): {[key: string]: any} {
        return {
            y: {
                label: {
                    text: 'Total Thread (count)',
                    position: 'outer-middle'
                },
                tick: {
                    count: 5,
                    format: (v: number): string => this.convertWithUnit(v)
                },
                padding: {
                    top: 0,
                    bottom: 0
                },
                min: 0,
                max: (() => {
                    const maxTickValue = getMaxTickValue(data, 1);

                    return maxTickValue === 0 ? this.defaultYMax : maxTickValue;
                })(),
                default: [0, this.defaultYMax]
            }
        };
    }


makeTooltipOptions(): {[key: string]: any} {
        return {};
    }


convertWithUnit(value: number): string {
        return value.toString();
    }


getTooltipFormat(v: number, columnId: string, i: number): string {
        return `${this.convertWithUnit(v)} ${getAgentId(columnId, i, this.minAgentIdList, this.maxAgentIdList)}`;
    }


() => {
  it('should create an instance', () => {
    expect(new Forecast()).toBeTruthy();
  });
}


() => {
    expect(new Forecast()).toBeTruthy();
  }


props => {
  const { contest, onSwitchContest } = props;

  const [contestPickerVisible, setContestPickerVisible] = useState(false);

  const ContestPickerButton = () => (
    <HeaderButton
      title={contest.name}
      onPress={()


() => (
    <HeaderButton
      title={contest.name}


() => (
    <TimetableStack.Navigator screenOptions={defaultStackScreenOptions}>
      <TimetableStack.Screen
        component


() => (
    <ResultsStack.Navigator screenOptions={defaultStackScreenOptions}>
      <ResultsStack.Screen
        component


({ focused, color }) => (
              <Image
                source={focused ? timetableFilledIcon : timetableIcon}


({ focused, color }) => (
              <Image
                source={focused ? scrollFilledIcon : scrollIcon}


interface Props {
  contest: Contest;
  onSwitchContest: (contest?: Contest) => void;
}


export type TimetableStackParamList = {
  PerformanceList: { contest: Contest };
  Performance: { id: string; stage: Stage };
};


export type ResultsStackParamList = {
  ResultGroupList: { contest: Contest };
  ResultList: { contestId: string; contestCategoryId: string };
};


type BottomTabParamList = {
  Timetable: undefined;
  Results: undefined;
};


function calcSkipValue(input: number): number {
  let blit = 0;
  // 1. Run sieve first;
  blit =
    ((0x88888888 & input) >>> 3) |
    ((0x44444444 & input) >>> 2) |
    ((0x22222222 & input) >>> 1) |
    (0x11111111 & input);
  // 2. Shift them to the value
  blit =
    ((blit & 0x10000000) >>> 21) |
    ((blit & 0x01000000) >>> 18) |
    ((blit & 0x00100000) >>> 15) |
    ((blit & 0x00010000) >>> 12) |
    ((blit & 0x00001000) >>> 9) |
    ((blit & 0x00000100) >>> 6) |
    ((blit & 0x00000010) >>> 3) |
    (blit & 0x00000001);
  return blit;
}


function blit(input: number, offset: number, value: number): number {
  return (input & ~(0xFF << offset)) | (value << offset);
}


_getPage(pageId: number): Int32Array {
    let page = this.pages[pageId];
    if (page == null) {
      page = new Int32Array(256);
      this.pages[pageId] = page;
    }
    return page;
  }


_getPageIfExists(pageId: number): Int32Array | null {
    const page = this.pages[pageId];
    return page;
  }


_getSkipPage(pageId: number): Int32Array {
    let page = this.skipPages[pageId];
    if (page == null) {
      page = new Int32Array(84);
      this.skipPages[pageId] = page;
    }
    return page;
  }


_generateSkipPageWord(pageId: number, wordPos: number, value: number): void {
    // Regenerate skip page for the given word.
    // Each 4 bits are compacted to 1 bit - therefore 32 bits are combined to
    // 8 bits. This sets 1 byte of layer 1.
    // We repeat this for 3 times to generate each layer.
    const skipPage = this._getSkipPage(pageId);
    const skip1Pos = wordPos >>> 2;
    const skip1Offset = (wordPos << 3) % 32;
    const skip2Pos = (skip1Pos >>> 2);
    const skip2Offset = (skip1Pos << 3) % 32;
    const skip3Pos = (skip2Pos >>> 2);
    const skip3Offset = (skip2Pos << 3) % 32;
    const skip1 = blit(skipPage[skip1Pos], skip1Offset, calcSkipValue(value));
    const skip2 = blit(skipPage[skip2Pos + 64], skip2Offset,
      calcSkipValue(skip1));
    const skip3 = blit(skipPage[skip3Pos + 80], skip3Offset,
      calcSkipValue(skip2));
    skipPage[skip1Pos] = skip1;
    skipPage[skip2Pos + 64] = skip2;
    skipPage[skip3Pos + 80] = skip3;
  }


_generateSkipPage(pageId: number): void {
    // If we're regenerating entire page, we can just calculate each skip page.
    const page = this._getPage(pageId);
    const skipPage = this._getSkipPage(pageId);
    // Mux 4 integers into one...
    for (let i = 0; i < page.length; i += 4) {
      let out = 0;
      for (let j = 0; j < 4; j += 1) {
        out |= calcSkipValue(page[i + j]) << (j * 8);
      }
      skipPage[i >> 2] = out;
    }
    // The same goes for level 1 and 2.
    for (let i = 0; i < 64; i += 4) {
      let out = 0;
      for (let j = 0; j < 4; j += 1) {
        out |= calcSkipValue(skipPage[i + j]) << (j * 8);
      }
      skipPage[(i >> 2) + 64] = out;
    }
    for (let i = 0; i < 16; i += 4) {
      let out = 0;
      for (let j = 0; j < 4; j += 1) {
        out |= calcSkipValue(skipPage[i + j + 64]) << (j * 8);
      }
      skipPage[(i >> 2) + 80] = out;
    }
  }


clear(): void {
    this.pages = [];
    this.skipPages = [];
  }


set(key: number, value: boolean): this {
    const pageId = key >> 13;
    const pageWord = (key >> 5) & 0xFF;
    const page = this._getPage(pageId);
    let wordValue = page[pageWord];
    if (value) wordValue |= 1 << (key & 31);
    else wordValue &= ~(1 << (key & 31));
    page[pageWord] = wordValue;
    this._generateSkipPageWord(pageId, pageWord, wordValue);
    return this;
  }


setWord(wordPos: number, value: number): void {
    const pageId = wordPos / 256 | 0;
    const page = this._getPage(pageId);
    const pos = wordPos % 256;
    page[pos] = value;
    this._generateSkipPageWord(pageId, pos, value);
  }


add(value: number): this {
    return this.set(value, true);
  }


delete(value: number): boolean {
    this.set(value, false);
    // TODO Check if bit was true
    return true;
  }


has(key: number): boolean {
    return this.get(key);
  }


get(key: number): boolean {
    const pageId = key >> 13;
    const pageByte = key >> 5;
    const pageOffset = pageByte & 255;
    const page = this._getPageIfExists(pageId);
    if (page == null) return false;
    return (page[pageOffset] & (1 << (key & 31))) !== 0;
  }


getWord(wordPos: number): number {
    const pageId = wordPos / 256 | 0;
    const page = this._getPageIfExists(pageId);
    if (page == null) return 0;
    return page[wordPos % 256];
  }


[Symbol.iterator](): IterableIterator<number> {
    return this.values();
  }


forEach(
    callbackfn: (value: number, value2: number, set: Set<number>) => void,
    thisArg?: any,
  ): void {
    for (const value of this.values()) {
      callbackfn.call(thisArg, value, value, this);
    }
  }


* entries(): IterableIterator<[number, number]> {
    for (const value of this.values()) {
      yield [value, value];
    }
  }


keys(): IterableIterator<number> {
    return this.values();
  }


* values(): IterableIterator<number> {
    for (let i = 0; i < this.pages.length; i += 1) {
      const page = this.pages[i];
      if (page == null) continue;
      const skipPage = this.skipPages[i];
      let skipPage1Val = 0;
      let skipPage2Val = 0;
      let skipPage3Val = 0;
      // skip page 1: 0.125 bytes per 1 bit, wraps every 4 byte
      // skip page 2: 0.5 bytes per 1 bit, wraps every 16 byte
      // skip page 3: 2 bytes per 1 bit, wraps every 64 byte
      for (let j = 0; j < page.length; j += 1) {
        if (j % 64 === 0) skipPage3Val = skipPage[(j / 64 | 0) + 80];
        if (j % 16 === 0) skipPage2Val = skipPage[(j / 16 | 0) + 64];
        if (j % 4 === 0) skipPage1Val = skipPage[j / 4 | 0];
        if (j % 2 === 0) {
          if (!(skipPage3Val & (1 << ((j >> 1) % 32)))) {
            j += 1;
            continue;
          }
        }
        let value = page[j];
        let pos = 0;
        while (value !== 0) {
          if (pos % 16 === 0) {
            if (!(skipPage2Val & (1 << ((j >> 2) + (pos >> 4))))) {
              pos += 16;
              value >>>= 16;
              continue;
            }
          }
          if (pos % 4 === 0) {
            if (!(skipPage1Val & (1 << (pos >> 2)))) {
              pos += 4;
              value >>>= 4;
              continue;
            }
          }
          if (value & 1) yield pos + j * 32 + i * 256 * 32;
          pos += 1;
          value >>>= 1;
        }
      }
    }
  }


and(set: BitSet): BitSet {
    const output = new BitSet();
    const minPages = Math.min(set.pages.length, this.pages.length);
    for (let i = 0; i < minPages; i += 1) {
      const aPage = this.pages[i];
      const bPage = set.pages[i];
      if (aPage == null || bPage == null) {
        continue;
      }
      const outPage = new Int32Array(256);
      for (let j = 0; j < outPage.length; j += 1) {
        outPage[j] = aPage[j] & bPage[j];
      }
      output.pages[i] = outPage;
      output._generateSkipPage(i);
    }
    return output;
  }


// this AND ~set
andNot(set: BitSet): BitSet {
    const output = new BitSet();
    for (let i = 0; i < this.pages.length; i += 1) {
      const aPage = this.pages[i];
      const bPage = set.pages[i];
      if (aPage == null) continue;
      if (bPage == null) {
        output.pages[i] = aPage;
        continue;
      }
      const outPage = new Int32Array(256);
      for (let j = 0; j < outPage.length; j += 1) {
        outPage[j] = aPage[j] & ~bPage[j];
      }
      output.pages[i] = outPage;
      output._generateSkipPage(i);
    }
    return output;
  }


or(set: BitSet): BitSet {
    const output = new BitSet();
    const maxPages = Math.max(set.pages.length, this.pages.length);
    for (let i = 0; i < maxPages; i += 1) {
      const aPage = this.pages[i];
      const bPage = set.pages[i];
      if (aPage == null) {
        output.pages[i] = bPage;
        continue;
      }
      if (bPage == null) {
        output.pages[i] = aPage;
        continue;
      }
      const outPage = new Int32Array(256);
      for (let j = 0; j < outPage.length; j += 1) {
        outPage[j] = aPage[j] | bPage[j];
      }
      output.pages[i] = outPage;
      output._generateSkipPage(i);
    }
    return output;
  }


xor(set: BitSet): BitSet {
    const output = new BitSet();
    const maxPages = Math.max(set.pages.length, this.pages.length);
    for (let i = 0; i < maxPages; i += 1) {
      const aPage = this.pages[i];
      const bPage = set.pages[i];
      if (aPage == null) {
        output.pages[i] = bPage;
        continue;
      }
      if (bPage == null) {
        output.pages[i] = aPage;
        continue;
      }
      const outPage = new Int32Array(256);
      for (let j = 0; j < outPage.length; j += 1) {
        outPage[j] = aPage[j] ^ bPage[j];
      }
      output.pages[i] = outPage;
      output._generateSkipPage(i);
    }
    return output;
  }


function toggleStackedLabels() {
    const { yAxis } = this;

    // CL-10676 - Return if yAxis is undefined
    if (!yAxis || yAxis.length === 0) {
        return;
    }
    const { stackTotalGroup, stacks }: any = yAxis[0] || {};

    if (stacks && stackTotalGroup) {
        // We need to use Lodash map, because we are iterating through an object
        const labels = map(yAxis[0].stacks.column, (point: any) => point.label);
        const neighbors = toNeighbors(labels);

        const neighborsAreOverlapping = neighbors.some((labelsPair) => {
            const [firstLabel, nextLabel]: any[] = labelsPair || [];

            if (firstLabel && nextLabel) {
                if (firstLabel.alignAttr && nextLabel.alignAttr) {
                    // We need to calculate this from getBBox, because FireFox does not
                    // provide clientWidth attribute
                    const firstLabelWidth = firstLabel.element.getBBox().width;
                    const firstLabelRight = firstLabel.alignAttr.x + firstLabelWidth;
                    const nextLabelLeft = nextLabel.alignAttr.x;
                    return firstLabelRight > nextLabelLeft;
                }
            }
            return false;
        });

        if (neighborsAreOverlapping) {
            this.userOptions.stackLabelsVisibility = 'hidden';
            stackTotalGroup.hide();
        } else {
            this.userOptions.stackLabelsVisibility = 'visible';
            stackTotalGroup.show();
        }
    }
}


(
    visiblePoints: any,
    minAxisValue: number,
    shouldCheckShapeIntersection: boolean = false) => {
    const foundIntersection = toNeighbors(
        // some data labels may not be rendered (too many points)
        visiblePoints.filter(hasDataLabel)
    ).some((pointPair) => {
        const [firstPoint, nextPoint]: any[] = pointPair || [];
        const firstDataLabelAttr = getDataLabelAttributes(firstPoint);
        const nextDataLabelAttr = getDataLabelAttributes(nextPoint);

        if (shouldCheckShapeIntersection) {
            const firstShapeAttr = getShapeAttributes(firstPoint);
            const nextShapeAttr = getShapeAttributes(nextPoint);

            return isIntersecting(firstDataLabelAttr, nextDataLabelAttr) ||
                isIntersecting(firstDataLabelAttr, nextShapeAttr) ||
                isIntersecting(firstShapeAttr, nextDataLabelAttr);
        }

        return isIntersecting(firstDataLabelAttr, nextDataLabelAttr);
    });

    if (foundIntersection) {
        hideDataLabels(visiblePoints);
    } else {
        visiblePoints.forEach((point: any) => showDataLabelInAxisRange(point, minAxisValue));
    }
}


(pointPair) => {
        const [firstPoint, nextPoint]: any[] = pointPair || [];
        const firstDataLabelAttr = getDataLabelAttributes(firstPoint);
        const nextDataLabelAttr = getDataLabelAttributes(nextPoint);

        if (shouldCheckShapeIntersection) {
            const firstShapeAttr = getShapeAttributes(firstPoint);
            const nextShapeAttr = getShapeAttributes(nextPoint);

            return isIntersecting(firstDataLabelAttr, nextDataLabelAttr) ||
                isIntersecting(firstDataLabelAttr, nextShapeAttr) ||
                isIntersecting(firstShapeAttr, nextDataLabelAttr);
        }

        return isIntersecting(firstDataLabelAttr, nextDataLabelAttr);
    }


(point: any) => showDataLabelInAxisRange(point, minAxisValue)


(visiblePoints: any, minAxisValue: number) => {
    const toggleLabel = (point: any) => {
        const { dataLabel, shapeArgs } = point;
        if (dataLabel && shapeArgs) {
            const labelHeight = dataLabel.height + (2 * dataLabel.padding || 0);
            const isOverlappingHeight = labelHeight > shapeArgs.height;
            return isOverlappingHeight ? hideDataLabel(point) : showDataLabelInAxisRange(point, minAxisValue);
        }

        return null;
    };

    const isOverlappingWidth = visiblePoints.filter(hasDataLabel).some((point: any) => {
        const { dataLabel } = point;
        if (dataLabel) {
            const labelWidth = dataLabel.width + (2 * dataLabel.padding);
            return labelWidth > point.shapeArgs.width;
        }
        return false;
    });

    if (isOverlappingWidth) {
        hideDataLabels(visiblePoints);
    } else {
        visiblePoints.forEach(toggleLabel);
    }
}


(point: any) => {
        const { dataLabel, shapeArgs } = point;
        if (dataLabel && shapeArgs) {
            const labelHeight = dataLabel.height + (2 * dataLabel.padding || 0);
            const isOverlappingHeight = labelHeight > shapeArgs.height;
            return isOverlappingHeight ? hideDataLabel(point) : showDataLabelInAxisRange(point, minAxisValue);
        }

        return null;
    }


(point: any) => {
        const { dataLabel } = point;
        if (dataLabel) {
            const labelWidth = dataLabel.width + (2 * dataLabel.padding);
            return labelWidth > point.shapeArgs.width;
        }
        return false;
    }


(point: any) => point.label


(labelsPair) => {
            const [firstLabel, nextLabel]: any[] = labelsPair || [];

            if (firstLabel && nextLabel) {
                if (firstLabel.alignAttr && nextLabel.alignAttr) {
                    // We need to calculate this from getBBox, because FireFox does not
                    // provide clientWidth attribute
                    const firstLabelWidth = firstLabel.element.getBBox().width;
                    const firstLabelRight = firstLabel.alignAttr.x + firstLabelWidth;
                    const nextLabelLeft = nextLabel.alignAttr.x;
                    return firstLabelRight > nextLabelLeft;
                }
            }
            return false;
        }


(chart: any) => {
    const isStackedChart = isStacked(chart);
    const hasLabelsStacked = areLabelsStacked(chart);
    const visibleSeries = getVisibleSeries(chart);
    const visiblePoints = getDataPoints(visibleSeries);
    const minAxisValue = get(chart, ['yAxis', 0, 'min'], 0);

    if (isStackedChart) {
        toggleStackedChartLabels(visiblePoints, minAxisValue);
    } else {
        toggleNonStackedChartLabels(visiblePoints, minAxisValue, true);
    }
    if (hasLabelsStacked) {
        toggleStackedLabels.call(chart);
    }
}


(e: KeyboardEvent) => {
    if (e.key === 'Escape') {
      this.props.onSkip();
    }
  }


() => {
    this.services.trackUiMetric(METRIC_TYPE.CLICK, 'sampleDataDecline');
    this.props.onSkip();
  }


() => {
    this.services.trackUiMetric(METRIC_TYPE.CLICK, 'sampleDataConfirm');
    this.redirecToSampleData();
  }


() => {
    const { telemetry } = this.props;
    if (!telemetry) {
      return null;
    }

    const isOptedIn = telemetry.telemetryService.getIsOptedIn();
    if (isOptedIn) {
      return (
        <Fragment>
          <FormattedMessage
            id="kbn.home.dataManagementDisableCollection"
            defaultMessage=" To stop collection, "
          />
          <EuiLink href="#/management/kibana/settings">
            <FormattedMessage
              id="kbn.home.dataManagementDisableCollectionLink"
              defaultMessage="disable usage data here."
            />
          </EuiLink>
        </Fragment>
      );
    } else {
      return (
        <Fragment>
          <FormattedMessage
            id="kbn.home.dataManagementEnableCollection"
            defaultMessage=" To start collection, "
          />
          <EuiLink href="#/management/kibana/settings">
            <FormattedMessage
              id="kbn.home.dataManagementEnableCollectionLink"
              defaultMessage="enable usage data here."
            />
          </EuiLink>
        </Fragment>
      );
    }
  }


/**
 * Shows a full-screen welcome page that gives helpful quick links to beginners.
 */
export class Welcome extends React.Component<Props> {
  private services = getServices();

  private hideOnEsc = (e: KeyboardEvent) => {
    if (e.key === 'Escape') {
      this.props.onSkip();
    }
  };

  private redirecToSampleData() {
    const path = this.services.addBasePath('#/home/tutorial_directory/sampleData');
    window.location.href = path;
  }

  private onSampleDataDecline = () => {
    this.services.trackUiMetric(METRIC_TYPE.CLICK, 'sampleDataDecline');
    this.props.onSkip();
  };

  private onSampleDataConfirm = () => {
    this.services.trackUiMetric(METRIC_TYPE.CLICK, 'sampleDataConfirm');
    this.redirecToSampleData();
  };

  componentDidMount() {
    const { telemetry } = this.props;
    this.services.trackUiMetric(METRIC_TYPE.LOADED, 'welcomeScreenMount');
    if (telemetry) {
      telemetry.telemetryNotifications.setOptedInNoticeSeen();
    }
    document.addEventListener('keydown', this.hideOnEsc);
  }

  componentWillUnmount() {
    document.removeEventListener('keydown', this.hideOnEsc);
  }

  private renderTelemetryEnabledOrDisabledText = () => {
    const { telemetry } = this.props;
    if (!telemetry) {
      return null;
    }

    const isOptedIn = telemetry.telemetryService.getIsOptedIn();
    if (isOptedIn) {
      return (
        <Fragment>
          <FormattedMessage
            id="kbn.home.dataManagementDisableCollection"
            defaultMessage=" To stop collection, "
          />
          <EuiLink href="#/management/kibana/settings">
            <FormattedMessage
              id="kbn.home.dataManagementDisableCollectionLink"
              defaultMessage="disable usage data here."
            />
          </EuiLink>
        </Fragment>
      );
    } else {
      return (
        <Fragment>
          <FormattedMessage
            id="kbn.home.dataManagementEnableCollection"
            defaultMessage=" To start collection, "
          />
          <EuiLink href="#/management/kibana/settings">
            <FormattedMessage
              id="kbn.home.dataManagementEnableCollectionLink"
              defaultMessage="enable usage data here."
            />
          </EuiLink>
        </Fragment>
      );
    }
  };

  render() {
    const { urlBasePath, telemetry } = this.props;
    return (
      <EuiPortal>

              <EuiSpacer size="xl" />

                <EuiIcon type="logoKibana" size="xxl" />

              <EuiTitle size="l" className="homWelcome__title">

                  <FormattedMessage id="kbn.home.welcomeTitle" defaultMessage="Welcome to Kibana" />

              </EuiTitle>
              <EuiText size="s" color="subdued" className="homWelcome__subtitle">

                  <FormattedMessage
                    id="kbn.home.welcomeDescription"
                    defaultMessage="Your window into the Elastic Stack"
                  />

              </EuiText>
              <EuiSpacer size="m" />

            <EuiFlexGroup gutterSize="l">
              <EuiFlexItem>
                <SampleDataCard
                  urlBasePath={urlBasePath}
                  onConfirm={this.onSampleDataConfirm}
                  onDecline={this.onSampleDataDecline}
                />
                <EuiSpacer size="s" />
                {!!telemetry && (
                  <Fragment>
                    <EuiTextColor className="euiText--small" color="subdued">
                      <FormattedMessage
                        id="kbn.home.dataManagementDisclaimerPrivacy"
                        defaultMessage="To learn about how usage data helps us manage and improve our products and services, see our "
                      />
                      <EuiLink href={PRIVACY_STATEMENT_URL} target="_blank" rel="noopener">
                        <FormattedMessage
                          id="kbn.home.dataManagementDisclaimerPrivacyLink"
                          defaultMessage="Privacy Statement."
                        />
                      </EuiLink>
                      {this.renderTelemetryEnabledOrDisabledText()}
                    </EuiTextColor>
                    <EuiSpacer size="xs" />
                  </Fragment>
                )}


interface Props {
  urlBasePath: string;
  onSkip: () => void;
  telemetry?: TelemetryPluginStart;
}


private redirecToSampleData() {
    const path = this.services.addBasePath('#/home/tutorial_directory/sampleData');
    window.location.href = path;
  }


componentDidMount() {
    const { telemetry } = this.props;
    this.services.trackUiMetric(METRIC_TYPE.LOADED, 'welcomeScreenMount');
    if (telemetry) {
      telemetry.telemetryNotifications.setOptedInNoticeSeen();
    }
    document.addEventListener('keydown', this.hideOnEsc);
  }


componentWillUnmount() {
    document.removeEventListener('keydown', this.hideOnEsc);
  }


render() {
    const { urlBasePath, telemetry } = this.props;
    return (
      <EuiPortal>

              <EuiSpacer size="xl" />

                <EuiIcon type="logoKibana" size="xxl" />

              <EuiTitle size="l" className="homWelcome__title">

                  <FormattedMessage id="kbn.home.welcomeTitle" defaultMessage="Welcome to Kibana" />

              </EuiTitle>
              <EuiText size="s" color="subdued" className="homWelcome__subtitle">

                  <FormattedMessage
                    id="kbn.home.welcomeDescription"
                    defaultMessage="Your window into the Elastic Stack"
                  />

              </EuiText>
              <EuiSpacer size="m" />

            <EuiFlexGroup gutterSize="l">
              <EuiFlexItem>
                <SampleDataCard
                  urlBasePath={urlBasePath}
                  onConfirm={this.onSampleDataConfirm}
                  onDecline={this.onSampleDataDecline}
                />
                <EuiSpacer size="s" />
                {!!telemetry && (
                  <Fragment>
                    <EuiTextColor className="euiText--small" color="subdued">
                      <FormattedMessage
                        id="kbn.home.dataManagementDisclaimerPrivacy"
                        defaultMessage="To learn about how usage data helps us manage and improve our products and services, see our "
                      />
                      <EuiLink href={PRIVACY_STATEMENT_URL} target="_blank" rel="noopener">
                        <FormattedMessage
                          id="kbn.home.dataManagementDisclaimerPrivacyLink"
                          defaultMessage="Privacy Statement."
                        />
                      </EuiLink>
                      {this.renderTelemetryEnabledOrDisabledText()}
                    </EuiTextColor>
                    <EuiSpacer size="xs" />
                  </Fragment>
                )}


() => {

    test('renders correctly', () => {
        const tree = shallow(
            <Loader active />
        );
        expect(tree).toMatchSnapshot();
    });

    test('renders non-active Loader correctly', () => {
        const tree = shallow(
            <Loader active />
        );
        expect(tree).toMatchSnapshot();
    });

    test('Renders with custom loader and animation', () => {
        const component = shallow(
            <Loader
                active
                loader="someImage"
                animation="someAnimation"
            />
        );

        expect(component.find('img').prop('src')).toEqual('someImage');
        expect(component.find('img').prop('className')).toContain('someAnimation');

    });

}


() => {
        const tree = shallow(
            <Loader active />
        );
        expect(tree).toMatchSnapshot();
    }


() => {
        const component = shallow(
            <Loader
                active
                loader="someImage"
                animation="someAnimation"
            />
        );

        expect(component.find('img').prop('src')).toEqual('someImage');
        expect(component.find('img').prop('className')).toContain('someAnimation');

    }


/**
 * A logger that just throws away all messages.
 *
 * @public
 */
export function getVoidLogger(): winston.Logger {
  return winston.createLogger({
    transports: [new winston.transports.Console({ silent: true })],
  });
}


() => {
    let diagnosticService: UnitTestDiagnosticService;

    suiteSetup(() => {
        diagnosticService = new UnitTestDiagnosticService();
    });
    suite('TestStatus: Error', () => {
        let actualPrefix: string;
        let actualSeverity: DiagnosticSeverity;
        let expectedPrefix: string;
        let expectedSeverity: DiagnosticSeverity;
        suiteSetup(() => {
            actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Error)!;
            actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Error)!;
            expectedPrefix = localize.Testing.testErrorDiagnosticMessage();
            expectedSeverity = DiagnosticSeverity.Error;
        });
        test('Message Prefix', () => {
            assert.equal(actualPrefix, expectedPrefix);
        });
        test('Severity', () => {
            assert.equal(actualSeverity, expectedSeverity);
        });
    });
    suite('TestStatus: Fail', () => {
        let actualPrefix: string;
        let actualSeverity: DiagnosticSeverity;
        let expectedPrefix: string;
        let expectedSeverity: DiagnosticSeverity;
        suiteSetup(() => {
            actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Fail)!;
            actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Failure)!;
            expectedPrefix = localize.Testing.testFailDiagnosticMessage();
            expectedSeverity = DiagnosticSeverity.Error;
        });
        test('Message Prefix', () => {
            assert.equal(actualPrefix, expectedPrefix);
        });
        test('Severity', () => {
            assert.equal(actualSeverity, expectedSeverity);
        });
    });
    suite('TestStatus: Skipped', () => {
        let actualPrefix: string;
        let actualSeverity: DiagnosticSeverity;
        let expectedPrefix: string;
        let expectedSeverity: DiagnosticSeverity;
        suiteSetup(() => {
            actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Skipped)!;
            actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Skip)!;
            expectedPrefix = localize.Testing.testSkippedDiagnosticMessage();
            expectedSeverity = DiagnosticSeverity.Information;
        });
        test('Message Prefix', () => {
            assert.equal(actualPrefix, expectedPrefix);
        });
        test('Severity', () => {
            assert.equal(actualSeverity, expectedSeverity);
        });
    });
}


() => {
        diagnosticService = new UnitTestDiagnosticService();
    }


() => {
        let actualPrefix: string;
        let actualSeverity: DiagnosticSeverity;
        let expectedPrefix: string;
        let expectedSeverity: DiagnosticSeverity;
        suiteSetup(() => {
            actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Error)!;
            actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Error)!;
            expectedPrefix = localize.Testing.testErrorDiagnosticMessage();
            expectedSeverity = DiagnosticSeverity.Error;
        });
        test('Message Prefix', () => {
            assert.equal(actualPrefix, expectedPrefix);
        });
        test('Severity', () => {
            assert.equal(actualSeverity, expectedSeverity);
        });
    }


() => {
            actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Error)!;
            actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Error)!;
            expectedPrefix = localize.Testing.testErrorDiagnosticMessage();
            expectedSeverity = DiagnosticSeverity.Error;
        }


() => {
            assert.equal(actualPrefix, expectedPrefix);
        }


() => {
            assert.equal(actualSeverity, expectedSeverity);
        }


() => {
        let actualPrefix: string;
        let actualSeverity: DiagnosticSeverity;
        let expectedPrefix: string;
        let expectedSeverity: DiagnosticSeverity;
        suiteSetup(() => {
            actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Fail)!;
            actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Failure)!;
            expectedPrefix = localize.Testing.testFailDiagnosticMessage();
            expectedSeverity = DiagnosticSeverity.Error;
        });
        test('Message Prefix', () => {
            assert.equal(actualPrefix, expectedPrefix);
        });
        test('Severity', () => {
            assert.equal(actualSeverity, expectedSeverity);
        });
    }


() => {
            actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Fail)!;
            actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Failure)!;
            expectedPrefix = localize.Testing.testFailDiagnosticMessage();
            expectedSeverity = DiagnosticSeverity.Error;
        }


() => {
        let actualPrefix: string;
        let actualSeverity: DiagnosticSeverity;
        let expectedPrefix: string;
        let expectedSeverity: DiagnosticSeverity;
        suiteSetup(() => {
            actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Skipped)!;
            actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Skip)!;
            expectedPrefix = localize.Testing.testSkippedDiagnosticMessage();
            expectedSeverity = DiagnosticSeverity.Information;
        });
        test('Message Prefix', () => {
            assert.equal(actualPrefix, expectedPrefix);
        });
        test('Severity', () => {
            assert.equal(actualSeverity, expectedSeverity);
        });
    }


() => {
            actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Skipped)!;
            actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Skip)!;
            expectedPrefix = localize.Testing.testSkippedDiagnosticMessage();
            expectedSeverity = DiagnosticSeverity.Information;
        }


export default class FirebaseModel {

    @observable status: STATUS = STATUS.LOADING;
    @observable error: Error = null;

    protected readonly ref: Reference;

    constructor(database: Database, ref: string) {
        this.ref = database.ref(ref);
    }

    @action.bound
    protected setCancelled(error: Error) {
        this.error = error;
        this.status = STATUS.CANCELLED;
    }

}


@action.bound
    protected setCancelled(error: Error) {
        this.error = error;
        this.status = STATUS.CANCELLED;
    }


({
  label,
  value,
  noDataValue = "-",
}: DataRowItemProps): JSX.Element => (
  <>
    {label ? label + ": "


interface DataRowItemProps {
  label?: string;
  value?: string;
  noDataValue?: string;
}


export default class Client {

  constructor() {
  }

  async hello(): Promise<void> {
    let request_ = new $tea.Request();
    request_.method = "GET";
    request_.pathname = "/";
    request_.headers = {
      host: "www.test.com",
    };
    if (true) {
      request_.headers["host"] = "www.test2.com";
    }

    let response_ = await $tea.doAction(request_);

    if (true) {
      throw $tea.newRetryError(request_, response_);
    } else {
      true;
    }

    Client.helloIf();
    !false;
    let a : string = null;
    a = "string";
    return ;
  }

  static helloIf(): void {
    if (true) {
    }

    if (true) {
    } else if (true) {
    } else {
    }

  }

  static helloThrow(): void {
    throw $tea.newError({ });
  }

  static helloForBreak(): void {

    for (let item of [ ]) {
      break;
    }
  }

  static helloWhile(): void {

    while (true) {
      break;
    }
  }

  static helloDeclare(): void {
    let hello = "world";
    let helloNull : string = null;
    hello = "\"hehe\"";
  }

}


async hello(): Promise<void> {
    let request_ = new $tea.Request();
    request_.method = "GET";
    request_.pathname = "/";
    request_.headers = {
      host: "www.test.com",
    };
    if (true) {
      request_.headers["host"] = "www.test2.com";
    }

    let response_ = await $tea.doAction(request_);

    if (true) {
      throw $tea.newRetryError(request_, response_);
    } else {
      true;
    }

    Client.helloIf();
    !false;
    let a : string = null;
    a = "string";
    return ;
  }


static helloIf(): void {
    if (true) {
    }

    if (true) {
    } else if (true) {
    } else {
    }

  }


static helloThrow(): void {
    throw $tea.newError({ });
  }


static helloForBreak(): void {

    for (let item of [ ]) {
      break;
    }
  }


static helloWhile(): void {

    while (true) {
      break;
    }
  }


static helloDeclare(): void {
    let hello = "world";
    let helloNull : string = null;
    hello = "\"hehe\"";
  }


@Injectable()
export class NotificationService {
  getHello(): string {
    return 'Hello World from notification!';
  }
}


getHello(): string {
    return 'Hello World from notification!';
  }


export interface StandardProps {
  /**
   * An optional theme which can be passed down to a component.
   */
  theme?: 'default'
  /**
   * The style prop for explicitly overriding some CSS styles.
   */
  style?: React.CSSProperties
}


function loadable<Props extends Record<string, unknown> = Record<string, unknown>>(load: {
  importAsync: () => Promise<{ default: ComponentType<Props> }>;
}): ComponentType<Props> {
  let Component: ComponentType<Props>;
  const loadPromise = load.importAsync().then((val) => {
    Component = val.default;
  });
  const Loadable: FC<Props> & { load: () => Promise<void> } = (props: Props) => {
    if (!Component) {
      throw new Error(
        // eslint-disable-next-line max-len
        `Bundle split module not loaded yet, ensure you beforeAll(() => MyLazyComponent.load()) in your test, import statement: ${load.toString()}`,
      );
    }
    return <Component {...props} />;
  };
  Loadable.load = (): Promise<void> => loadPromise;
  return Loadable;
}


(val) => {
    Component = val.default;
  }


(props: Props) => {
    if (!Component) {
      throw new Error(
        // eslint-disable-next-line max-len
        `Bundle split module not loaded yet, ensure you beforeAll(() => MyLazyComponent.load()) in your test, import statement: ${load.toString()}`,
      );
    }
    return <Component {...props} />;
  }


(): Promise<void> => loadPromise


@Component({
  selector: 'app-account-footer',
  templateUrl: './account-footer.component.html',
  styleUrls: ['./account-footer.component.scss']
})
export class AccountFooterComponent implements OnInit {

  constructor() { }

  ngOnInit(): void {
  }

}


(shape, overlay) => {
          if (
            tooltip == null &&
            (trigger === shape.elem || trigger.parentNode === shape.elem)
          ) {
            tooltip = this.graph.getOverlayTooltip(state.cell, overlay)
          }
        }


() => {
            if (this.willShow() && state != null) {
              const tip = this.getTooltip(state, elem, x, y)
              this.show(state.cell, elem, tip, x, y)
              this.state = state
              this.sourceElem = elem
              this.isStateSource = isStateSource
            }
          }


export class TooltipHandler extends MouseHandler {
  ignoreTouchEvents: boolean = true
  hideOnHover: boolean = false
  delay: number = 500
  zIndex: number = 9999

  protected doHide: (() => void) | null
  protected doShow: ((args: ShowTooltipArgs) => void) | null

  protected lastX: number
  protected lastY: number
  protected timer: number | null
  protected state: State | null
  protected sourceElem: HTMLElement
  protected isStateSource: boolean
  protected showing: boolean = false

  constructor(graph: Graph) {
    super(graph)
    this.config()
  }

  config() {
    const options = this.graph.options.tooltip
    this.delay = options.delay
    this.zIndex = options.zIndex
    this.hideOnHover = options.hideOnHover
    this.ignoreTouchEvents = options.ignoreTouchEvents
    this.doShow = options.show || null
    this.doHide = options.hide || null
    this.setEnadled(options.enabled)
  }

  isHidden() {
    return !this.showing
  }

  mouseDown(e: MouseEventEx) {
    this.reset(e, false)
    this.hideTooltip()
  }

  mouseUp(e: MouseEventEx) {
    this.reset(e, true)
    this.hideTooltip()
  }

  mouseMove(e: MouseEventEx) {
    const clientX = e.getClientX()
    const clientY = e.getClientY()

    if (clientX !== this.lastX || clientY !== this.lastY) {
      this.reset(e, true)
      const state = this.getState(e)

      // prettier-ignore
      if (
        this.hideOnHover ||
        this.state !== state ||
        (
          e.getSource() !== this.sourceElem &&
          (
            !this.isStateSource ||
            (
              state &&
              this.isStateSource === (e.isSource(state.shape) || !e.isSource(state.text))
            )
          )
        )
      ) {
        // hide current tooltip
        this.hideTooltip()
      }
    }

    this.lastX = e.getClientX()
    this.lastY = e.getClientY()
  }

  show(
    cell: Cell,
    elem: HTMLElement,
    tip: string | HTMLElement | null | undefined,
    x: number,
    y: number,
  ) {
    if (this.canShow(tip)) {
      this.showing = true
      if (this.doShow) {
        this.doShow.call(this.graph, { cell, elem, x, y, tip: tip! })
      }
    }
  }

  hide() {
    this.clearTimer()
    this.hideTooltip()
  }

  protected willShow() {
    return (
      !this.disposed &&
      !this.isMouseDown() &&
      !this.graph.isEditing() &&
      !this.graph.isContextMenuShowing()
    )
  }

  protected canShow(tip?: string | HTMLElement | null) {
    return !this.disposed && this.enabled && this.validateTooltip(tip)
  }

  protected validateTooltip(tip?: string | HTMLElement | null) {
    return (
      tip != null &&
      ((typeof tip === 'string' && tip.length > 0) ||
        DomUtil.isHtmlElement(tip))
    )
  }

  protected getTooltip(
    state: State | null,
    trigger: HTMLElement,
    x: number,
    y: number,
  ) {
    let tooltip: string | HTMLElement | null | undefined = null
    if (state != null) {
      // Checks if the mouse is over the folding icon
      if (
        state.control != null &&
        (trigger === state.control.elem ||
          trigger.parentNode === state.control.elem)
      ) {
        tooltip = this.graph.getCollapseTooltip(state.cell)
      }

      if (tooltip == null && state.overlays != null) {
        state.overlays.each((shape, overlay) => {
          if (
            tooltip == null &&
            (trigger === shape.elem || trigger.parentNode === shape.elem)
          ) {
            tooltip = this.graph.getOverlayTooltip(state.cell, overlay)
          }
        })
      }

      if (tooltip == null) {
        const handler = this.graph.selectionHandler.getHandler(state.cell)
        const getTooltipForNode = handler && (handler as any).getTooltipForNode
        if (getTooltipForNode && typeof getTooltipForNode === 'function') {
          tooltip = getTooltipForNode(trigger)
        }
      }

      if (tooltip == null) {
        tooltip = this.graph.getTooltip(state.cell)
      }
    }

    return tooltip
  }

  protected reset(
    e: MouseEventEx,
    restart: boolean = false,
    state: State | null = null,
  ) {
    if (!this.ignoreTouchEvents || DomEvent.isMouseEvent(e.getEvent())) {
      this.clearTimer()
      if (restart && this.isEnabled() && this.isHidden()) {
        state = state || this.getState(e) // tslint:disable-line
        if (state != null) {
          const x = e.getClientX()
          const y = e.getClientY()
          const elem = e.getSource()
          const isStateSource =
            e.isSource(state.shape) || e.isSource(state.text)

          this.timer = window.setTimeout(() => {
            if (this.willShow() && state != null) {
              const tip = this.getTooltip(state, elem, x, y)
              this.show(state.cell, elem, tip, x, y)
              this.state = state
              this.sourceElem = elem
              this.isStateSource = isStateSource
            }
          }, this.delay)
        }
      }
    }
  }

  protected clearTimer() {
    if (this.timer != null) {
      window.clearTimeout(this.timer)
      this.timer = null
    }
  }

  protected hideTooltip() {
    this.showing = false
    this.doHide && this.doHide.call(this.graph)
  }

  @MouseHandler.dispose()
  dispose() {
    this.graph.removeHandler(this)
  }
}


config() {
    const options = this.graph.options.tooltip
    this.delay = options.delay
    this.zIndex = options.zIndex
    this.hideOnHover = options.hideOnHover
    this.ignoreTouchEvents = options.ignoreTouchEvents
    this.doShow = options.show || null
    this.doHide = options.hide || null
    this.setEnadled(options.enabled)
  }


isHidden() {
    return !this.showing
  }


mouseDown(e: MouseEventEx) {
    this.reset(e, false)
    this.hideTooltip()
  }


mouseUp(e: MouseEventEx) {
    this.reset(e, true)
    this.hideTooltip()
  }


mouseMove(e: MouseEventEx) {
    const clientX = e.getClientX()
    const clientY = e.getClientY()

    if (clientX !== this.lastX || clientY !== this.lastY) {
      this.reset(e, true)
      const state = this.getState(e)

      // prettier-ignore
      if (
        this.hideOnHover ||
        this.state !== state ||
        (
          e.getSource() !== this.sourceElem &&
          (
            !this.isStateSource ||
            (
              state &&
              this.isStateSource === (e.isSource(state.shape) || !e.isSource(state.text))
            )
          )
        )
      ) {
        // hide current tooltip
        this.hideTooltip()
      }
    }

    this.lastX = e.getClientX()
    this.lastY = e.getClientY()
  }


show(
    cell: Cell,
    elem: HTMLElement,
    tip: string | HTMLElement | null | undefined,
    x: number,
    y: number,
  ) {
    if (this.canShow(tip)) {
      this.showing = true
      if (this.doShow) {
        this.doShow.call(this.graph, { cell, elem, x, y, tip: tip! })
      }
    }
  }


hide() {
    this.clearTimer()
    this.hideTooltip()
  }


protected willShow() {
    return (
      !this.disposed &&
      !this.isMouseDown() &&
      !this.graph.isEditing() &&
      !this.graph.isContextMenuShowing()
    )
  }


protected canShow(tip?: string | HTMLElement | null) {
    return !this.disposed && this.enabled && this.validateTooltip(tip)
  }


protected validateTooltip(tip?: string | HTMLElement | null) {
    return (
      tip != null &&
      ((typeof tip === 'string' && tip.length > 0) ||
        DomUtil.isHtmlElement(tip))
    )
  }


protected getTooltip(
    state: State | null,
    trigger: HTMLElement,
    x: number,
    y: number,
  ) {
    let tooltip: string | HTMLElement | null | undefined = null
    if (state != null) {
      // Checks if the mouse is over the folding icon
      if (
        state.control != null &&
        (trigger === state.control.elem ||
          trigger.parentNode === state.control.elem)
      ) {
        tooltip = this.graph.getCollapseTooltip(state.cell)
      }

      if (tooltip == null && state.overlays != null) {
        state.overlays.each((shape, overlay) => {
          if (
            tooltip == null &&
            (trigger === shape.elem || trigger.parentNode === shape.elem)
          ) {
            tooltip = this.graph.getOverlayTooltip(state.cell, overlay)
          }
        })
      }

      if (tooltip == null) {
        const handler = this.graph.selectionHandler.getHandler(state.cell)
        const getTooltipForNode = handler && (handler as any).getTooltipForNode
        if (getTooltipForNode && typeof getTooltipForNode === 'function') {
          tooltip = getTooltipForNode(trigger)
        }
      }

      if (tooltip == null) {
        tooltip = this.graph.getTooltip(state.cell)
      }
    }

    return tooltip
  }


protected reset(
    e: MouseEventEx,
    restart: boolean = false,
    state: State | null = null,
  ) {
    if (!this.ignoreTouchEvents || DomEvent.isMouseEvent(e.getEvent())) {
      this.clearTimer()
      if (restart && this.isEnabled() && this.isHidden()) {
        state = state || this.getState(e) // tslint:disable-line
        if (state != null) {
          const x = e.getClientX()
          const y = e.getClientY()
          const elem = e.getSource()
          const isStateSource =
            e.isSource(state.shape) || e.isSource(state.text)

          this.timer = window.setTimeout(() => {
            if (this.willShow() && state != null) {
              const tip = this.getTooltip(state, elem, x, y)
              this.show(state.cell, elem, tip, x, y)
              this.state = state
              this.sourceElem = elem
              this.isStateSource = isStateSource
            }
          }, this.delay)
        }
      }
    }
  }


protected clearTimer() {
    if (this.timer != null) {
      window.clearTimeout(this.timer)
      this.timer = null
    }
  }


protected hideTooltip() {
    this.showing = false
    this.doHide && this.doHide.call(this.graph)
  }


@MouseHandler.dispose()
  dispose() {
    this.graph.removeHandler(this)
  }


(propTypes: PropsInterface) => {
  const defaultProps: any = {};
  const unions: any = {};
  for (const [prop, type] of Object.entries(propTypes)) {
    if (isNumber(type)) defaultProps[prop] = 0;
    if (isBoolean(type)) defaultProps[prop] = false;
    if (isString(type)) defaultProps[prop] = "Text";
    if (isNumberArray(type)) defaultProps[prop] = [1, 2, 3];
    if (isStringArray(type)) defaultProps[prop] = ["Text", "Text", "Text"];
    if (isBoolArray(type)) defaultProps[prop] = [true, true, true];
    if (isStringUnion(type)) {
      defaultProps[prop] = "Variant1";
      unions[prop] = ["Variant1", "Variant2"];
    }
    if (isNumberUnion(type)) {
      defaultProps[prop] = 0;
      unions[prop] = [0, 1];
    }
    if (isStringLiteralUnion(type) || isNumberLiteralUnion(type)) {
      defaultProps[prop] = type[0];
      unions[prop] = type;
    }
    if (isInterface(type)) defaultProps[prop] = setDefaultValues(type).props;
  }
  return { unions, props: defaultProps };
}


(t: PropType): t is PrimitiveType.String => {
  return t === PrimitiveType.String;
}


(t: PropType): t is PrimitiveType.Boolean => {
  return t === PrimitiveType.Boolean;
}


(t: PropType): t is PrimitiveType.Number => {
  return t === PrimitiveType.Number;
}


(t: PropType): t is [PrimitiveType.String] => {
  return Array.isArray(t) && t.length === 1 && t[0] === PrimitiveType.String;
}


(t: PropType): t is [PrimitiveType.Number] => {
  return Array.isArray(t) && t.length === 1 && t[0] === PrimitiveType.Number;
}


(t: PropType): t is [PrimitiveType.Boolean] => {
  return Array.isArray(t) && t.length === 1 && t[0] === PrimitiveType.Boolean;
}


(t: PropType): t is string[] => {
  return (
    Array.isArray(t) &&
    t.length > 1 &&
    typeof t[0] === "string" &&
    t[0] !== PrimitiveType.String &&
    t[0] !== PrimitiveType.Number
  );
}


(t: PropType): t is PrimitiveType.String[] => {
  return Array.isArray(t) && t.length > 1 && t[0] === PrimitiveType.String;
}


(t: PropType): t is number[] => {
  return Array.isArray(t) && t.length > 1 && typeof t[0] === "number";
}


(t: PropType): t is PrimitiveType.Number[] => {
  return Array.isArray(t) && t.length > 1 && t[0] === PrimitiveType.Number;
}


(t: PropType): t is PropsInterface => {
  return typeof t === "object" && t !== null && !Array.isArray(t);
}


(componentName: string) => (
  interfaces: Interfaces
) => {
  const propTypes = `${componentName}Props`;
  return interfaces[propTypes];
}


(
  interfaces: Interfaces
) => {
  const propTypes = `${componentName}Props`;
  return interfaces[propTypes];
}


export interface Interfaces {
  [name: string]: PropsInterface;
}


export interface PropsInterface {
  [prop: string]:
    | PrimitiveType
    | [PrimitiveType]
    | string[]
    | number[]
    | PropsInterface;
}


export enum ArrayType {
  String,
  Number,
  Boolean,
  Nothing,
}


export enum PrimitiveType {
  String = "string",
  Boolean = "boolean",
  Number = "number",
  Nothing = "nothing",
}


export type PropType = PropsInterface[keyof PropsInterface];


@Component({
  templateUrl: "build/pages/discover/exam-list/index.html",
})
export class ExamListPage {
  constructor(public nav:NavController) {
    this.nav = nav;
  }

  openExamDetailPage(domain) {
    this.nav.push(ExamDetailPage, {domain: domain});
  }
}


openExamDetailPage(domain) {
    this.nav.push(ExamDetailPage, {domain: domain});
  }


export class AuthStatusChanged implements Action {
  readonly type = JitsiConferenceEventTypes.AuthStatusChanged;
  constructor(public payload: [boolean, string]) {}
}


export class ConferenceJoined implements Action {
  readonly type = JitsiConferenceEventTypes.Joined;
  constructor(
    public payload: {
      role: string;
      myUserId: string;
      roomname: string;
      isHidden: boolean;
    }
  ) {}
}


export class ConferenceLeft implements Action {
  readonly type = JitsiConferenceEventTypes.Left;
  constructor(public payload = null) {}
}


export class TrackRemoved implements Action {
  readonly type = JitsiConferenceEventTypes.TrackRemoved;
  constructor(public payload: JitsiTrack) {}
}


export class TrackAdded implements Action {
  readonly type = JitsiConferenceEventTypes.TrackAdded;
  constructor(public payload: JitsiTrack) {}
}


export class TrackMuteChanged implements Action {
  readonly type = JitsiConferenceEventTypes.TrackMuteChanged;
  constructor(public payload: JitsiTrack[] | JitsiTrack) {}
}


export class UserLeft implements Action {
  readonly type = JitsiConferenceEventTypes.UserLeft;
  constructor(public payload: [string, JitsiParticipant]) {}
}


export class UserKicked implements Action {
  readonly type = JitsiConferenceEventTypes.kicked;
  constructor(public payload: [JitsiParticipant, string]) {}
}


export class UserJoined implements Action {
  readonly type = JitsiConferenceEventTypes.UserJoined;
  constructor(public payload: [string, JitsiParticipant]) {}
}


export class SetCreatedTimestamp implements Action {
  readonly type = JitsiConferenceEventTypes.CreatedTimestamp;
  constructor(public payload: number) {}
}


export class ConnectionEstablished implements Action {
  readonly type = JitsiConferenceEventTypes.ConnectionEstablished;
  constructor(public payload: number) {}
}


export class AudioLevelsChanged implements Action {
  readonly type = JitsiConferenceEventTypes.AudioLevelsChanged;

  constructor(public payload: [string, number]) {}
}


export class ConferenceFailed implements Action {
  readonly type = JitsiConferenceEventTypes.ConferenceFailed;

  constructor(public payload: 'conference.passwordRequired') {}
}


export enum JitsiConferenceEventTypes {
  AudioLevelsChanged = 'conference.audioLevelsChanged',
  AuthStatusChanged = 'conference.auth_status_changed',
  BeforeStatisticsDisposed = 'conference.beforeStatisticsDisposed',
  Joined = 'conference.joined',
  Left = 'conference.left',
  kicked = 'conference.kicked',
  CreatedTimestamp = 'conference.createdTimestamp',
  PropertiesChanged = 'conference.propertiesChanged',
  RoleChange = 'conference.roleChanged',
  TrackAdded = 'conference.trackAdded',
  TrackMuteChanged = 'conference.trackMuteChanged',
  TrackRemoved = 'conference.trackRemoved',
  UserLeft = 'conference.userLeft',
  UserJoined = 'conference.userJoined',
  ConnectionEstablished = 'conference.connectionEstablished',
  ConferenceFailed = 'conference.failed'
}


export type JitsiConferenceEvents =
  | AuthStatusChanged
  | ConferenceJoined
  | ConferenceLeft
  | TrackAdded
  | TrackRemoved
  | TrackMuteChanged
  | UserLeft
  | UserKicked
  | SetCreatedTimestamp
  | UserJoined
  | ConnectionEstablished
  | AudioLevelsChanged
  | ConferenceFailed;


(obj) => referenceFor(obj) === referenceForModel(SubscriptionModel)


(obj): obj is ClusterServiceVersionKind =>
  referenceFor(obj) === referenceForModel(ClusterServiceVersionModel)


(obj) =>
  obj.metadata.name === 'packageserver' &&
  obj.metadata.namespace === 'openshift-operator-lifecycle-manager'


(sub: SubscriptionKind): KebabOption =>
  !_.isNil(sub)
    ? {
        // t('olm~Edit Subscription')
        labelKey: 'olm~Edit Subscription',
        href: `${resourcePathFromModel(
          SubscriptionModel,
          sub.metadata.name,
          sub.metadata.namespace,
        )}/yaml`,
      }
    : null


(sub: SubscriptionKind, csv?: ClusterServiceVersionKind): KebabOption =>
  !_.isNil(sub)
    ? {
        // t('olm~Uninstall Operator')
        labelKey: 'olm~Uninstall Operator',
        callback: () =>
          createUninstallOperatorModal({
            k8sKill,
            k8sGet,
            k8sPatch,
            subscription: sub,
            csv,
          }),
        accessReview: {
          group: SubscriptionModel.apiGroup,
          resource: SubscriptionModel.plural,
          name: sub.metadata.name,
          namespace: sub.metadata.namespace,
          verb: 'delete',
        },
      }
    : null


() =>
          createUninstallOperatorModal({
            k8sKill,
            k8sGet,
            k8sPatch,
            subscription: sub,
            csv,
          })


(
  csv: ClusterServiceVersionKind,
  subscription: SubscriptionKind,
): KebabAction[] => {
  return _.isEmpty(subscription)
    ? [Kebab.factory.Delete]
    : [() => editSubscription(subscription), () => uninstall(subscription, csv)];
}


() => editSubscription(subscription)


() => uninstall(subscription, csv)


({
  muted = false,
  subscription,
}) => {
  const { t } = useTranslation();
  if (!subscription) {
    return null;
  }

  if (upgradeRequiresApproval(subscription)) {
    return <UpgradeApprovalLink subscription={subscription} />;
  }

  const subscriptionStatus = getSubscriptionStatus(subscription);
  return (
    <span className={muted ? 'text-muted' : 'co-icon-and-text'}>
      {muted ? (
        subscriptionStatus.title


({
  obj,
  subscription,
}) => {
  const status = obj?.status?.phase;
  if (obj.metadata.deletionTimestamp) {
    return (
      <span className="co-icon-and-text">
        <Status status={ClusterServiceVersionPhase.CSVPhaseDeleting} />
      </span>


({ obj }) => {
  const { t } = useTranslation();
  const olmTargetNamespaces = obj?.metadata?.annotations?.['olm.targetNamespaces'] ?? '';
  const managedNamespaces = olmTargetNamespaces?.split(',') || [];

  if (managedNamespaces.length === 1 && managedNamespaces[0] === '') {
    return t('olm~All Namespaces');
  }

  switch (managedNamespaces.length) {
    case 0:
      return {t('olm~All Namespaces')};
    case 1:
      return (
        <ResourceLink kind="Namespace" title={managedNamespaces[0]} name={managedNamespaces[0]} />


(namespace) => (
            <ResourceLink kind="Namespace"


({ csvPlugins, trusted }) => {
  const console: WatchK8sResource = {
    kind: referenceForModel(ConsoleOperatorConfigModel),
    isList: false,
    name: CONSOLE_OPERATOR_CONFIG_NAME,
  };
  const [consoleOperatorConfig] = useK8sWatchResource<K8sResourceKind>(console);
  const { t } = useTranslation();
  const canPatchConsoleOperatorConfig = useAccessReview({
    group: ConsoleOperatorConfigModel.apiGroup,
    resource: ConsoleOperatorConfigModel.plural,
    verb: 'patch',
    name: CONSOLE_OPERATOR_CONFIG_NAME,
  });
  const csvPluginsCount = csvPlugins.length;

  return (
    <>
      {consoleOperatorConfig && canPatchConsoleOperatorConfig && (

{t('olm~Console plugin', { count: csvPluginsCount })}

          {csvPlugins.map((plugin) => (

              {csvPluginsCount > 1 && (
                {t('olm~{{plugin}}:', { plugin })}
              )}
              <Button
                data-test="edit-console-plugin"
                type="button"
                isInline
                onClick={()


(plugin) => (
            <dd key={plugin}


({ csv, csvPlugins }) => {
  const console: WatchK8sResource = {
    kind: referenceForModel(ConsoleOperatorConfigModel),
    isList: false,
    name: CONSOLE_OPERATOR_CONFIG_NAME,
  };
  const [consoleOperatorConfig] = useK8sWatchResource<K8sResourceKind>(console);
  const { t } = useTranslation();
  const canPatchConsoleOperatorConfig = useAccessReview({
    group: ConsoleOperatorConfigModel.apiGroup,
    resource: ConsoleOperatorConfigModel.plural,
    verb: 'patch',
    name: CONSOLE_OPERATOR_CONFIG_NAME,
  });
  const aPluginIsDisabled =
    !consoleOperatorConfig?.spec?.plugins?.length ||
    csvPlugins.some((plugin) => !isPluginEnabled(consoleOperatorConfig, plugin));

  return (
    consoleOperatorConfig &&
    canPatchConsoleOperatorConfig &&
    aPluginIsDisabled && (
      <Popover
        headerContent={
{t('olm~Console plugin available')}
}
        bodyContent={

              {t(
                'olm~To let this operator provide a custom interface and run its own code in your console, enable its console plugin in the operator details.',
              )}

            <Link to={resourceObjPath(csv, referenceFor(csv))}


(plugin) => !isPluginEnabled(consoleOperatorConfig, plugin)


({ activeNamespace, obj, subscription, catalogSourceMissing }) => {
    const { displayName, provider, version } = obj.spec ?? {};
    const olmOperatorNamespace = obj.metadata?.annotations?.['olm.operatorNamespace'] ?? '';
    const [icon] = obj.spec.icon ?? [];
    const route = resourceObjPath(obj, referenceFor(obj));
    const providedAPIs = providedAPIsForCSV(obj);
    const csvPlugins = getClusterServiceVersionPlugins(obj?.metadata?.annotations);

    return (
      <>
        {/* Name */}
        <TableData className={nameColumnClass}>
          <Link
            to={route}
            className="co-clusterserviceversion-link"
            data-test-operator-row={displayName}
          >
            <ClusterServiceVersionLogo
              icon={icon}
              displayName={displayName}
              version={version}
              provider={provider}
            />
          </Link>
        </TableData>

        {/* Operator Namespace */}
        {activeNamespace === ALL_NAMESPACES_KEY ? (
          <TableData className={namespaceColumnClass}>
            <ResourceLink
              kind="Namespace"
              title={olmOperatorNamespace}
              name={olmOperatorNamespace}
            />
          </TableData>


(desc) => (
                <div key={referenceForProvidedAPI(desc)}>
                  <Link to


({
  activeNamespace,
  catalogSourceMissing,
  obj,
}) => {
  const { t } = useTranslation();
  const csvName = obj?.spec?.name;
  const menuActions = [Kebab.factory.Edit, () => uninstall(obj)];
  const namespace = getNamespace(obj);
  const route = resourceObjPath(obj, referenceForModel(SubscriptionModel));

  return (
    <>
      {/* Name */}
      <TableData className={nameColumnClass}>
        <Link to={route}>
          <ClusterServiceVersionLogo
            icon={null}
            displayName={csvName}
            version={null}
            provider={null}
          />
        </Link>
      </TableData>

      {/* Operator Namespace */}
      {activeNamespace === ALL_NAMESPACES_KEY ? (
        <TableData className={namespaceColumnClass}>
          <ResourceLink kind="Namespace" title={namespace} name={namespace} />
        </TableData>


() => uninstall(obj)


({
  obj,
  customData,
}) => {
  const { catalogSources, subscriptions, activeNamespace } = customData;
  const subscription = isCSV(obj)
    ? subscriptionForCSV(subscriptions, obj as ClusterServiceVersionKind)
    : (obj as SubscriptionKind);
  // Only warn about missing catalog sources if the user was able to list them
  // but exclude PackageServer as it does not have a subscription.
  const catalogSourceMissing =
    !_.isEmpty(catalogSources) &&
    !catalogSourceForSubscription(catalogSources, subscription) &&
    !isPackageServer(obj);

  return isCSV(obj) ? (
    <ClusterServiceVersionTableRow
      activeNamespace={activeNamespace}
      catalogSourceMissing={catalogSourceMissing}
      obj={obj as ClusterServiceVersionKind}
      subscription={subscription}
    />


() => {
  const { t } = useTranslation();
  return <MsgBox title={t('olm~No Operators found')} />;
}


() => {
  const { t } = useTranslation();
  const project = useActiveNamespace();
  const noOperatorsInSingleNamespaceMessage = t(
    'olm~No Operators are available for project {{project}}.',
    { project },
  );
  const noOperatorsInAllNamespacesMessage = t('olm~No Operators are available.');
  const detail = (
    <>
      <div>
        {project === ALL_NAMESPACES_KEY
          ? noOperatorsInAllNamespacesMessage
          : noOperatorsInSingleNamespaceMessage}


({
  subscriptions,
  catalogSources,
  data,
  ...rest
}) => {
  const { t } = useTranslation();
  const activeNamespace = useActiveNamespace();
  const nameHeader: Header = {
    title: t('olm~Name'),
    sortField: 'metadata.name',
    transforms: [sortable],
    props: { className: nameColumnClass },
  };

  const namespaceHeader: Header = {
    title: t('olm~Namespace'),
    sortFunc: 'getOperatorNamespace',
    transforms: [sortable],
    props: { className: namespaceColumnClass },
  };

  const managedNamespacesHeader: Header = {
    title: t('olm~Managed Namespaces'),
    sortFunc: 'formatTargetNamespaces',
    transforms: [sortable, wrappable],
    props: { className: managedNamespacesColumnClass },
  };

  const statusHeader: Header = {
    title: t('olm~Status'),
    props: { className: statusColumnClass },
  };

  const lastUpdatedHeader: Header = {
    title: t('olm~Last updated'),
    props: { className: lastUpdatedColumnClass },
  };

  const providedAPIsHeader: Header = {
    title: t('olm~Provided APIs'),
    props: { className: providedAPIsColumnClass },
  };

  const kebabHeader: Header = {
    title: '',
    props: { className: Kebab.columnClass },
  };

  const AllProjectsTableHeader = (): Header[] => [
    nameHeader,
    namespaceHeader,
    managedNamespacesHeader,
    statusHeader,
    lastUpdatedHeader,
    providedAPIsHeader,
    kebabHeader,
  ];

  const SingleProjectTableHeader = (): Header[] => [
    nameHeader,
    managedNamespacesHeader,
    statusHeader,
    lastUpdatedHeader,
    providedAPIsHeader,
    kebabHeader,
  ];

  const isCopiedCSV = (source: ClusterServiceVersionKind, kind: string) => {
    return (
      referenceForModel(ClusterServiceVersionModel) === kind &&
      (source.status?.reason === 'Copied' || source.metadata?.labels?.['olm.copiedFrom'])
    );
  };

  const isStandaloneCSV = (operator: ClusterServiceVersionKind) => {
    return (
      operator.metadata.annotations?.[OPERATOR_TYPE_ANNOTATION] !==
        NON_STANDALONE_ANNOTATION_VALUE ||
      operator.status?.phase === ClusterServiceVersionPhase.CSVPhaseFailed
    );
  };

  const filterOperators = (
    operators: (ClusterServiceVersionKind | SubscriptionKind)[],
    allNamespaceActive: boolean,
  ): (ClusterServiceVersionKind | SubscriptionKind)[] => {
    return operators.filter((source) => {
      const kind = referenceFor(source);
      if (isSubscription(source)) {
        return true;
      }
      const csv = source as ClusterServiceVersionKind;
      if (allNamespaceActive) {
        return !isCopiedCSV(csv, kind) && isStandaloneCSV(csv);
      }
      return isStandaloneCSV(csv);
    });
  };

  const formatTargetNamespaces = (obj: ClusterServiceVersionKind | SubscriptionKind): string => {
    if (obj.kind === 'Subscription') {
      return t('olm~None');
    }
    const namespaces = obj.metadata.annotations?.['olm.targetNamespaces']?.split(',') || [];
    if (namespaces.length === 1 && namespaces[0] === '') {
      return t('olm~All Namespaces');
    }

    switch (namespaces.length) {
      case 0:
        return t('olm~All Namespaces');
      case 1:
        return namespaces[0];
      default:
        return t('olm~{{count}} Namespaces', { count: namespaces.length });
    }
  };
  const getOperatorNamespace = (
    obj: ClusterServiceVersionKind | SubscriptionKind,
  ): string | null => {
    const olmOperatorNamespace = obj.metadata?.annotations?.['olm.operatorNamespace'];
    return olmOperatorNamespace ?? getNamespace(obj);
  };
  const allNamespaceActive = activeNamespace === ALL_NAMESPACES_KEY;

  const customData = React.useMemo(
    () => ({
      catalogSources: catalogSources.data,
      subscriptions: subscriptions.data,
      activeNamespace,
    }),
    [activeNamespace, catalogSources.data, subscriptions.data],
  );

  return (
    <Table
      data={filterOperators(data, allNamespaceActive)}
      {...rest}
      aria-label="Installed Operators"
      Header={allNamespaceActive ? AllProjectsTableHeader : SingleProjectTableHeader}
      Row={InstalledOperatorTableRow}
      EmptyMsg={CSVListEmptyMsg}
      NoDataEmptyMsg={CSVListNoDataEmptyMsg}
      virtualize
      customData={customData}
      customSorts={{
        formatTargetNamespaces,
        getOperatorNamespace,
      }}


(): Header[] => [
    nameHeader,
    namespaceHeader,
    managedNamespacesHeader,
    statusHeader,
    lastUpdatedHeader,
    providedAPIsHeader,
    kebabHeader,
  ]


(): Header[] => [
    nameHeader,
    managedNamespacesHeader,
    statusHeader,
    lastUpdatedHeader,
    providedAPIsHeader,
    kebabHeader,
  ]


(source: ClusterServiceVersionKind, kind: string) => {
    return (
      referenceForModel(ClusterServiceVersionModel) === kind &&
      (source.status?.reason === 'Copied' || source.metadata?.labels?.['olm.copiedFrom'])
    );
  }


(operator: ClusterServiceVersionKind) => {
    return (
      operator.metadata.annotations?.[OPERATOR_TYPE_ANNOTATION] !==
        NON_STANDALONE_ANNOTATION_VALUE ||
      operator.status?.phase === ClusterServiceVersionPhase.CSVPhaseFailed
    );
  }


(
    operators: (ClusterServiceVersionKind | SubscriptionKind)[],
    allNamespaceActive: boolean,
  ): (ClusterServiceVersionKind | SubscriptionKind)[] => {
    return operators.filter((source) => {
      const kind = referenceFor(source);
      if (isSubscription(source)) {
        return true;
      }
      const csv = source as ClusterServiceVersionKind;
      if (allNamespaceActive) {
        return !isCopiedCSV(csv, kind) && isStandaloneCSV(csv);
      }
      return isStandaloneCSV(csv);
    });
  }


(source) => {
      const kind = referenceFor(source);
      if (isSubscription(source)) {
        return true;
      }
      const csv = source as ClusterServiceVersionKind;
      if (allNamespaceActive) {
        return !isCopiedCSV(csv, kind) && isStandaloneCSV(csv);
      }
      return isStandaloneCSV(csv);
    }


(obj: ClusterServiceVersionKind | SubscriptionKind): string => {
    if (obj.kind === 'Subscription') {
      return t('olm~None');
    }
    const namespaces = obj.metadata.annotations?.['olm.targetNamespaces']?.split(',') || [];
    if (namespaces.length === 1 && namespaces[0] === '') {
      return t('olm~All Namespaces');
    }

    switch (namespaces.length) {
      case 0:
        return t('olm~All Namespaces');
      case 1:
        return namespaces[0];
      default:
        return t('olm~{{count}} Namespaces', { count: namespaces.length });
    }
  }


(
    obj: ClusterServiceVersionKind | SubscriptionKind,
  ): string | null => {
    const olmOperatorNamespace = obj.metadata?.annotations?.['olm.operatorNamespace'];
    return olmOperatorNamespace ?? getNamespace(obj);
  }


() => ({
      catalogSources: catalogSources.data,
      subscriptions: subscriptions.data,
      activeNamespace,
    })


(props) => {
  const { t } = useTranslation();
  const title = t('olm~Installed Operators');
  const helpText = (
    <Trans ns="olm">
      Installed Operators are represented by ClusterServiceVersions within this Namespace. For more
      information, see the{' '}
      <ExternalLink
        href={`${openshiftHelpBase}operators/understanding/olm-what-operators-are.html`}
      >
        Understanding Operators documentation
      </ExternalLink>
      . Or create an Operator and ClusterServiceVersion using the{' '}
      <ExternalLink href="https://sdk.operatorframework.io/">Operator SDK</ExternalLink>.
    </Trans>


({ clusterServiceVersions, subscriptions }) =>
    [
      ...(clusterServiceVersions?.data ?? []),
      ...(subscriptions?.data ?? []).filter(
        (sub) =>
          ['', sub.metadata.namespace].includes(props.namespace || '') &&
          _.isNil(_.get(sub, 'status.installedCSV')),
      ),
    ].filter(
      (obj, i, all) =>
        isCSV(obj) ||
        _.isUndefined(
          all.find(({ metadata }) =>
            [obj?.status?.currentCSV, obj?.spec?.startingCSV].includes(metadata.name),
          ),
        ),
    )


(sub) =>
          ['', sub.metadata.namespace].includes(props.namespace || '') &&
          _.isNil(_.get(sub, 'status.installedCSV'))


(obj, i, all) =>
        isCSV(obj) ||
        _.isUndefined(
          all.find(({ metadata }) =>
            [obj?.status?.currentCSV, obj?.spec?.startingCSV].includes(metadata.name),
          ),
        )


({ metadata }) =>
            [obj?.status?.currentCSV, obj?.spec?.startingCSV].includes(metadata.name)


(props: {
  content: string;
  styles?: string;
  exactHeight?: boolean;
  truncateContent?: boolean;
}) => {
  return (
    <AsyncComponent
      loader={()


(c) => c.SyncMarkdownView


({ csv, crd, required, ...rest }) => {
  const { t } = useTranslation();
  const reference = referenceForProvidedAPI(crd);
  const [model] = useK8sModel(reference);
  const canCreate = rest.canCreate ?? model?.verbs?.includes?.('create');
  const createRoute = React.useMemo(
    () =>
      csv
        ? `/k8s/ns/${csv.metadata.namespace}/${ClusterServiceVersionModel.plural}/${csv.metadata.name}/${reference}/~new`
        : null,
    [csv, reference],
  );

  return (
    <Card>
      <CardTitle>
        <span className="co-resource-item">
          <ResourceLink
            kind={referenceForProvidedAPI(crd)}
            title={crd.name}
            linkTo={false}
            displayName={crd.displayName || crd.kind}
          />
          {required && (
            <ResourceStatus badgeAlt>
              <StatusIconAndText icon={<RedExclamationCircleIcon />} title={t('olm~Required')} />
            </ResourceStatus>


() =>
      csv
        ? `/k8s/ns/${csv.metadata.namespace}/${ClusterServiceVersionModel.plural}/${csv.metadata.name}/${reference}/~new`
        : null


({ csv, providedAPIs }: CRDCardRowProps) => {
  return (
    <div className="co-crd-card-row">
      {providedAPIs.length ? (
        providedAPIs.map((crd) => (
          <CRDCard key={referenceForProvidedAPI(crd)} crd={crd} csv={csv} />
        ))


(crd) => (
          <CRDCard key={referenceForProvidedAPI(crd)}


(props) => {
  const { t } = useTranslation();
  const { initializationResource, csv } = props;

  const initializationResourceKind = initializationResource?.kind;
  const { group: initializationResourceGroup } = groupVersionFor(
    initializationResource?.apiVersion,
  );
  const model = modelFor(referenceFor(initializationResource));

  // Check if the CR is already present - only watches for the model in namespace
  const [customResource, customResourceLoaded] = useK8sWatchResource<K8sResourceCommon[]>({
    kind: referenceForModel(model),
    namespaced: true,
    isList: true,
  });

  const canCreateCustomResource = useAccessReview({
    group: initializationResourceGroup,
    resource: model?.plural,
    namespace: model?.namespaced
      ? initializationResource?.metadata.namespace || csv.metadata.namespace
      : null,
    verb: 'create',
  });

  if (customResourceLoaded && customResource.length === 0 && canCreateCustomResource) {
    return (
      <Alert
        isInline
        className="co-alert"
        variant="warning"
        title={t('olm~{{initializationResourceKind}} required', { initializationResourceKind })}
      >
        <p>
          {t('olm~Create a {{initializationResourceKind}} instance to use this Operator.', {
            initializationResourceKind,
          })}
        </p>
        <CreateInitializationResourceButton
          obj={props.csv}
          initializationResource={initializationResource}
          targetNamespace={
            model?.namespaced
              ? initializationResource?.metadata.namespace || csv.metadata?.namespace


(
  props,
) => {
  const { t } = useTranslation();
  const { spec, metadata, status } = props.obj;
  const providedAPIs = providedAPIsForCSV(props.obj);
  const {
    'marketplace.openshift.io/support-workflow': marketplaceSupportWorkflow,
    'olm.targetNamespaces': olmTargetNamespaces = '',
    'operatorframework.io/initialization-resource': initializationResourceJSON,
  } = metadata.annotations || {};

  const initializationResource = React.useMemo(() => {
    if (initializationResourceJSON) {
      try {
        return JSON.parse(initializationResourceJSON);
      } catch (error) {
        // eslint-disable-next-line no-console
        console.error(error.message);
      }
    }
    return null;
  }, [initializationResourceJSON]);

  const supportWorkflowUrl = React.useMemo(() => {
    if (marketplaceSupportWorkflow) {
      try {
        const url = new URL(marketplaceSupportWorkflow);
        url.searchParams.set('utm_source', 'openshift_console');
        return url.toString();
      } catch (error) {
        // eslint-disable-next-line no-console
        console.error(error.message);
      }
    }
    return null;
  }, [marketplaceSupportWorkflow]);

  const csvPlugins = getClusterServiceVersionPlugins(metadata?.annotations);
  const subscription = subscriptionForCSV(props.subscriptions, props.obj);
  const permissions = _.uniqBy(spec?.install?.spec?.permissions, 'serviceAccountName');

  return (
    <>
      <ScrollToTopOnMount />

              {status && status.phase === ClusterServiceVersionPhase.CSVPhaseFailed && (
                <Alert
                  isInline
                  className="co-alert"
                  variant="danger"
                  title={t('olm~Operator failed')}
                >
                  {status.reason === CSVConditionReason.CSVReasonCopied ? (
                    <>
                      <Trans t={t} ns="olm">
                        This Operator was copied from another namespace. For the reason it failed,
                        see{' '}
                        <ResourceLink
                          name={metadata.name}
                          kind={referenceForModel(ClusterServiceVersionModel)}
                          namespace={operatorNamespaceFor(props.obj)}
                          hideIcon
                          inline
                        />
                      </Trans>
                    </>


() => {
    if (initializationResourceJSON) {
      try {
        return JSON.parse(initializationResourceJSON);
      } catch (error) {
        // eslint-disable-next-line no-console
        console.error(error.message);
      }
    }
    return null;
  }


() => {
    if (marketplaceSupportWorkflow) {
      try {
        const url = new URL(marketplaceSupportWorkflow);
        url.searchParams.set('utm_source', 'openshift_console');
        return url.toString();
      } catch (error) {
        // eslint-disable-next-line no-console
        console.error(error.message);
      }
    }
    return null;
  }


(link) => (
                    <dd key={link.url}


(maintainer) => (
                    <dd key={maintainer.email}


({ name }) => (
                <dd key={name}>
                  <ResourceLink
                    name


({ serviceAccountName }) => (
                    <dd key={serviceAccountName}


(c) => ({
            ...c,
            type: c.phase,
            status: 'True',
          })


({
  obj,
  subscriptions = [],
  ...rest
}) => {
  const { t } = useTranslation();
  const EmptyMsg = () => (
    <MsgBox
      title={t('olm~No Operator Subscription')}
      detail={t('olm~This Operator will not receive updates.')}
    />


() => (
    <MsgBox
      title={t('olm~No Operator Subscription')}


() => subscriptionForCSV(subscriptions, obj)


(
  props,
) => {
  const { t } = useTranslation();
  const menuActions = (
    model,
    obj: ClusterServiceVersionKind,
    { subscriptions }: ExtraResources,
  ) => {
    const subscription = subscriptionForCSV(subscriptions, obj);
    return [
      ...(_.isEmpty(subscription)
        ? [Kebab.factory.Delete(model, obj)]
        : [editSubscription(subscription), uninstall(subscription, obj)]),
    ];
  };

  const canListSubscriptions = useAccessReview({
    group: SubscriptionModel.apiGroup,
    resource: SubscriptionModel.plural,
    verb: 'list',
  });

  const pagesFor = React.useCallback(
    (obj: ClusterServiceVersionKind) => {
      const providedAPIs = providedAPIsForCSV(obj);
      return [
        navFactory.details(ClusterServiceVersionDetails),
        navFactory.editYaml(),
        ...(canListSubscriptions
          ? [
              {
                href: 'subscription',
                // t('olm~Subscription')
                nameKey: 'olm~Subscription',
                component: CSVSubscription,
              },
            ]
          : []),
        navFactory.events(ResourceEventStream),
        ...(providedAPIs.length > 1
          ? [
              {
                href: 'instances',
                // t('olm~All instances')
                nameKey: 'olm~All instances',
                component: ProvidedAPIsPage,
              },
            ]
          : []),
        ...providedAPIs.map<Page<ProvidedAPIPageProps>>((api: CRDDescription) => ({
          href: referenceForProvidedAPI(api),
          name: ['Details', 'YAML', 'Subscription', 'Events'].includes(api.displayName)
            ? `${api.displayName} Operand`
            : api.displayName || api.kind,
          component: ProvidedAPIPage,
          pageData: {
            csv: obj,
            kind: referenceForProvidedAPI(api),
            namespace: obj.metadata.namespace,
          },
        })),
      ];
    },
    [canListSubscriptions],
  );

  return (
    <DetailsPage
      {...props}
      breadcrumbsFor={()


(
    model,
    obj: ClusterServiceVersionKind,
    { subscriptions }: ExtraResources,
  ) => {
    const subscription = subscriptionForCSV(subscriptions, obj);
    return [
      ...(_.isEmpty(subscription)
        ? [Kebab.factory.Delete(model, obj)]
        : [editSubscription(subscription), uninstall(subscription, obj)]),
    ];
  }


(obj: ClusterServiceVersionKind) => {
      const providedAPIs = providedAPIsForCSV(obj);
      return [
        navFactory.details(ClusterServiceVersionDetails),
        navFactory.editYaml(),
        ...(canListSubscriptions
          ? [
              {
                href: 'subscription',
                // t('olm~Subscription')
                nameKey: 'olm~Subscription',
                component: CSVSubscription,
              },
            ]
          : []),
        navFactory.events(ResourceEventStream),
        ...(providedAPIs.length > 1
          ? [
              {
                href: 'instances',
                // t('olm~All instances')
                nameKey: 'olm~All instances',
                component: ProvidedAPIsPage,
              },
            ]
          : []),
        ...providedAPIs.map<Page<ProvidedAPIPageProps>>((api: CRDDescription) => ({
          href: referenceForProvidedAPI(api),
          name: ['Details', 'YAML', 'Subscription', 'Events'].includes(api.displayName)
            ? `${api.displayName} Operand`
            : api.displayName || api.kind,
          component: ProvidedAPIPage,
          pageData: {
            csv: obj,
            kind: referenceForProvidedAPI(api),
            namespace: obj.metadata.namespace,
          },
        })),
      ];
    }


(api: CRDDescription) => ({
          href: referenceForProvidedAPI(api),
          name: ['Details', 'YAML', 'Subscription', 'Events'].includes(api.displayName)
            ? `${api.displayName} Operand`
            : api.displayName || api.kind,
          component: ProvidedAPIPage,
          pageData: {
            csv: obj,
            kind: referenceForProvidedAPI(api),
            namespace: obj.metadata.namespace,
          },
        })


type ExtraResources = { subscriptions: SubscriptionKind[] };


type ClusterServiceVersionStatusProps = {
  obj: ClusterServiceVersionKind;
  subscription: SubscriptionKind;
};


export type ClusterServiceVersionsPageProps = {
  kind: string;
  namespace: string;
  resourceDescriptions: CRDDescription[];
};


export type ClusterServiceVersionListProps = {
  loaded: boolean;
  loadError?: string;
  data: ClusterServiceVersionKind[];
  subscriptions: FirehoseResult<SubscriptionKind[]>;
  catalogSources: FirehoseResult<CatalogSourceKind[]>;
  activeNamespace?: string;
};