File: //home2/gazetufm/www/wp/wp-content/plugins/gutenberg/build/scripts/react-i18n/index.min.js.map
{
"version": 3,
"sources": ["package-external:@wordpress/element", "package-external:@wordpress/i18n", "vendor-external:react/jsx-runtime", "../../../packages/react-i18n/src/index.tsx"],
"sourcesContent": ["module.exports = window.wp.element;", "module.exports = window.wp.i18n;", "module.exports = window.ReactJSXRuntime;", "/**\n * External dependencies\n */\nimport type {\n\tComponentType,\n\tFunctionComponent,\n\tPropsWithChildren,\n} from 'react';\nimport type { Subtract } from 'utility-types';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseReducer,\n} from '@wordpress/element';\nimport { defaultI18n } from '@wordpress/i18n';\nimport type { I18n } from '@wordpress/i18n';\ninterface I18nContextProps {\n\t__: I18n[ '__' ];\n\t_x: I18n[ '_x' ];\n\t_n: I18n[ '_n' ];\n\t_nx: I18n[ '_nx' ];\n\tisRTL: I18n[ 'isRTL' ];\n\thasTranslation: I18n[ 'hasTranslation' ];\n}\n\n/**\n * Utility to make a new context value\n *\n * @param i18n\n */\nfunction makeContextValue( i18n: I18n ): I18nContextProps {\n\treturn {\n\t\t__: i18n.__.bind( i18n ),\n\t\t_x: i18n._x.bind( i18n ),\n\t\t_n: i18n._n.bind( i18n ),\n\t\t_nx: i18n._nx.bind( i18n ),\n\t\tisRTL: i18n.isRTL.bind( i18n ),\n\t\thasTranslation: i18n.hasTranslation.bind( i18n ),\n\t};\n}\n\nconst I18nContext = createContext( makeContextValue( defaultI18n ) );\nI18nContext.displayName = 'I18nContext';\n\ntype I18nProviderProps = PropsWithChildren< { i18n: I18n } >;\n\n/**\n * The `I18nProvider` should be mounted above any localized components:\n *\n * @example\n * ```js\n * import { createI18n } from '@wordpress/i18n';\n * import { I18nProvider } from '@wordpress/react-i18n';\n * const i18n = createI18n();\n *\n * ReactDom.render(\n * \t<I18nProvider i18n={ i18n }>\n * \t\t<App />\n * \t</I18nProvider>,\n * \tel\n * );\n * ```\n *\n * You can also instantiate the provider without the `i18n` prop. In that case it will use the\n * default `I18n` instance exported from `@wordpress/i18n`.\n *\n * @param props i18n provider props.\n * @return Children wrapped in the I18nProvider.\n */\nexport function I18nProvider( props: I18nProviderProps ) {\n\tconst { children, i18n = defaultI18n } = props;\n\tconst [ update, forceUpdate ] = useReducer( () => [], [] );\n\n\t// Rerender translations whenever the i18n instance fires a change event.\n\tuseEffect( () => i18n.subscribe( forceUpdate ), [ i18n ] );\n\n\tconst value = useMemo( () => makeContextValue( i18n ), [ i18n, update ] );\n\n\treturn (\n\t\t<I18nContext.Provider value={ value }>\n\t\t\t{ children }\n\t\t</I18nContext.Provider>\n\t);\n}\n\n/**\n * React hook providing access to i18n functions. It exposes the `__`, `_x`, `_n`, `_nx`,\n * `isRTL` and `hasTranslation` functions from [`@wordpress/i18n`](../i18n).\n * Refer to their documentation there.\n *\n * @example\n * ```js\n * import { useI18n } from '@wordpress/react-i18n';\n *\n * function MyComponent() {\n * \tconst { __ } = useI18n();\n * \treturn __( 'Hello, world!' );\n * }\n * ```\n */\nexport const useI18n = () => useContext( I18nContext );\n\ntype PropsAndI18n< P > = Pick<\n\tP,\n\tExclude< keyof P, '__' | '_x' | '_n' | '_nx' | 'isRTL' | 'hasTranslation' >\n>;\n\n/**\n * React higher-order component that passes the i18n translate functions (the same set\n * as exposed by the `useI18n` hook) to the wrapped component as props.\n *\n * @example\n * ```js\n * import { withI18n } from '@wordpress/react-i18n';\n *\n * function MyComponent( { __ } ) {\n * \treturn __( 'Hello, world!' );\n * }\n *\n * export default withI18n( MyComponent );\n * ```\n *\n * @param InnerComponent React component to be wrapped and receive the i18n functions like `__`\n * @return The wrapped component\n */\nexport function withI18n< P extends I18nContextProps >(\n\tInnerComponent: ComponentType< P >\n): FunctionComponent< PropsAndI18n< P > > {\n\tconst EnhancedComponent: ComponentType<\n\t\tSubtract< P, I18nContextProps >\n\t> = ( props ) => {\n\t\tconst i18nProps = useI18n();\n\t\treturn <InnerComponent { ...( props as P ) } { ...i18nProps } />;\n\t};\n\tconst innerComponentName =\n\t\tInnerComponent.displayName || InnerComponent.name || 'Component';\n\tEnhancedComponent.displayName = `WithI18n(${ innerComponentName })`;\n\treturn EnhancedComponent;\n}\n"],
"mappings": "qpBAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAAAA,EAAO,QAAU,OAAO,GAAG,UCA3B,IAAAC,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAAAA,EAAO,QAAU,OAAO,GAAG,OCA3B,IAAAC,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAAAA,EAAO,QAAU,OAAO,kFCaxB,IAAAC,EAMO,SACPC,EAA4B,SAiE1BC,EAAA,SAjDF,SAASC,EAAkBC,EAA+B,CACzD,MAAO,CACN,GAAIA,EAAK,GAAG,KAAMA,CAAK,EACvB,GAAIA,EAAK,GAAG,KAAMA,CAAK,EACvB,GAAIA,EAAK,GAAG,KAAMA,CAAK,EACvB,IAAKA,EAAK,IAAI,KAAMA,CAAK,EACzB,MAAOA,EAAK,MAAM,KAAMA,CAAK,EAC7B,eAAgBA,EAAK,eAAe,KAAMA,CAAK,CAChD,CACD,CAEA,IAAMC,KAAc,iBAAeF,EAAkB,aAAY,CAAE,EACnEE,EAAY,YAAc,cA2BnB,SAASC,EAAcC,EAA2B,CACxD,GAAM,CAAE,SAAAC,EAAU,KAAAJ,EAAO,aAAY,EAAIG,EACnC,CAAEE,EAAQC,CAAY,KAAI,cAAY,IAAM,CAAC,EAAG,CAAC,CAAE,KAGzD,aAAW,IAAMN,EAAK,UAAWM,CAAY,EAAG,CAAEN,CAAK,CAAE,EAEzD,IAAMO,KAAQ,WAAS,IAAMR,EAAkBC,CAAK,EAAG,CAAEA,EAAMK,CAAO,CAAE,EAExE,SACC,OAACJ,EAAY,SAAZ,CAAqB,MAAAM,EACnB,SAAAH,CAAA,CACH,CAEF,CAiBO,IAAMI,EAAU,OAAM,cAAYP,CAAY,EAyB9C,SAASQ,EACfC,EACyC,CACzC,IAAMC,EAEAR,GAAW,CAChB,IAAMS,EAAYJ,EAAQ,EAC1B,SAAO,OAACE,EAAA,CAAiB,GAAKP,EAAiB,GAAGS,CAAA,CAAY,CAC/D,EACMC,EACLH,EAAe,aAAeA,EAAe,MAAQ,YACtD,OAAAC,EAAkB,YAAc,YAAaE,CAAmB,IACzDF,CACR",
"names": ["require_element", "__commonJSMin", "exports", "module", "require_i18n", "__commonJSMin", "exports", "module", "require_jsx_runtime", "__commonJSMin", "exports", "module", "import_element", "import_i18n", "import_jsx_runtime", "makeContextValue", "i18n", "I18nContext", "I18nProvider", "props", "children", "update", "forceUpdate", "value", "useI18n", "withI18n", "InnerComponent", "EnhancedComponent", "i18nProps", "innerComponentName"]
}