text:
using org.javarosa.core.model.data;
using org.javarosa.core.model.instance.utils;
using org.javarosa.core.model.util.restorable;
using org.javarosa.core.model.utils;
using org.javarosa.core.services.storage;
using org.javarosa.core.util.externalizable;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
namespace org.javarosa.core.model.instance
{

    /**
     * This class represents the xform model instance
     */
    public class FormInstance : Persistable, Restorable
    {

        public  const String STORAGE_KEY = "FORMDATA";

        /** The root of this tree */
        private TreeElement root = new TreeElement();
        // represents '/'; always has one and only one child -- the top-level
        // instance data node
        // this node is never returned or manipulated directly

        /** The name for this data model */
        private String name;

        /** The integer Id of the model */
        private int id;

        /** The ID of the form that this is a model for */
        private int formId;

        /** The date that this model was taken and recorded */
        private DateTime dateSaved;

        public String schema;
        public String formVersion;
        public String uiVersion;

        private Hashtable namespaces = new Hashtable();

        public FormInstance()
        {
        }

        /**
         * Creates a new data model using the root given.
         *
         * @param root
         *            The root of the tree for this data model.
         */
        public FormInstance(TreeElement root)
        {
           ID = -1;
            setFormId(-1);
            setRoot(root);
        }

        /**
         * Sets the root element of this Model's tree
         *
         * @param root
         *            The root of the tree for this data model.
         */
        public void setRoot(TreeElement topLevel)
        {
            root = new TreeElement();
            if (topLevel != null)
                root.addChild(topLevel);
        }

        /**
         * TODO: confusion between root and its first child?
         *
         * @return This model's root tree element
         */
        public TreeElement getRoot()
        {

            if (root.getNumChildren() == 0)
                throw new SystemException("root node has no children");

            return root.getChildAt(0);
        }

        // throws classcastexception if not using XPathReference
        public  static TreeReference unpackReference(IDataReference ref_)
        {
            return (TreeReference)ref_.Reference;
        }
        public TreeReference unpackReference2(IDataReference ref_)
        {
            return (TreeReference)ref_.Reference;
        }

        public TreeReference copyNode(TreeReference from, TreeReference to)
        {
            if (!from.isAbsolute())
            {
                throw new InvalidReferenceException("Source reference must be absolute for copying", from);
            }

            TreeElement src = resolveReference(from);
            if (src == null)
            {
                throw new InvalidReferenceException("Null Source reference while attempting to copy node", from);
            }

            return copyNode(src, to).getRef();
        }

        // for making new repeat instances; 'from' and 'to' must be unambiguous
        // references EXCEPT 'to' may be ambiguous at its final step
        // return true is successfully copied, false otherwise
        public TreeElement copyNode(TreeElement src, TreeReference to)
        {
            if (!to.isAbsolute())
                throw new InvalidReferenceException("Destination reference must be absolute for copying", to);

            // strip out dest node info and get dest parent
            String dstName = to.getNameLast();
            int dstMult = to.getMultLast();
            TreeReference toParent = to.getParentRef();

            TreeElement parent = resolveReference(toParent);
            if (parent == null)
            {
                throw new InvalidReferenceException("Null parent reference whle attempting to copy", toParent);
            }
            if (!parent.isChildable())
            {
                throw new InvalidReferenceException("Invalid Parent Node: cannot accept children.", toParent);
            }

            if (dstMult == TreeReference.INDEX_UNBOUND)
            {
                dstMult = parent.getChildMultiplicity(dstName);
            }
            else if (parent.getChild(dstName, dstMult) != null)
            {
                throw new InvalidReferenceException("Destination already exists!", to);
            }

            TreeElement dest = src.deepCopy(false);
            dest.setName(dstName);
            dest.multiplicity = dstMult;
            parent.addChild(dest);
            return dest;
        }

        public void copyItemsetNode(TreeElement copyNode, TreeReference destRef, FormDef f)
        {
            TreeElement templateNode = getTemplate(destRef);
            TreeElement newNode = this.copyNode(templateNode, destRef);
            newNode.populateTemplate(copyNode, f);
        }

        // don't think this is used anymore
        public IAnswerData getDataValue(IDataReference questionReference)
        {
            TreeElement element = resolveReference(questionReference);
            if (element != null)
            {
                return element.getValue();
            }
            else
            {
                return null;
            }
        }

        // take a ref that unambiguously refers to a single node and return that node
        // return null if ref is ambiguous, node does not exist, ref is relative, or ref is '/'
        // can be used to retrieve template nodes
        public TreeElement resolveReference(TreeReference ref_)
        {
            if (!ref_.isAbsolute())
            {
                return null;
            }

            TreeElement node = root;
            for (int i = 0; i < ref_.size(); i++)
            {
                String name = ref_.getName(i);
                int mult = ref_.getMultiplicity(i);

                if (mult == TreeReference.INDEX_ATTRIBUTE)
                {
                    //Should we possibly just return here?
                    //I guess technically we could step back...
                    node = node.getAttribute(null, name);
                    continue;
                }
                if (mult == TreeReference.INDEX_UNBOUND)
                {
                    if (node.getChildMultiplicity(name) == 1)
                    {
                        mult = 0;
                    }
                    else
                    {
                        // reference is not unambiguous
                        node = null;
                        break;
                    }
                }

                node = node.getChild(name, mult);
                if (node == null)
                    break;
            }

            return (node == root ? null : node); // never return a reference to '/'
        }

        // same as resolveReference but return a vector containing all interstitial
        // nodes: top-level instance data node first, and target node last
        // returns null in all the same situations as resolveReference EXCEPT ref
        // '/' will instead return empty vector
        public ArrayList explodeReference(TreeReference ref_)
        {
            if (!ref_.isAbsolute())
                return null;

            ArrayList nodes = new ArrayList();
            TreeElement cur = root;
            for (int i = 0; i < ref_.size(); i++)
            {
                String name = ref_.getName(i);
                int mult = ref_.getMultiplicity(i);

                //If the next node down the line is an attribute
                if (mult == TreeReference.INDEX_ATTRIBUTE)
                {
                    //This is not the attribute we're testing
                    if (cur != root)
                    {
                        //Add the current node
                        nodes.Add(cur);
                    }
                    cur = cur.getAttribute(null, name);
                }

                //Otherwise, it's another child element
                else
                {
                    if (mult == TreeReference.INDEX_UNBOUND)
                    {
                        if (cur.getChildMultiplicity(name) == 1)
                        {
                            mult = 0;
                        }
                        else
                        {
                            // reference is not unambiguous
                            return null;
                        }
                    }

                    if (cur != root)
                    {
                        nodes.Add(cur);
                    }

                    cur = cur.getChild(name, mult);
                    if (cur == null)
                    {
                        return null;
                    }
                }
            }
            return nodes;
        }

        public List<TreeReference> expandReference(TreeReference ref_)
        {
            return expandReference(ref_, false);
        }

        // take in a potentially-ambiguous ref, and return a vector of refs for all nodes that match the passed-in ref
        // meaning, search out all repeated nodes that match the pattern of the passed-in ref
        // every ref in the returned vector will be unambiguous (no index will ever be INDEX_UNBOUND)
        // does not return template nodes when matching INDEX_UNBOUND, but will match templates when INDEX_TEMPLATE is explicitly set
        // return null if ref is relative, otherwise return vector of refs (but vector will be empty is no refs match)
        // '/' returns {'/'}
        // can handle sub-repetitions (e.g., {/a[1]/b[1], /a[1]/b[2], /a[2]/b[1]})
        public List<TreeReference> expandReference(TreeReference ref_, Boolean includeTemplates)
        {
            if (!ref_.isAbsolute())
                return null;

            List<TreeReference> v = new List<TreeReference>();
            expandReference(ref_, root, v, includeTemplates);
            return v;
        }

        // recursive helper function for expandReference
        // sourceRef: original path we're matching against
        // node: current node that has matched the sourceRef thus far
        // templateRef: explicit path that refers to the current node
        // refs: Vector to collect matching paths; if 'node' is a target node that
        // matches sourceRef, templateRef is added to refs
        private void expandReference(TreeReference sourceRef, TreeElement node, List<TreeReference> refs, Boolean includeTemplates)
        {
            int depth = node.getDepth();

            if (depth == sourceRef.size())
            {
                refs.Add(node.getRef());
            }
            else
            {
                String name = sourceRef.getName(depth);
                int mult = sourceRef.getMultiplicity(depth);
                List<TreeElement> set = new List<TreeElement>();

                if (node.getNumChildren() > 0)
                {
                    if (mult == TreeReference.INDEX_UNBOUND)
                    {
                        int count = node.getChildMultiplicity(name);
                        for (int i = 0; i < count; i++)
                        {
                            TreeElement child = node.getChild(name, i);
                            if (child != null)
                            {
                                set.Add(child);
                            }
                            else
                            {
                                throw new InvalidOperationException(); // missing/non-sequential
                                // nodes
                            }
                        }
                        if (includeTemplates)
                        {
                            TreeElement template = node.getChild(name, TreeReference.INDEX_TEMPLATE);
                            if (template != null)
                            {
                                set.Add(template);
                            }
                        }
                    }
                    else if (mult != TreeReference.INDEX_ATTRIBUTE)
                    {
                        //TODO: Make this test mult >= 0?
                        //If the multiplicity is a simple integer, just get
                        //the appropriate child
                        TreeElement child = node.getChild(name, mult);
                        if (child != null)
                        {
                            set.Add(child);
                        }
                    }
                }

                if (mult == TreeReference.INDEX_ATTRIBUTE)
                {
                    TreeElement attribute = node.getAttribute(null, name);
                    set.Add(attribute);
                }

                for (IEnumerator e = set.GetEnumerator(); e.MoveNext(); )
                {
                    expandReference(sourceRef, (TreeElement)e.Current, refs, includeTemplates);
                }
            }
        }

        // retrieve the template node for a given repeated node ref may be ambiguous
        // return null if node is not repeatable
        // assumes templates are built correctly and obey all data model validity rules
        public TreeElement getTemplate(TreeReference ref_)
        {
            TreeElement node = getTemplatePath(ref_);
            return (node == null ? null : node.repeatable ? node : null);
        }

        public TreeElement getTemplatePath(TreeReference ref_)
        {
            if (!ref_.isAbsolute())
                return null;

            TreeElement node = root;
            for (int i = 0; i < ref_.size(); i++)
            {
                String name = ref_.getName(i);

                if (ref_.getMultiplicity(i) == TreeReference.INDEX_ATTRIBUTE)
                {
                    node = node.getAttribute(null, name);
                }
                else
                {

                    TreeElement newNode = node.getChild(name, TreeReference.INDEX_TEMPLATE);
                    if (newNode == null)
                    {
                        newNode = node.getChild(name, 0);
                    }
                    if (newNode == null)
                    {
                        return null;
                    }
                    node = newNode;
                }
            }

            return node;
        }

        // determine if nodes are homogeneous, meaning their descendant structure is 'identical' for repeat purposes
        // identical means all children match, and the children's children match, and so on
        // repeatable children are ignored; as they do not have to exist in the same quantity for nodes to be homogeneous
        // however, the child repeatable nodes MUST be verified amongst themselves for homogeneity later
        // this function ignores the names of the two nodes
        public static Boolean isHomogeneous(TreeElement a, TreeElement b)
        {
            if (a.isLeaf() && b.isLeaf())
            {
                return true;
            }
            else if (a.isChildable() && b.isChildable())
            {
                // verify that every (non-repeatable) node in a exists in b and vice
                // versa
                for (int k = 0; k < 2; k++)
                {
                    TreeElement n1 = (k == 0 ? a : b);
                    TreeElement n2 = (k == 0 ? b : a);

                    for (int i = 0; i < n1.getNumChildren(); i++)
                    {
                        TreeElement child1 = n1.getChildAt(i);
                        if (child1.repeatable)
                            continue;
                        TreeElement child2 = n2.getChild(child1.getName(), 0);
                        if (child2 == null)
                            return false;
                        if (child2.repeatable)
                            throw new SystemException("shouldn't happen");
                    }
                }

                // compare children
                for (int i = 0; i < a.getNumChildren(); i++)
                {
                    TreeElement childA = a.getChildAt(i);
                    if (childA.repeatable)
                        continue;
                    TreeElement childB = b.getChild(childA.getName(), 0);
                    if (!isHomogeneous(childA, childB))
                        return false;
                }

                return true;
            }
            else
            {
                return false;
            }
        }

        /**
         * Resolves a binding to a particular question data element
         *
         * @param binding
         *            The binding representing a particular question
         * @return A QuestionDataElement corresponding to the binding provided. Null
         *         if none exists in this tree.
         */
        public TreeElement resolveReference(IDataReference binding)
        {
            return resolveReference(unpackReference(binding));
        }

        public void accept(IInstanceVisitor visitor)
        {
            visitor.visit(this);

            if (visitor is ITreeVisitor)
            {
                root.accept((ITreeVisitor)visitor);
            }

        }

