text:
"""Wrapper object for Iotic Things
"""
from __future__ import unicode_literals

from contextlib import contextmanager
import logging
logger = logging.getLogger(__name__)

from IoticAgent.Core.Const import (P_RESOURCE, R_FEED, R_CONTROL, R_SUB, P_ID, P_LID, P_ENTITY_LID, P_POINT_LID,
                                   P_POINT_ID, P_POINT_ENTITY_LID, P_POINT_TYPE, P_EPID)
from IoticAgent.Core import ThreadSafeDict
from IoticAgent.Core.compat import raise_from, string_types, Sequence
from IoticAgent.Core.Validation import Validation

from .Exceptions import IOTClientError
from .Resource import Resource
from .RemotePoint import RemoteFeed, RemoteControl
from .Point import Feed, Control
from .utils import foc_to_str, uuid_to_hex
from .ThingMeta import ThingMeta

_POINT_TYPE_TO_CLASS = {cls._type: cls for cls in (Feed, Control)}

class Thing(Resource):  # pylint: disable=too-many-public-methods
    """Thing class
    """

    def __init__(self, client, lid, guid, epId):
        super(Thing, self).__init__(client, guid)
        self.__lid = Validation.lid_check_convert(lid)
        self.__epId = Validation.guid_check_convert(epId, allow_none=True)
        # Keep track of newly created points & subs (the requests for which originated from current agent)
        self.__new_feeds = ThreadSafeDict()
        self.__new_controls = ThreadSafeDict()
        self.__new_subs = ThreadSafeDict()

    def __str__(self):
        return '%s (thing, %s)' % (self.guid, self.__lid)

    def __hash__(self):
        # Why not just hash guid? Because Thing is used before knowing guid in some cases
        # Why not hash without guid? Because in two separate containers one could have identicial things
        # (if not taking guid into account)
        return hash(self.__lid) ^ hash(self.guid)

    def __eq__(self, other):
        return (isinstance(other, Thing) and
                self.guid == other.guid and
                self.__lid == other.__lid)

    @property
    def lid(self):
        """
        The local id of this Thing. This is unique to you on this container. Think of it as a nickname for the Thing
        """
        return self.__lid

    @property
    def agent_id(self):
        """
        Agent id (aka epId) with which this Thing is associated. None indicates this Thing is not assigned to any
        agent. The following actions can only be performed with a Thing if operating in its associated agent:

        * Receive feed data from feeds the Thing is following
        * Share feed data for feeds this Thing owns
        * Receive control requests for controls the Thing owns
        * Perform ask/tell on a control this Thing is attached to

        Attempting to perform the above actions from another agent will result in either a local (e.g. ValueError) or
        remote exception to be raised(:doc:`IoticAgent.IOT.Exceptions`).
        """
        return self.__epId

    def __list(self, foc, limit=500, offset=0):
        logger.info("__list(foc=\"%s\", limit=%s, offset=%s) [lid=%s]", foc_to_str(foc), limit, offset, self.__lid)
        evt = self._client._request_point_list(foc, self.__lid, limit=limit, offset=offset)
        self._client._wait_and_except_if_failed(evt)
        return evt.payload

    def list_feeds(self, limit=500, offset=0):
        """
        List `all` the feeds on this Thing.

        Returns:
            QAPI list function payload

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            limit (integer, optional): Return this many Point details
            offset (integer, optional): Return Point details starting at this offset
        """
        return self.__list(R_FEED, limit=limit, offset=offset)['feeds']

    def list_controls(self, limit=500, offset=0):
        """
        List `all` the controls on this Thing.

        Returns:
            QAPI list function payload

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            limit (integer, optional): Return this many Point details
            offset (integer, optional): Return Point details starting at this offset
        """
        return self.__list(R_CONTROL, limit=limit, offset=offset)['controls']

    def set_public(self, public=True):
        """
        Sets your Thing to be public to all if `public=True`.
        This means the tags, label and description of your Thing are now searchable by anybody, along with its
        location and the units of any values on any Points.

        If `public=False` the metadata of your Thing is no longer searchable.

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            public (boolean, optional): Whether (or not) to allow your Thing's metadata to be searched by anybody
        """
        logger.info("set_public(public=%s) [lid=%s]", public, self.__lid)
        evt = self._client._request_entity_meta_setpublic(self.__lid, public)
        self._client._wait_and_except_if_failed(evt)

    def rename(self, new_lid):
        """
        Rename the Thing.

        **Advanced users only**

        This can be confusing. You are changing the local id of a Thing to `new_lid`. If you create another Thing using
        the "old_lid", the system will oblige, but it will be a completely **new** Thing.

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            new_lid (string): The new local identifier of your Thing
        """
        logger.info("rename(new_lid=\"%s\") [lid=%s]", new_lid, self.__lid)
        evt = self._client._request_entity_rename(self.__lid, new_lid)
        self._client._wait_and_except_if_failed(evt)
        self.__lid = new_lid
        self._client._notify_thing_lid_change(self.__lid, new_lid)

    def reassign(self, new_epid):
        """
        Reassign the Thing from one agent to another.

        **Advanced users only**

        This will lead to any local instances of a Thing being rendered useless. They won't be able to receive control
        requests, feed data or to share any feeds as they won't be in this agent.

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            new_epid (string): The new agent id to which your Thing should be assigned. If None, current
                agent will be chosen. If False, existing agent will be unassigned.
        """
        logger.info("reassign(new_epid=\"%s\") [lid=%s]", new_epid, self.__lid)
        evt = self._client._request_entity_reassign(self.__lid, new_epid)
        self._client._wait_and_except_if_failed(evt)

    def create_tag(self, tags):
        """
        Create tags for a Thing in the language you specify. Tags can only contain alphanumeric (unicode) characters
        and the underscore. Tags will be stored lower-cased.

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            tags (list): The list of tags (or single one) you want to add to your Thing, e.g. `["garden", "soil"]`
        """
        evt = self._client._request_entity_tag_update(self.__lid, tags, delete=False)
        self._client._wait_and_except_if_failed(evt)

    def delete_tag(self, tags):
        """
        Delete tags for a Thing in the language you specify. Case will be ignored and any tags matching lower-cased
        will be deleted.

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            tags (list): The list of tags (or single one) you want to delete from your Thing, e.g. `["garden", "soil"]`
        """
        evt = self._client._request_entity_tag_update(self.__lid, tags, delete=True)
        self._client._wait_and_except_if_failed(evt)

    def list_tag(self, limit=500, offset=0):
        """List `all` the tags for this Thing

        Returns:
            Lists of tags, as below

        ::

            [
                "mytag1",
                "mytag2"
                "ein_name",
                "nochein_name"
            ]

        Or:

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            limit (integer, optional): Return at most this many tags
            offset (integer, optional): Return tags starting at this offset
        """
        evt = self._client._request_entity_tag_list(self.__lid, limit=limit, offset=offset)

        self._client._wait_and_except_if_failed(evt)
        return evt.payload['tags']

    def create_property(self, props, replace=True, replace_all=False):
        """
        Create RDF properties for a Thing, given as a list of predicate-object tuples. Strs, bools, ints, and floats
        will be automatically cast to the correct XSD type; any other type must be given as a third member of the tuple.
        Strings can be given a language with two @'s and the two-letter language code at the end, e.g. "Fritz@@de".
        Iotic internal properties cannot be altered.

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            props (list): The sequence of properties (or single property) you want to add to your Thing
            replace (bool): Whether to delete all existing properties for the given predicates before adding new ones.
            replace_all (bool): Whether to delete all existing properties for ALL predicates before adding new ones.
        """
        evt = self._client._request_entity_property_update(self.__lid, props, replace=replace, replace_all=replace_all)
        self._client._wait_and_except_if_failed(evt)

    def delete_property(self, props):
        """
        Delete RDF properties for a Thing. Properties should be given as a list of predicate-object tuples as shown in
        the create_property method; however, unlike that method, None can be given as an object, having the effect of
        deleting all the properties for that predicate. Also, an empty list can be passed, deleting all non-internal
        properties. Iotic internal properties cannot be altered.

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            properties (list): The sequence of properties (or single property) you want to delete from your Thing
        """
        evt = self._client._request_entity_property_delete(self.__lid, props)
        self._client._wait_and_except_if_failed(evt)

    def list_property(self, limit=500, offset=0):
        """List `all` the properties for this Thing

        Returns:
            dict with predicates as keys and object lists as values, with RDF Literals converted to the format given as
            input to create_property (ie, XSD type as extra tuple member where required, language via '@@en' suffix).
            Iotic-internal properties omitted. Eg:

        ::

            {
                "http://xmlns.com/foaf/0.1/age": [
                    31
                ],
                "http://my.domain.net/some/ontology#customPredicate": [
                    55.4
                ],
                "http://my.domain.net/some/ontology#someFlag": [
                    True
                ],
                "http://my.domain.net/some/ontology#someProperty": [
                    "A string without language"
                ],
                "http://my.domain.net/some/ontology#anotherProperty2": [
                    "Language-specific string@@en"
                ],
                "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
                    "http://some.company.org/my-types/oven",
                    "http://some.company.org/my-types/hob"
                ],
                "http://my.domain.net/some/ontology#anotherProperty": [
                    "The english text@@en",
                    "Die deutsche Version@@de"
                ],
                "http://my.domain.net/some/ontology#buildMonth": [
                    ("2019-11", "gYearMonth")
                ],
                "http://my.domain.net/some/ontology#purchaseTime": [
                    ("2018-10-10T12:00:00Z", "dateTime"),
                    ("2019-11-12T14:21:44Z", "dateTime")
                ]
            }

        Or:

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            limit (integer, optional): Return at most this many properties
            offset (integer, optional): Return properties starting at this offset
        """
        evt = self._client._request_entity_property_list(self.__lid, limit=limit, offset=offset)
        self._client._wait_and_except_if_failed(evt)
        return evt.payload['props']

    def get_meta(self):
        """
        Get the metadata object for this Thing

        Returns:
            A :doc:`IoticAgent.IOT.ThingMeta` object
        """
        rdf = self.get_meta_rdf(fmt='n3')
        return ThingMeta(self, rdf, self._client.default_lang, fmt='n3')

    def get_meta_rdf(self, fmt='n3'):
        """
        Get the metadata for this Thing in rdf fmt.

        Advanced users who want to manipulate the RDF for this Thing directly without the
        :doc:`IoticAgent.IOT.ThingMeta` helper object.

        Returns:
            The RDF in the format you specify

        OR

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            fmt (string, optional): The format of RDF you want returned. Valid formats are: "xml", "n3", "turtle"
        """
        evt = self._client._request_entity_meta_get(self.__lid, fmt=fmt)

        self._client._wait_and_except_if_failed(evt)
        return evt.payload['meta']

    def set_meta_rdf(self, rdf, fmt='n3'):
        """
        Set the metadata for this Thing in RDF fmt.

        Advanced users who want to manipulate the RDF for this Thing directly without the
        :doc:`IoticAgent.IOT.ThingMeta` helper object.

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            fmt (string, optional): The format of RDF you have sent. Valid formats are: "xml", "n3", "turtle"
        """
        evt = self._client._request_entity_meta_set(self.__lid, rdf, fmt=fmt)
        self._client._wait_and_except_if_failed(evt)

    def get_feed(self, pid):
        """
        Get the details of a newly created feed. This only applies to asynchronous creation of feeds and the new feed
        instance can only be retrieved once.

        Note:
            Destructive Read. Once you've called get_feed once, any further calls will raise a `KeyError`

        Returns:
            A :doc:`IoticAgent.IOT.Point` feed object, which corresponds to the cached entry for this local feed id.

        Args:
            pid (string): Point id - local identifier of your feed.

        Raises:
            KeyError: Feed has not been newly created (or has already been retrieved by a previous call)
        """
        with self.__new_feeds:
            try:
                return self.__new_feeds.pop(pid)
            except KeyError as ex:
                raise_from(KeyError('Feed %s not know as new' % pid), ex)

    def get_control(self, pid):
        """
        Get the details of a newly created control. This only applies to asynchronous creation of feeds and the new
        control instance can only be retrieved once.

        Note:
            Destructive Read. Once you've called get_control once, any further calls will raise a `KeyError`

        Returns:
            A :doc:`IoticAgent.IOT.Point` control object, which corresponds to the cached entry for this local
            control id

        Args:
            pid (string): Local identifier of your control.

        Raises:
            KeyError: The control has not been newly created (or has already been retrieved by a previous call)
        """
        with self.__new_controls:
            try:
                return self.__new_controls.pop(pid)
            except KeyError as ex:
                raise_from(KeyError('Control %s not know as new' % pid), ex)

    def __create_point(self, foc, pid, control_cb=None, save_recent=0):
        evt = self.__create_point_async(foc, pid, control_cb=control_cb, save_recent=save_recent)
        self._client._wait_and_except_if_failed(evt)
        store = self.__new_feeds if foc == R_FEED else self.__new_controls
        try:
            with store:
                return store.pop(pid)
        except KeyError as ex:
            raise raise_from(IOTClientError('%s %s (from %s) not in cache (post-create)' %
                                            (foc_to_str(foc), pid, self.__lid)),
                             ex)

    def __create_point_async(self, foc, pid, control_cb=None, save_recent=0):
        return self._client._request_point_create(foc, self.__lid, pid, control_cb=control_cb, save_recent=save_recent)

    def create_feed(self, pid, save_recent=0):
        """
        Create a new Feed for this Thing with a local point id (pid).

        Returns:
            A new :doc:`IoticAgent.IOT.Point` feed object, or the existing one, if the Feed already exists

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            pid (string): Local id of your Feed
            save_recent (int, optional): How many shares to store for later retrieval. If not supported by container,
                this argument will be ignored. A value of zero disables this feature whilst a negative value requests
                the maximum sample store amount.
        """
        logger.info("create_feed(pid=\"%s\") [lid=%s]", pid, self.__lid)
        return self.__create_point(R_FEED, pid, save_recent=save_recent)

    def create_feed_async(self, pid, save_recent=0):
        logger.info("create_feed_async(pid=\"%s\") [lid=%s]", pid, self.__lid)
        return self.__create_point_async(R_FEED, pid, save_recent=save_recent)

    def create_control(self, pid, callback, callback_parsed=None):
        """
        Create a control for this Thing with a local point id (pid) and a control request feedback

        Returns:
            A new :doc:`IoticAgent.IOT.Point` control object or the existing one if the Control already exists

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            pid (string): Local id of your Control
            callback (function reference): Callback function to invoke on receipt of a control request.
            callback_parsed (function reference, optional): Callback function to invoke on receipt of control
                data. This is equivalent to `callback` except the dict includes the `parsed` key which holds the set of
                values in a :doc:`IoticAgent.IOT.Point` PointDataObject instance. If both `callback_parsed` and
                callback` have been specified, the former takes precedence and `callback` is only called if the point
                data could not be parsed according to its current value description.

        The `callback` receives a single dict argument, with keys of:

        ::

            'data'      # (decoded or raw bytes)
            'mime'      # (None, unless payload was not decoded and has a mime type)
            'subId'     # (the global id of the associated subscripion)
            'entityLid' # (local id of the Thing to which the control belongs)
            'lid'       # (local id of control)
            'confirm'   # (whether a confirmation is expected)
            'requestId' # (required for sending confirmation)

        Note:
            `callback_parsed` can only be used if `auto_encode_decode` is enabled for the client instance.
        """
        logger.info("create_control(pid=\"%s\", control_cb=%s) [lid=%s]", pid, callback, self.__lid)
        if callback_parsed:
            callback = self._client._get_parsed_control_callback(callback_parsed, callback)
        return self.__create_point(R_CONTROL, pid, control_cb=callback)

    def create_control_async(self, pid, callback, callback_parsed=None):
        logger.info("create_control_async(pid=\"%s\", control_cb=%s) [lid=%s]", pid, callback, self.__lid)
        if callback_parsed:
            callback = self._client._get_parsed_control_callback(callback_parsed, callback)
        return self.__create_point_async(R_CONTROL, pid, control_cb=callback)

    def __delete_point(self, foc, pid):
        evt = self.__delete_point_async(foc, pid)
        self._client._wait_and_except_if_failed(evt)

    def __delete_point_async(self, foc, pid):
        return self._client._request_point_delete(foc, self.__lid, pid)

    def delete_feed(self, pid):
        """
        Delete a feed, identified by its local id.

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            pid (string): Local identifier of your feed you want to delete

        """
        logger.info("delete_feed(pid=\"%s\") [lid=%s]", pid, self.__lid)
        return self.__delete_point(R_FEED, pid)

    def delete_feed_async(self, pid):
        logger.info("delete_feed_async(pid=\"%s\") [lid=%s]", pid, self.__lid)
        return self.__delete_point_async(R_FEED, pid)

    def delete_control(self, pid):
        """
        Delete a control, identified by its local id.

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            pid (string): Local identifier of your control you want to delete
        """
        logger.info("delete_control(pid=\"%s\") [lid=%s]", pid, self.__lid)
        return self.__delete_point(R_CONTROL, pid)

    def delete_control_async(self, pid):
        logger.info("delete_control_async(pid=\"%s\") [lid=%s]", pid, self.__lid)
        return self.__delete_point_async(R_CONTROL, pid)

    def __get_sub(self, foc, gpid):
        # global
        if isinstance(gpid, string_types):
            gpid = uuid_to_hex(gpid)
        # not local
        elif not (isinstance(gpid, Sequence) and len(gpid) == 2):
            raise ValueError('gpid must be string or two-element tuple')
        try:
            # Not using ThreadSafeDict lock since pop() is atomic operation
            sub = self.__new_subs.pop((foc, gpid))
        except KeyError as ex:
            raise_from(KeyError('Remote%s subscription %s not know as new' % (foc_to_str(foc).capitalize(), gpid)), ex)
        if sub is None:
            raise ValueError('Either subscription not complete yet or point %s is of opposite type. (In which case'
                             ' call %s instead' % (gpid, 'attach()' if foc == R_FEED else 'follow()'))
        return sub

    def get_remote_feed(self, gpid):
        """
        Retrieve `RemoteFeed` instance for a follow. This only applies to asynchronous follow requests and the
        new `RemoteFeed` instance can only be retrieved once.

        Note:
            Destructive Read. Once you've called get_remote_feed once, any further calls will raise a `KeyError`

        Raises:
            KeyError: The follow-subscription has not been newly created (or has already been retrieved by a previous
                call
            ValueError: The followed Point is actually a control instead of a feed, or if the subscription has not
                completed yet.
        """
        return self.__get_sub(R_FEED, gpid)

    def get_remote_control(self, gpid):
        """
        Retrieve `RemoteControl` instance for an attach. This only applies to asynchronous attach requests and the
        new `RemoteControl` instance can only be retrieved once.

        Note:
            Destructive Read. Once you've called get_remote_control once, any further calls will raise a `KeyError`

        Raises:
            KeyError: If the attach-subscription has not been newly created (or has already been retrieved by a previous
                call)
            ValueError: If the followed Point is actually a feed instead of a control, or if the subscription has not
                completed yet.
        """
        return self.__get_sub(R_CONTROL, gpid)

    @contextmanager
    def __sub_add_reference(self, key):
        """
        Used by __sub_make_request to save reference for pending sub request
        """
        new_subs = self.__new_subs
        with new_subs:
            # don't allow multiple subscription requests to overwrite internal reference
            if key in new_subs:
                raise ValueError('subscription for given args pending: %s' % str(key))
            new_subs[key] = None
        try:
            yield
        except:
            # don't preserve reference if request creation failed
            with new_subs:
                new_subs.pop(key, None)
            raise

    def __sub_del_reference(self, req, key):
        """
        Blindly clear reference to pending subscription on failure.
        """
        if not req.success:
            try:
                self.__new_subs.pop(key)
            except KeyError:
                logger.warning('No sub ref %s', key)

    def __sub_make_request(self, foc, gpid, callback):
        """
        Make right subscription request depending on whether local or global - used by __sub*
        """
        # global
        if isinstance(gpid, string_types):
            gpid = uuid_to_hex(gpid)
            ref = (foc, gpid)
            with self.__sub_add_reference(ref):
                req = self._client._request_sub_create(self.__lid, foc, gpid, callback=callback)
        # local
        elif isinstance(gpid, Sequence) and len(gpid) == 2:
            ref = (foc, tuple(gpid))
            with self.__sub_add_reference(ref):
                req = self._client._request_sub_create_local(self.__lid, foc, *gpid, callback=callback)
        else:
            raise ValueError('gpid must be string or two-element tuple')

        req._run_on_completion(self.__sub_del_reference, ref)
        return req

    def __sub(self, foc, gpid, callback=None):
        evt = self.__sub_async(foc, gpid, callback=callback)
        self._client._wait_and_except_if_failed(evt)
        try:
            return self.__get_sub(foc, gpid)
        except KeyError as ex:
            raise raise_from(IOTClientError('Subscription for %s (from %s) not in cache (post-create)' %
                                            gpid, self.__lid),
                             ex)

    def __sub_async(self, foc, gpid, callback=None):
        logger.info("__sub(foc=%s, gpid=\"%s\", callback=%s) [lid=%s]", foc_to_str(foc), gpid, callback, self.__lid)
        return self.__sub_make_request(foc, gpid, callback)

    def follow(self, gpid, callback=None, callback_parsed=None):
        """
        Create a subscription (i.e. follow) a Feed/Point with a global point id (gpid) and a feed data callback

        Returns:
            A new :doc:`IoticAgent.IOT.RemotePoint` RemoteFeed object or the existing one if the subscription
            already exists

        Or:

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            gpid (uuid): Global id of the Point you want to follow **OR**
            gpid (lid, pid): Tuple of `(thing_localid, point_localid)` for local subscription
            callback (function reference, optional): Callback function to invoke on receipt of feed data.
            callback_parsed (function reference, optional): Callback function to invoke on receipt of feed data. This
                is equivalent to `callback` except the dict includes the `parsed` key which holds the set of values in a
                :doc:`IoticAgent.IOT.Point` PointDataObject instance. If both `callback_parsed` and `callback` have been
                specified, the former takes precedence and `callback` is only called if the point data could not be
                parsed according to its current value description.

        Note:
            The callback receives a single dict argument, with keys of:

            ::

                'data' # (decoded or raw bytes)
                'mime' # (None, unless payload was not decoded and has a mime type)
                'pid'  # (the global id of the feed from which the data originates)
                'time' # (datetime representing UTC timestamp of share)

        Note:
            `callback_parsed` can only be used if `auto_encode_decode` is enabled for the client instance.
        """
        if callback_parsed:
            callback = self._client._get_parsed_feed_callback(callback_parsed, callback)
        return self.__sub(R_FEED, gpid, callback=callback)

    def follow_async(self, gpid, callback=None, callback_parsed=None):
        if callback_parsed:
            callback = self._client._get_parsed_feed_callback(callback_parsed, callback)
        return self.__sub_async(R_FEED, gpid, callback=callback)

    def attach(self, gpid):
        """
        Create a subscription (i.e. attach) to a Control-Point with a global point id (gpid) and a feed data callback

        Returns:
            A new RemoteControl object from the :doc:`IoticAgent.IOT.RemotePoint` or the existing one if the
            subscription already exists

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            gpid (uuid): Global id of the Point to which you want to attach **OR**
            gpid (lid, pid): Tuple of `(thing_localid, point_localid)` for local subscription
        """
        return self.__sub(R_CONTROL, gpid)

    def attach_async(self, gpid):
        return self.__sub_async(R_CONTROL, gpid)

    def __sub_delete(self, subid):
        if isinstance(subid, (RemoteFeed, RemoteControl)):
            subid = subid.subid
        evt = self._client._request_sub_delete(subid)
        self._client._wait_and_except_if_failed(evt)

    def unfollow(self, subid):
        """
        Remove a subscription of a Feed with a global subscription id (gpid)

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            subid (uuid): Global id of the subscription you want to delete **OR**
            subid (object): The instance of a RemoteFeed object corresponding to the feed you want to cease following.
        """
        return self.__sub_delete(subid)

    def unattach(self, subid):
        """
        Remove a subscription of a control with a global subscription id (gpid)

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Args:
            subid (uuid): Global id of the subscription you want to delete **OR**
            subid (object): The instance of a RemoteControl object corresponding to the control you want to cease being
                able to actuate.
        """
        return self.__sub_delete(subid)

    def list_connections(self, limit=500, offset=0):
        """
        List Points to which this Things is subscribed.
        I.e. list all the Points this Thing is following and controls it's attached to

        Returns:
            Subscription list e.g.

        ::

            {
                "<Subscription GUID 1>": {
                    "id": "<Control GUID>",
                    "entityId":  "<Control's Thing GUID>",
                    "type": 3  # R_CONTROL from IoticAgent.Core.Const
                },
                "<Subscription GUID 2>": {
                    "id": "<Feed GUID>",
                    "entityId":  "<Feed's Thing GUID>",
                    "type": 2  # R_FEED from IoticAgent.Core.Const
            }

        Raises:
            IOTException: Infrastructure problem detected
            LinkException: Communications problem between you and the infrastructure

        Note:
            For Things following a Point see :doc:`IoticAgent.IOT.Point` list_followers.
        """
        evt = self._client._request_sub_list(self.__lid, limit=limit, offset=offset)

        self._client._wait_and_except_if_failed(evt)
        return evt.payload['subs']

    def _cb_created(self, payload, duplicated):
        """
        Indirect callback (via Client) for point & subscription creation responses
        """
        if payload[P_RESOURCE] in _POINT_TYPE_TO_CLASS:
            store = self.__new_feeds if payload[P_RESOURCE] == R_FEED else self.__new_controls
            cls = _POINT_TYPE_TO_CLASS[payload[P_RESOURCE]]
            with store:
                store[payload[P_LID]] = cls(self._client, payload[P_ENTITY_LID], payload[P_LID], payload[P_ID])
            logger.debug('Added %s: %s (for %s)', foc_to_str(payload[P_RESOURCE]), payload[P_LID],
                         payload[P_ENTITY_LID])

        elif payload[P_RESOURCE] == R_SUB:
            # local
            if P_POINT_ENTITY_LID in payload:
                key = (payload[P_POINT_TYPE], (payload[P_POINT_ENTITY_LID], payload[P_POINT_LID]))
            # global
            else:
                key = (payload[P_POINT_TYPE], payload[P_POINT_ID])

            new_subs = self.__new_subs
            with new_subs:
                if key in new_subs:
                    cls = RemoteFeed if payload[P_POINT_TYPE] == R_FEED else RemoteControl
                    new_subs[key] = cls(self._client, payload[P_ID], payload[P_POINT_ID], payload[P_ENTITY_LID])
                else:
                    logger.warning('Ignoring subscription creation for unexpected %s: %s',
                                   foc_to_str(payload[P_POINT_TYPE]), key[1])

        else:
            logger.error('Resource creation of type %d unhandled', payload[P_RESOURCE])

    def _cb_reassigned(self, payload):
        self.__epId = payload[P_EPID]
        logger.info('Thing %s reassigned to agent %s', self.__lid, self.__epId)


