{"version":3,"file":"create-component-DUNPnWI2.cjs","sources":["../src/runtime/create-component.ts"],"sourcesContent":["import type { EventName, Options } from '@lit/react';\nimport { createComponent as createComponentWrapper } from '@lit/react';\n\n// A key value map matching React prop names to event names.\ntype EventNames = Record<string, EventName | string>;\n\n// Type that's compatible with both React 18 and 19\ntype StencilProps<I extends HTMLElement, E extends EventNames, C> = Omit<\n  React.HTMLAttributes<I>,\n  keyof E\n> &\n  Partial<{ [K in keyof E]: E[K] extends EventName<infer T> ? (event: T) => void : (event: any) => void }> &\n  Partial<C> &\n  React.RefAttributes<I>;\n\nexport type StencilReactComponent<\n  I extends HTMLElement,\n  E extends EventNames = {},\n  C = Omit<I, keyof HTMLElement>,\n> = React.FunctionComponent<StencilProps<I, E, C>>;\n\n/**\n * Defines a custom element and creates a React component.\n * @public\n */\nexport const createComponent = <I extends HTMLElement, E extends EventNames = {}, C = Omit<I, keyof HTMLElement>>({\n  defineCustomElement,\n  tagName,\n  transformTag,\n  ...options\n}: Options<I, E> & {\n  defineCustomElement: () => void;\n  transformTag?: (tagName: string) => string;\n}): StencilReactComponent<I, E, C> => {\n  if (typeof defineCustomElement !== 'undefined') {\n    defineCustomElement();\n  }\n  const finalTagName = transformTag ? transformTag(tagName) : tagName;\n  return createComponentWrapper<I, E>({ ...options, tagName: finalTagName }) as unknown as StencilReactComponent<\n    I,\n    E,\n    C\n  >;\n};\n"],"names":["createComponent","defineCustomElement","tagName","transformTag","options","finalTagName","createComponentWrapper"],"mappings":"2CAyBaA,EAAkB,CAAmF,CAChH,oBAAAC,EACA,QAAAC,EACA,aAAAC,EACA,GAAGC,CACL,IAGsC,CAChC,OAAOH,EAAwB,KACbA,EAAA,EAEtB,MAAMI,EAAeF,EAAeA,EAAaD,CAAO,EAAIA,EAC5D,OAAOI,kBAA6B,CAAE,GAAGF,EAAS,QAASC,EAAc,CAK3E"}