        public void setDateSaved(DateTime dateSaved)
        {
            this.dateSaved = dateSaved;
        }

        public void setFormId(int formId)
        {
            this.formId = formId;
        }

        public DateTime getDateSaved()
        {
            return this.dateSaved;
        }

        public int getFormId()
        {
            return this.formId;
        }

        /*
         * (non-Javadoc)
         *
         * @see
         * org.javarosa.core.services.storage.utilities.Externalizable#readExternal
         * (java.io.DataInputStream)
         */
        public void readExternal(BinaryReader in_, PrototypeFactory pf)
        {
            id = ExtUtil.readInt(in_);
            formId = ExtUtil.readInt(in_);
            name = (String)ExtUtil.read(in_, new ExtWrapNullable(typeof(String)), pf);
            schema = (String)ExtUtil.read(in_, new ExtWrapNullable(typeof(String)), pf);
            dateSaved = (DateTime)ExtUtil.read(in_, new ExtWrapNullable(typeof(DateTime)), pf);

            namespaces = (Hashtable)ExtUtil.read(in_, new ExtWrapMap(typeof(String), typeof(String)));
            setRoot((TreeElement)ExtUtil.read(in_, typeof(TreeElement), pf));
        }

        /*
         * (non-Javadoc)
         *
         * @see
         * org.javarosa.core.services.storage.utilities.Externalizable#writeExternal
         * (java.io.DataOutputStream)
         */
        public void writeExternal(BinaryWriter out_)
        {
            ExtUtil.writeNumeric(out_, id);
            ExtUtil.writeNumeric(out_, formId);
            ExtUtil.write(out_, new ExtWrapNullable(name));
            ExtUtil.write(out_, new ExtWrapNullable(schema));
            ExtUtil.write(out_, new ExtWrapNullable(dateSaved));
            ExtUtil.write(out_, new ExtWrapMap(namespaces));
            ExtUtil.write(out_, getRoot());
        }

        public String getName()
        {
            return name;
        }

        /**
         * Sets the name of this datamodel instance
         *
         * @param name
         *            The name to be used
         */
        public void setName(String name)
        {
            this.name = name;
        }

        public int ID
        {
            get { return id; }
            set {
                this.id = value;
            }
        }

        public TreeReference addNode(TreeReference ambigRef)
        {
            TreeReference ref_ = ambigRef.clone();
            if (createNode(ref_) != null)
            {
                return ref_;
            }
            else
            {
                return null;
            }
        }

        public TreeReference addNode(TreeReference ambigRef, IAnswerData data, int dataType)
        {
            TreeReference ref_ = ambigRef.clone();
            TreeElement node = createNode(ref_);
            if (node != null)
            {
                if (dataType >= 0)
                {
                    node.dataType = dataType;
                }

                node.setValue(data);
                return ref_;
            }
            else
            {
                return null;
            }
        }

        /*
         * create the specified node in the tree, creating all intermediary nodes at
         * each step, if necessary. if specified node already exists, return null
         *
         * creating a duplicate node is only allowed at the final step. it will be
         * done if the multiplicity of the last step is ALL or equal to the count of
         * nodes already there
         *
         * at intermediate steps, the specified existing node is used; if
         * multiplicity is ALL: if no nodes exist, a new one is created; if one node
         * exists, it is used; if multiple nodes exist, it's an error
         *
         * return the newly-created node; modify ref so that it's an unambiguous ref
         * to the node
         */
        private TreeElement createNode(TreeReference ref_)
        {

            TreeElement node = root;

            for (int k = 0; k < ref_.size(); k++)
            {
                String name = ref_.getName(k);
                int count = node.getChildMultiplicity(name);
                int mult = ref_.getMultiplicity(k);

                TreeElement child;
                if (k < ref_.size() - 1)
                {
                    if (mult == TreeReference.INDEX_UNBOUND)
                    {
                        if (count > 1)
                        {
                            return null; // don't know which node to use
                        }
                        else
                        {
                            // will use existing (if one and only one) or create new
                            mult = 0;
                            ref_.setMultiplicity(k, 0);
                        }
                    }

                    // fetch
                    child = node.getChild(name, mult);
                    if (child == null)
                    {
                        if (mult == 0)
                        {
                            // create
                            child = new TreeElement(name, count);
                            node.addChild(child);
                            ref_.setMultiplicity(k, count);
                        }
                        else
                        {
                            return null; // intermediate node does not exist
                        }
                    }
                }
                else
                {
                    if (mult == TreeReference.INDEX_UNBOUND || mult == count)
                    {
                        if (k == 0 && root.getNumChildren() != 0)
                        {
                            return null; // can only be one top-level node, and it
                            // already exists
                        }

                        if (!node.isChildable())
                        {
                            return null; // current node can't have children
                        }

                        // create new
                        child = new TreeElement(name, count);
                        node.addChild(child);
                        ref_.setMultiplicity(k, count);
                    }
                    else
                    {
                        return null; // final node must be a newly-created node
                    }
                }

                node = child;
            }

            return node;
        }

        public void addNamespace(String prefix, String URI)
        {
            namespaces.Add(prefix, URI);
        }

        public String[] getNamespacePrefixes()
        {
            String[] prefixes = new String[namespaces.Count];
            int i = 0;
            for (IEnumerator en = namespaces.GetEnumerator(); en.MoveNext(); )
            {
                prefixes[i] = (String)en.Current;
                ++i;
            }
            return prefixes;
        }

        public String getNamespaceURI(String prefix)
        {
            return (String)namespaces[prefix];
        }

        public String RestorableType
        {
            get
            {
                return "form";
            }
        }

        // TODO: include whether form was sent already (or restrict always to unsent
        // forms)

        public FormInstance exportData()
        {
            FormInstance dm = RestoreUtils.createDataModel(this);
            RestoreUtils.addData(dm, "name", name);
            RestoreUtils.addData(dm, "form-id", (int)(formId));
            RestoreUtils.addData(dm, "saved-on", dateSaved,
                    Constants.DATATYPE_DATE_TIME);
            RestoreUtils.addData(dm, "schema", schema);

            /////////////
            throw new SystemException("FormInstance.exportData(): must be updated to use new transport layer");
            //		ITransportManager tm = TransportManager._();
            //		boolean sent = (tm.getModelDeliveryStatus(id, true) == TransportMessage.STATUS_DELIVERED);
            //		RestoreUtils.addData(dm, "sent", new Boolean(sent));
            /////////////

            //		for (Enumeration e = namespaces.keys(); e.hasMoreElements(); ) {
            //			String key = (String)e.nextElement();
            //			RestoreUtils.addData(dm, "namespace/" + key, namespaces.get(key));
            //		}
            //
            //		RestoreUtils.mergeDataModel(dm, this, "data");
            //		return dm;
        }

        public void templateData(FormInstance dm, TreeReference parentRef)
        {
            RestoreUtils.applyDataType(dm, "name", parentRef, typeof(String));
            RestoreUtils.applyDataType(dm, "form-id", parentRef, typeof(int));
            RestoreUtils.applyDataType(dm, "saved-on", parentRef,
                    Constants.DATATYPE_DATE_TIME);
            RestoreUtils.applyDataType(dm, "schema", parentRef, typeof(String));
            RestoreUtils.applyDataType(dm, "sent", parentRef, typeof(Boolean));
            // don't touch data for now
        }

        public void importData(FormInstance dm)
        {
            name = (String)RestoreUtils.getValue("name", dm);
            formId = ((int)RestoreUtils.getValue("form-id", dm));
            dateSaved = (DateTime)RestoreUtils.getValue("saved-on", dm);
            schema = (String)RestoreUtils.getValue("schema", dm);

            Boolean sent = RestoreUtils.getBoolean(RestoreUtils
                    .getValue("sent", dm));

            TreeElement names = dm.resolveReference(RestoreUtils.absRef("namespace", dm));
            if (names != null)
            {
                for (int i = 0; i < names.getNumChildren(); i++)
                {
                    TreeElement child = names.getChildAt(i);
                    String name_ = child.getName();
                    Object value = RestoreUtils.getValue("namespace/" + name_, dm);
                    if (value != null)
                    {
                        namespaces.Add(name_, value);
                    }
                }
            }

            /////////////
            throw new SystemException("FormInstance.importData(): must be updated to use new transport layer");
            //		if (sent) {
            //			ITransportManager tm = TransportManager._();
            //			tm.markSent(id, false);
            //		}
            /////////////

            //		IStorageUtility forms = StorageManager.getStorage(FormDef.STORAGE_KEY);
            //		FormDef f = (FormDef)forms.read(formId);
            //		setRoot(processSavedDataModel(dm.resolveReference(RestoreUtils.absRef("data", dm)), f.getDataModel(), f));
        }

        public TreeElement processSaved(FormInstance template, FormDef f)
        {
            TreeElement fixedInstanceRoot = template.getRoot().deepCopy(true);
            TreeElement incomingRoot = root.getChildAt(0);

            if (!fixedInstanceRoot.getName().Equals(incomingRoot.getName()) || incomingRoot.getMult() != 0)
            {
                throw new SystemException("Saved form instance to restore does not match form definition");
            }

            fixedInstanceRoot.populate(incomingRoot, f);
            return fixedInstanceRoot;
        }

        public FormInstance clone()
        {
            FormInstance cloned = new FormInstance(this.getRoot().deepCopy(true));

            cloned.ID = (this.ID);
            cloned.setFormId(this.getFormId());
            cloned.setName(this.getName());
            cloned.setDateSaved(this.getDateSaved());
            cloned.schema = this.schema;
            cloned.formVersion = this.formVersion;
            cloned.uiVersion = this.uiVersion;
            cloned.namespaces = new Hashtable();
            for (IEnumerator e = this.namespaces.GetEnumerator(); e.MoveNext(); )
            {
                Object key = e.Current;
                cloned.namespaces.Add(key, this.namespaces[key]);
            }

            return cloned;
        }

    }
}


text:
import ModuleInstance from './ModuleInstance.js';
import { uri } from 'modapp-utils';

/**
 * Require callback
 * @callback App~requireCallback
 * @param {Object.<string,AppModule>} modules A key/value object with keys being the module names and the value being the app module instance.
 */

/**
 * Module class callback
 * @callback App~moduleClassCallback
 * @param {string} moduleName Name of the module
 * @returns {Promise.<Class,Error>} Returns promise of the {@link AppModule} class.
 */

/**
 * Load app module results
 * @typedef {object} App~loadResults
 * @property {Object.<string,AppModule>} modules A key/value object where the key is the module name and the value is the app module instance.
 * @property {?Object.<string,Error>} errors A key/value object where the key is the module name and the value is the error when trying to load the module. Null means there are no errors.
 */

/**
 * A modular app container loading, storing, and linking app modules together.
 */
class App {

	/**
	 * Creates an App instance.

	 * The optional module configuration may be overridden using the url query.

	 * Eg. "?login.auto=true" would pass {auto: "true"} as parameter to the login app module.
	 * If a module configuration has the property "active" set to the strings "false", "no",
	 * or "0", or has value false or 0, it will automatically be deactivated on load.
	 * @param {Object.<string,object>} [moduleConfig] App module configuration key-value object where the key is the name of the module and the value is the parameters passed to the module on creation.
	 * @param {object} [opt] App configuration
	 * @param {App~moduleClassCallback} [opt.moduleClass] Callback for fetching the {@link AppModule} class for a given module name.
	 * @param {string} [opt.queryNamespace] Namespace prefix for query params. Eg. 'mod' for ?mod.login.auto=true . Defaults to no namespace.
	 */
	constructor(moduleConfig, opt = {}) {
		// Module configuration
		this._moduleConfig = moduleConfig || {};
		this._query = uri.getQuery(opt.queryNamespace || null);
		this._moduleClassCallback = opt.moduleClass || null;

		// Module storage
		this._module = {}; // Holds all ModuleInstances
		this._moduleClass = {}; // Holds all AppModule classes

		// Require
		this._catchRequire = false; // Holds required modules
		this._require = null;
	}

	/**
	 * Loads an app module bundle, creating an explicit instance of each app module class.

	 * If a moduleClass already exist for a given name, loadBundle will dispose the previously
	 * loaded version and replace it with a new instance.
	 * The returned promise will always resolve.
	 * @param {Object.<string, Class>} bundle A key/value object where the key is the module name and the value is the app module class.
	 * @returns {Promise.<App~loadResults>} Promise of the load results. Will always resolve.
	 */
	loadBundle(bundle) {
		var i, modName, modNames = Object.keys(bundle);

		// Put all module classes in _moduleClass cache
		for (i = 0; i < modNames.length; i++) {
			modName = modNames[i];
			if (this._moduleClass[modName]) {
				throw new Error(`Module ${modName} already in cache. Handling not implemented yet`);
			}

			this._moduleClass[modName] = bundle[modName];
		}

		return this.loadModules(modNames);
	}

