// Path: src/main/java/fr/brouillard/oss/cssfx/impl/log/CSSFXLogger.java
// public static Logger logger(String loggerName) {
//     if (!isInitialized()) {
//         noop();
//     }
//     return loggerFactory.getLogger(loggerName);
// }
// 
// Path: src/main/java/fr/brouillard/oss/cssfx/api/URIToPathConverter.java
// @FunctionalInterface
// public interface URIToPathConverter {
//     public Path convert(String uri);
// }


import fr.brouillard.oss.cssfx.api.URIToPathConverter;
import static fr.brouillard.oss.cssfx.impl.log.CSSFXLogger.logger;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
package fr.brouillard.oss.cssfx.impl;

/*
 * #%L
 * CSSFX
 * %%
 * Copyright (C) 2014 CSSFX by Matthieu Brouillard
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */





public class URIToPathConverters {
    private static final URIToPathConverter MAVEN_RESOURCE = new URIToPathConverter() {
        @Override
        public Path convert(String uri) {
            if (uri != null && uri.startsWith("file:")) {
                if (uri.contains("target/classes")) {
                    String[] classesTransform = {
                            "src/main/java", "src/main/resources" };
                    for (String ct : classesTransform) {
                        String potentialSourceURI = uri.replace("target/classes", ct);
                        try {
                            Path p = Paths.get(new URI(potentialSourceURI));
                            if (Files.exists(p)) {
                                return p;
                            }
                        } catch (URISyntaxException e) {
                            e.printStackTrace();
                        }
                    }
                } else if (uri.contains("target/test-classes")) {
                    String[] testClassesTransform = {
// Path: src/main/java/fr/brouillard/oss/cssfx/impl/log/CSSFXLogger.java
// public static Logger logger(String loggerName) {
//     if (!isInitialized()) {
//         noop();
//     }
//     return loggerFactory.getLogger(loggerName);
// }
// 
// Path: src/main/java/fr/brouillard/oss/cssfx/api/URIToPathConverter.java
// @FunctionalInterface
// public interface URIToPathConverter {
//     public Path convert(String uri);
// }


// Path: src/main/java/fr/brouillard/oss/cssfx/impl/URIToPathConverters.java
import fr.brouillard.oss.cssfx.api.URIToPathConverter;
import static fr.brouillard.oss.cssfx.impl.log.CSSFXLogger.logger;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

package fr.brouillard.oss.cssfx.impl;

/*
 * #%L
 * CSSFX
 * %%
 * Copyright (C) 2014 CSSFX by Matthieu Brouillard
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */





public class URIToPathConverters {
    private static final URIToPathConverter MAVEN_RESOURCE = new URIToPathConverter() {
        @Override
        public Path convert(String uri) {
            if (uri != null && uri.startsWith("file:")) {
                if (uri.contains("target/classes")) {
                    String[] classesTransform = {
                            "src/main/java", "src/main/resources" };
                    for (String ct : classesTransform) {
                        String potentialSourceURI = uri.replace("target/classes", ct);
                        try {
                            Path p = Paths.get(new URI(potentialSourceURI));
                            if (Files.exists(p)) {
                                return p;
                            }
                        } catch (URISyntaxException e) {
                            e.printStackTrace();
                        }
                    }
                } else if (uri.contains("target/test-classes")) {
                    String[] testClassesTransform = {
                            "src/test/java", "src/test/resources" };