docs: @Override
      public boolean libraryExists(String libraryName)
      {
          FacesContext facesContext = FacesContext.getCurrentInstance();
          String localePrefix = getLocalePrefixForLocateResource(facesContext);
          final List<String> contracts = facesContext.getResourceLibraryContracts(); 
  
          String pathToLib = null;
          Boolean libraryFound = null;
          if (libraryName != null && !ResourceValidationUtils.isValidLibraryName(
                  libraryName, isAllowSlashesLibraryName()))
          {
              return false;
          }
          
          if (localePrefix != null)
          {
              //Check with locale
              pathToLib = localePrefix + '/' + libraryName;
  
              libraryFound = getResourceLoaderCache().libraryExists(pathToLib);
              if (libraryFound != null)
              {
                  return libraryFound.booleanValue();
              }
          }
          libraryFound = getResourceLoaderCache().libraryExists(libraryName);
          if (libraryFound != null)
          {
              return libraryFound.booleanValue();
          }
          
          if (localePrefix != null)
          {
              if (!contracts.isEmpty())
              {
                  for (String contract : contracts)
                  {
                      for (ContractResourceLoader loader : getResourceHandlerSupport()
                              .getContractResourceLoaders())
                      {
                          if (loader.libraryExists(pathToLib, contract))
                          {
                              getResourceLoaderCache().confirmLibraryExists(pathToLib);
                              return true;
                          }
                      }
                  }
              }
              
              for (ResourceLoader loader : getResourceHandlerSupport()
                      .getResourceLoaders())
              {
                  if (loader.libraryExists(pathToLib))
                  {
                      getResourceLoaderCache().confirmLibraryExists(pathToLib);
                      return true;
                  }
              }            
          }
  
          //Check without locale
          if (!contracts.isEmpty())
          {
              for (String contract : contracts)
              {
                  for (ContractResourceLoader loader : getResourceHandlerSupport()
                          .getContractResourceLoaders())
                  {
                      if (loader.libraryExists(libraryName, contract))
                      {
                          getResourceLoaderCache().confirmLibraryExists(libraryName);
                          return true;
                      }
                  }
              }
          }
  
          for (ResourceLoader loader : getResourceHandlerSupport()
                  .getResourceLoaders())
          {
              if (loader.libraryExists(libraryName))
              {
                  getResourceLoaderCache().confirmLibraryExists(libraryName);
                  return true;
              }
          }
  
          if (localePrefix != null)
          {
              //Check with locale
              getResourceLoaderCache().confirmLibraryNotExists(pathToLib);
          }
          else
          {
              getResourceLoaderCache().confirmLibraryNotExists(libraryName);
          }
          return false;
      }