text:
A lightweight (2.2 KB), no-dependency top progress bar library.

# Demo

http://djyde.github.io/ToProgress

# Screenshot

####Desktop
![desktop](http://ww4.sinaimg.cn/large/62580dd9gw1et3i1t9amjj218b0q5juw.jpg)

####Mobile
![mobile](http://ww2.sinaimg.cn/large/62580dd9gw1et41eqm2usg20f00qo7if.gif)

# Quick Start
```
var options = {
  color: '#EEE',
  duration: 0.2,
  height: '2px'
}
var topbar = new ToProgress(options);
```

# Support

* IE >= 10
* Chrome
* Firefox
* Safari

# Use cases

If you are using ToProgress.js in production, just tell us.

# API

### new ToProgress(options[,selector])

* options
  * **id** - the id of auto-created progress bar element
  * **color** - progress bar color
  * **height** - progress bar height
  * **duration** - increase duration (seconds)

* **selector** - valid css selector, if is defined, progress bar will be put on the top of the element. Only find the first element.

### .increase(progress[,callback])
* **progress** - percentage number

### .decrease(progress[,callback])
* **progress** - percentage number

### .setProgress(progress[,callback])
* **progress** - percentage number

### .reset([,callback])

### .finish([,callback])

### .getProgress()
return current progress (percentage number)

### .show()
### .hide()

# License
MIT License

redpajama_set_name: RedPajamaGithub


text:
/*
 * This file demonstrates how Toast can be used from within Node.js
 * programs. It translates all of the Omelet language reference pages,
 * which are written in Omelet, into HTML. The input files are located
 * in omelet-ref/inputs, and the output HTML files will be placed in
 * omelet-ref/outputs. After running this file with "node run.js",
 * you will be able to open up {your path to}/omelet-ref/outputs/index.html
 * in your browser and see the documentation pages.
 *
 * If you'd rather not run the code yourself, you can see the input
 * and output files in this repo:
 *      https://github.com/reid47/toast/tree/gh-pages/omelet-ref
 * and you can visit the actual web pages here:
 *      http://reidmitchell.net/toast/omelet-ref/
 */

// We import the Toast class
var Toast = require('./toast.js');

// We create a new instance of Toast, given a set of
// options (see docs/usage-nodejs.txt for more on these)
var T = new Toast.ToastInstance({
    sourceLanguage: "omelet",
    targetLanguage: "html",
    outputDirectory: "omelet-ref/outputs",
    prettyPrint: true,
    isWeb: false
})

// We use an external JSON file as our evaluation context
var ctx = require("./omelet-ref/inputs/templates/config.json");

// We render all files in the omelet-ref/inputs directory
T.renderDirectory("omelet-ref/inputs", ctx);


text:
@interface PodsDummy_Pods_Demo_BubbleTransition : NSObject
@end
@implementation PodsDummy_Pods_Demo_BubbleTransition
@end


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied.
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.ops4j.pax.web.service.undertow.internal.configuration.model;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import static org.ops4j.pax.web.service.undertow.internal.configuration.model.ObjectFactory.NS_PAXWEB_UNDERTOW;
import static org.ops4j.pax.web.service.undertow.internal.configuration.model.ObjectFactory.NS_WILDFLY;

@XmlType(name = "security-realmType", namespace = NS_PAXWEB_UNDERTOW, propOrder = {
		"identities",
		"authentication",
		"userPrincipalClassName",
		"rolePrincipalClassNames"
})
public class SecurityRealm {

	@XmlAttribute
	private String name;

	@XmlElement(name = "server-identities", namespace = NS_WILDFLY)
	private ServerIdentities identities;

	@XmlElement(name = "authentication", namespace = NS_WILDFLY)
	private Authentication authentication;

	@XmlElement(name = "user-principal-class-name")
	private String userPrincipalClassName;

	@XmlElement(name = "role-principal-class-name")
	private List<String> rolePrincipalClassNames = new ArrayList<>();

	public ServerIdentities getIdentities() {
		return identities;
	}

	public void setIdentities(ServerIdentities identities) {
		this.identities = identities;
	}

	public Authentication getAuthentication() {
		return authentication;
	}

	public void setAuthentication(Authentication authentication) {
		this.authentication = authentication;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUserPrincipalClassName() {
		return userPrincipalClassName;
	}

	public void setUserPrincipalClassName(String userPrincipalClassName) {
		this.userPrincipalClassName = userPrincipalClassName;
	}

	public List<String> getRolePrincipalClassNames() {
		return rolePrincipalClassNames;
	}

	@Override
	public String toString() {
		final StringBuilder sb = new StringBuilder("{\n");
		sb.append("\t\t\tname: " + name);
		if (identities != null) {
			sb.append("\n\t\t\tssl: " + identities.getSsl());
		}
		sb.append("\n\t\t\tauthentication: " + authentication);
		sb.append("\n\t\t\tuser principal class name: " + userPrincipalClassName);
		sb.append("\n\t\t\trole principal class names: " + rolePrincipalClassNames);
		sb.append("\n\t\t}");
		return sb.toString();
	}

	@XmlType(name = "server-identitiesType", namespace = NS_WILDFLY, propOrder = {
			"ssl"
	})
	public static class ServerIdentities {
		@XmlElement(name = "ssl")
		private SSLConfig ssl;

		public SSLConfig getSsl() {
			return ssl;
		}

		public void setSsl(SSLConfig ssl) {
			this.ssl = ssl;
		}
	}

	@XmlType(name = "sslType", namespace = NS_WILDFLY, propOrder = {
			"engine",
			"keystore"
	})
	public static class SSLConfig {
		@XmlElement(name = "engine")
		private Engine engine;

		@XmlElement(name = "keystore")
		private Keystore keystore;

		public Engine getEngine() {
			return engine;
		}

		public void setEngine(Engine engine) {
			this.engine = engine;
		}

		public Keystore getKeystore() {
			return keystore;
		}

		public void setKeystore(Keystore keystore) {
			this.keystore = keystore;
		}

		@Override
		public String toString() {
			final StringBuilder sb = new StringBuilder("{\n");
			sb.append("\t\t\t\tengine: ").append(engine);
			sb.append("\n\t\t\t\tkeystore: ").append(keystore);
			sb.append("\n\t\t\t}");
			return sb.toString();
		}
	}

	@XmlType(name = "authenticationType", namespace = NS_WILDFLY, propOrder = {
			"truststore",
			"jaas",
			"properties"
	})
	public static class Authentication {
		@XmlElement
		private Truststore truststore;
		@XmlElement
		private JaasAuth jaas;
		@XmlElement
		private PropertiesAuth properties;

		public Truststore getTruststore() {
			return truststore;
		}

		public void setTruststore(Truststore truststore) {
			this.truststore = truststore;
		}

		public JaasAuth getJaas() {
			return jaas;
		}

		public void setJaas(JaasAuth jaas) {
			this.jaas = jaas;
		}

		public PropertiesAuth getProperties() {
			return properties;
		}

		public void setProperties(PropertiesAuth properties) {
			this.properties = properties;
		}

		@Override
		public String toString() {
			final StringBuilder sb = new StringBuilder("{ ");
			sb.append("truststore: ").append(truststore);
			sb.append(", jaas: ").append(jaas);
			sb.append(", properties: ").append(properties);
			sb.append(" }");
			return sb.toString();
		}
	}

	@XmlType(name = "engineType", namespace = NS_WILDFLY)
	public static class Engine {
		@XmlAttribute(name = "enabled-cipher-suites")
		private List<String> enabledCipherSuites = new ArrayList<>();
		@XmlAttribute(name = "enabled-protocols")
		private List<String> enabledProtocols = new ArrayList<>();

		public List<String> getEnabledCipherSuites() {
			return enabledCipherSuites;
		}

		public List<String> getEnabledProtocols() {
			return enabledProtocols;
		}

		@Override
		public String toString() {
			final StringBuilder sb = new StringBuilder("{ ");
			sb.append("enabled ciphers: ").append(enabledCipherSuites);
			sb.append(", enabled protocols: ").append(enabledProtocols);
			sb.append(" }");
			return sb.toString();
		}
	}

	@XmlType(name = "realmKeyStoreType", namespace = NS_WILDFLY)
	public static class Truststore {
		@XmlAttribute
		private String provider;
		@XmlAttribute
		private String path;
		@XmlAttribute(name = "keystore-password")
		private String password;

		public String getProvider() {
			return provider;
		}

		public void setProvider(String provider) {
			this.provider = provider;
		}

		public String getPath() {
			return path;
		}

		public void setPath(String path) {
			this.path = path;
		}

		public String getPassword() {
			return password;
		}

		public void setPassword(String password) {
			this.password = password;
		}

		@Override
		public String toString() {
			final StringBuilder sb = new StringBuilder("{ ");
			sb.append("provider: ").append(provider);
			sb.append(", path: ").append(path);
			sb.append(" }");
			return sb.toString();
		}
	}

	@XmlType(name = "realmExtendedKeyStoreType", namespace = NS_WILDFLY)
	public static class Keystore extends Truststore {
		@XmlAttribute
		private String alias;
		@XmlAttribute(name = "key-password")
		private String keyPassword;
		@XmlAttribute(name = "generate-self-signed-certificate-host")
		private String generateSelfSignedCertificateHost;

		public String getAlias() {
			return alias;
		}

		public void setAlias(String alias) {
			this.alias = alias;
		}

		public String getKeyPassword() {
			return keyPassword;
		}

		public void setKeyPassword(String keyPassword) {
			this.keyPassword = keyPassword;
		}

		public String getGenerateSelfSignedCertificateHost() {
			return generateSelfSignedCertificateHost;
		}

		public void setGenerateSelfSignedCertificateHost(String generateSelfSignedCertificateHost) {
			this.generateSelfSignedCertificateHost = generateSelfSignedCertificateHost;
		}

		@Override
		public String toString() {
			final StringBuilder sb = new StringBuilder("{ ");
			sb.append("provider: ").append(getProvider());
			sb.append(", path: ").append(getPath());
			sb.append(", alias: ").append(alias);
			sb.append(" }");
			return sb.toString();
		}
	}

	@XmlType(name = "jaasAuthenticationType", namespace = NS_WILDFLY)
	public static class JaasAuth {
		@XmlAttribute
		private String name;

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		@Override
		public String toString() {
			final StringBuilder sb = new StringBuilder("{ ");
			sb.append("name: ").append(name);
			sb.append(" }");
			return sb.toString();
		}
	}

	@XmlType(name = "propertiesAuthenticationType", namespace = NS_WILDFLY)
	public static class PropertiesAuth {
		@XmlAttribute
		private String path;

		public String getPath() {
			return path;
		}

		public void setPath(String path) {
			this.path = path;
		}

		@Override
		public String toString() {
			final StringBuilder sb = new StringBuilder("{ ");
			sb.append("path: ").append(path);
			sb.append(" }");
			return sb.toString();
		}
	}

}


text:
package com.liuguangqiang.asyncokhttp.json;

import android.text.TextUtils;

import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;

/**
 * Created by Eric on 15/6/11.
 */
public abstract class BaseJsonEngine {

    public abstract <T> T parse(String json, Class<?> cls);

    public boolean isJson(String json) {
        if (TextUtils.isEmpty(json)) return false;

        try {
            new JsonParser().parse(json);
            return true;
        } catch (JsonParseException e) {
            return false;
        }
    }

}


text:
//  HTMLNode.h
//
//  Public domain. https://github.com/nolanw/HTMLReader

#import <Foundation/Foundation.h>
@class HTMLDocument;
@class HTMLElement;
#import "HTMLNamespace.h"
#import "HTMLSupport.h"

/**
 * HTMLNode is an abstract class representing a node in a parsed HTML tree.
 *
 * @note Copying an HTMLNode does not copy its document, parentElement, or children.
 */
@interface HTMLNode : NSObject <NSCopying>

- (instancetype)init NS_DESIGNATED_INITIALIZER;

/**
 * The document in which this node appears, or nil if the node is not in a tree with a document at its root.
 */
@property (readonly, strong, nonatomic) HTMLDocument *document;

/**
 * The node's parent, or nil if the node is a root node.
 */
@property (weak, nonatomic) HTMLNode *parentNode;

/**
 * The node's parent if it is an instance of HTMLElement, otherwise nil. Setter is equivalent to calling -setParentNode:.
 */
@property (weak, nonatomic) HTMLElement *parentElement;

/**
 * Removes the node from its parent, effectively detaching it from the tree.
 */
- (void)removeFromParentNode;

/**
 * The node's children. Each is an instance of HTMLNode. Key-Value Coding compliant for accessing and mutation.
 */
@property (readonly, copy, nonatomic) NSOrderedSet *children;

/**
 * Convenience method that returns a mutable proxy for children. The proxy returned by -mutableChildren is much faster than the one obtained by calling -mutableOrderedSetValueForKey: yourself.
 */
@property (readonly, nonatomic) NSMutableOrderedSet *mutableChildren;

/**
 * The number of nodes that have the node as their parent.
 *
 * This method is faster than calling `aNode.children.count`.
 */
@property (readonly, assign, nonatomic) NSUInteger numberOfChildren;

/**
 * Returns a child of the node. Throws an NSRangeException if index is out of bounds.
 *
 * This method is faster than calling `[aNode.children objectAtIndex:]`.
 */
- (HTMLNode *)childAtIndex:(NSUInteger)index;

/**
 * Returns the location of a child, or NSNotFound if the node is not the child's parent.
 *
 * This method is faster than calling `[aNode.children indexOfObject:]`.
 */
- (NSUInteger)indexOfChild:(HTMLNode *)child;

/**
 * The node's children which are instances of HTMLElement.
 */
@property (readonly, copy, nonatomic) NSArray *childElementNodes;

/**
 * Emits in tree order the nodes in the subtree rooted at the node.
 *
 * For more information, see http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#tree-order
 */
- (NSEnumerator *)treeEnumerator;

/**
 * Emits in tree order the node in the subree rooted at the node, except children are enumerated back to front.
 */
- (NSEnumerator *)reversedTreeEnumerator;

/**
 * The combined text content of the node and its descendants. The setter replaces the node's text, removing all descendants.
 *
 * For more information, see http://dom.spec.whatwg.org/#dom-node-textcontent
 */
@property (copy, nonatomic) NSString *textContent;

/**
 * Convenience method for either adding a string to an existing text node or creating a new text node.
 *
 * @param string         The text to insert.
 * @param childNodeIndex The desired location of the text. If a new text node is created, this is where it will be inserted.
 */
- (void)insertString:(NSString *)string atChildNodeIndex:(NSUInteger)childNodeIndex;

@end


text:
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @fileoverview 'settings-cups-add-printer-dialog' is the dialog for setting up
 * a new CUPS printer.
 */
Polymer({
  is: 'settings-cups-add-printer-dialog',

  /** Opens the Add printer dialog. */
  open: function() {
    this.$.dialog.showModal();
  },

  /** @private */
  onCancelTap_: function() {
    this.$.dialog.close();
  },
});


text:
extern Context context;

////////////////////////////////////////////////////////////////////////////////
ColumnUDA::ColumnUDA ()
{
  _name      = "<uda>";
  _type      = "string";
  _style     = "default";
  _label     = "";
  _uda       = true;
  _hyphenate = (_type == "string") ? true : false;
  _styles    = {_style, "indicator"};
}

////////////////////////////////////////////////////////////////////////////////
ColumnUDA::~ColumnUDA ()
{
}

////////////////////////////////////////////////////////////////////////////////
bool ColumnUDA::validate (std::string& value)
{
  // No restrictions.
  if (_values.size () == 0)
    return true;

  // Look for exact match value.
  for (auto& i : _values)
    if (i == value)
      return true;

  // Fail if not found.
  return false;
}

////////////////////////////////////////////////////////////////////////////////
// Set the minimum and maximum widths for the value.
//
void ColumnUDA::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
{
  minimum = maximum = 0;

  if (task.has (_name))
  {
    if (_style == "default")
    {
      std::string value = task.get (_name);
      if (value != "")
      {
        if (_type == "date")
        {
          // Determine the output date format, which uses a hierarchy of definitions.
          //   rc.report.<report>.dateformat
          //   rc.dateformat.report
          //   rc.dateformat
          Date date ((time_t) strtol (value.c_str (), NULL, 10));
          std::string format = context.config.get ("report." + _report + ".dateformat");
          if (format == "")
            format = context.config.get ("dateformat.report");
          if (format == "")
            format = context.config.get ("dateformat");

          minimum = maximum = Date::length (format);
        }
        else if (_type == "duration")
        {
          minimum = maximum = utf8_width (ISO8601p (value).format ());
        }
        else if (_type == "string")
        {
          std::string stripped = Color::strip (value);
          maximum = longestLine (stripped);
          minimum = longestWord (stripped);
        }
        else if (_type == "numeric")
        {
          minimum = maximum = utf8_width (value);
        }
      }
    }
    else if (_style == "indicator")
    {
      if (task.has (_name))
        minimum = maximum = utf8_width (context.config.get ("uda." + _name + ".indicator"));
      else
        minimum = maximum = 0;
    }
    else
      throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
  }
}

////////////////////////////////////////////////////////////////////////////////
void ColumnUDA::render (
  std::vector <std::string>& lines,
  Task& task,
  int width,
  Color& color)
{
  if (task.has (_name))
  {
    if (_style == "default")
    {
      std::string value = task.get (_name);
      if (_type == "date")
      {
        // Determine the output date format, which uses a hierarchy of definitions.
        //   rc.report.<report>.dateformat
        //   rc.dateformat.report
        //   rc.dateformat.
        std::string format = context.config.get ("report." + _report + ".dateformat");
        if (format == "")
          format = context.config.get ("dateformat.report");
        if (format == "")
          format = context.config.get ("dateformat");

        lines.push_back (
          color.colorize (
            leftJustify (
              Date ((time_t) strtol (value.c_str (), NULL, 10))
                .toString (format), width)));
      }
      else if (_type == "duration")
      {
        lines.push_back (
          color.colorize (
            rightJustify (
              ISO8601p (value).format (),
              width)));
      }
      else if (_type == "string")
      {
        std::vector <std::string> raw;
        wrapText (raw, value, width, _hyphenate);

        for (auto& i : raw)
          lines.push_back (color.colorize (leftJustify (i, width)));
      }
      else if (_type == "numeric")
      {
        lines.push_back (color.colorize (rightJustify (value, width)));
      }
    }
    else if (_style == "indicator")
    {
      if (task.has (_name))
        lines.push_back (
          color.colorize (
            rightJustify (context.config.get ("uda." + _name + ".indicator"), width)));
    }
  }
}

////////////////////////////////////////////////////////////////////////////////


text:
namespace Microsoft
{
    namespace AspNetCore
    {
        namespace Http
        {
            // Generated from `Microsoft.AspNetCore.Http.CookieOptions` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
            public class CookieOptions
            {
                public CookieOptions() => throw null;
                public string Domain { get => throw null; set => throw null; }
                public System.DateTimeOffset? Expires { get => throw null; set => throw null; }
                public bool HttpOnly { get => throw null; set => throw null; }
                public bool IsEssential { get => throw null; set => throw null; }
                public System.TimeSpan? MaxAge { get => throw null; set => throw null; }
                public string Path { get => throw null; set => throw null; }
                public Microsoft.AspNetCore.Http.SameSiteMode SameSite { get => throw null; set => throw null; }
                public bool Secure { get => throw null; set => throw null; }
            }

            // Generated from `Microsoft.AspNetCore.Http.IFormCollection` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
            public interface IFormCollection : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, Microsoft.Extensions.Primitives.StringValues>>, System.Collections.IEnumerable
            {
                bool ContainsKey(string key);
                int Count { get; }
                Microsoft.AspNetCore.Http.IFormFileCollection Files { get; }
                Microsoft.Extensions.Primitives.StringValues this[string key] { get; }
                System.Collections.Generic.ICollection<string> Keys { get; }
                bool TryGetValue(string key, out Microsoft.Extensions.Primitives.StringValues value);
            }

            // Generated from `Microsoft.AspNetCore.Http.IFormFile` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
            public interface IFormFile
            {
                string ContentDisposition { get; }
                string ContentType { get; }
                void CopyTo(System.IO.Stream target);
                System.Threading.Tasks.Task CopyToAsync(System.IO.Stream target, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
                string FileName { get; }
                Microsoft.AspNetCore.Http.IHeaderDictionary Headers { get; }
                System.Int64 Length { get; }
                string Name { get; }
                System.IO.Stream OpenReadStream();
            }

            // Generated from `Microsoft.AspNetCore.Http.IFormFileCollection` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
            public interface IFormFileCollection : System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Http.IFormFile>, System.Collections.Generic.IReadOnlyCollection<Microsoft.AspNetCore.Http.IFormFile>, System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Http.IFormFile>, System.Collections.IEnumerable
            {
                Microsoft.AspNetCore.Http.IFormFile GetFile(string name);
                System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Http.IFormFile> GetFiles(string name);
                Microsoft.AspNetCore.Http.IFormFile this[string name] { get; }
            }

            // Generated from `Microsoft.AspNetCore.Http.IHeaderDictionary` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
            public interface IHeaderDictionary : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, Microsoft.Extensions.Primitives.StringValues>>, System.Collections.Generic.IDictionary<string, Microsoft.Extensions.Primitives.StringValues>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, Microsoft.Extensions.Primitives.StringValues>>, System.Collections.IEnumerable
            {
                Microsoft.Extensions.Primitives.StringValues Accept { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AcceptCharset { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AcceptEncoding { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AcceptLanguage { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AcceptRanges { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AccessControlAllowCredentials { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AccessControlAllowHeaders { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AccessControlAllowMethods { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AccessControlAllowOrigin { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AccessControlExposeHeaders { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AccessControlMaxAge { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AccessControlRequestHeaders { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AccessControlRequestMethod { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Age { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Allow { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues AltSvc { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Authorization { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Baggage { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues CacheControl { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Connection { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues ContentDisposition { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues ContentEncoding { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues ContentLanguage { get => throw null; set => throw null; }
                System.Int64? ContentLength { get; set; }
                Microsoft.Extensions.Primitives.StringValues ContentLocation { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues ContentMD5 { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues ContentRange { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues ContentSecurityPolicy { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues ContentSecurityPolicyReportOnly { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues ContentType { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Cookie { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues CorrelationContext { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Date { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues ETag { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Expect { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Expires { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues From { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues GrpcAcceptEncoding { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues GrpcEncoding { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues GrpcMessage { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues GrpcStatus { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues GrpcTimeout { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Host { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues IfMatch { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues IfModifiedSince { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues IfNoneMatch { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues IfRange { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues IfUnmodifiedSince { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues this[string key] { get; set; }
                Microsoft.Extensions.Primitives.StringValues KeepAlive { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues LastModified { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Link { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Location { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues MaxForwards { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Origin { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Pragma { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues ProxyAuthenticate { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues ProxyAuthorization { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues ProxyConnection { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Range { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Referer { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues RequestId { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues RetryAfter { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues SecWebSocketAccept { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues SecWebSocketExtensions { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues SecWebSocketKey { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues SecWebSocketProtocol { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues SecWebSocketVersion { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Server { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues SetCookie { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues StrictTransportSecurity { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues TE { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues TraceParent { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues TraceState { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Trailer { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues TransferEncoding { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Translate { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Upgrade { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues UpgradeInsecureRequests { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues UserAgent { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Vary { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Via { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues WWWAuthenticate { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues Warning { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues WebSocketSubProtocols { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues XContentTypeOptions { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues XFrameOptions { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues XPoweredBy { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues XRequestedWith { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues XUACompatible { get => throw null; set => throw null; }
                Microsoft.Extensions.Primitives.StringValues XXSSProtection { get => throw null; set => throw null; }
            }

            // Generated from `Microsoft.AspNetCore.Http.IQueryCollection` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
            public interface IQueryCollection : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, Microsoft.Extensions.Primitives.StringValues>>, System.Collections.IEnumerable
            {
                bool ContainsKey(string key);
                int Count { get; }
                Microsoft.Extensions.Primitives.StringValues this[string key] { get; }
                System.Collections.Generic.ICollection<string> Keys { get; }
                bool TryGetValue(string key, out Microsoft.Extensions.Primitives.StringValues value);
            }

            // Generated from `Microsoft.AspNetCore.Http.IRequestCookieCollection` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
            public interface IRequestCookieCollection : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>, System.Collections.IEnumerable
            {
                bool ContainsKey(string key);
                int Count { get; }
                string this[string key] { get; }
                System.Collections.Generic.ICollection<string> Keys { get; }
                bool TryGetValue(string key, out string value);
            }

            // Generated from `Microsoft.AspNetCore.Http.IResponseCookies` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
            public interface IResponseCookies
            {
                void Append(System.ReadOnlySpan<System.Collections.Generic.KeyValuePair<string, string>> keyValuePairs, Microsoft.AspNetCore.Http.CookieOptions options) => throw null;
                void Append(string key, string value);
                void Append(string key, string value, Microsoft.AspNetCore.Http.CookieOptions options);
                void Delete(string key);
                void Delete(string key, Microsoft.AspNetCore.Http.CookieOptions options);
            }

            // Generated from `Microsoft.AspNetCore.Http.ISession` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
            public interface ISession
            {
                void Clear();
                System.Threading.Tasks.Task CommitAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
                string Id { get; }
                bool IsAvailable { get; }
                System.Collections.Generic.IEnumerable<string> Keys { get; }
                System.Threading.Tasks.Task LoadAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
                void Remove(string key);
                void Set(string key, System.Byte[] value);
                bool TryGetValue(string key, out System.Byte[] value);
            }

            // Generated from `Microsoft.AspNetCore.Http.SameSiteMode` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
            public enum SameSiteMode : int
            {
                Lax = 1,
                None = 0,
                Strict = 2,
                Unspecified = -1,
            }

            // Generated from `Microsoft.AspNetCore.Http.WebSocketAcceptContext` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
            public class WebSocketAcceptContext
            {
                public bool DangerousEnableCompression { get => throw null; set => throw null; }
                public bool DisableServerContextTakeover { get => throw null; set => throw null; }
                public virtual System.TimeSpan? KeepAliveInterval { get => throw null; set => throw null; }
                public int ServerMaxWindowBits { get => throw null; set => throw null; }
                public virtual string SubProtocol { get => throw null; set => throw null; }
                public WebSocketAcceptContext() => throw null;
            }

            namespace Features
            {
                // Generated from `Microsoft.AspNetCore.Http.Features.HttpsCompressionMode` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public enum HttpsCompressionMode : int
                {
                    Compress = 2,
                    Default = 0,
                    DoNotCompress = 1,
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IBadRequestExceptionFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IBadRequestExceptionFeature
                {
                    System.Exception Error { get; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IFormFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IFormFeature
                {
                    Microsoft.AspNetCore.Http.IFormCollection Form { get; set; }
                    bool HasFormContentType { get; }
                    Microsoft.AspNetCore.Http.IFormCollection ReadForm();
                    System.Threading.Tasks.Task<Microsoft.AspNetCore.Http.IFormCollection> ReadFormAsync(System.Threading.CancellationToken cancellationToken);
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpBodyControlFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpBodyControlFeature
                {
                    bool AllowSynchronousIO { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpConnectionFeature
                {
                    string ConnectionId { get; set; }
                    System.Net.IPAddress LocalIpAddress { get; set; }
                    int LocalPort { get; set; }
                    System.Net.IPAddress RemoteIpAddress { get; set; }
                    int RemotePort { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpMaxRequestBodySizeFeature
                {
                    bool IsReadOnly { get; }
                    System.Int64? MaxRequestBodySize { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpRequestBodyDetectionFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpRequestBodyDetectionFeature
                {
                    bool CanHaveBody { get; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpRequestFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpRequestFeature
                {
                    System.IO.Stream Body { get; set; }
                    Microsoft.AspNetCore.Http.IHeaderDictionary Headers { get; set; }
                    string Method { get; set; }
                    string Path { get; set; }
                    string PathBase { get; set; }
                    string Protocol { get; set; }
                    string QueryString { get; set; }
                    string RawTarget { get; set; }
                    string Scheme { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpRequestIdentifierFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpRequestIdentifierFeature
                {
                    string TraceIdentifier { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpRequestLifetimeFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpRequestLifetimeFeature
                {
                    void Abort();
                    System.Threading.CancellationToken RequestAborted { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpRequestTrailersFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpRequestTrailersFeature
                {
                    bool Available { get; }
                    Microsoft.AspNetCore.Http.IHeaderDictionary Trailers { get; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpResetFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpResetFeature
                {
                    void Reset(int errorCode);
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpResponseBodyFeature
                {
                    System.Threading.Tasks.Task CompleteAsync();
                    void DisableBuffering();
                    System.Threading.Tasks.Task SendFileAsync(string path, System.Int64 offset, System.Int64? count, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
                    System.Threading.Tasks.Task StartAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
                    System.IO.Stream Stream { get; }
                    System.IO.Pipelines.PipeWriter Writer { get; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpResponseFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpResponseFeature
                {
                    System.IO.Stream Body { get; set; }
                    bool HasStarted { get; }
                    Microsoft.AspNetCore.Http.IHeaderDictionary Headers { get; set; }
                    void OnCompleted(System.Func<object, System.Threading.Tasks.Task> callback, object state);
                    void OnStarting(System.Func<object, System.Threading.Tasks.Task> callback, object state);
                    string ReasonPhrase { get; set; }
                    int StatusCode { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpResponseTrailersFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpResponseTrailersFeature
                {
                    Microsoft.AspNetCore.Http.IHeaderDictionary Trailers { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpUpgradeFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpUpgradeFeature
                {
                    bool IsUpgradableRequest { get; }
                    System.Threading.Tasks.Task<System.IO.Stream> UpgradeAsync();
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpWebSocketFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpWebSocketFeature
                {
                    System.Threading.Tasks.Task<System.Net.WebSockets.WebSocket> AcceptAsync(Microsoft.AspNetCore.Http.WebSocketAcceptContext context);
                    bool IsWebSocketRequest { get; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IHttpsCompressionFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IHttpsCompressionFeature
                {
                    Microsoft.AspNetCore.Http.Features.HttpsCompressionMode Mode { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IItemsFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IItemsFeature
                {
                    System.Collections.Generic.IDictionary<object, object> Items { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IQueryFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IQueryFeature
                {
                    Microsoft.AspNetCore.Http.IQueryCollection Query { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IRequestBodyPipeFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IRequestBodyPipeFeature
                {
                    System.IO.Pipelines.PipeReader Reader { get; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IRequestCookiesFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IRequestCookiesFeature
                {
                    Microsoft.AspNetCore.Http.IRequestCookieCollection Cookies { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IResponseCookiesFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IResponseCookiesFeature
                {
                    Microsoft.AspNetCore.Http.IResponseCookies Cookies { get; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IServerVariablesFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IServerVariablesFeature
                {
                    string this[string variableName] { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.IServiceProvidersFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface IServiceProvidersFeature
                {
                    System.IServiceProvider RequestServices { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.ISessionFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface ISessionFeature
                {
                    Microsoft.AspNetCore.Http.ISession Session { get; set; }
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.ITlsConnectionFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface ITlsConnectionFeature
                {
                    System.Security.Cryptography.X509Certificates.X509Certificate2 ClientCertificate { get; set; }
                    System.Threading.Tasks.Task<System.Security.Cryptography.X509Certificates.X509Certificate2> GetClientCertificateAsync(System.Threading.CancellationToken cancellationToken);
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.ITlsTokenBindingFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface ITlsTokenBindingFeature
                {
                    System.Byte[] GetProvidedTokenBindingId();
                    System.Byte[] GetReferredTokenBindingId();
                }

                // Generated from `Microsoft.AspNetCore.Http.Features.ITrackingConsentFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                public interface ITrackingConsentFeature
                {
                    bool CanTrack { get; }
                    string CreateConsentCookie();
                    void GrantConsent();
                    bool HasConsent { get; }
                    bool IsConsentNeeded { get; }
                    void WithdrawConsent();
                }

                namespace Authentication
                {
                    // Generated from `Microsoft.AspNetCore.Http.Features.Authentication.IHttpAuthenticationFeature` in `Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
                    public interface IHttpAuthenticationFeature
                    {
                        System.Security.Claims.ClaimsPrincipal User { get; set; }
                    }

                }
            }
        }
    }
}


text:
package jetbrains.mps.samples.VoiceMenu.editor;

/*Generated by MPS */

import jetbrains.mps.editor.runtime.descriptor.AbstractEditorBuilder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.openapi.editor.EditorContext;
import jetbrains.mps.openapi.editor.cells.EditorCell;
import jetbrains.mps.nodeEditor.cells.EditorCell_Collection;
import jetbrains.mps.nodeEditor.cellLayout.CellLayout_Indent;
import jetbrains.mps.nodeEditor.cells.EditorCell_Image;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.openapi.editor.style.Style;
import jetbrains.mps.editor.runtime.style.StyleImpl;
import jetbrains.mps.editor.runtime.style.StyleAttributes;
import jetbrains.mps.nodeEditor.cells.EditorCell_Constant;
import jetbrains.mps.samples.VoiceMenu.editor.Styles_StyleSheet.ActionStyleClass;
import jetbrains.mps.lang.editor.menus.transformation.DefaultTransformationMenuLookup;
import jetbrains.mps.smodel.language.LanguageRegistry;
import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfo;
import org.jetbrains.mps.openapi.language.SConcept;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;

/*package*/ class Back_EditorBuilder_a extends AbstractEditorBuilder {
  @NotNull
  private SNode myNode;

  public Back_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
    super(context);
    myNode = node;
  }

  @NotNull
  @Override
  public SNode getNode() {
    return myNode;
  }

  /*package*/ EditorCell createCell() {
    return createCollection_0();
  }

  private EditorCell createCollection_0() {
    EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
    editorCell.setCellId("Collection_t12aci_a");
    editorCell.setBig(true);
    setCellContext(editorCell);
    editorCell.addEditorCell(createImage_0());
    editorCell.addEditorCell(createConstant_0());
    editorCell.addEditorCell(createConstant_1());
    return editorCell;
  }
  private EditorCell createImage_0() {
    EditorCell_Image editorCell = EditorCell_Image.createImageCell(getEditorContext(), myNode, SNodeOperations.getConcept(myNode).getLanguage().getSourceModule(), "${module}/src/arrow.png");
    editorCell.setCellId("Image_t12aci_a0");
    Style style = new StyleImpl();
    style.set(StyleAttributes.SELECTABLE, false);
    editorCell.getStyle().putAll(style);
    editorCell.setDescent(-150);
    return editorCell;
  }
  private EditorCell createConstant_0() {
    EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "");
    editorCell.setCellId("Constant_t12aci_b0");
    Style style = new StyleImpl();
    style.set(StyleAttributes.SELECTABLE, false);
    editorCell.getStyle().putAll(style);
    editorCell.setDefaultText("");
    return editorCell;
  }
  private EditorCell createConstant_1() {
    EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "Back");
    editorCell.setCellId("Constant_t12aci_c0");
    Style style = new StyleImpl();
    new ActionStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
    style.set(StyleAttributes.INDENT_LAYOUT_INDENT, true);
    editorCell.getStyle().putAll(style);
    editorCell.setTransformationMenuLookup(new DefaultTransformationMenuLookup(LanguageRegistry.getInstance(getEditorContext().getRepository()), CONCEPTS.Back$$j));
    editorCell.setDefaultText("");
    editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell));
    return editorCell;
  }

  private static final class CONCEPTS {
    /*package*/ static final SConcept Back$$j = MetaAdapterFactory.getConcept(0x4bc750d756884f52L, 0xb7d5b263a3393a24L, 0x5dfe7d1339980acaL, "jetbrains.mps.samples.VoiceMenu.structure.Back");
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<person user="hiram">
  <firstName>Hiram</firstName>
  <lastName>Chirino</lastName>
  <city>Tampa</city>
</person>


text:
         <?= t('Actions') ?>

            <?php if (isset($is_board)): ?>

                <span class="filter-display-mode" <?= $this->board->isCollapsed($project['id']) ? '' : 'style="display: none;"' ?>>

                    <?= $this->url->link(t('Expand tasks'), 'board', 'expand', array('project_id' => $project['id']), false, 'board-display-mode', t('Keyboard shortcut: "%s"', 's')) ?>

                <span class="filter-display-mode" <?= $this->board->isCollapsed($project['id']) ? 'style="display: none;"' : '' ?>>

                    <?= $this->url->link(t('Collapse tasks'), 'board', 'collapse', array('project_id' => $project['id']), false, 'board-display-mode', t('Keyboard shortcut: "%s"', 's')) ?>

                     <a href="#" class="filter-toggle-scrolling" title="<?= t('Keyboard shortcut: "%s"', 'c') ?>"><?= t('Compact view') ?>

                     <a href="#" class="filter-toggle-scrolling" title="<?= t('Keyboard shortcut: "%s"', 'c') ?>"><?= t('Horizontal scrolling') ?>

            <?php endif ?>
            <?= $this->render('project/dropdown', array('project' => $project)) ?>

        <li <?= $filters['controller'] === 'board' ? 'class="active"' : '' ?>>

            <?= $this->url->link(t('Board'), 'board', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-board', t('Keyboard shortcut: "%s"', 'v b')) ?>

        <li <?= $filters['controller'] === 'calendar' ? 'class="active"' : '' ?>>

            <?= $this->url->link(t('Calendar'), 'calendar', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-calendar', t('Keyboard shortcut: "%s"', 'v c')) ?>

        <li <?= $filters['controller'] === 'listing' ? 'class="active"' : '' ?>>

            <?= $this->url->link(t('List'), 'listing', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-listing', t('Keyboard shortcut: "%s"', 'v l')) ?>

    <form method="get" action="<?= $this->url->dir() ?>" class="search">
        <?= $this->form->hidden('controller', $filters) ?>
        <?= $this->form->hidden('action', $filters) ?>
        <?= $this->form->hidden('project_id', $filters) ?>
        <?= $this->form->text('search', $filters, array(), array('placeholder="'.t('Filter').'"'), 'form-input-large') ?>
    </form>
    <?= $this->render('app/filters_helper', array('reset' => 'status:open')) ?>


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners android:radius="1000dp" />
    <solid android:color="@color/colorAccent" />
    <stroke
        android:width="2dip"
        android:color="@color/colorAccent" />
    <padding
        android:bottom="10dp"
        android:left="10dp"
        android:right="10dp"
        android:top="10dp" />
</shape>