	/**
	 * Loads a set of modules, creating an instance for each if there is none, fetching the module
	 * class from the server if needed.
	 * @param {Array.<string>} moduleNames An array of module names
	 * @returns {Promise.<App~loadResults>} Promise of the load results. Will always resolve.
	 */
	loadModules(moduleNames) {
		return this._loadInstances(moduleNames)
			.then(this._toLoadResults);
	}

	/**
	 * Gets a loaded and active module.
	 * @param {string} moduleName Name of the module
	 * @returns {object} Module instance, or undefined if it is not loaded and active.
	 */
	getModule(moduleName) {
		let modInst = this._module[moduleName];
		return modInst && modInst.state == 'ready'
			? modInst.instance
			: undefined;
	}

	/**
	 * Converts an array of ModuleInstance's to an {@link App~loadResults} object.
	 * @param {Array.<ModuleInstance>} modInsts Array of ModuleInstance objects.
	 * @returns {App~loadResults} Load results object.
	 * @private
	 */
	_toLoadResults(modInsts) {
		let modules = {}, errors = null;
		for (let i = 0, modInst; (modInst = modInsts[i]); i++) {
			if (modInst.error) {
				errors = errors || {};
				errors[modInst.name] = modInst.error;
			} else {
				modules[modInst.name] = modInst.instance;
			}
		}

		return { modules, errors };
	}

	/**
	 * Deactivates a previously loaded (explicitly or implicitly through require) module,
	 * and disposes its instance. Any recursivly dependant module will also be disposed along
	 * with any implicitly loaded module with all its dependants being disposed.
	 * @param {string} moduleName Name of module to deactivate
	 */
	deactivate(moduleName) {
		let modInst = this._module[moduleName];
		if (!modInst) {
			throw new Error(`Module ${moduleName} is not loaded.`);
		}

		this._disposeInstance(modInst, 'deactivated');
	}

	/**
	 * Activates a previously deactivated module by creating a new module instance.

	 * Any other module that has been blocked loading due to being dependant upon the
	 * deactivated module, will also be loaded.
	 * @param {string} moduleName Name of module to activate.
	 * @returns {Promise.<AppModule, Error>} Promise of the app module.
	 */
	activate(moduleName) {
		let modInst = this._module[moduleName];
		if (!modInst || modInst.state !== 'deactivated') {
			throw new Error(`Module ${moduleName} is not deactivated.`);
		}

		return this._reloadInstance(modInst);
	}

	/**
	 * Reloads an instance and any module blocked by it.
	 * @param {ModuleInstance} modInst Module instance
	 * @returns {Promise.<AppModule, Error>} Promise of the app module.
	 * @private
	 */
	_reloadInstance(modInst) {
		if (modInst.state == 'ready') {
			return Promise.resolve(modInst.instance);
		}

		return this._getModuleClass(modInst.name)
			.catch(err => {
				modInst.setState('unavailable', err);
				return Promise.reject(modInst.error);
			})
			.then(modClass => {
				let params = this._getModuleParams(modInst.name);
				return this._createInstance(modInst, modClass, params, []);
			})
			.then(modInst => {
				if (modInst.error) {
					return Promise.reject(modInst.error);
				}

				// Take the blocked dependants and try to reload them
				let deps = modInst.dependants;
				let promises = [];
				modInst.dependants = [];
				for (var i = 0; i < deps.length; i++) {
					promises.push(this._reloadInstance(this._module[deps[i]]));
				}

				// Wait with resolving until all dependants have loaded.
				// Why? To allow proper testing that dependants did load.
				return Promise.all(promises)
					.then(() => modInst.instance)
					.catch(() => modInst.instance);
			});
	}

	// eslint-disable-next-line valid-jsdoc
	/**
	 * Checks if the provided module class is different from the one loaded, and if it is,
	 * disposes the previously loaded version and replace it with a new instance.

	 * If no module class is provided, update will try fetching the module class from the server.
	 * @param {string} moduleName Name of the module to update
	 * @param {Class.<AppModule>} [moduleClass] Optional module class.
	 * returns {Promise.<AppModule, Error>} Promise of the app module instance.
	 */
	update(moduleName, moduleClass = null) {
		throw new Error("Not implemented");
	}

	/**
	 * Requires an app module or a set of app modules.

	 * May only be called within an app module [constructor]{@link AppModule#constructor}.

	 * If a required module has not yet been loaded, an instance of if will be created
	 . If any of the required modules cannot be created,
	 * the returned promise will be rejected, and the module that called the require will not
	 * be loaded.

	 * If any modules that has been created during this call also calls {@link App#require}
	 * within their constructors, those require requests will be queued to be handled after
	 * all modules on the initial request has been loaded.
	 * @param {string|Array.<string>} moduleNames The name of a module, or an array of module names
	 * @param {App~requireCallback} callback Require callback on success
	 * @returns {this}
	 */
	require(moduleNames, callback) {
		// Check if call doesn't origin from module creation inside of App
		if (!this._catchRequire) {
			throw new Error("App.require may only be called from an AppModule's constructor when created by the App.");
		}

		if (moduleNames && moduleNames.length) {
			this._require = { moduleNames, callback };
		} else {
			callback({});
		}

		return this;
	}

	/**
	 * Loads a list of modules.
	 * @param {Array.<string>} modNames Array of module names to load
	 * @param {string} [loadedBy] Name of module loading the instances. Defaults to null.
	 * @returns {Promise.<Array.<ModuleInstance>>} Promise of the ModuleInstance array. Will always resolve.
	 * @private
	 */
	_loadInstances(modNames, loadedBy = null) {
		// Quick escape
		if (!modNames || !modNames.length) {
			return Promise.resolve([]);
		}

		let promises = [];
		for (let i = 0; i < modNames.length; i++) {
			promises.push(this._loadInstance(modNames[i], loadedBy));
		}

		return Promise.all(promises);
	}

	/**
	 * Loads a module instance. If the module has not been loaded previously, a new instance will
	 * be created.
	 * @param {string} modName Name of the module.
	 * @param {string} [loadedBy] Name of module loading the instance.
	 * @returns {Promise.<ModuleInstance>} A promise of the module instance. Will always resolve.
	 * @private
	 */
	_loadInstance(modName, loadedBy) {
		let checkActiveFlag = true;

		// Check if module is loading
		let modInst = this._module[modName];
		if (modInst) {
			if (modInst.state === 'passive') {
				modInst.setState('loading');
				checkActiveFlag = false;
			}
		} else {
			modInst = new ModuleInstance(modName);
			this._module[modName] = modInst;
		}

		if (loadedBy) {
			modInst.addDependant(loadedBy);
		} else {
			modInst.setExplicit();
		}

		if (!modInst.promise) {
			modInst.promise = this._getModuleClass(modName)
				.then(modClass => {
					let params = this._getModuleParams(modInst.name);

					// Check if module defaults to being deactivated
					if (checkActiveFlag && !this._isTrue(params.active)) {
						modInst.setState('deactivated');
						return modInst;
					}

					return this._createInstance(modInst, modClass, params);
				})
				.catch(err => {
					modInst.setState('unavailable', err);
					return modInst;
				});
		}

		return modInst.promise;
	}

	/**
	 * Gets a module class from the cache, or fetches it using
	 * @param {string} modName Name of the module.
	 * @returns {Promise.<Class, Error>} Promise of a AppModule class.
	 * @private
	 */
	_getModuleClass(modName) {
		// Check if module is already loaded
		let modClass = this._moduleClass[modName];
		if (modClass) {
			return Promise.resolve(modClass);
		}

		// Check if we have a callback to get it with
		if (this._moduleClassCallback) {
			// Get the class. We don't cache the promise
			// as we expect only one call per module instance
			return this._moduleClassCallback(modName)
				.then(modClass => {
					this._moduleClass[modName] = modClass;
					return modClass;
				});
		}

		return Promise.reject(new Error("No module class callback available."));
	}

	/**
	 * Tries to create an instance of a module
	 * @param {ModuleInstance} modInst Module instance object
	 * @param {Class.<AppModule>} modClass AppModule class
	 * @param {object} params Parameters to pass to modClass.
	 * @returns {Promise.<ModuleInstance>} A promise of the module instance. Will always resolve.
	 * @private
	 */
	_createInstance(modInst, modClass, params) {
		// Create new module instance
		this._catchRequire = true;
		try {
			modInst.instance = new modClass(this, params);
		} catch (ex) {
			modInst.setState('error', ex);
			return Promise.resolve(modInst);
		}
		this._catchRequire = false;

		// Quick escape if module had no dependencies
		if (!this._require) {
			modInst.setState('ready');
			return Promise.resolve(modInst);
		}

		// Store away the caught require
		let require = this._require;
		this._require = null;

		// Set requires
		modInst.setRequires(require.moduleNames);
		modInst.setState('require');

		// Check for circular dependencies
		try {
			this._checkCircularRef(modInst);
		} catch (ex) {
			modInst.setState('circularDependency', ex);
			return Promise.resolve(modInst);
		}

		// Load required modules
		return this._loadInstances(
			modInst.requires,
			modInst.name
		).then(modInsts => {
			let result = this._toLoadResults(modInsts);

			if (result.errors) {
				modInst.setState('blocked', result.errors);
				// Clean up any implicitly loaded module
				this._cleanImplicits(Object.keys(result.modules));
			} else {
				modInst.setState('ready');

				try {
					// Store error in a context that can be thrown later
					require.callback(result.modules);
				} catch (ex) {
					// Defer throwing the exception
					if (ex) {
						setTimeout(() => { throw ex; });
					}
				}
			}
			return modInst;
		});
	}

	/**
	 * Goes through a module instance's dependencies
	 * and removes itself. If a dependency is loaded implicitly
	 * and has no other dependants, it is disposed.
	 * @param {Array.<string>} modNames Module names to clean.
	 * @private
	 */
	_cleanImplicits(modNames) {
		for (let i = 0; i < modNames.length; i++) {
			var modInst = this._module[modNames[i]];
			this._cleanImplicit(modInst);
		}
	}

	/**
	 * Checks if a module instance is implicit and disposes it
	 * if it has no active dependants.
	 * @param {ModuleInstance} modInst Module instance
	 * @private
	 */
	_cleanImplicit(modInst) {
		if (modInst.explicit) return;

		let d = modInst.dependants;
		for (let i = 0; i < d.length; i++) {
			if (this._module[d[i]].isActive()) {
				return;
			}
		}

		this._disposeInstance(modInst, 'passive');
	}

	/**
	 * Disposes a module instance and all of its dependencies
	 * @param {ModuleInstance} modInst Module instance to dispose
	 * @param {string} state State reason for disposal. Must be 'blocked', 'passive', or 'deactivated'.
	 * @private
	 */
	_disposeInstance(modInst, state) {
		// Do nothing with instance if deactivated
		if (modInst.state === 'deactivated') return;

		let instance = modInst.instance;

		if (state === 'blocked') {
			let blockedBy = {};
			for (let i = 0; i < modInst.requires.length; i++) {
				let depInst = this._module[modInst.requires[i]];
				if (depInst.error) {
					blockedBy[depInst.name] = depInst.error;
				}
			}

			modInst.setState('blocked', blockedBy);
		} else {
			modInst.setState(state);
		}

		// Has the instance already been disposed?
		if (!instance) return;

		// Dispose any dependants
		for (let i = 0; i < modInst.dependants.length; i++) {
			var depName = modInst.dependants[i];
			this._disposeInstance(this._module[depName], 'blocked');
		}

		// Dispose instance
		if (instance.dispose) {
			instance.dispose();
		}

		this._cleanImplicits(modInst.requires);
	}

	/**
	 * Checks if value is true. Returns true unless the value is any of the following:

	 * * A boolean false

	 * * A string with the case-insensitive value of 'false', '0' or 'no'

	 * * A number with the value of 0

	 * @param {*} v Value
	 * @returns {boolean}
	 * @private
	 */
	_isTrue(v) {
		switch (typeof v) {
			case 'boolean': return v;
			case 'number': v = v.toString();
			case 'string':
				v = v.toLowerCase();
				if (v == 'false' || v == '0' || v == 'no') {
					return false;
				}
				break;
		}

		return true;
	}

	/**
	 * Returns module parameters based on configuration and query values for given module name
	 * @param {string} modName Name of module
	 * @returns {object} Configuration object
	 * @private
	 */
	_getModuleParams(modName) {
		// Query based params has priority over configuration provided on App creation
		return Object.assign({}, this._moduleConfig[modName], this._query[modName]);
	}

	/**
	 * Checks for circular references by traversing the require tree
	 * for all modules in 'require' state.
	 * @param {ModuleInstance} modInst Module instance to check
	 * @param {Array.<string>} [chain] Require chain
	 * @private
	 */
	_checkCircularRef(modInst, chain = []) {
		let m, req = modInst.requires;
		chain.push(modInst.name);

		if (req.indexOf(chain[0]) > -1) {
			throw chain;
		}

		for (let i = 0; i < req.length; i++) {
			m = this._module[req[i]];
			if (m && m.state === 'require') {
				this._checkCircularRef(m, chain);
			}
		}
	}
}

