const attributionData = {
    sources: [
        {
            prefix: "./media/buildings/",
            files: [
                { name: "house.svg", source: null },
                { name: "mailbox.svg", source: null },
                { name: "mobile-home.svg", source: null },
            ],
            authors: [
                "chemicalcrux"
            ]
        },
        {
            prefix: "./media/buildings/skyscrapers/",
            files: [
                { name: "wide.svg", source: null },
                { name: "medium.svg", source: null },
                { name: "slender.svg", source: null },
                { name: "narrow.svg", source: null },
            ],
            authors: [
                "chemicalcrux"
            ]
        },
        {
            prefix: "./media/characters/abysgar/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/32424108/" }
            ],
            authors: [
                "clown-grin",
                "labratkuma"
            ],
            owners: [

            ]
        },
        {
            prefix: "./media/characters/adake/",
            files: [
                { name: "front-1.svg", source: "https://www.furaffinity.net/view/26253324/" },
                { name: "front-2.svg", source: "https://www.furaffinity.net/view/26253324/" },
                { name: "back.svg", source: "https://www.furaffinity.net/view/26253324/" },
                { name: "kneel.svg", source: "https://www.furaffinity.net/view/26253324/" },

            ],
            authors: [
                "oselotti"
            ],
            owners: [
                "Dialuca01"
            ]
        },
        {
            prefix: "./media/characters/aigey/",
            files: [
                { name: "side.svg", source: "https://www.furaffinity.net/view/12006265/" }
            ],
            authors: [
                "just-a-little-mixed-up"
            ],
            owners: [

            ]
        },
        {
            prefix: "./media/characters/akari/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/21329356/" }
            ],
            authors: [
                "spyropurple"
            ],
            owners: [

            ]
        },
        {
            prefix: "./media/characters/alicia/",
            files: [
                { name: "anthro.svg", source: "https://www.furaffinity.net/view/31363235/" }

            ],
            authors: [
                "helisa-adopts",
                "chesta"
            ],
            owners: [
                "little-big-x110"
            ]
        },
        {
            prefix: "./media/characters/alicia/",
            files: [
                { name: "feral.svg", source: "https://www.furaffinity.net/view/34138885/" }
            ],
            authors: [
                "little-big-x110",
                "helisa-adopts",
                "chesta"
            ],
            owners: [
                "little-big-x110"
            ]
        },
        {
            prefix: "./media/characters/andy/",
            files: [
                { name: "front.svg", source: null }
            ],
            authors: [
                "cardboardhead"
            ],
            owners: [

            ]
        },
        {
            prefix: "./media/characters/angelpatamon/",
            files: [
                { name: "front.svg", source: "http://www.furaffinity.net/view/26475369/" }
            ],
            authors: [
                "mallowchu"
            ]
        },
        {
            prefix: "./media/characters/appledectomy/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/33002197/" }
            ],
            authors: [
                "stonerabbit"
            ],
            owners: [
                "appledectomy"
            ]
        },
        {
            prefix: "./media/characters/archy/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/17286706/" }
            ],
            authors: [
                "twitch-the-dragon"
            ],
            owners: [
                "archy-d"
            ]
        },
        {
            prefix: "./media/characters/asana/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/35087729/" },
                { name: "back.svg", source: "https://www.furaffinity.net/view/35087729/" },
            ],
            authors: [
                "silverwingink"
            ],
            owners: [
                "aviraptia"
            ]
        },
        {
            prefix: "./media/characters/asana/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/35087729/" },
                { name: "back.svg", source: "https://www.furaffinity.net/view/35087729/" },
            ],
            authors: [
                "silverwingink"
            ],
            owners: [
                "aviraptia"
            ]
        },
        {
            prefix: "./media/characters/asana-mech/",
            files: [
                { name: "side.svg", source: null }
            ],
            authors: [
                "ashtrek"
            ],
            owners: [
                "aviraptia"
            ]
        },
        {
            prefix: "./media/characters/ashtrek/",
            files: [
                { name: "front.svg", source: null },
                { name: "front-armor.svg", source: null },
            ],
            authors: [
                "silverwingink"
            ],
            owners: [
                "ashtrek"
            ]
        },
        {
            prefix: "./media/characters/berri/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/34510917/" }
            ],
            authors: [
                "lynxsprout",
                "sugarbeans"
            ],
            owners: [
                "little-big-x110"
            ]
        },
        {
            prefix: "./media/characters/blake/",
            files: [
                { name: "side.svg", source: "https://www.furaffinity.net/view/30676178/" },
                { name: "crouched.svg", source: "https://www.furaffinity.net/view/30676178/" },
                { name: "bent.svg", source: "https://www.furaffinity.net/view/30676178/" },
            ],
            authors: [
                "zyraxus"
            ],
            owners: [
                "kurrikage"
            ]
        },
        {
            prefix: "./media/characters/cibus/",
            files: [
                { name: "side.svg", source: "https://www.furaffinity.net/view/15534343/" }
            ],
            authors: [
                "jaydom"
            ],
            owners: [
                "movler"
            ]
        },
        {
            prefix: "./media/characters/gemini/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/31363584/" },
                { name: "back.svg", source: "https://www.furaffinity.net/view/31363584/" },
            ],
            authors: [
                "rebonica"
            ],
            owners: [
                "geminimacro"
            ]
        },
        {
            prefix: "./media/characters/gemini/",
            files: [
                { name: "kneeling.svg", source: "https://www.furaffinity.net/view/31295122/" },
            ],
            authors: [
                "furrypur"
            ],
            owners: [
                "geminimacro"
            ]
        },
        {
            prefix: "./media/characters/jaro/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/26084387/" },
                { name: "back.svg", source: "https://www.furaffinity.net/view/26084387/" }
            ],
            authors: [
                "mizumisensei"
            ],
            owners: [
                "jaro-the-dragon"
            ]
        },
        {
            prefix: "./media/characters/juno/",
            files: [
                { name: "front.svg", source: "https://toyhou.se/2991942.juno#16906063" },
            ],
            authors: [
                "gaily"
            ],
            owners: [
                "little-big-x110"
            ]
        },
        {
            prefix: "./media/characters/lexi/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/32187352/" }
            ],
            authors: [

            ],
            owners: [
                "little-big-x110"
            ]
        },
        {
            prefix: "./media/characters/malfressa/",
            files: [
                { name: "side.svg", source: "https://www.furaffinity.net/view/25377262/" },
                { name: "feral.svg", source: "https://www.furaffinity.net/view/25377262/" }
            ],
            authors: [
                "d-eath-tail"
            ],
            owners: [
                "scareye"
            ]
        },
        {
            prefix: "./media/characters/malfressa/",
            files: [
                { name: "walking.svg", source: "https://www.furaffinity.net/view/23877052/" }
            ],
            authors: [
                "kerneldecoy"
            ],
            owners: [
                "scareye"
            ]
        },
        {
            prefix: "./media/characters/martin/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/30066999" }
            ],
            authors: [
                "little-big-x110"
            ],
            owners: [
                "little-big-x110"
            ]
        },
        {
            prefix: "./media/characters/nibbles/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/22964778/" },
                { name: "side.svg", source: "https://www.furaffinity.net/view/22964778/" },
            ],
            authors: [
                "dragga"
            ],
            owners: [
                "movler"
            ]
        },
        {
            prefix: "./media/characters/piper/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/22964778/" }
            ],
            authors: [
                "brit-bork"
            ],
            owners: [
                "flyhar"
            ]
        },
        {
            prefix: "./media/characters/rikky/",
            files: [
                { name: "side.svg", source: null }
            ],
            authors: [
                "ethan64"
            ],
            owners: [
                "quake-yote"
            ]
        },
        {
            prefix: "./media/characters/rogue/",
            files: [
                { name: "front.svg", source: "http://rogue.macrophile.com/ken" }
            ],
            authors: [
                "cougr"
            ],
            owners: [
                "rogue"
            ]
        },
        {
            prefix: "./media/characters/samantha/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/31077914/" },
                { name: "front-clothed.svg", source: "https://www.furaffinity.net/view/31077914/" },
                { name: "back.svg", source: "https://www.furaffinity.net/view/31077914/" },
            ],
            authors: [
                "wonderball"
            ],
            owners: [
                "little-big-x110"
            ]
        },
        {
            prefix: "./media/characters/surgo/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/33348481/" },
                { name: "back.svg", source: "https://www.furaffinity.net/view/33348481/" },
                { name: "laying.svg", source: "https://www.furaffinity.net/view/33348481/" },
            ],
            authors: [
                "gaiawolfess",
                "malakhael"
            ],
            owners: [
                "movler"
            ]
        },
        {
            prefix: "./media/characters/tiberius/",
            files: [
                { name: "front.svg", source: "https://www.furaffinity.net/view/34977812/" },
                { name: "back.svg", source: "https://www.furaffinity.net/view/34977812/" }
            ],
            authors: [
                "rebonica"
            ],
            owners: [
                "movler"
            ]
        },
        {
            prefix: "./media/characters/",
            files: [
                { name: "", source: "" }
            ],
            authors: [

            ]
        },
        {
            prefix: "./media/objects/humans/",
            files: [
                { name: "woman-1.svg", source: "https://commons.wikimedia.org/wiki/File:1Silhouette_Female.svg" }
            ],
            authors: [
                "phil-bronnery",
                "beao"
            ]
        },
        {
            prefix: "./media/objects/humans/",
            files: [
                { name: "man-1.svg", source: "https://commons.wikimedia.org/wiki/File:Silhouette.svg" }
            ],
            authors: [
                
            ]
        },
        {
            prefix: "./media/vehicles/",
            files: [
                { name: "titanic.svg", source: "https://creazilla.com/nodes/873-titanic-silhouette" },
                { name: "vertical-titanic.svg", source: "https://creazilla.com/nodes/873-titanic-silhouette" }
            ],
            authors: [
                
            ]
        },
    ],
    people: {
        "appledectomy": {
            name: "Appledectomy",
            url: "https://www.furaffinity.net/user/appledectomy"
        },
        "archy-d": {
            name: "ArchyD",
            url: "https://www.furaffinity.net/user/ArchyD"
        },
        "ashtrek": {
            name: "Ashtrek",
            url: "https://www.furaffinity.net/user/ashtrek/"
        },
        "aviraptia": {
            name: "Aviraptia",
            url: "https://www.furaffinity.net/user/aviraptia/"
        },
        "beao": {
            name: "Beao",
            url: "https://commons.wikimedia.org/wiki/User:Beao"
        },
        "brit-bork": {
            name: "Koijot",
            url: "https://twitter.com/Brit_Bork",
        },
        "cardboardhead": {
            name: "cardboardhead",
            url: "https://twitter.com/cardboardhead"
        },
        "chemicalcrux": {
            name: "chemicalcrux",
            url: "https://www.furaffinity.net/user/chemicalcrux"
        },
        "chesta": {
            name: "Chesta",
            url: "https://www.furaffinity.net/user/chesta"
        },
        "clown-grin": {
            name: "clown-grin",
            url: "https://www.furaffinity.net/user/clown-grin"
        },
        "cougr": {
            name: "Cougr",
            url: "https://www.furaffinity.net/user/cougr"
        },
        "d-eath-tail": {
            name: "Deathy",
            url: "https://www.furaffinity.net/user/d-eath-tail"
        },
        "Dialuca01": {
            name: "Dialuca",
            url: "https://www.furaffinity.net/user/dialuca01"
        },
        "dragga": {
            name: "Dragga",
            url: "https://www.furaffinity.net/user/dragga"
        },
        "ethan64": {
            name: "Ethan64",
            url: "https://www.furaffinity.net/user/ethan64/"
        },
        "flyhar": {
            name: "Flyhar",
            url: "https://www.furaffinity.net/user/flyfeline/"
        },
        "furrypur": {
            name: "FurryPur",
            url: "https://www.furaffinity.net/user/furrypur/"
        },
        "gaiawolfess": {
            name: "Gaiawolfess",
            url: "https://www.furaffinity.net/user/gaiawolfess"
        },
        "gaily": {
            name: "Gaily",
            url: "https://www.furaffinity.net/user/gaily/"
        },
        "geminimacro": {
            name: "geminimacro",
            url: "https://www.furaffinity.net/user/lajay"
        },
        "helisa-adopts": {
            name: "Helisa",
            url: "https://www.furaffinity.net/user/HelisaAdopts"
        },
        "jaro-the-dragon": {
            name: "Jaro",
            url: "https://www.furaffinity.net/user/jarothedragon/"
        },
        "jaydom": {
            name: "Jaydom",
            url: "https://www.furaffinity.net/user/jaydom"
        },
        "just-a-little-mixed-up": {
            name: "just-a-little-mixed-up",
            url: "https://www.furaffinity.net/user/just-a-little-mixed-up"
        },
        "kerneldecoy": {
            name: "Kernel Decoy",
            url: "https://www.furaffinity.net/user/kerneldecoy/"
        },
        "kurrikage": {
            name: "Kurrikage",
            url: "https://www.furaffinity.net/user/kurrikage/"
        },
        "labratkuma": {
            name: "labratkuma",
            url: "https://www.furaffinity.net/user/labratkuma"
        },
        "little-big-x110": {
            name: "LittleBig",
            url: "https://www.furaffinity.net/user/LittlebigX110"
        },
        "lynxsprout": {
            name: "Lynxsprout",
            url: "https://lynxsprout.carrd.co/"
        },
        "malakhael": {
            name: "Malakhael",
            url: "https://www.furaffinity.net/user/malakhael"
        },
        "mallowchu": {
            name: "Mallowchu",
            url: "https://www.furaffinity.net/user/mallowchu"
        },
        "mizumisensei": {
            name: "Mizumisensei",
            url: "https://twitter.com/mizumisensei"
        },
        "movler": {
            name: "Movler",
            url: "https://www.furaffinity.net/user/movler/"
        },
        "oselotti": {
            name: "Oselotti",
            url: "https://www.furaffinity.net/user/oselotti"
        },
        "phil-bronnery": {
            name: "Phil Bronnery",
            url: "https://www.flickr.com/people/27919241@N02"
        },
        "quake-yote": {
            name: "Quake Yote",
            url: "https://www.furaffinity.net/user/rokossovskiy"
        },
        "rebonica": {
            name: "Rebonica",
            url: "https://www.furaffinity.net/user/rebonica"
        },
        "rogue": {
            name: "Rogue Megawolf",
            url: "https://twitter.com/roguemegawolf"
        },
        "scareye": {
            name: "Scareye",
            url: "https://www.furaffinity.net/user/scareye/"
        },
        "silverwingink": {
            name: "silverwingink",
            url: "https://www.furaffinity.net/gallery/silverwingink/"
        },
        "spyropurple": {
            name: "spyropurple",
            url: "https://www.furaffinity.net/user/spyropurple/"
        },
        "stonerabbit": {
            name: "stonerabbit",
            url: "https://www.furaffinity.net/user/stonerabbit/"
        },
        "sugarbeans": {
            name: "sugarbeans",
            url: "https://www.furaffinity.net/user/sugarbeans/"
        },
        "twitch-the-dragon": {
            name: "Twitch",
            url: "https://www.furaffinity.net/user/twitchthedragon/"
        },
        "wonderball": {
            name: "Wonderball",
            url: "https://www.furaffinity.net/user/wonderball"
        },
        "zyraxus": {
            name: "Zyraxus",
            url: "https://www.furaffinity.net/user/zyraxus"
        }
    }
}

const attribution = {};

function prepareAttribution() {
    attribution["files"] = {};

    attributionData.sources.forEach(citation => {
        citation.files.forEach(file => {
            attribution.files[citation.prefix + file.name] = {
                authors: citation.authors,
                owners: citation.owners,
                source: file.source
            }
        })
    });
}

function authorsOf(file) {
    if (attribution.files[file])
        return attribution.files[file].authors;
    else
        return undefined;
}

function authorsOfFull(file) {
    if (attribution.files[file]) {
        const result = [];
        attribution.files[file].authors.forEach(author => {
            result.push(attributionData.people[author]);
        });

        return result;
    }
    else
        return undefined;
}

function ownersOf(file) {
    if (attribution.files[file])
        return attribution.files[file].owners;
    else
        return undefined;
}

function ownersOfFull(file) {
    if (attribution.files[file]) {
        if (attribution.files[file].owners !== undefined) {
            const result = [];
            attribution.files[file].owners.forEach(owner => {
                result.push(attributionData.people[owner]);
            });

            return result;
        } else {
            return [];
        }

    }
    else
        return undefined;
}

function sourceOf(file) {
    if (attribution.files[file])
        return attribution.files[file].source;
    else
        return undefined;
}

prepareAttribution();
