{"version":3,"sources":["../src/createChainOfResponsibilityForFluentUI.tsx"],"sourcesContent":["import { type IRenderFunction } from '@fluentui/react';\nimport React, { useCallback, type Key } from 'react';\n\nimport createChainOfResponsibility, {\n  type CreateChainOfResponsibilityOptions\n} from './createChainOfResponsibility.tsx';\n\ntype UseBuildRenderFunctionOptions<Props> = { getKey?: (props: Props | undefined) => Key };\n\ntype UseBuildRenderFunction<Props> = (options?: UseBuildRenderFunctionOptions<Props>) => IRenderFunction<Props>;\n\n// We are using the props as both \"Request\" and \"Props\".\n// This should eases migration from `onRender` to chain of responsibility.\n// Downside is, web developers could accidentally pass request as props and not honoring props modified by upstreamers.\n\n/**\n * @deprecated Fluent UI v9 no longer use `IRenderFunction` for custom render. We no longer validate the correctness of this function.\n */\nexport default function createChainOfResponsibilityForFluentUI<Props extends object, Init = undefined>(\n  options?: CreateChainOfResponsibilityOptions\n): ReturnType<typeof createChainOfResponsibility<Props | undefined, Props, Init>> & {\n  useBuildRenderFunction: UseBuildRenderFunction<Props>;\n} {\n  // We no longer validate the correctness of this function.\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  const returnValue = createChainOfResponsibility<Props | undefined, Props, Init>(options as any);\n\n  const { Proxy } = returnValue;\n\n  const useBuildRenderFunction: UseBuildRenderFunction<Props> = (options = {}) => {\n    const { getKey } = options;\n\n    return useCallback<IRenderFunction<Props>>(\n      (props, defaultRender) => (\n        // We no longer validate the correctness of this function.\n        // eslint-disable-next-line @typescript-eslint/no-explicit-any\n        <Proxy {...(props as Props)} fallbackComponent={defaultRender as any} key={getKey?.(props)} request={props} />\n      ),\n      [getKey]\n    );\n  };\n\n  // We no longer validate the correctness of this function.\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  return { ...returnValue, useBuildRenderFunction } as any;\n}\n"],"mappings":";;;;;AACA,OAAO,SAAS,mBAA6B;AAiB9B,SAAR,uCACL,SAGA;AAGA,QAAM,cAAc,oCAA4D,OAAc;AAE9F,QAAM,EAAE,MAAM,IAAI;AAElB,QAAM,yBAAwD,CAACA,WAAU,CAAC,MAAM;AAC9E,UAAM,EAAE,OAAO,IAAIA;AAEnB,WAAO;AAAA,MACL,CAAC,OAAO;AAAA;AAAA;AAAA,QAGN,oCAAC,SAAO,GAAI,OAAiB,mBAAmB,eAAsB,KAAK,SAAS,KAAK,GAAG,SAAS,OAAO;AAAA;AAAA,MAE9G,CAAC,MAAM;AAAA,IACT;AAAA,EACF;AAIA,SAAO,EAAE,GAAG,aAAa,uBAAuB;AAClD;","names":["options"]}