export default App;

redpajama_set_name: RedPajamaGithub


text:
CREATE TABLE list (id VARCHAR(2) NOT NULL, value VARCHAR(64) NOT NULL, PRIMARY KEY(id));

INSERT INTO "list" ("id", "value") VALUES (E'ab', E'abhaasi');
INSERT INTO "list" ("id", "value") VALUES (E'ada', E'adangme');
INSERT INTO "list" ("id", "value") VALUES (E'ady', E'adõgee');
INSERT INTO "list" ("id", "value") VALUES (E'aa', E'afari');
INSERT INTO "list" ("id", "value") VALUES (E'afh', E'afrihili');
INSERT INTO "list" ("id", "value") VALUES (E'af', E'afrikaani');
INSERT INTO "list" ("id", "value") VALUES (E'agq', E'aghemi');
INSERT INTO "list" ("id", "value") VALUES (E'ay', E'aimara');
INSERT INTO "list" ("id", "value") VALUES (E'ain', E'ainu');
INSERT INTO "list" ("id", "value") VALUES (E'akk', E'akadi');
INSERT INTO "list" ("id", "value") VALUES (E'ak', E'akani');
INSERT INTO "list" ("id", "value") VALUES (E'ach', E'akoli');
INSERT INTO "list" ("id", "value") VALUES (E'bss', E'akoose');
INSERT INTO "list" ("id", "value") VALUES (E'akz', E'Alabama');
INSERT INTO "list" ("id", "value") VALUES (E'nds', E'alamsaksa');
INSERT INTO "list" ("id", "value") VALUES (E'dsb', E'alamsorbi');
INSERT INTO "list" ("id", "value") VALUES (E'sq', E'albaania');
INSERT INTO "list" ("id", "value") VALUES (E'ale', E'aleuudi');
INSERT INTO "list" ("id", "value") VALUES (E'arq', E'Algerian Arabic');
INSERT INTO "list" ("id", "value") VALUES (E'alt', E'altai');
INSERT INTO "list" ("id", "value") VALUES (E'kj', E'ambo');
INSERT INTO "list" ("id", "value") VALUES (E'ase', E'American Sign Language');
INSERT INTO "list" ("id", "value") VALUES (E'am', E'amhari');
INSERT INTO "list" ("id", "value") VALUES (E'anp', E'angika');
INSERT INTO "list" ("id", "value") VALUES (E'njo', E'Ao Naga');
INSERT INTO "list" ("id", "value") VALUES (E'ar', E'araabia');
INSERT INTO "list" ("id", "value") VALUES (E'ar_001', E'araabia (tänapäevane)');
INSERT INTO "list" ("id", "value") VALUES (E'an', E'aragoni');
INSERT INTO "list" ("id", "value") VALUES (E'arc', E'aramea');
INSERT INTO "list" ("id", "value") VALUES (E'aro', E'Araona');
INSERT INTO "list" ("id", "value") VALUES (E'arp', E'arapaho');
INSERT INTO "list" ("id", "value") VALUES (E'arn', E'araukaani');
INSERT INTO "list" ("id", "value") VALUES (E'arw', E'aravaki');
INSERT INTO "list" ("id", "value") VALUES (E'hy', E'armeenia');
INSERT INTO "list" ("id", "value") VALUES (E'rup', E'aromuuni');
INSERT INTO "list" ("id", "value") VALUES (E'frp', E'Arpitan');
INSERT INTO "list" ("id", "value") VALUES (E'asa', E'asa');
INSERT INTO "list" ("id", "value") VALUES (E'az', E'aserbaidžaani');
INSERT INTO "list" ("id", "value") VALUES (E'as', E'assami');
INSERT INTO "list" ("id", "value") VALUES (E'ast', E'astuuria');
INSERT INTO "list" ("id", "value") VALUES (E'cch', E'atsami');
INSERT INTO "list" ("id", "value") VALUES (E'ace', E'atšehi');
INSERT INTO "list" ("id", "value") VALUES (E'en_AU', E'Australian English');
INSERT INTO "list" ("id", "value") VALUES (E'de_AT', E'Austrian German');
INSERT INTO "list" ("id", "value") VALUES (E'av', E'avaari');
INSERT INTO "list" ("id", "value") VALUES (E'awa', E'avadhi');
INSERT INTO "list" ("id", "value") VALUES (E'ae', E'avesta');
INSERT INTO "list" ("id", "value") VALUES (E'bfq', E'Badaga');
INSERT INTO "list" ("id", "value") VALUES (E'ksf', E'bafia');
INSERT INTO "list" ("id", "value") VALUES (E'bfd', E'bafuti');
INSERT INTO "list" ("id", "value") VALUES (E'bqi', E'Bakhtiari');
INSERT INTO "list" ("id", "value") VALUES (E'ban', E'bali');
INSERT INTO "list" ("id", "value") VALUES (E'bm', E'bambara');
INSERT INTO "list" ("id", "value") VALUES (E'bax', E'bamuni');
INSERT INTO "list" ("id", "value") VALUES (E'bjn', E'Banjar');
INSERT INTO "list" ("id", "value") VALUES (E'bas', E'basa');
INSERT INTO "list" ("id", "value") VALUES (E'eu', E'baski');
INSERT INTO "list" ("id", "value") VALUES (E'ba', E'baškiiri');
INSERT INTO "list" ("id", "value") VALUES (E'bbc', E'Batak Toba');
INSERT INTO "list" ("id", "value") VALUES (E'bar', E'Bavarian');
INSERT INTO "list" ("id", "value") VALUES (E'bej', E'bedža');
INSERT INTO "list" ("id", "value") VALUES (E'pau', E'belau');
INSERT INTO "list" ("id", "value") VALUES (E'bal', E'belutši');
INSERT INTO "list" ("id", "value") VALUES (E'bem', E'bemba');
INSERT INTO "list" ("id", "value") VALUES (E'bez', E'bena');
INSERT INTO "list" ("id", "value") VALUES (E'bn', E'bengali');
INSERT INTO "list" ("id", "value") VALUES (E'bew', E'Betawi');
INSERT INTO "list" ("id", "value") VALUES (E'bho', E'bhodžpuri');
INSERT INTO "list" ("id", "value") VALUES (E'bik', E'bikoli');
INSERT INTO "list" ("id", "value") VALUES (E'byn', E'bilini');
INSERT INTO "list" ("id", "value") VALUES (E'my', E'birma');
INSERT INTO "list" ("id", "value") VALUES (E'bpy', E'Bishnupriya');
INSERT INTO "list" ("id", "value") VALUES (E'bi', E'bislama');
INSERT INTO "list" ("id", "value") VALUES (E'zbl', E'blissümbolid');
INSERT INTO "list" ("id", "value") VALUES (E'brx', E'bodo');
INSERT INTO "list" ("id", "value") VALUES (E'bs', E'bosnia');
INSERT INTO "list" ("id", "value") VALUES (E'bra', E'bradži');
INSERT INTO "list" ("id", "value") VALUES (E'brh', E'Brahui');
INSERT INTO "list" ("id", "value") VALUES (E'pt_BR', E'Brazilian Portuguese');
INSERT INTO "list" ("id", "value") VALUES (E'br', E'bretooni');
INSERT INTO "list" ("id", "value") VALUES (E'bug', E'bugi');
INSERT INTO "list" ("id", "value") VALUES (E'bg', E'bulgaaria');
INSERT INTO "list" ("id", "value") VALUES (E'bum', E'bulu');
INSERT INTO "list" ("id", "value") VALUES (E'bua', E'burjaadi');
INSERT INTO "list" ("id", "value") VALUES (E'frc', E'Cajun French');
INSERT INTO "list" ("id", "value") VALUES (E'en_CA', E'Canadian English');
INSERT INTO "list" ("id", "value") VALUES (E'fr_CA', E'Canadian French');
INSERT INTO "list" ("id", "value") VALUES (E'cps', E'Capiznon');
INSERT INTO "list" ("id", "value") VALUES (E'cay', E'cayuga');
INSERT INTO "list" ("id", "value") VALUES (E'dtp', E'Central Dusun');
INSERT INTO "list" ("id", "value") VALUES (E'esu', E'Central Yupik');
INSERT INTO "list" ("id", "value") VALUES (E'cgg', E'chiga');
INSERT INTO "list" ("id", "value") VALUES (E'qug', E'Chimborazo Highland Quichua');
INSERT INTO "list" ("id", "value") VALUES (E'ksh', E'cologniani');
INSERT INTO "list" ("id", "value") VALUES (E'dar', E'dargi');
INSERT INTO "list" ("id", "value") VALUES (E'dzg', E'dazaga');
INSERT INTO "list" ("id", "value") VALUES (E'del', E'delavari');
INSERT INTO "list" ("id", "value") VALUES (E'din', E'dinka');
INSERT INTO "list" ("id", "value") VALUES (E'dyu', E'djula');
INSERT INTO "list" ("id", "value") VALUES (E'doi', E'dogri');
INSERT INTO "list" ("id", "value") VALUES (E'dgr', E'dogribi');
INSERT INTO "list" ("id", "value") VALUES (E'dz', E'dzongkha');
INSERT INTO "list" ("id", "value") VALUES (E'dua', E'duala');
INSERT INTO "list" ("id", "value") VALUES (E'bin', E'edo');
INSERT INTO "list" ("id", "value") VALUES (E'elx', E'eelami');
INSERT INTO "list" ("id", "value") VALUES (E'et', E'eesti');
INSERT INTO "list" ("id", "value") VALUES (E'efi', E'efiki');
INSERT INTO "list" ("id", "value") VALUES (E'arz', E'Egyptian Arabic');
INSERT INTO "list" ("id", "value") VALUES (E'eka', E'ekadžuki');
INSERT INTO "list" ("id", "value") VALUES (E'ebu', E'embu');
INSERT INTO "list" ("id", "value") VALUES (E'egl', E'Emilian');
INSERT INTO "list" ("id", "value") VALUES (E'myv', E'ersa');
INSERT INTO "list" ("id", "value") VALUES (E'eo', E'esperanto');
INSERT INTO "list" ("id", "value") VALUES (E'gez', E'etioopia');
INSERT INTO "list" ("id", "value") VALUES (E'ee', E'eve');
INSERT INTO "list" ("id", "value") VALUES (E'ewo', E'evondo');
INSERT INTO "list" ("id", "value") VALUES (E'ext', E'Extremaduran');
INSERT INTO "list" ("id", "value") VALUES (E'fan', E'fangi');
INSERT INTO "list" ("id", "value") VALUES (E'fat', E'fanti');
INSERT INTO "list" ("id", "value") VALUES (E'fj', E'fidži');
INSERT INTO "list" ("id", "value") VALUES (E'hif', E'Fiji Hindi');
INSERT INTO "list" ("id", "value") VALUES (E'fil', E'filipino');
INSERT INTO "list" ("id", "value") VALUES (E'nl_BE', E'flaami');
INSERT INTO "list" ("id", "value") VALUES (E'phn', E'foiniikia');
INSERT INTO "list" ("id", "value") VALUES (E'fon', E'foni');
INSERT INTO "list" ("id", "value") VALUES (E'gur', E'Frafra');
INSERT INTO "list" ("id", "value") VALUES (E'fur', E'friuuli');
INSERT INTO "list" ("id", "value") VALUES (E'ff', E'fulbe');
INSERT INTO "list" ("id", "value") VALUES (E'fo', E'fääri');
INSERT INTO "list" ("id", "value") VALUES (E'gaa', E'gaa');
INSERT INTO "list" ("id", "value") VALUES (E'gd', E'gaeli');
INSERT INTO "list" ("id", "value") VALUES (E'gag', E'gagauusi');
INSERT INTO "list" ("id", "value") VALUES (E'gay', E'gajo');
INSERT INTO "list" ("id", "value") VALUES (E'gl', E'galeegi');
INSERT INTO "list" ("id", "value") VALUES (E'gan', E'Gan Chinese');
INSERT INTO "list" ("id", "value") VALUES (E'lg', E'ganda');
INSERT INTO "list" ("id", "value") VALUES (E'gba', E'gbaja');
INSERT INTO "list" ("id", "value") VALUES (E'aln', E'Gheg Albanian');
INSERT INTO "list" ("id", "value") VALUES (E'bbj', E'ghomala');
INSERT INTO "list" ("id", "value") VALUES (E'glk', E'Gilaki');
INSERT INTO "list" ("id", "value") VALUES (E'gom', E'Goan Konkani');
INSERT INTO "list" ("id", "value") VALUES (E'gon', E'gondi');
INSERT INTO "list" ("id", "value") VALUES (E'got', E'gooti');
INSERT INTO "list" ("id", "value") VALUES (E'gor', E'gorontalo');
INSERT INTO "list" ("id", "value") VALUES (E'grb', E'grebo');
INSERT INTO "list" ("id", "value") VALUES (E'ka', E'gruusia');
INSERT INTO "list" ("id", "value") VALUES (E'kl', E'grööni');
INSERT INTO "list" ("id", "value") VALUES (E'gn', E'guaranii');
INSERT INTO "list" ("id", "value") VALUES (E'gu', E'gudžarati');
INSERT INTO "list" ("id", "value") VALUES (E'guz', E'gusii');
INSERT INTO "list" ("id", "value") VALUES (E'gwi', E'gvitšini');
INSERT INTO "list" ("id", "value") VALUES (E'hai', E'haida');
INSERT INTO "list" ("id", "value") VALUES (E'ht', E'haiti');
INSERT INTO "list" ("id", "value") VALUES (E'hak', E'Hakka Chinese');
INSERT INTO "list" ("id", "value") VALUES (E'ha', E'hausa');
INSERT INTO "list" ("id", "value") VALUES (E'haw', E'havai');
INSERT INTO "list" ("id", "value") VALUES (E'he', E'heebrea');
INSERT INTO "list" ("id", "value") VALUES (E'hz', E'herero');
INSERT INTO "list" ("id", "value") VALUES (E'hit', E'heti');
INSERT INTO "list" ("id", "value") VALUES (E'zh', E'hiina');
INSERT INTO "list" ("id", "value") VALUES (E'zh_Hans', E'hiina (lihtsustatud)');
INSERT INTO "list" ("id", "value") VALUES (E'zh_Hant', E'hiina (traditsiooniline)');
INSERT INTO "list" ("id", "value") VALUES (E'hil', E'hiligainoni');
INSERT INTO "list" ("id", "value") VALUES (E'hi', E'hindi');
INSERT INTO "list" ("id", "value") VALUES (E'es', E'hispaania');
INSERT INTO "list" ("id", "value") VALUES (E'es_ES', E'hispaania (Euroopa)');
INSERT INTO "list" ("id", "value") VALUES (E'hmn', E'hmongi');
INSERT INTO "list" ("id", "value") VALUES (E'nl', E'hollandi');
INSERT INTO "list" ("id", "value") VALUES (E'hr', E'horvaadi');
INSERT INTO "list" ("id", "value") VALUES (E'hup', E'hupa');
INSERT INTO "list" ("id", "value") VALUES (E'iba', E'ibani');
INSERT INTO "list" ("id", "value") VALUES (E'ibb', E'ibibio');
INSERT INTO "list" ("id", "value") VALUES (E'ig', E'ibo');
INSERT INTO "list" ("id", "value") VALUES (E'frs', E'idafriisi');
INSERT INTO "list" ("id", "value") VALUES (E'io', E'ido');
INSERT INTO "list" ("id", "value") VALUES (E'ga', E'iiri');
INSERT INTO "list" ("id", "value") VALUES (E'ilo', E'iloko');
INSERT INTO "list" ("id", "value") VALUES (E'smn', E'inari saami');
INSERT INTO "list" ("id", "value") VALUES (E'id', E'indoneesia');
INSERT INTO "list" ("id", "value") VALUES (E'en', E'inglise');
INSERT INTO "list" ("id", "value") VALUES (E'en_GB', E'inglise (Briti)');
INSERT INTO "list" ("id", "value") VALUES (E'en_US', E'inglise (USA)');
INSERT INTO "list" ("id", "value") VALUES (E'izh', E'Ingrian');
INSERT INTO "list" ("id", "value") VALUES (E'inh', E'inguši');
INSERT INTO "list" ("id", "value") VALUES (E'ik', E'injupiaki');
INSERT INTO "list" ("id", "value") VALUES (E'ia', E'interlingua');
INSERT INTO "list" ("id", "value") VALUES (E'ie', E'interlingue');
INSERT INTO "list" ("id", "value") VALUES (E'iu', E'inuktituti');
INSERT INTO "list" ("id", "value") VALUES (E'is', E'islandi');
INSERT INTO "list" ("id", "value") VALUES (E'it', E'itaalia');
INSERT INTO "list" ("id", "value") VALUES (E'bkm', E'itaŋikomi');
INSERT INTO "list" ("id", "value") VALUES (E'ja', E'jaapani');
INSERT INTO "list" ("id", "value") VALUES (E'jv', E'jaava');
INSERT INTO "list" ("id", "value") VALUES (E'sah', E'jakuudi');
INSERT INTO "list" ("id", "value") VALUES (E'jam', E'Jamaican Creole English');
INSERT INTO "list" ("id", "value") VALUES (E'yao', E'jao');
INSERT INTO "list" ("id", "value") VALUES (E'yap', E'japi');
INSERT INTO "list" ("id", "value") VALUES (E'yi', E'jidiši');
INSERT INTO "list" ("id", "value") VALUES (E'kaj', E'jju');
INSERT INTO "list" ("id", "value") VALUES (E'dyo', E'jola-fonyi');
INSERT INTO "list" ("id", "value") VALUES (E'yo', E'joruba');
INSERT INTO "list" ("id", "value") VALUES (E'jut', E'Jutish');
INSERT INTO "list" ("id", "value") VALUES (E'jrb', E'juudiaraabia');
INSERT INTO "list" ("id", "value") VALUES (E'jpr', E'juudipärsia');
INSERT INTO "list" ("id", "value") VALUES (E'quc', E'k'iche'');
INSERT INTO "list" ("id", "value") VALUES (E'kaw', E'kaavi');
INSERT INTO "list" ("id", "value") VALUES (E'kbd', E'kabardi-tšerkessi');
INSERT INTO "list" ("id", "value") VALUES (E'kab', E'kabiili');
INSERT INTO "list" ("id", "value") VALUES (E'kea', E'kabuverdianu');
INSERT INTO "list" ("id", "value") VALUES (E'cad', E'kado');
INSERT INTO "list" ("id", "value") VALUES (E'kgp', E'Kaingang');
INSERT INTO "list" ("id", "value") VALUES (E'kkj', E'kako');
INSERT INTO "list" ("id", "value") VALUES (E'kln', E'kaljenjin');
INSERT INTO "list" ("id", "value") VALUES (E'xal', E'kalmõki');
INSERT INTO "list" ("id", "value") VALUES (E'kam', E'kamba');
INSERT INTO "list" ("id", "value") VALUES (E'kbl', E'kanembu');
INSERT INTO "list" ("id", "value") VALUES (E'kn', E'kannada');
INSERT INTO "list" ("id", "value") VALUES (E'yue', E'kantoni');
INSERT INTO "list" ("id", "value") VALUES (E'kr', E'kanuri');
INSERT INTO "list" ("id", "value") VALUES (E'kaa', E'karakalpaki');
INSERT INTO "list" ("id", "value") VALUES (E'krc', E'karatšai-balkaari');
INSERT INTO "list" ("id", "value") VALUES (E'car', E'kariibi');
INSERT INTO "list" ("id", "value") VALUES (E'krl', E'karjala');
INSERT INTO "list" ("id", "value") VALUES (E'kk', E'kasahhi');
INSERT INTO "list" ("id", "value") VALUES (E'ks', E'kašmiiri');
INSERT INTO "list" ("id", "value") VALUES (E'csb', E'kašuubi');
INSERT INTO "list" ("id", "value") VALUES (E'ca', E'katalaani');
INSERT INTO "list" ("id", "value") VALUES (E'kac', E'katšini');
INSERT INTO "list" ("id", "value") VALUES (E'ken', E'Kenyang');
INSERT INTO "list" ("id", "value") VALUES (E'tzm', E'Kesk-Maroko tamazighti');
INSERT INTO "list" ("id", "value") VALUES (E'dum', E'keskhollandi');
INSERT INTO "list" ("id", "value") VALUES (E'mga', E'keskiiri');
INSERT INTO "list" ("id", "value") VALUES (E'enm', E'keskinglise');
INSERT INTO "list" ("id", "value") VALUES (E'frm', E'keskprantsuse');
INSERT INTO "list" ("id", "value") VALUES (E'gmh', E'keskülemsaksa');
INSERT INTO "list" ("id", "value") VALUES (E'qu', E'ketšua');
INSERT INTO "list" ("id", "value") VALUES (E'kha', E'khasi');
INSERT INTO "list" ("id", "value") VALUES (E'km', E'khmeeri');
INSERT INTO "list" ("id", "value") VALUES (E'khw', E'Khowar');
INSERT INTO "list" ("id", "value") VALUES (E'ki', E'kikuju');
INSERT INTO "list" ("id", "value") VALUES (E'krj', E'Kinaray-a');
INSERT INTO "list" ("id", "value") VALUES (E'ky', E'kirgiisi');
INSERT INTO "list" ("id", "value") VALUES (E'gil', E'kiribati');
INSERT INTO "list" ("id", "value") VALUES (E'cu', E'kirikuslaavi');
INSERT INTO "list" ("id", "value") VALUES (E'kiu', E'Kirmanjki');
INSERT INTO "list" ("id", "value") VALUES (E'syc', E'klassikaline süüria');
INSERT INTO "list" ("id", "value") VALUES (E'tlh', E'klingoni');
INSERT INTO "list" ("id", "value") VALUES (E'sms', E'koltasaami');
INSERT INTO "list" ("id", "value") VALUES (E'kv', E'komi');
INSERT INTO "list" ("id", "value") VALUES (E'swb', E'komoori');
INSERT INTO "list" ("id", "value") VALUES (E'kg', E'kongo');
INSERT INTO "list" ("id", "value") VALUES (E'swc', E'Kongo suahiili');
INSERT INTO "list" ("id", "value") VALUES (E'kok', E'konkani');
INSERT INTO "list" ("id", "value") VALUES (E'xh', E'koosa');
INSERT INTO "list" ("id", "value") VALUES (E'cop', E'kopti');
INSERT INTO "list" ("id", "value") VALUES (E'ko', E'korea');
INSERT INTO "list" ("id", "value") VALUES (E'kw', E'korni');
INSERT INTO "list" ("id", "value") VALUES (E'kfo', E'koro');
INSERT INTO "list" ("id", "value") VALUES (E'co', E'korsika');
INSERT INTO "list" ("id", "value") VALUES (E'kos', E'kosrae');
INSERT INTO "list" ("id", "value") VALUES (E'avk', E'Kotava');
INSERT INTO "list" ("id", "value") VALUES (E'khq', E'koyra chiini');
INSERT INTO "list" ("id", "value") VALUES (E'ses', E'koyraboro senni');
INSERT INTO "list" ("id", "value") VALUES (E'kpe', E'kpelle');
INSERT INTO "list" ("id", "value") VALUES (E'el', E'kreeka');
INSERT INTO "list" ("id", "value") VALUES (E'cr', E'krii');
INSERT INTO "list" ("id", "value") VALUES (E'crh', E'krimmitatari');
INSERT INTO "list" ("id", "value") VALUES (E'kri', E'Krio');
INSERT INTO "list" ("id", "value") VALUES (E'kum', E'kumõki');
INSERT INTO "list" ("id", "value") VALUES (E'ku', E'kurdi');
INSERT INTO "list" ("id", "value") VALUES (E'kut', E'kutenai');
INSERT INTO "list" ("id", "value") VALUES (E'nmg', E'kwasio');
INSERT INTO "list" ("id", "value") VALUES (E'cy', E'kõmri');
INSERT INTO "list" ("id", "value") VALUES (E'lad', E'ladiino');
INSERT INTO "list" ("id", "value") VALUES (E'la', E'ladina');
INSERT INTO "list" ("id", "value") VALUES (E'lah', E'lahnda');
INSERT INTO "list" ("id", "value") VALUES (E'lkt', E'lakota');
INSERT INTO "list" ("id", "value") VALUES (E'lam', E'lamba');
INSERT INTO "list" ("id", "value") VALUES (E'lag', E'langi');
INSERT INTO "list" ("id", "value") VALUES (E'lo', E'lao');
INSERT INTO "list" ("id", "value") VALUES (E'lzz', E'Laz');
INSERT INTO "list" ("id", "value") VALUES (E'ltg', E'Latgalian');
INSERT INTO "list" ("id", "value") VALUES (E'es_419', E'Latin American Spanish');
INSERT INTO "list" ("id", "value") VALUES (E'lt', E'leedu');
INSERT INTO "list" ("id", "value") VALUES (E'lez', E'lesgi');
INSERT INTO "list" ("id", "value") VALUES (E'lb', E'letseburgi');
INSERT INTO "list" ("id", "value") VALUES (E'lij', E'Ligurian');
INSERT INTO "list" ("id", "value") VALUES (E'li', E'limburgi');
INSERT INTO "list" ("id", "value") VALUES (E'ln', E'lingala');
INSERT INTO "list" ("id", "value") VALUES (E'lfn', E'Lingua Franca Nova');
INSERT INTO "list" ("id", "value") VALUES (E'lzh', E'Literary Chinese');
INSERT INTO "list" ("id", "value") VALUES (E'liv', E'Livonian');
INSERT INTO "list" ("id", "value") VALUES (E'jbo', E'lojbani');
INSERT INTO "list" ("id", "value") VALUES (E'lmo', E'Lombard');
INSERT INTO "list" ("id", "value") VALUES (E'loz', E'lozi');
INSERT INTO "list" ("id", "value") VALUES (E'sli', E'Lower Silesian');
INSERT INTO "list" ("id", "value") VALUES (E'lu', E'luba');
INSERT INTO "list" ("id", "value") VALUES (E'lua', E'luba-lulua');
INSERT INTO "list" ("id", "value") VALUES (E'lui', E'luisenjo');
INSERT INTO "list" ("id", "value") VALUES (E'smj', E'lule saami');
INSERT INTO "list" ("id", "value") VALUES (E'lun', E'lunda');
INSERT INTO "list" ("id", "value") VALUES (E'luo', E'luo');
INSERT INTO "list" ("id", "value") VALUES (E'lus', E'lušei');
INSERT INTO "list" ("id", "value") VALUES (E'luy', E'luyia');
INSERT INTO "list" ("id", "value") VALUES (E'nr', E'lõunandebele');
INSERT INTO "list" ("id", "value") VALUES (E'sma', E'lõunasaami');
INSERT INTO "list" ("id", "value") VALUES (E'st', E'lõunasotho');
INSERT INTO "list" ("id", "value") VALUES (E'lv', E'läti');
INSERT INTO "list" ("id", "value") VALUES (E'fy', E'läänefriisi');
INSERT INTO "list" ("id", "value") VALUES (E'mde', E'maba');
INSERT INTO "list" ("id", "value") VALUES (E'jmc', E'machame');
INSERT INTO "list" ("id", "value") VALUES (E'mad', E'madura');
INSERT INTO "list" ("id", "value") VALUES (E'maf', E'mafa');
INSERT INTO "list" ("id", "value") VALUES (E'mag', E'magali');
INSERT INTO "list" ("id", "value") VALUES (E'vmf', E'Main-Franconian');
INSERT INTO "list" ("id", "value") VALUES (E'mai', E'maithili');
INSERT INTO "list" ("id", "value") VALUES (E'mak', E'makassari');
INSERT INTO "list" ("id", "value") VALUES (E'mk', E'makedoonia');
INSERT INTO "list" ("id", "value") VALUES (E'mgh', E'makhuwa-meetto');
INSERT INTO "list" ("id", "value") VALUES (E'kde', E'makonde');
INSERT INTO "list" ("id", "value") VALUES (E'mg', E'malagassi');
INSERT INTO "list" ("id", "value") VALUES (E'ms', E'malai');
INSERT INTO "list" ("id", "value") VALUES (E'ml', E'malajalami');
INSERT INTO "list" ("id", "value") VALUES (E'dv', E'maldiivi');
INSERT INTO "list" ("id", "value") VALUES (E'man', E'malinke');
INSERT INTO "list" ("id", "value") VALUES (E'mt', E'malta');
INSERT INTO "list" ("id", "value") VALUES (E'mdr', E'mandari');
INSERT INTO "list" ("id", "value") VALUES (E'mnc', E'mandžu');
INSERT INTO "list" ("id", "value") VALUES (E'mni', E'manipuri');
INSERT INTO "list" ("id", "value") VALUES (E'mi', E'maoori');
INSERT INTO "list" ("id", "value") VALUES (E'mr', E'marathi');
INSERT INTO "list" ("id", "value") VALUES (E'chm', E'mari');
INSERT INTO "list" ("id", "value") VALUES (E'mh', E'maršalli');
INSERT INTO "list" ("id", "value") VALUES (E'mwr', E'marvari');
INSERT INTO "list" ("id", "value") VALUES (E'mas', E'masai');
INSERT INTO "list" ("id", "value") VALUES (E'mus', E'maskogi');
INSERT INTO "list" ("id", "value") VALUES (E'mzn', E'Mazanderani');
INSERT INTO "list" ("id", "value") VALUES (E'mfe', E'Mauritiuse kreoolkeel');
INSERT INTO "list" ("id", "value") VALUES (E'kmb', E'mbundu');
INSERT INTO "list" ("id", "value") VALUES (E'byv', E'medumba');
INSERT INTO "list" ("id", "value") VALUES (E'men', E'mende');
INSERT INTO "list" ("id", "value") VALUES (E'mwv', E'Mentawai');
INSERT INTO "list" ("id", "value") VALUES (E'mer', E'meru');
INSERT INTO "list" ("id", "value") VALUES (E'mgo', E'meta'');
INSERT INTO "list" ("id", "value") VALUES (E'es_MX', E'Mexican Spanish');
INSERT INTO "list" ("id", "value") VALUES (E'mic', E'mikmaki');
INSERT INTO "list" ("id", "value") VALUES (E'nan', E'Min Nan Chinese');
INSERT INTO "list" ("id", "value") VALUES (E'min', E'minangkabau');
INSERT INTO "list" ("id", "value") VALUES (E'xmf', E'Mingrelian');
INSERT INTO "list" ("id", "value") VALUES (E'mwl', E'miranda');
INSERT INTO "list" ("id", "value") VALUES (E'zxx', E'mittekeeleline');
INSERT INTO "list" ("id", "value") VALUES (E'mul', E'mitu keelt');
INSERT INTO "list" ("id", "value") VALUES (E'moh', E'mohoogi');
INSERT INTO "list" ("id", "value") VALUES (E'mdf', E'mokša');
INSERT INTO "list" ("id", "value") VALUES (E'ro_MD', E'moldova');
INSERT INTO "list" ("id", "value") VALUES (E'lol', E'mongo');
INSERT INTO "list" ("id", "value") VALUES (E'mn', E'mongoli');
INSERT INTO "list" ("id", "value") VALUES (E'mos', E'more');
INSERT INTO "list" ("id", "value") VALUES (E'ary', E'Moroccan Arabic');
INSERT INTO "list" ("id", "value") VALUES (E'ho', E'motu');
INSERT INTO "list" ("id", "value") VALUES (E'egy', E'muinasegiptuse');
INSERT INTO "list" ("id", "value") VALUES (E'mua', E'mundangi');
INSERT INTO "list" ("id", "value") VALUES (E'ttt', E'Muslim Tat');
INSERT INTO "list" ("id", "value") VALUES (E'rom', E'mustlaskeel');
INSERT INTO "list" ("id", "value") VALUES (E'gv', E'mänksi');
INSERT INTO "list" ("id", "value") VALUES (E'und', E'määramata');
INSERT INTO "list" ("id", "value") VALUES (E'mye', E'myene');
INSERT INTO "list" ("id", "value") VALUES (E'naq', E'nama');
INSERT INTO "list" ("id", "value") VALUES (E'nap', E'napoli');
INSERT INTO "list" ("id", "value") VALUES (E'na', E'nauru');
INSERT INTO "list" ("id", "value") VALUES (E'nv', E'navaho');
INSERT INTO "list" ("id", "value") VALUES (E'ng', E'ndonga');
INSERT INTO "list" ("id", "value") VALUES (E'ne', E'nepali');
INSERT INTO "list" ("id", "value") VALUES (E'new', E'nevari');
INSERT INTO "list" ("id", "value") VALUES (E'sba', E'ngembay');
INSERT INTO "list" ("id", "value") VALUES (E'nnh', E'ngiembooni');
INSERT INTO "list" ("id", "value") VALUES (E'jgo', E'ngomba');
INSERT INTO "list" ("id", "value") VALUES (E'yrl', E'Nheengatu');
INSERT INTO "list" ("id", "value") VALUES (E'nia', E'niasi');
INSERT INTO "list" ("id", "value") VALUES (E'niu', E'niue');
INSERT INTO "list" ("id", "value") VALUES (E'nym', E'njamvesi');
INSERT INTO "list" ("id", "value") VALUES (E'ny', E'njandža');
INSERT INTO "list" ("id", "value") VALUES (E'nyo', E'njoro');
INSERT INTO "list" ("id", "value") VALUES (E'nyn', E'nkole');
INSERT INTO "list" ("id", "value") VALUES (E'nqo', E'nkoo');
INSERT INTO "list" ("id", "value") VALUES (E'nog', E'nogai');
INSERT INTO "list" ("id", "value") VALUES (E'no', E'norra');
INSERT INTO "list" ("id", "value") VALUES (E'nb', E'norra bokmål');
INSERT INTO "list" ("id", "value") VALUES (E'nn', E'norra nynorsk');
INSERT INTO "list" ("id", "value") VALUES (E'nov', E'Novial');
INSERT INTO "list" ("id", "value") VALUES (E'nzi', E'nzima');
INSERT INTO "list" ("id", "value") VALUES (E'nus', E'nueri');
INSERT INTO "list" ("id", "value") VALUES (E'oj', E'odžibvei');
INSERT INTO "list" ("id", "value") VALUES (E'kru', E'oraoni');
INSERT INTO "list" ("id", "value") VALUES (E'or', E'oria');
INSERT INTO "list" ("id", "value") VALUES (E'om', E'oromo');
INSERT INTO "list" ("id", "value") VALUES (E'osa', E'oseidži');
INSERT INTO "list" ("id", "value") VALUES (E'ota', E'osmanitürgi');
INSERT INTO "list" ("id", "value") VALUES (E'os', E'osseedi');
INSERT INTO "list" ("id", "value") VALUES (E'pi', E'paali');
INSERT INTO "list" ("id", "value") VALUES (E'pal', E'pahlavi');
INSERT INTO "list" ("id", "value") VALUES (E'pfl', E'Palatine German');
INSERT INTO "list" ("id", "value") VALUES (E'pam', E'pampanga');
INSERT INTO "list" ("id", "value") VALUES (E'pa', E'pandžabi');
INSERT INTO "list" ("id", "value") VALUES (E'pag', E'pangasinani');
INSERT INTO "list" ("id", "value") VALUES (E'pap', E'papiamento');
INSERT INTO "list" ("id", "value") VALUES (E'nso', E'pedi');
INSERT INTO "list" ("id", "value") VALUES (E'pdc', E'Pennsylvania German');
INSERT INTO "list" ("id", "value") VALUES (E'koi', E'permikomi');
INSERT INTO "list" ("id", "value") VALUES (E'pcd', E'Picard');
INSERT INTO "list" ("id", "value") VALUES (E'pms', E'Piedmontese');
INSERT INTO "list" ("id", "value") VALUES (E'pdt', E'Plautdietsch');
INSERT INTO "list" ("id", "value") VALUES (E'pnt', E'Pontic');
INSERT INTO "list" ("id", "value") VALUES (E'pl', E'poola');
INSERT INTO "list" ("id", "value") VALUES (E'pon', E'poonpei');
INSERT INTO "list" ("id", "value") VALUES (E'pt', E'portugali');
INSERT INTO "list" ("id", "value") VALUES (E'pt_PT', E'portugali (Euroopa)');
INSERT INTO "list" ("id", "value") VALUES (E'fr', E'prantsuse');
INSERT INTO "list" ("id", "value") VALUES (E'oc', E'provansi');
INSERT INTO "list" ("id", "value") VALUES (E'prg', E'Prussian');
INSERT INTO "list" ("id", "value") VALUES (E'ps', E'puštu');
INSERT INTO "list" ("id", "value") VALUES (E'frr', E'põhjafriisi');
INSERT INTO "list" ("id", "value") VALUES (E'nd', E'põhjandebele');
INSERT INTO "list" ("id", "value") VALUES (E'se', E'põhjasaami');
INSERT INTO "list" ("id", "value") VALUES (E'fa', E'pärsia');
INSERT INTO "list" ("id", "value") VALUES (E'raj', E'radžastani');
INSERT INTO "list" ("id", "value") VALUES (E'rap', E'rapanui');
INSERT INTO "list" ("id", "value") VALUES (E'rar', E'rarotonga');
INSERT INTO "list" ("id", "value") VALUES (E'rm', E'retoromaani');
INSERT INTO "list" ("id", "value") VALUES (E'rif', E'Riffian');
INSERT INTO "list" ("id", "value") VALUES (E'rgn', E'Romagnol');
INSERT INTO "list" ("id", "value") VALUES (E'rof', E'rombo');
INSERT INTO "list" ("id", "value") VALUES (E'root', E'root');
INSERT INTO "list" ("id", "value") VALUES (E'sv', E'rootsi');
INSERT INTO "list" ("id", "value") VALUES (E'rtm', E'Rotuman');
INSERT INTO "list" ("id", "value") VALUES (E'rug', E'Roviana');
INSERT INTO "list" ("id", "value") VALUES (E'rw', E'ruanda');
INSERT INTO "list" ("id", "value") VALUES (E'ro', E'rumeenia');
INSERT INTO "list" ("id", "value") VALUES (E'rn', E'rundi');
INSERT INTO "list" ("id", "value") VALUES (E'rue', E'Rusyn');
INSERT INTO "list" ("id", "value") VALUES (E'rwk', E'rwa');
INSERT INTO "list" ("id", "value") VALUES (E'ssy', E'saho');
INSERT INTO "list" ("id", "value") VALUES (E'kho', E'saki');
INSERT INTO "list" ("id", "value") VALUES (E'de', E'saksa');
INSERT INTO "list" ("id", "value") VALUES (E'de_CH', E'saksa (kõrgsaksa)');
INSERT INTO "list" ("id", "value") VALUES (E'sam', E'samaaria aramea');
INSERT INTO "list" ("id", "value") VALUES (E'saq', E'samburu');
INSERT INTO "list" ("id", "value") VALUES (E'sm', E'samoa');
INSERT INTO "list" ("id", "value") VALUES (E'sgs', E'Samogitian');
INSERT INTO "list" ("id", "value") VALUES (E'sad', E'sandave');
INSERT INTO "list" ("id", "value") VALUES (E'sg', E'sango');
INSERT INTO "list" ("id", "value") VALUES (E'sbp', E'sangu');
INSERT INTO "list" ("id", "value") VALUES (E'sa', E'sanskriti');
INSERT INTO "list" ("id", "value") VALUES (E'sat', E'santali');
INSERT INTO "list" ("id", "value") VALUES (E'zap', E'sapoteegi');
INSERT INTO "list" ("id", "value") VALUES (E'sc', E'sardiinia');
INSERT INTO "list" ("id", "value") VALUES (E'sas', E'sasaki');
INSERT INTO "list" ("id", "value") VALUES (E'sdc', E'Sassarese Sardinian');
INSERT INTO "list" ("id", "value") VALUES (E'stq', E'Saterland Frisian');
INSERT INTO "list" ("id", "value") VALUES (E'saz', E'Saurashtra');
INSERT INTO "list" ("id", "value") VALUES (E'ceb', E'sebu');
INSERT INTO "list" ("id", "value") VALUES (E'sly', E'Selayar');
INSERT INTO "list" ("id", "value") VALUES (E'seh', E'sena');
INSERT INTO "list" ("id", "value") VALUES (E'see', E'seneca');
INSERT INTO "list" ("id", "value") VALUES (E'sr', E'serbia');
INSERT INTO "list" ("id", "value") VALUES (E'sh', E'serbia-horvaadi');
INSERT INTO "list" ("id", "value") VALUES (E'srr', E'sereri');
INSERT INTO "list" ("id", "value") VALUES (E'sei', E'Seri');
INSERT INTO "list" ("id", "value") VALUES (E'ksb', E'shambala');
INSERT INTO "list" ("id", "value") VALUES (E'ii', E'sichuani jii');
INSERT INTO "list" ("id", "value") VALUES (E'sid', E'sidamo');
INSERT INTO "list" ("id", "value") VALUES (E'bla', E'siksika');
INSERT INTO "list" ("id", "value") VALUES (E'szl', E'Silesian');
INSERT INTO "list" ("id", "value") VALUES (E'sd', E'sindhi');
INSERT INTO "list" ("id", "value") VALUES (E'si', E'singali');
INSERT INTO "list" ("id", "value") VALUES (E'scn', E'sitsiilia');
INSERT INTO "list" ("id", "value") VALUES (E'dak', E'siuu');
INSERT INTO "list" ("id", "value") VALUES (E'den', E'sleivi');
INSERT INTO "list" ("id", "value") VALUES (E'sk', E'slovaki');
INSERT INTO "list" ("id", "value") VALUES (E'sl', E'sloveeni');
INSERT INTO "list" ("id", "value") VALUES (E'xog', E'soga');
INSERT INTO "list" ("id", "value") VALUES (E'sog', E'sogdi');
INSERT INTO "list" ("id", "value") VALUES (E'so', E'somaali');
INSERT INTO "list" ("id", "value") VALUES (E'snk', E'soninke');
INSERT INTO "list" ("id", "value") VALUES (E'fi', E'soome');
INSERT INTO "list" ("id", "value") VALUES (E'ckb', E'sorani kurdi');
INSERT INTO "list" ("id", "value") VALUES (E'azb', E'South Azerbaijani');
INSERT INTO "list" ("id", "value") VALUES (E'srn', E'sranani');
INSERT INTO "list" ("id", "value") VALUES (E'sw', E'suahiili');
INSERT INTO "list" ("id", "value") VALUES (E'suk', E'sukuma');
INSERT INTO "list" ("id", "value") VALUES (E'sux', E'sumeri');
INSERT INTO "list" ("id", "value") VALUES (E'su', E'sunda');
INSERT INTO "list" ("id", "value") VALUES (E'zun', E'sunji');
INSERT INTO "list" ("id", "value") VALUES (E'sus', E'susu');
INSERT INTO "list" ("id", "value") VALUES (E'zu', E'suulu');
INSERT INTO "list" ("id", "value") VALUES (E'ss', E'svaasi');
INSERT INTO "list" ("id", "value") VALUES (E'fr_CH', E'Swiss French');
INSERT INTO "list" ("id", "value") VALUES (E'sel', E'sölkupi');
INSERT INTO "list" ("id", "value") VALUES (E'syr', E'süüria');
INSERT INTO "list" ("id", "value") VALUES (E'chy', E'šaieeni');
INSERT INTO "list" ("id", "value") VALUES (E'shn', E'šani');
INSERT INTO "list" ("id", "value") VALUES (E'sn', E'šona');
INSERT INTO "list" ("id", "value") VALUES (E'sco', E'šoti');
INSERT INTO "list" ("id", "value") VALUES (E'gsw', E'šveitsisaksa');
INSERT INTO "list" ("id", "value") VALUES (E'dje', E'zarma');
INSERT INTO "list" ("id", "value") VALUES (E'zza', E'zaza');
INSERT INTO "list" ("id", "value") VALUES (E'zea', E'Zeelandic');
INSERT INTO "list" ("id", "value") VALUES (E'zen', E'zenaga');
INSERT INTO "list" ("id", "value") VALUES (E'gbz', E'Zoroastrian Dari');
INSERT INTO "list" ("id", "value") VALUES (E'da', E'taani');
INSERT INTO "list" ("id", "value") VALUES (E'shi', E'tachelhiti');
INSERT INTO "list" ("id", "value") VALUES (E'tg', E'tadžiki');
INSERT INTO "list" ("id", "value") VALUES (E'tl', E'tagalogi');
INSERT INTO "list" ("id", "value") VALUES (E'ty', E'tahiti');
INSERT INTO "list" ("id", "value") VALUES (E'th', E'tai');
INSERT INTO "list" ("id", "value") VALUES (E'dav', E'taita');
INSERT INTO "list" ("id", "value") VALUES (E'tly', E'Talysh');
INSERT INTO "list" ("id", "value") VALUES (E'zgh', E'tamasikti (Maroko)');
INSERT INTO "list" ("id", "value") VALUES (E'tmh', E'tamašeki');
INSERT INTO "list" ("id", "value") VALUES (E'ta', E'tamili');
INSERT INTO "list" ("id", "value") VALUES (E'trv', E'taroko');
INSERT INTO "list" ("id", "value") VALUES (E'twq', E'taswaqi');
INSERT INTO "list" ("id", "value") VALUES (E'tt', E'tatari');
INSERT INTO "list" ("id", "value") VALUES (E'te', E'telugu');
INSERT INTO "list" ("id", "value") VALUES (E'tem', E'temne');
INSERT INTO "list" ("id", "value") VALUES (E'ter', E'tereno');
INSERT INTO "list" ("id", "value") VALUES (E'teo', E'teso');
INSERT INTO "list" ("id", "value") VALUES (E'tet', E'tetumi');
INSERT INTO "list" ("id", "value") VALUES (E'tig', E'tigree');
INSERT INTO "list" ("id", "value") VALUES (E'ti', E'tigrinja');
INSERT INTO "list" ("id", "value") VALUES (E'bo', E'tiibeti');
INSERT INTO "list" ("id", "value") VALUES (E'tiv', E'tivi');
INSERT INTO "list" ("id", "value") VALUES (E'tli', E'tlingiti');
INSERT INTO "list" ("id", "value") VALUES (E'tkl', E'tokelau');
INSERT INTO "list" ("id", "value") VALUES (E'to', E'tonga');
INSERT INTO "list" ("id", "value") VALUES (E'fit', E'Tornedalen Finnish');
INSERT INTO "list" ("id", "value") VALUES (E'tkr', E'Tsakhur');
INSERT INTO "list" ("id", "value") VALUES (E'tsd', E'Tsakonian');
INSERT INTO "list" ("id", "value") VALUES (E'ts', E'tsonga');
INSERT INTO "list" ("id", "value") VALUES (E'tn', E'tsvana');
INSERT INTO "list" ("id", "value") VALUES (E'shu', E'Tšaadi araabia');
INSERT INTO "list" ("id", "value") VALUES (E'chg', E'tšagatai');
INSERT INTO "list" ("id", "value") VALUES (E'ch', E'tšamorro');
INSERT INTO "list" ("id", "value") VALUES (E'cs', E'tšehhi');
INSERT INTO "list" ("id", "value") VALUES (E'chr', E'tšerokii');
INSERT INTO "list" ("id", "value") VALUES (E'ce', E'tšetšeeni');
INSERT INTO "list" ("id", "value") VALUES (E'chb', E'tšibtša');
INSERT INTO "list" ("id", "value") VALUES (E'tsi', E'tšimši');
INSERT INTO "list" ("id", "value") VALUES (E'chn', E'tšinuki žargoon');
INSERT INTO "list" ("id", "value") VALUES (E'chp', E'tšipevai');
INSERT INTO "list" ("id", "value") VALUES (E'tog', E'tšitonga');
INSERT INTO "list" ("id", "value") VALUES (E'cho', E'tšokto');
INSERT INTO "list" ("id", "value") VALUES (E'za', E'tšuangi');
INSERT INTO "list" ("id", "value") VALUES (E'chk', E'tšuugi');
INSERT INTO "list" ("id", "value") VALUES (E'cv', E'tšuvaši');
INSERT INTO "list" ("id", "value") VALUES (E'tcy', E'Tulu');
INSERT INTO "list" ("id", "value") VALUES (E'tum', E'tumbuka');
INSERT INTO "list" ("id", "value") VALUES (E'aeb', E'Tunisian Arabic');
INSERT INTO "list" ("id", "value") VALUES (E'tru', E'Turoyo');
INSERT INTO "list" ("id", "value") VALUES (E'tvl', E'tuvalu');
INSERT INTO "list" ("id", "value") VALUES (E'tw', E'tvii');
INSERT INTO "list" ("id", "value") VALUES (E'tyv', E'tõva');
INSERT INTO "list" ("id", "value") VALUES (E'tr', E'türgi');
INSERT INTO "list" ("id", "value") VALUES (E'tk', E'türkmeeni');
INSERT INTO "list" ("id", "value") VALUES (E'kcg', E'tyapi');
INSERT INTO "list" ("id", "value") VALUES (E'udm', E'udmurdi');
INSERT INTO "list" ("id", "value") VALUES (E'uga', E'ugariti');
INSERT INTO "list" ("id", "value") VALUES (E'ug', E'uiguuri');
INSERT INTO "list" ("id", "value") VALUES (E'uk', E'ukraina');
INSERT INTO "list" ("id", "value") VALUES (E'umb', E'umbundu');
INSERT INTO "list" ("id", "value") VALUES (E'hu', E'ungari');
INSERT INTO "list" ("id", "value") VALUES (E'ur', E'urdu');
INSERT INTO "list" ("id", "value") VALUES (E'uz', E'usbeki');
INSERT INTO "list" ("id", "value") VALUES (E'tpi', E'uusmelaneesia');
INSERT INTO "list" ("id", "value") VALUES (E'vot', E'vadja');
INSERT INTO "list" ("id", "value") VALUES (E'vai', E'vai');
INSERT INTO "list" ("id", "value") VALUES (E'be', E'valgevene');
INSERT INTO "list" ("id", "value") VALUES (E'wa', E'vallooni');
INSERT INTO "list" ("id", "value") VALUES (E'sga', E'vanaiiri');
INSERT INTO "list" ("id", "value") VALUES (E'ang', E'vanainglise');
INSERT INTO "list" ("id", "value") VALUES (E'grc', E'vanakreeka');
INSERT INTO "list" ("id", "value") VALUES (E'nwc', E'vananevari');
INSERT INTO "list" ("id", "value") VALUES (E'fro', E'vanaprantsuse');
INSERT INTO "list" ("id", "value") VALUES (E'pro', E'vanaprovansi');
INSERT INTO "list" ("id", "value") VALUES (E'non', E'vanapõhjala');
INSERT INTO "list" ("id", "value") VALUES (E'peo', E'vanapärsia');
INSERT INTO "list" ("id", "value") VALUES (E'goh', E'vanaülemsaksa');
INSERT INTO "list" ("id", "value") VALUES (E'war', E'varai');
INSERT INTO "list" ("id", "value") VALUES (E'was', E'vašo');
INSERT INTO "list" ("id", "value") VALUES (E've', E'venda');
INSERT INTO "list" ("id", "value") VALUES (E'ru', E'vene');
INSERT INTO "list" ("id", "value") VALUES (E'vec', E'Venetian');
INSERT INTO "list" ("id", "value") VALUES (E'vep', E'Veps');
INSERT INTO "list" ("id", "value") VALUES (E'vi', E'vietnami');
INSERT INTO "list" ("id", "value") VALUES (E'wal', E'volamo');
INSERT INTO "list" ("id", "value") VALUES (E'vo', E'volapüki');
INSERT INTO "list" ("id", "value") VALUES (E'wo', E'volofi');
INSERT INTO "list" ("id", "value") VALUES (E'vun', E'vunjo');
INSERT INTO "list" ("id", "value") VALUES (E'vro', E'Võro');
INSERT INTO "list" ("id", "value") VALUES (E'wae', E'walseri');
INSERT INTO "list" ("id", "value") VALUES (E'guc', E'Wayuu');
INSERT INTO "list" ("id", "value") VALUES (E'vls', E'West Flemish');
INSERT INTO "list" ("id", "value") VALUES (E'mrj', E'Western Mari');
INSERT INTO "list" ("id", "value") VALUES (E'wuu', E'Wu Chinese');
INSERT INTO "list" ("id", "value") VALUES (E'hsb', E'ülemsorbi');
INSERT INTO "list" ("id", "value") VALUES (E'hsn', E'Xiang Chinese');
INSERT INTO "list" ("id", "value") VALUES (E'yav', E'yangbeni');
INSERT INTO "list" ("id", "value") VALUES (E'ybb', E'yemba');


text:
'use strict';

(function() {
	// Applications Controller Spec
	describe('Applications Controller Tests', function() {
		// Initialize global variables
		var ApplicationsController,
		scope,
		$httpBackend,
		$stateParams,
		$location;

		// The $resource service augments the response object with methods for updating and deleting the resource.
		// If we were to use the standard toEqual matcher, our tests would fail because the test values would not match
		// the responses exactly. To solve the problem, we define a new toEqualData Jasmine matcher.
		// When the toEqualData matcher compares two objects, it takes only object properties into
		// account and ignores methods.
		beforeEach(function() {
			jasmine.addMatchers({
				toEqualData: function(util, customEqualityTesters) {
					return {
						compare: function(actual, expected) {
							return {
								pass: angular.equals(actual, expected)
							};
						}
					};
				}
			});
		});

		// Then we can start by loading the main application module
		beforeEach(module(ApplicationConfiguration.applicationModuleName));

		// The injector ignores leading and trailing underscores here (i.e. _$httpBackend_).
		// This allows us to inject a service but then attach it to a variable
		// with the same name as the service.
		beforeEach(inject(function($controller, $rootScope, _$location_, _$stateParams_, _$httpBackend_) {
			// Set a new global scope
			scope = $rootScope.$new();

			// Point global variables to injected services
			$stateParams = _$stateParams_;
			$httpBackend = _$httpBackend_;
			$location = _$location_;

			// Initialize the Applications controller.
			ApplicationsController = $controller('ApplicationsController', {
				$scope: scope
			});
		}));

		it('$scope.find() should create an array with at least one Application object fetched from XHR', inject(function(Applications) {
			// Create sample Application using the Applications service
			var sampleApplication = new Applications({
				name: 'New Application'
			});

			// Create a sample Applications array that includes the new Application
			var sampleApplications = [sampleApplication];

			// Set GET response
			$httpBackend.expectGET('applications').respond(sampleApplications);

			// Run controller functionality
			scope.find();
			$httpBackend.flush();

			// Test scope value
			expect(scope.applications).toEqualData(sampleApplications);
		}));

		it('$scope.findOne() should create an array with one Application object fetched from XHR using a applicationId URL parameter', inject(function(Applications) {
			// Define a sample Application object
			var sampleApplication = new Applications({
				name: 'New Application'
			});

			// Set the URL parameter
			$stateParams.applicationId = '525a8422f6d0f87f0e407a33';

			// Set GET response
			$httpBackend.expectGET(/applications\/([0-9a-fA-F]{24})$/).respond(sampleApplication);

			// Run controller functionality
			scope.findOne();
			$httpBackend.flush();

			// Test scope value
			expect(scope.application).toEqualData(sampleApplication);
		}));

		it('$scope.create() with valid form data should send a POST request with the form input values and then locate to new object URL', inject(function(Applications) {
			// Create a sample Application object
			var sampleApplicationPostData = new Applications({
				name: 'New Application'
			});

			// Create a sample Application response
			var sampleApplicationResponse = new Applications({
				_id: '525cf20451979dea2c000001',
				name: 'New Application'
			});

			// Fixture mock form input values
			scope.name = 'New Application';

			// Set POST response
			$httpBackend.expectPOST('applications', sampleApplicationPostData).respond(sampleApplicationResponse);

			// Run controller functionality
			scope.create();
			$httpBackend.flush();

			// Test form inputs are reset
			expect(scope.name).toEqual('');

			// Test URL redirection after the Application was created
			expect($location.path()).toBe('/applications/' + sampleApplicationResponse._id);
		}));

		it('$scope.update() should update a valid Application', inject(function(Applications) {
			// Define a sample Application put data
			var sampleApplicationPutData = new Applications({
				_id: '525cf20451979dea2c000001',
				name: 'New Application'
			});

			// Mock Application in scope
			scope.application = sampleApplicationPutData;

			// Set PUT response
			$httpBackend.expectPUT(/applications\/([0-9a-fA-F]{24})$/).respond();

			// Run controller functionality
			scope.update();
			$httpBackend.flush();

			// Test URL location to new object
			expect($location.path()).toBe('/applications/' + sampleApplicationPutData._id);
		}));

		it('$scope.remove() should send a DELETE request with a valid applicationId and remove the Application from the scope', inject(function(Applications) {
			// Create new Application object
			var sampleApplication = new Applications({
				_id: '525a8422f6d0f87f0e407a33'
			});

			// Create new Applications array and include the Application
			scope.applications = [sampleApplication];

			// Set expected DELETE response
			$httpBackend.expectDELETE(/applications\/([0-9a-fA-F]{24})$/).respond(204);

			// Run controller functionality
			scope.remove(sampleApplication);
			$httpBackend.flush();

			// Test array after successful delete
			expect(scope.applications.length).toBe(0);
		}));
	});
}());


text:
cask "find-any-file" do
  version "2.1.1"
  sha256 "5e444bcb16f89bbb44ded8da6f84d494d081ef07d8949ac2287ac80d1cc2a585"

  # s3.amazonaws.com/ was verified as official when first introduced to the cask
  url "https://s3.amazonaws.com/files.tempel.org/FindAnyFile_#{version}.zip"
  appcast "https://findanyfile.app/appcast2.php"
  name "Find Any File"
  desc "File finder"
  homepage "https://apps.tempel.org/FindAnyFile/"

  app "Find Any File.app"

  zap trash: "~/Library/Application Support/Find Any File"
end


text:
// Copyright (c) 2011, Eric Maupin
// All rights reserved.
//
// Redistribution and use in source and binary forms, with
// or without modification, are permitted provided that
// the following conditions are met:
//
// - Redistributions of source code must retain the above
//   copyright notice, this list of conditions and the
//   following disclaimer.
//
// - Redistributions in binary form must reproduce the above
//   copyright notice, this list of conditions and the
//   following disclaimer in the documentation and/or other
//   materials provided with the distribution.
//
// - Neither the name of Gablarski nor the names of its
//   contributors may be used to endorse or promote products
//   or services derived from this software without specific
//   prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
// AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Gablarski.Server
{
	/// <summary>
	/// Contract for providers of permissions
	/// </summary>
	public interface IPermissionsProvider
	{
		/// <summary>
		/// Fired when permissions have changed.
		/// </summary>
		event EventHandler<PermissionsChangedEventArgs> PermissionsChanged;

		/// <summary>
		/// Gets whether or not the permissions provided can be updated.
		/// </summary>
		bool UpdatedSupported { get; }

		/// <remarks>
		/// <0 is guests.
		/// 0 is connections only
		/// >1 is logged in users.
		/// </remarks>
		IEnumerable<Permission> GetPermissions (int userId);

		/// <summary>
		/// Sets permissions for the specified user id.
		/// </summary>
		/// <param name="userId">The user id to set permissions for.</param>
		/// <param name="permissions">The permissions to set for the user.</param>
		/// <exception cref="NotSupportedException">If <see cref="UpdatedSupported"/> is <c>false</c>.</exception>
		/// <exception cref="ArgumentNullException"><paramref name="permissions"/> is <c>null</c>.</exception>
		/// <remarks>
		/// This should only update permissions in <paramref name="permissions"/>, it's not a blanket set.
		/// </remarks>
		void SetPermissions (int userId, IEnumerable<Permission> permissions);
	}

	public class PermissionsChangedEventArgs
		: EventArgs
	{
		public PermissionsChangedEventArgs (int userId)
		{
			this.UserId = userId;
		}

		public int UserId
		{
			get; private set;
		}
	}
}


text:
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInitb3b7adcdc69d232e4fd3f930244960d1::getLoader();


text:
package audioplayer;

import com.google.inject.Inject;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
import com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter;
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
import com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason;
import lombok.Getter;
import lombok.val;
import net.dv8tion.jda.core.entities.Game;
import net.dv8tion.jda.core.entities.TextChannel;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicReference;

import static enums.MarkdownDecorator.BOLD;
import static enums.MarkdownDecorator.CODE_BLOCK;
import static java.lang.System.lineSeparator;

/**
 * Created by Huy on 02/02/2017.
 */
public final class TrackScheduler extends AudioEventAdapter {

    @Getter
    private final AudioPlayer audioPlayer;
    private final BlockingQueue<AudioTrack> queue;
    private final AtomicReference<TextChannel> outputChannel;

    @Inject
    public TrackScheduler(AbstractAudioPlayer audioPlayer) {
        this.audioPlayer = audioPlayer.get();
        this.queue = new LinkedBlockingQueue<>();
        this.outputChannel = new AtomicReference<>();
    }

    public void queueTrack(TextChannel textChannel, AudioTrack audioTrack) {
        if (this.audioPlayer.startTrack(audioTrack, true)) {
            this.outputChannel.set(textChannel);
            this.setGameInfo(audioTrack);
        } else {
            this.queue.offer(audioTrack);
        }
    }

    public void nextTrack() {
        if(this.queue.isEmpty()) {
            this.audioPlayer.stopTrack();
            this.outputChannel.get().getJDA().getPresence().setGame(null);
        } else {
            this.audioPlayer.startTrack(this.queue.element(), false);
            this.outputChannel.get().sendMessage(this.nowPlaying()).queue();
            this.setGameInfo(this.queue.element());
            this.queue.poll();
        }
    }

    public void shuffleToggle(){
        List<AudioTrack> queueTracks = new ArrayList<>(this.queue);
        AudioTrack currentTrack = queueTracks.get(0);
        queueTracks.remove(0);
        Collections.shuffle(queueTracks);
        queueTracks.add(0, currentTrack);
        this.queue.clear();
        this.queue.addAll(queueTracks);
    }

    @Override
    public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason endReason) {
        if (endReason.mayStartNext) {
            this.nextTrack();
        }
    }

    public String getQueuedTracks() {
        if (this.queue.isEmpty()) {
            return "Queue is empty";
        }

        val tracksInQueue = new StringBuilder("Songs currently in queue:" + lineSeparator() + lineSeparator());
        int counter = 1;
        for (AudioTrack audioTrack : this.queue) {
            tracksInQueue.append(" ").append(BOLD).append(counter++).append(". ")
                    .append(audioTrack.getInfo().title).append(BOLD)
                    .append(CODE_BLOCK).append(" [")
                    .append(this.longFormatter(audioTrack))
                    .append("]").append(CODE_BLOCK)
                    .append(lineSeparator());
        }
        return tracksInQueue.toString();
    }

    private String longFormatter(AudioTrack track) {
        long convertingValue = track.getDuration();
        int hours = (int) (convertingValue / (1000 * 60 * 60)) % 24;
        int minutes = (int) (convertingValue / (1000 * 60) % 60);
        int seconds = (int) (convertingValue / 1000) % 60;
        return String.format("%02d:%02d:%02d", hours, minutes, seconds);
    }

    private String nowPlaying() {
        StringBuilder audioTrack = new StringBuilder("Now playing: ");
        audioTrack.append(BOLD).append(this.queue.element().getInfo().title).append(BOLD);
        return audioTrack.toString();
    }

    private void setGameInfo(AudioTrack audioTrack){
        this.outputChannel.get().getJDA().getPresence().setGame(Game.of(audioTrack.getInfo().title));
    }
}


text:
export class Transaction {
  $key: string;
  seller: string;
  buyer: string;
  price: number;
  numberofshares :number;
  blockchaintransactionid: string;
  propertyid:string;
  buyerupdated:string;
  sellerupdated: string;
  active = true;
  timeStamp: number;
}