"use strict";

import * as React from 'react';
import { createContext, useMemo, useRef, useState } from 'react';

/**
 * 自渲染 Context。
 * 持广告素材 + 各 AssetView 的 ref；AssetView 组件从这里取素材自渲染、注册 ref。
 * 加载完成后 ATNativeAdView 调 setNativeAd(素材) → AssetView 自动填值。
 */
import { jsx as _jsx } from "react/jsx-runtime";
export const NativeAdContext = /*#__PURE__*/createContext({});
export function NativeAdProvider({
  children
}) {
  const [nativeAd, setNativeAd] = useState({});
  const titleRef = useRef(null);
  const descRef = useRef(null);
  const ctaRef = useRef(null);
  const iconRef = useRef(null);
  const mainImageRef = useRef(null);
  const mediaRef = useRef(null);
  const closeRef = useRef(null);
  const textColors = useRef({});
  const value = useMemo(() => ({
    nativeAd,
    setNativeAd,
    titleRef,
    descRef,
    ctaRef,
    iconRef,
    mainImageRef,
    mediaRef,
    closeRef,
    textColors
  }), [nativeAd]);
  return /*#__PURE__*/_jsx(NativeAdContext.Provider, {
    value: value,
    children: children
  });
}
//# sourceMappingURL=NativeAdProvider.js.map