import { useConstant } from './useConstant' ; let seed = Math . random ( ) . toString ( 36 ) . slice ( 2 ) . replace ( /[0-9]*/ , '' ) . substr ( 0 , 4 ) ; let c = 0 ; /**
 * Generates a unique and HTML5 compliant identifier every time it is called. Internally it uses a 4
 * character random seed starting with a letter. This seed is unique to each instance of this
 * package meaning different versions of Canvas Kit on the page will have a different seed. Each
 * call will use a Base 36 string (10 numbers + 26 letters) based on an incremented number. The
 * incremented number always starts at 0 and can be reset for testing purposes using
 * [resetUniqueIdCount](#resetuniqueidcount). [setUniqueSeed](#setuniqueseed) can also be used for
 * testing or server side rendering to get the same results during hydration.
 */ export const generateUniqueId = ( ) => seed + ( c ++ ) . toString ( 36 ) ; param id export const useUniqueId = ( id ? ) => { const generatedId = useConstant ( generateUniqueId ) ; return id || generatedId ; } ; deprecated export const uniqueId = useUniqueId ; example export const setUniqueSeed = ( s ) => { seed = s ; } ; /**
 * This should only be called for tests in an `beforeEach`
 */ export const resetUniqueIdCount = ( ) => { c = 0 ; } ;