text:
@implementation SMKDetectionCamera

- (void)beginDetecting:(SMKDetectionOptions)options
          withDelegate:(id<SMKDetectionDelegate>)delegate
             codeTypes:(NSArray *)machineCodeTypesOrNil;
{
    [self ensureStabilityOfOptionsViaAsserts:options
                                withDelegate:delegate
                                   codeTypes:machineCodeTypesOrNil];

    self.detectionDelegate = delegate;

    if (options & kFaceFeatures) {
        self.delegate = self;

		NSDictionary *detectorOptions = @{CIDetectorAccuracy : CIDetectorAccuracyLow};
		self.faceDetector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:detectorOptions];
    } else {
        [self stopDetectionOfTypes:kFaceFeatures];
    }

    if (options & kFaceMetaData) {
        [self.captureSession removeOutput:self.faceOutput];

        self.faceOutput = [[AVCaptureMetadataOutput alloc] init];
        [self.faceOutput setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
        [self.captureSession addOutput:self.faceOutput];
        [self.faceOutput setMetadataObjectTypes:@[AVMetadataObjectTypeFace]];
    } else {
        [self stopDetectionOfTypes:kFaceMetaData];
    }

    if (options & kMachineReadableMetaData) {
        [self.captureSession removeOutput:self.codeOutput];

        self.codeOutput = [[AVCaptureMetadataOutput alloc] init];
        [self.codeOutput setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
        [self.captureSession addOutput:self.codeOutput];
        [self.codeOutput setMetadataObjectTypes:machineCodeTypesOrNil];
    } else {
        [self stopDetectionOfTypes:kMachineReadableMetaData];
    }

    if (options & kMachineAndFaceMetaData) {
        [self.captureSession removeOutput:self.mixedOutput];

        self.mixedOutput = [[AVCaptureMetadataOutput alloc] init];
        [self.mixedOutput setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
        [self.captureSession addOutput:self.mixedOutput];
        [self.mixedOutput setMetadataObjectTypes:[machineCodeTypesOrNil arrayByAddingObject:AVMetadataObjectTypeFace]];
    } else {
        [self stopDetectionOfTypes:kMachineAndFaceMetaData];
    }

}

- (void)beginDetecting:(SMKDetectionOptions)options
             codeTypes:(NSArray *)machineCodeTypesOrNil
    withDetectionBlock:(SMKDetectionBlock)detectionBlock
{
    [self beginDetecting:options withDelegate:self codeTypes:machineCodeTypesOrNil];
    self.detectBlock = detectionBlock;
}

- (void)stopDetectionOfTypes:(SMKDetectionOptions)options
{
    if (options & kFaceFeatures) {
        self.delegate = nil;
    }

    if (options & kFaceMetaData) {
        [self.captureSession removeOutput:self.faceOutput];
        self.faceOutput = nil;
    }

    if (options & kMachineReadableMetaData) {
        [self.captureSession removeOutput:self.codeOutput];
        self.codeOutput = nil;
    }

    if (options & kMachineAndFaceMetaData) {
        [self.captureSession removeOutput:self.mixedOutput];
        self.mixedOutput = nil;
    }
}

- (void)stopAllDetection
{
    [self stopDetectionOfTypes:kMachineReadableMetaData | kFaceMetaData | kFaceFeatures | kMachineAndFaceMetaData];
}

#pragma mark Asserts
- (void)ensureStabilityOfOptionsViaAsserts:(SMKDetectionOptions)options
                              withDelegate:(id<SMKDetectionDelegate>)delegate
                                 codeTypes:(NSArray *)machineCodeTypesOrNil
{

    NSAssert(!(options & kFaceMetaData && options & kMachineReadableMetaData), @"Do not use both kFaceMetaData && kMachineReadableMetaData, instead use kMachineAndFaceMetaData");
    NSAssert(!(options & kFaceMetaData && options & kMachineAndFaceMetaData), @"Do not use kFaceMetaData with kMachineAndFaceMetaData, just use kMachineAndFaceMetaData");
    NSAssert(!(options & kMachineAndFaceMetaData && options & kMachineReadableMetaData), @"Do not use kMachineReadableMetaData with kMachineAndFaceMetaData, just use kMachineAndFaceMetaData");

    if (options & kFaceMetaData) {
        NSAssert([delegate respondsToSelector:@selector(detectorWillOuputFaceMetadata:)], @"Your detection delegate must respond to detectorWillOuputFaceMetadata: in order to detect kFaceMetadata");
    }

    if (options & kMachineReadableMetaData) {
        NSAssert([delegate respondsToSelector:@selector(detectorWillOuputMachineReadableMetadata:)], @"Your detection delegate must respond to detectorWillOuputMachineReadableMetadata: in order to detect kMachineReadableMetaData");
        NSAssert(machineCodeTypesOrNil.count, @"If you'd like to track machine codes, you need to supply an array of types to track");
    }

    if (options & kMachineAndFaceMetaData) {
        NSAssert([delegate respondsToSelector:@selector(detectorWillOuputMachineAndFaceMetadata:)], @"Your detection delegate must respond to detectorWillOuputMachineAndFaceMetadata: in order to detect kMachineAndFaceMetaData");
        NSAssert(machineCodeTypesOrNil.count, @"If you'd like to track machine codes, you need to supply an array of types to track");
    }

    if (options & kFaceFeatures) {
        NSAssert([delegate respondsToSelector:@selector(detectorWillOuputFaceFeatures:inClap:)], @"Your detection delegate must respond to detectorWillOutputFaceFeatures:inClap: in order to detect kFaceFeatures");
    }

}

@end


text:
/**
 * @extends {WebInspector.VBox}
 * @constructor
 */
WebInspector.TabbedPane = function()
{
    WebInspector.VBox.call(this, true);
    this.registerRequiredCSS("ui/tabbedPane.css");
    this.element.classList.add("tabbed-pane");
    this.contentElement.classList.add("tabbed-pane-shadow");
    this.contentElement.tabIndex = -1;
    this._headerElement = this.contentElement.createChild("div", "tabbed-pane-header toolbar-colors");
    this._headerElement.createChild("content").select = ".tabbed-pane-header-before";
    this._headerContentsElement = this._headerElement.createChild("div", "tabbed-pane-header-contents");
    this._tabSlider = this._headerContentsElement.createChild("div", "tabbed-pane-tab-slider");
    this._headerElement.createChild("content").select = ".tabbed-pane-header-after";
    this._tabsElement = this._headerContentsElement.createChild("div", "tabbed-pane-header-tabs");
    this._contentElement = this.contentElement.createChild("div", "tabbed-pane-content");
    this._contentElement.createChild("content");
    /** @type {!Array.<!WebInspector.TabbedPaneTab>} */
    this._tabs = [];
    /** @type {!Array.<!WebInspector.TabbedPaneTab>} */
    this._tabsHistory = [];
    /** @type {!Object.<string, !WebInspector.TabbedPaneTab>} */
    this._tabsById = {};
    this._currentTabLocked = false;

    this._dropDownButton = this._createDropDownButton();
    WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged, this._zoomChanged, this);
}

WebInspector.TabbedPane.EventTypes = {
    TabSelected: "TabSelected",
    TabClosed: "TabClosed"
}

WebInspector.TabbedPane.prototype = {
    /**
     * @param {boolean} locked
     */
    setCurrentTabLocked: function(locked)
    {
        this._currentTabLocked = locked;
        this._headerElement.classList.toggle("locked", this._currentTabLocked);
    },

    /**
     * @return {?WebInspector.Widget}
     */
    get visibleView()
    {
        return this._currentTab ? this._currentTab.view : null;
    },

    /**
     * @return {!Array.<!WebInspector.Widget>}
     */
    tabViews: function()
    {
        /**
         * @param {!WebInspector.TabbedPaneTab} tab
         * @return {!WebInspector.Widget}
         */
        function tabToView(tab)
        {
            return tab.view;
        }
        return this._tabs.map(tabToView);
    },

    /**
     * @return {?string}
     */
    get selectedTabId()
    {
        return this._currentTab ? this._currentTab.id : null;
    },

    /**
     * @param {boolean} shrinkableTabs
     */
    setShrinkableTabs: function(shrinkableTabs)
    {
        this._shrinkableTabs = shrinkableTabs;
    },

    /**
     * @param {boolean} verticalTabLayout
     */
    setVerticalTabLayout: function(verticalTabLayout)
    {
        this._verticalTabLayout = verticalTabLayout;
        this.contentElement.classList.add("vertical-tab-layout");
        this.invalidateConstraints();
    },

    /**
     * @param {boolean} closeableTabs
     */
    setCloseableTabs: function(closeableTabs)
    {
        this._closeableTabs = closeableTabs;
    },

    /**
     * @param {boolean} retainTabOrder
     * @param {function(string, string):number=} tabOrderComparator
     */
    setRetainTabOrder: function(retainTabOrder, tabOrderComparator)
    {
        this._retainTabOrder = retainTabOrder;
        this._tabOrderComparator = tabOrderComparator;
    },

    /**
     * @override
     * @return {!Element}
     */
    defaultFocusedElement: function()
    {
        return this.visibleView ? this.visibleView.defaultFocusedElement() : this.contentElement;
    },

    focus: function()
    {
        if (this.visibleView)
            this.visibleView.focus();
        else
            this.contentElement.focus();
    },

    /**
     * @return {!Element}
     */
    headerElement: function()
    {
        return this._headerElement;
    },

    /**
     * @param {string} id
     * @return {boolean}
     */
    isTabCloseable: function(id)
    {
        var tab = this._tabsById[id];
        return tab ? tab.isCloseable() : false;
    },

    /**
     * @param {!WebInspector.TabbedPaneTabDelegate} delegate
     */
    setTabDelegate: function(delegate)
    {
        var tabs = this._tabs.slice();
        for (var i = 0; i < tabs.length; ++i)
            tabs[i].setDelegate(delegate);
        this._delegate = delegate;
    },

    /**
     * @param {string} id
     * @param {string} tabTitle
     * @param {!WebInspector.Widget} view
     * @param {string=} tabTooltip
     * @param {boolean=} userGesture
     * @param {boolean=} isCloseable
     */
    appendTab: function(id, tabTitle, view, tabTooltip, userGesture, isCloseable)
    {
        isCloseable = typeof isCloseable === "boolean" ? isCloseable : this._closeableTabs;
        var tab = new WebInspector.TabbedPaneTab(this, id, tabTitle, isCloseable, view, tabTooltip);
        tab.setDelegate(this._delegate);
        this._tabsById[id] = tab;

        /**
         * @param {!WebInspector.TabbedPaneTab} tab1
         * @param {!WebInspector.TabbedPaneTab} tab2
         * @this {WebInspector.TabbedPane}
         * @return {number}
         */
        function comparator(tab1, tab2)
        {
            return this._tabOrderComparator(tab1.id, tab2.id);
        }

        if (this._tabOrderComparator)
            this._tabs.splice(insertionIndexForObjectInListSortedByFunction(tab, this._tabs, comparator.bind(this)), 0, tab);
        else
            this._tabs.push(tab);

        this._tabsHistory.push(tab);

        if (this._tabsHistory[0] === tab && this.isShowing())
            this.selectTab(tab.id, userGesture);

        this._updateTabElements();
    },

    /**
     * @param {string} id
     * @param {boolean=} userGesture
     */
    closeTab: function(id, userGesture)
    {
        this.closeTabs([id], userGesture);
    },

    /**
     * @param {!Array.<string>} ids
     * @param {boolean=} userGesture
     */
    closeTabs: function(ids, userGesture)
    {
        var focused = this.hasFocus();
        for (var i = 0; i < ids.length; ++i)
            this._innerCloseTab(ids[i], userGesture);
        this._updateTabElements();
        if (this._tabsHistory.length)
            this.selectTab(this._tabsHistory[0].id, false);
        if (focused)
            this.focus();
    },

    /**
     * @param {string} id
     * @param {boolean=} userGesture
     */
    _innerCloseTab: function(id, userGesture)
    {
        if (!this._tabsById[id])
            return;
        if (userGesture && !this._tabsById[id]._closeable)
            return;
        if (this._currentTab && this._currentTab.id === id)
            this._hideCurrentTab();

        var tab = this._tabsById[id];
        delete this._tabsById[id];

        this._tabsHistory.splice(this._tabsHistory.indexOf(tab), 1);
        this._tabs.splice(this._tabs.indexOf(tab), 1);
        if (tab._shown)
            this._hideTabElement(tab);

        var eventData = { tabId: id, view: tab.view, isUserGesture: userGesture };
        this.dispatchEventToListeners(WebInspector.TabbedPane.EventTypes.TabClosed, eventData);
        return true;
    },

    /**
     * @param {string} tabId
     * @return {boolean}
     */
    hasTab: function(tabId)
    {
        return !!this._tabsById[tabId];
    },

    /**
     * @return {!Array.<string>}
     */
    allTabs: function()
    {
        return this._tabs.map(function (tab) { return tab.id; });
    },

    /**
     * @param {string} id
     * @return {!Array.<string>}
     */
    otherTabs: function(id)
    {
        var result = [];
        for (var i = 0; i < this._tabs.length; ++i) {
            if (this._tabs[i].id !== id)
                result.push(this._tabs[i].id);
        }
        return result;
    },

    /**
     * @param {string} id
     * @return {!Array.<string>}
     */
    _tabsToTheRight: function(id)
    {
        var index = -1;
        for (var i = 0; i < this._tabs.length; ++i) {
            if (this._tabs[i].id === id) {
                index = i;
                break;
            }
        }
        if (index === -1)
            return [];
        return this._tabs.slice(index + 1).map(function (tab) { return tab.id; });
    },

    /**
     * @param {string} id
     * @param {boolean=} userGesture
     * @return {boolean}
     */
    selectTab: function(id, userGesture)
    {
        if (this._currentTabLocked)
            return false;
        var focused = this.hasFocus();
        var tab = this._tabsById[id];
        if (!tab)
            return false;
        if (this._currentTab && this._currentTab.id === id)
            return true;

        this._hideCurrentTab();
        this._showTab(tab);
        this._currentTab = tab;

        this._tabsHistory.splice(this._tabsHistory.indexOf(tab), 1);
        this._tabsHistory.splice(0, 0, tab);

        this._updateTabElements();
        if (focused)
            this.focus();

        var eventData = { tabId: id, view: tab.view, isUserGesture: userGesture };
        this.dispatchEventToListeners(WebInspector.TabbedPane.EventTypes.TabSelected, eventData);
        return true;
    },

    /**
     * @param {number} tabsCount
     * @return {!Array.<string>}
     */
    lastOpenedTabIds: function(tabsCount)
    {
        function tabToTabId(tab) {
            return tab.id;
        }

        return this._tabsHistory.slice(0, tabsCount).map(tabToTabId);
    },

    /**
     * @param {string} id
     * @param {string} iconType
     * @param {string=} iconTooltip
     */
    setTabIcon: function(id, iconType, iconTooltip)
    {
        var tab = this._tabsById[id];
        if (tab._setIconType(iconType, iconTooltip))
            this._updateTabElements();
    },

    /**
     * @param {string} id
     * @param {string} className
     * @param {boolean=} force
     */
    toggleTabClass: function(id, className, force)
    {
        var tab = this._tabsById[id];
        if (tab._toggleClass(className, force))
            this._updateTabElements();
    },

    /**
     * @param {!WebInspector.Event} event
     */
    _zoomChanged: function(event)
    {
        for (var i = 0; i < this._tabs.length; ++i)
            delete this._tabs[i]._measuredWidth;
        if (this.isShowing())
            this._updateTabElements();
    },

    /**
     * @param {string} id
     * @param {string} tabTitle
     */
    changeTabTitle: function(id, tabTitle)
    {
        var tab = this._tabsById[id];
        if (tab.title === tabTitle)
            return;
        tab.title = tabTitle;
        this._updateTabElements();
    },

    /**
     * @param {string} id
     * @param {!WebInspector.Widget} view
     */
    changeTabView: function(id, view)
    {
        var tab = this._tabsById[id];
        if (this._currentTab && this._currentTab.id === tab.id) {
            if (tab.view !== view)
                this._hideTab(tab);
            tab.view = view;
            this._showTab(tab);
        } else
            tab.view = view;
    },

    onResize: function()
    {
        this._updateTabElements();
    },

    headerResized: function()
    {
        this._updateTabElements();
    },

    wasShown: function()
    {
        var effectiveTab = this._currentTab || this._tabsHistory[0];
        if (effectiveTab)
            this.selectTab(effectiveTab.id);
    },

    /**
     * @param {boolean} enable
     */
    setTabSlider: function(enable)
    {
        this._sliderEnabled = enable;
        this._tabSlider.classList.toggle("enabled", enable);
    },

    /**
     * @override
     * @return {!Constraints}
     */
    calculateConstraints: function()
    {
        var constraints = WebInspector.VBox.prototype.calculateConstraints.call(this);
        var minContentConstraints = new Constraints(new Size(0, 0), new Size(50, 50));
        constraints = constraints.widthToMax(minContentConstraints).heightToMax(minContentConstraints);
        if (this._verticalTabLayout)
            constraints = constraints.addWidth(new Constraints(new Size(120, 0)));
        else
            constraints = constraints.addHeight(new Constraints(new Size(0, 30)));
        return constraints;
    },

    _updateTabElements: function()
    {
        WebInspector.invokeOnceAfterBatchUpdate(this, this._innerUpdateTabElements);
    },

    /**
     * @param {string} text
     */
    setPlaceholderText: function(text)
    {
        this._noTabsMessage = text;
    },

    _innerUpdateTabElements: function()
    {
        if (!this.isShowing())
            return;

        if (!this._tabs.length) {
            this._contentElement.classList.add("has-no-tabs");
            if (this._noTabsMessage && !this._noTabsMessageElement) {
                this._noTabsMessageElement = this._contentElement.createChild("div", "tabbed-pane-placeholder fill");
                this._noTabsMessageElement.textContent = this._noTabsMessage;
            }
        } else {
            this._contentElement.classList.remove("has-no-tabs");
            if (this._noTabsMessageElement) {
                this._noTabsMessageElement.remove();
                delete this._noTabsMessageElement;
            }
        }

        if (!this._measuredDropDownButtonWidth)
            this._measureDropDownButton();

        this._updateWidths();
        this._updateTabsDropDown();
        this._updateTabSlider();
    },

    /**
     * @param {number} index
     * @param {!WebInspector.TabbedPaneTab} tab
     */
    _showTabElement: function(index, tab)
    {
        if (index >= this._tabsElement.children.length)
            this._tabsElement.appendChild(tab.tabElement);
        else
            this._tabsElement.insertBefore(tab.tabElement, this._tabsElement.children[index]);
        tab._shown = true;
    },

    /**
     * @param {!WebInspector.TabbedPaneTab} tab
     */
    _hideTabElement: function(tab)
    {
        this._tabsElement.removeChild(tab.tabElement);
        tab._shown = false;
    },

    _createDropDownButton: function()
    {
        var dropDownContainer = createElementWithClass("div", "tabbed-pane-header-tabs-drop-down-container");
        dropDownContainer.createTextChild("\u00bb");

        this._dropDownMenu = new WebInspector.DropDownMenu(dropDownContainer);
        this._dropDownMenu.addEventListener(WebInspector.DropDownMenu.Events.ItemSelected, this._dropDownMenuItemSelected, this);

        return dropDownContainer;
    },

    /**
     * @param {!WebInspector.Event} event
     */
    _dropDownMenuItemSelected: function(event)
    {
        var tabId = /** @type {string} */ (event.data);
        this.selectTab(tabId, true);
    },

    _totalWidth: function()
    {
        return this._headerContentsElement.getBoundingClientRect().width;
    },

    _updateTabsDropDown: function()
    {
        var tabsToShowIndexes = this._tabsToShowIndexes(this._tabs, this._tabsHistory, this._totalWidth(), this._measuredDropDownButtonWidth);

        for (var i = 0; i < this._tabs.length; ++i) {
            if (this._tabs[i]._shown && tabsToShowIndexes.indexOf(i) === -1)
                this._hideTabElement(this._tabs[i]);
        }
        for (var i = 0; i < tabsToShowIndexes.length; ++i) {
            var tab = this._tabs[tabsToShowIndexes[i]];
            if (!tab._shown)
                this._showTabElement(i, tab);
        }

        this._populateDropDownFromIndex();
    },

    _populateDropDownFromIndex: function()
    {
        if (this._dropDownButton.parentElement)
            this._headerContentsElement.removeChild(this._dropDownButton);

        this._dropDownMenu.clear();

        var tabsToShow = [];
        for (var i = 0; i < this._tabs.length; ++i) {
            if (!this._tabs[i]._shown)
                tabsToShow.push(this._tabs[i]);
                continue;
        }

        function compareFunction(tab1, tab2)
        {
            return tab1.title.localeCompare(tab2.title);
        }
        if (!this._retainTabOrder)
            tabsToShow.sort(compareFunction);

        var selectedId = null;
        for (var i = 0; i < tabsToShow.length; ++i) {
            var tab = tabsToShow[i];
            this._dropDownMenu.addItem(tab.id, tab.title);
            if (this._tabsHistory[0] === tab)
                selectedId = tab.id;
        }
        if (tabsToShow.length) {
            this._headerContentsElement.appendChild(this._dropDownButton);
            this._dropDownMenu.selectItem(selectedId);
        }
    },

    _measureDropDownButton: function()
    {
        this._dropDownButton.classList.add("measuring");
        this._headerContentsElement.appendChild(this._dropDownButton);
        this._measuredDropDownButtonWidth = this._dropDownButton.getBoundingClientRect().width;
        this._headerContentsElement.removeChild(this._dropDownButton);
        this._dropDownButton.classList.remove("measuring");
    },

    _updateWidths: function()
    {
        var measuredWidths = this._measureWidths();
        var maxWidth = this._shrinkableTabs ? this._calculateMaxWidth(measuredWidths.slice(), this._totalWidth()) : Number.MAX_VALUE;

        var i = 0;
        for (var tabId in this._tabs) {
            var tab = this._tabs[tabId];
            tab.setWidth(this._verticalTabLayout ? -1 : Math.min(maxWidth, measuredWidths[i++]));
        }
    },

    _measureWidths: function()
    {
        // Add all elements to measure into this._tabsElement
        this._tabsElement.style.setProperty("width", "2000px");
        var measuringTabElements = [];
        for (var tabId in this._tabs) {
            var tab = this._tabs[tabId];
            if (typeof tab._measuredWidth === "number")
                continue;
            var measuringTabElement = tab._createTabElement(true);
            measuringTabElement.__tab = tab;
            measuringTabElements.push(measuringTabElement);
            this._tabsElement.appendChild(measuringTabElement);
        }

        // Perform measurement
        for (var i = 0; i < measuringTabElements.length; ++i) {
            var width = measuringTabElements[i].getBoundingClientRect().width;
            measuringTabElements[i].__tab._measuredWidth = Math.ceil(width);
        }

        // Nuke elements from the UI
        for (var i = 0; i < measuringTabElements.length; ++i)
            measuringTabElements[i].remove();

        // Combine the results.
        var measuredWidths = [];
        for (var tabId in this._tabs)
            measuredWidths.push(this._tabs[tabId]._measuredWidth);
        this._tabsElement.style.removeProperty("width");

        return measuredWidths;
    },

    /**
     * @param {!Array.<number>} measuredWidths
     * @param {number} totalWidth
     */
    _calculateMaxWidth: function(measuredWidths, totalWidth)
    {
        if (!measuredWidths.length)
            return 0;

        measuredWidths.sort(function(x, y) { return x - y; });

        var totalMeasuredWidth = 0;
        for (var i = 0; i < measuredWidths.length; ++i)
            totalMeasuredWidth += measuredWidths[i];

        if (totalWidth >= totalMeasuredWidth)
            return measuredWidths[measuredWidths.length - 1];

        var totalExtraWidth = 0;
        for (var i = measuredWidths.length - 1; i > 0; --i) {
            var extraWidth = measuredWidths[i] - measuredWidths[i - 1];
            totalExtraWidth += (measuredWidths.length - i) * extraWidth;

            if (totalWidth + totalExtraWidth >= totalMeasuredWidth)
                return measuredWidths[i - 1] + (totalWidth + totalExtraWidth - totalMeasuredWidth) / (measuredWidths.length - i);
        }

        return totalWidth / measuredWidths.length;
    },

    /**
     * @param {!Array.<!WebInspector.TabbedPaneTab>} tabsOrdered
     * @param {!Array.<!WebInspector.TabbedPaneTab>} tabsHistory
     * @param {number} totalWidth
     * @param {number} measuredDropDownButtonWidth
     * @return {!Array.<number>}
     */
    _tabsToShowIndexes: function(tabsOrdered, tabsHistory, totalWidth, measuredDropDownButtonWidth)
    {
        var tabsToShowIndexes = [];

        var totalTabsWidth = 0;
        var tabCount = tabsOrdered.length;
        var tabsToLookAt = tabsOrdered.slice(0);
        if (this._currentTab !== undefined)
            tabsToLookAt.unshift(tabsToLookAt.splice(tabsToLookAt.indexOf(this._currentTab), 1)[0]);
        for (var i = 0; i < tabCount; ++i) {
            var tab = this._retainTabOrder ? tabsToLookAt[i] : tabsHistory[i];
            totalTabsWidth += tab.width();
            var minimalRequiredWidth = totalTabsWidth;
            if (i !== tabCount - 1)
                minimalRequiredWidth += measuredDropDownButtonWidth;
            if (!this._verticalTabLayout && minimalRequiredWidth > totalWidth)
                break;
            tabsToShowIndexes.push(tabsOrdered.indexOf(tab));
        }

        tabsToShowIndexes.sort(function(x, y) { return x - y; });

        return tabsToShowIndexes;
    },

    _hideCurrentTab: function()
    {
        if (!this._currentTab)
            return;

        this._hideTab(this._currentTab);
        delete this._currentTab;
    },

    /**
     * @param {!WebInspector.TabbedPaneTab} tab
     */
    _showTab: function(tab)
    {
        tab.tabElement.classList.add("selected");
        tab.view.show(this.element);
        this._updateTabSlider();
    },

    _updateTabSlider: function()
    {
        if (!this._currentTab)
            return;
        if (!this._sliderEnabled)
            return;
        var left = 0;
        for (var i = 0; i < this._tabs.length && this._currentTab !== this._tabs[i] && this._tabs[i]._shown; i++)
            left += this._tabs[i]._measuredWidth;
        var sliderWidth = this._currentTab._shown ? this._currentTab._measuredWidth : this._dropDownButton.offsetWidth;
        this._tabSlider.style.transform = "translateX(" + left + "px)";
        this._tabSlider.style.width = sliderWidth + "px";
    },

    /**
     * @param {!WebInspector.TabbedPaneTab} tab
     */
    _hideTab: function(tab)
    {
        tab.tabElement.classList.remove("selected");
        tab.view.detach();
    },

    /**
     * @override
     * @return {!Array.<!Element>}
     */
    elementsToRestoreScrollPositionsFor: function()
    {
        return [ this._contentElement ];
    },

    /**
     * @param {!WebInspector.TabbedPaneTab} tab
     * @param {number} index
     */
    _insertBefore: function(tab, index)
    {
        this._tabsElement.insertBefore(tab._tabElement || null, this._tabsElement.childNodes[index]);
        var oldIndex = this._tabs.indexOf(tab);
        this._tabs.splice(oldIndex, 1);
        if (oldIndex < index)
            --index;
        this._tabs.splice(index, 0, tab);
    },

    /**
     * @param {!Element} element
     */
    insertBeforeTabStrip: function(element)
    {
        element.classList.add("tabbed-pane-header-before");
        this.element.appendChild(element);
    },

    /**
     * @param {!Element} element
     */
    appendAfterTabStrip: function(element)
    {
        element.classList.add("tabbed-pane-header-after");
        this.element.appendChild(element);
    },

    renderWithNoHeaderBackground: function()
    {
        this._headerElement.classList.add("tabbed-pane-no-header-background");
    },

    __proto__: WebInspector.VBox.prototype
}

/**
 * @constructor
 * @param {!WebInspector.TabbedPane} tabbedPane
 * @param {string} id
 * @param {string} title
 * @param {boolean} closeable
 * @param {!WebInspector.Widget} view
 * @param {string=} tooltip
 */
WebInspector.TabbedPaneTab = function(tabbedPane, id, title, closeable, view, tooltip)
{
    this._closeable = closeable;
    this._tabbedPane = tabbedPane;
    this._id = id;
    this._title = title;
    this._tooltip = tooltip;
    this._view = view;
    this._shown = false;
    /** @type {number} */ this._measuredWidth;
    /** @type {!Element|undefined} */ this._tabElement;
}

WebInspector.TabbedPaneTab.prototype = {
    /**
     * @return {string}
     */
    get id()
    {
        return this._id;
    },

    /**
     * @return {string}
     */
    get title()
    {
        return this._title;
    },

    set title(title)
    {
        if (title === this._title)
            return;
        this._title = title;
        if (this._titleElement)
            this._titleElement.textContent = title;
        delete this._measuredWidth;
    },

    /**
     * @return {boolean}
     */
    isCloseable: function()
    {
        return this._closeable;
    },

    /**
     * @param {string} iconType
     * @param {string=} iconTooltip
     * @return {boolean}
     */
    _setIconType: function(iconType, iconTooltip)
    {
        if (iconType === this._iconType && iconTooltip === this._iconTooltip)
            return false;
        this._iconType = iconType;
        this._iconTooltip = iconTooltip;
        if (this._tabElement)
            this._createIconElement(this._tabElement, this._titleElement);
        delete this._measuredWidth;
        return true;
    },

    /**
     * @param {string} className
     * @param {boolean=} force
     * @return {boolean}
     */
    _toggleClass: function(className, force)
    {
        var element = this.tabElement;
        var hasClass = element.classList.contains(className);
        if (hasClass === force)
            return false;
        element.classList.toggle(className, force);
        delete this._measuredWidth;
        return true;
    },

    /**
     * @return {!WebInspector.Widget}
     */
    get view()
    {
        return this._view;
    },

    set view(view)
    {
        this._view = view;
    },

    /**
     * @return {string|undefined}
     */
    get tooltip()
    {
        return this._tooltip;
    },

    set tooltip(tooltip)
    {
        this._tooltip = tooltip;
        if (this._titleElement)
            this._titleElement.title = tooltip || "";
    },

    /**
     * @return {!Element}
     */
    get tabElement()
    {
        if (!this._tabElement)
            this._tabElement = this._createTabElement(false);

        return this._tabElement;
    },

    /**
     * @return {number}
     */
    width: function()
    {
        return this._width;
    },

    /**
     * @param {number} width
     */
    setWidth: function(width)
    {
        this.tabElement.style.width = width === -1 ? "" : (width + "px");
        this._width = width;
    },

    /**
     * @param {!WebInspector.TabbedPaneTabDelegate} delegate
     */
    setDelegate: function(delegate)
    {
        this._delegate = delegate;
    },

    /**
     * @param {!Element} tabElement
     * @param {!Element} titleElement
     */
    _createIconElement: function(tabElement, titleElement)
    {
        if (tabElement.__iconElement)
            tabElement.__iconElement.remove();
        if (!this._iconType)
            return;

        var iconElement = createElementWithClass("label", "tabbed-pane-header-tab-icon", "dt-icon-label");
        iconElement.type = this._iconType;
        if (this._iconTooltip)
            iconElement.title = this._iconTooltip;
        tabElement.insertBefore(iconElement, titleElement);
        tabElement.__iconElement = iconElement;
    },

    /**
     * @param {boolean} measuring
     * @return {!Element}
     */
    _createTabElement: function(measuring)
    {
        var tabElement = createElementWithClass("div", "tabbed-pane-header-tab");
        tabElement.id = "tab-" + this._id;
        tabElement.tabIndex = -1;
        tabElement.selectTabForTest = this._tabbedPane.selectTab.bind(this._tabbedPane, this.id, true);

        var titleElement = tabElement.createChild("span", "tabbed-pane-header-tab-title");
        titleElement.textContent = this.title;
        titleElement.title = this.tooltip || "";
        this._createIconElement(tabElement, titleElement);
        if (!measuring)
            this._titleElement = titleElement;

        if (this._closeable)
            tabElement.createChild("div", "tabbed-pane-close-button", "dt-close-button").gray = true;

        if (measuring) {
            tabElement.classList.add("measuring");
        } else {
            tabElement.addEventListener("click", this._tabClicked.bind(this), false);
            tabElement.addEventListener("mousedown", this._tabMouseDown.bind(this), false);
            tabElement.addEventListener("mouseup", this._tabMouseUp.bind(this), false);

            tabElement.addEventListener("contextmenu", this._tabContextMenu.bind(this), false);
            if (this._closeable)
                WebInspector.installDragHandle(tabElement, this._startTabDragging.bind(this), this._tabDragging.bind(this), this._endTabDragging.bind(this), "pointer");
        }

        return tabElement;
    },

    /**
     * @param {!Event} event
     */
    _tabClicked: function(event)
    {
        var middleButton = event.button === 1;
        var shouldClose = this._closeable && (middleButton || event.target.classList.contains("tabbed-pane-close-button"));
        if (!shouldClose) {
            this._tabbedPane.focus();
            return;
        }
        this._closeTabs([this.id]);
        event.consume(true);
    },

    /**
     * @param {!Event} event
     */
    _tabMouseDown: function(event)
    {
        if (event.target.classList.contains("tabbed-pane-close-button") || event.button === 1)
            return;
        this._tabbedPane.selectTab(this.id, true);
    },

    /**
     * @param {!Event} event
     */
    _tabMouseUp: function(event)
    {
        // This is needed to prevent middle-click pasting on linux when tabs are clicked.
        if (event.button === 1)
            event.consume(true);
    },

    /**
     * @param {!Array.<string>} ids
     */
    _closeTabs: function(ids)
    {
        if (this._delegate) {
            this._delegate.closeTabs(this._tabbedPane, ids);
            return;
        }
        this._tabbedPane.closeTabs(ids, true);
    },

    _tabContextMenu: function(event)
    {
        /**
         * @this {WebInspector.TabbedPaneTab}
         */
        function close()
        {
            this._closeTabs([this.id]);
        }

        /**
         * @this {WebInspector.TabbedPaneTab}
         */
        function closeOthers()
        {
            this._closeTabs(this._tabbedPane.otherTabs(this.id));
        }

        /**
         * @this {WebInspector.TabbedPaneTab}
         */
        function closeAll()
        {
            this._closeTabs(this._tabbedPane.allTabs());
        }

        /**
         * @this {WebInspector.TabbedPaneTab}
         */
        function closeToTheRight()
        {
            this._closeTabs(this._tabbedPane._tabsToTheRight(this.id));
        }

        var contextMenu = new WebInspector.ContextMenu(event);
        if (this._closeable) {
            contextMenu.appendItem(WebInspector.UIString.capitalize("Close"), close.bind(this));
            contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^others"), closeOthers.bind(this));
            contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^tabs to the ^right"), closeToTheRight.bind(this));
            contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^all"), closeAll.bind(this));
        }
        if (this._delegate)
            this._delegate.onContextMenu(this.id, contextMenu);
        contextMenu.show();
    },

    /**
     * @param {!Event} event
     * @return {boolean}
     */
    _startTabDragging: function(event)
    {
        if (event.target.classList.contains("tabbed-pane-close-button"))
            return false;
        this._dragStartX = event.pageX;
        return true;
    },

    /**
     * @param {!Event} event
     */
    _tabDragging: function(event)
    {
        var tabElements = this._tabbedPane._tabsElement.childNodes;
        for (var i = 0; i < tabElements.length; ++i) {
            var tabElement = tabElements[i];
            if (tabElement === this._tabElement)
                continue;

            var intersects = tabElement.offsetLeft + tabElement.clientWidth > this._tabElement.offsetLeft &&
                this._tabElement.offsetLeft + this._tabElement.clientWidth > tabElement.offsetLeft;
            if (!intersects)
                continue;

            if (Math.abs(event.pageX - this._dragStartX) < tabElement.clientWidth / 2 + 5)
                break;

            if (event.pageX - this._dragStartX > 0) {
                tabElement = tabElement.nextSibling;
                ++i;
            }

            var oldOffsetLeft = this._tabElement.offsetLeft;
            this._tabbedPane._insertBefore(this, i);
            this._dragStartX += this._tabElement.offsetLeft - oldOffsetLeft;
            break;
        }

        if (!this._tabElement.previousSibling && event.pageX - this._dragStartX < 0) {
            this._tabElement.style.setProperty("left", "0px");
            return;
        }
        if (!this._tabElement.nextSibling && event.pageX - this._dragStartX > 0) {
            this._tabElement.style.setProperty("left", "0px");
            return;
        }

        this._tabElement.style.setProperty("position", "relative");
        this._tabElement.style.setProperty("left", (event.pageX - this._dragStartX) + "px");
    },

    /**
     * @param {!Event} event
     */
    _endTabDragging: function(event)
    {
        this._tabElement.style.removeProperty("position");
        this._tabElement.style.removeProperty("left");
        delete this._dragStartX;
    }
}

/**
 * @interface
 */
WebInspector.TabbedPaneTabDelegate = function()
{
}

WebInspector.TabbedPaneTabDelegate.prototype = {
    /**
     * @param {!WebInspector.TabbedPane} tabbedPane
     * @param {!Array.<string>} ids
     */
    closeTabs: function(tabbedPane, ids) { },

    /**
     * @param {string} tabId
     * @param {!WebInspector.ContextMenu} contextMenu
     */
    onContextMenu: function(tabId, contextMenu) { }
}

/**
 * @constructor
 * @param {!WebInspector.TabbedPane} tabbedPane
 * @param {string} extensionPoint
 * @param {function(string, !WebInspector.Widget)=} viewCallback
 */
WebInspector.ExtensibleTabbedPaneController = function(tabbedPane, extensionPoint, viewCallback)
{
    this._tabbedPane = tabbedPane;
    this._extensionPoint = extensionPoint;
    this._viewCallback = viewCallback;
    this._tabOrders = {};
    /** @type {!Object.<string, !Promise.<?WebInspector.Widget>>} */
    this._promiseForId = {};

    this._tabbedPane.setRetainTabOrder(true, this._tabOrderComparator.bind(this));
    this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, this._tabSelected, this);
    /** @type {!Map.<string, ?WebInspector.Widget>} */
    this._views = new Map();
    this._initialize();
}

WebInspector.ExtensibleTabbedPaneController.prototype = {
    _initialize: function()
    {
        /** @type {!Map.<string, !Runtime.Extension>} */
        this._extensions = new Map();
        var extensions = self.runtime.extensions(this._extensionPoint);

        for (var i = 0; i < extensions.length; ++i) {
            var descriptor = extensions[i].descriptor();
            var id = descriptor["name"];
            this._tabOrders[id] = i;
            var title = WebInspector.UIString(descriptor["title"]);

            this._extensions.set(id, extensions[i]);
            this._tabbedPane.appendTab(id, title, new WebInspector.Widget());
        }
    },

    /**
     * @param {string} id
     * @param {string} title
     * @param {number} order
     * @param {!WebInspector.Widget} view
     */
    appendView: function(id, title, order, view)
    {
        this._tabOrders[id] = order;
        this._views.set(id, view);
        this._tabbedPane.appendTab(id, title, new WebInspector.Widget());
    },

    /**
     * @param {!WebInspector.Event} event
     */
    _tabSelected: function(event)
    {
        var tabId = /** @type {string} */ (event.data.tabId);
        this.viewForId(tabId).then(viewLoaded.bind(this));

        /**
         * @this {WebInspector.ExtensibleTabbedPaneController}
         * @param {?WebInspector.Widget} view
         */
        function viewLoaded(view)
        {
            if (!view)
                return;
            this._tabbedPane.changeTabView(tabId, view);
            var shouldFocus = this._tabbedPane.visibleView.element.isSelfOrAncestor(WebInspector.currentFocusElement());
            if (shouldFocus)
                view.focus();
        }
    },

    /**
     * @return {!Array.<string>}
     */
    viewIds: function()
    {
        return this._extensions.keysArray();
    },

    /**
     * @param {string} id
     * @return {!Promise.<?WebInspector.Widget>}
     */
    viewForId: function(id)
    {
        if (this._views.has(id))
            return Promise.resolve(/** @type {?WebInspector.Widget} */ (this._views.get(id)));
        if (!this._extensions.has(id))
            return Promise.resolve(/** @type {?WebInspector.Widget} */ (null));
        if (this._promiseForId[id])
            return this._promiseForId[id];

        var promise = this._extensions.get(id).instancePromise();
        this._promiseForId[id] = /** @type {!Promise.<?WebInspector.Widget>} */ (promise);
        return promise.then(cacheView.bind(this));

        /**
         * @param {!Object} object
         * @this {WebInspector.ExtensibleTabbedPaneController}
         */
        function cacheView(object)
        {
            var view = /** @type {!WebInspector.Widget} */ (object);
            delete this._promiseForId[id];
            this._views.set(id, view);
            if (this._viewCallback && view)
                this._viewCallback(id, view);
            return view;
        }
    },

    /**
     * @param {string} id1
     * @param {string} id2
     * @return {number}
     */
    _tabOrderComparator: function(id1, id2)
    {
        return this._tabOrders[id2] = this._tabOrders[id1];
    }
}

redpajama_set_name: RedPajamaGithub


text:
https://www.beecrowd.com.br/judge/en/problems/view/2602

# Basic Select

Your company is doing a survey of how many customers are registered in the
states, however, lacked to raise the data of the state of the 'Rio Grande do
Sul'.

Then, you must show the names of all customers whose state is 'RS'.


text:
import React, {
  View,
  Text,
  Image,
  ListView,
  StyleSheet,
  TouchableHighlight,
  RecyclerViewBackedScrollView
} from 'react-native'

import UIExplorerPage from '../UIExplorerPage'

export const title = 'ListViewGridLayoutExample - Flexbox grid layout.'
export default class ListViewSimpleExample extends React.Component {
  constructor (props) {
    super(props)
    const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2})
    this.state = {
      dataSource: ds.cloneWithRows(this._getRows({}))
    }
  }

  componentWillMount () {
    this._pressData = {}
  }

  render () {
    return (
      <UIExplorerPage
        title={this.props.navigator ? null : title}
        onSpacer={true}
        onScroll={true}>
        <ListView
          contentContainerStyle={styles.list}
          dataSource={this.state.dataSource}
          renderRow={this._renderRow.bind(this)}
        />
      </UIExplorerPage>
    )
  }

  _renderRow (rowData, sectionID, rowID) {
    const rowHash = Math.abs(hashCode(rowData))
    const imgSource = THUMB_URLS[rowHash % THUMB_URLS.length]
    return (
      <TouchableHighlight onPress={() => this._pressRow(rowID)} underlayColor="transparent">
        <View style={styles.row}>
          <Image style={styles.thumb} source={imgSource}/>
          <Text style={styles.text}>
            {rowData}
          </Text>
        </View>
      </TouchableHighlight>
    )
  }

  _getRows (pressData) {
    const dataBlob = []
    for (let i = 0; i < 100; i++) {
      let pressedText = pressData[i] ? ' (X)' : ''
      dataBlob.push('Cell ' + i + pressedText)
    }
    return dataBlob
  }

  _pressRow (rowID) {
    this._pressData[rowID] = !this._pressData[rowID]
    this.setState({
      dataSource: this.state.dataSource.cloneWithRows(
        this._getRows(this._pressData)
      )
    })
  }
}

const THUMB_URLS = [
  require('../../styles/img/Thumbnails/like.png'),
  require('../../styles/img/Thumbnails/dislike.png'),
  require('../../styles/img/Thumbnails/call.png'),
  require('../../styles/img/Thumbnails/fist.png'),
  require('../../styles/img/Thumbnails/bandaged.png'),
  require('../../styles/img/Thumbnails/flowers.png'),
  require('../../styles/img/Thumbnails/heart.png'),
  require('../../styles/img/Thumbnails/liking.png'),
  require('../../styles/img/Thumbnails/party.png'),
  require('../../styles/img/Thumbnails/poke.png'),
  require('../../styles/img/Thumbnails/superlike.png'),
  require('../../styles/img/Thumbnails/victory.png')
]

const LOREM_IPSUM = 'Lorem ipsum dolor sit amet, ius ad pertinax oportere accommodare'

const hashCode = function (str) {
  let hash = 15
  for (let i = str.length - 1; i >= 0; i--) {
    hash = ((hash << 5) - hash) + str.charCodeAt(i)
  }
  return hash
}

const styles = StyleSheet.create({
  list: {
    justifyContent: 'space-around',
    flexDirection: 'row',
    flexWrap: 'wrap'
  },
  row: {
    justifyContent: 'center',
    padding: 5,
    margin: 3,
    width: 100,
    height: 100,
    backgroundColor: '#F6F6F6',
    alignItems: 'center',
    borderWidth: 1,
    borderRadius: 5,
    borderColor: '#CCC'
  },
  thumb: {
    width: 64,
    height: 64
  },
  text: {
    flex: 1,
    marginTop: 5,
    fontWeight: 'bold'
  }
})


text:
var _ = require('underscore'),
    jsonValidator = require('../jsonValidator');

exports.basicTest = function (test) {
    var validateName = function (value) {
        return _.contains(['basketball', 'baseball', 'football'], value);
    };

    var schema = {
        type: 'array',
        items: {
            type: 'object',
            properties: {
                name: { type: 'string', validate: validateName },
                players: { type: 'number', optional: true },
                popularity: [
                    { type: 'boolean' },
                    { type: 'number' }
                ]
            }
        }
    };

    var json = [
        {
            name: 'basketball',
            players: 5,
            popularity: 8
        },
        {
            name: 'baseball',
            players: 9,
            popularity: true
        },
        {
            name: 'football',
            popularity: 10
        }
    ];

    var result = jsonValidator.validateJson(json, schema);
    test.ok(result.success, result.errors.join('; '));
    test.done();
};


text:
.class final Lcom/android/server/SdpManagerService$StateListener;
.super Ljava/lang/Object;
.source "SdpManagerService.java"

# interfaces
.implements Landroid/os/IBinder$DeathRecipient;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/SdpManagerService;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x12
    name = "StateListener"
.end annotation

# instance fields
.field mEngineId:I

.field mIsValid:Z

.field mWeakListener:Ljava/lang/ref/WeakReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/WeakReference",
            "<",
            "Landroid/os/ISdpListener;",
            ">;"
        }
    .end annotation
.end field

.field final synthetic this$0:Lcom/android/server/SdpManagerService;

# direct methods
.method constructor <init>(Lcom/android/server/SdpManagerService;ILandroid/os/ISdpListener;)V
    .locals 2

    iput-object p1, p0, Lcom/android/server/SdpManagerService$StateListener;->this$0:Lcom/android/server/SdpManagerService;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/android/server/SdpManagerService$StateListener;->mIsValid:Z

    iput p2, p0, Lcom/android/server/SdpManagerService$StateListener;->mEngineId:I

    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p3}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/android/server/SdpManagerService$StateListener;->mWeakListener:Ljava/lang/ref/WeakReference;

    invoke-virtual {p0}, Lcom/android/server/SdpManagerService$StateListener;->asBinder()Landroid/os/IBinder;

    move-result-object v0

    invoke-static {v0}, Ljava/util/Optional;->ofNullable(Ljava/lang/Object;)Ljava/util/Optional;

    move-result-object v0

    new-instance v1, Lcom/android/server/-$Lambda$lhXyqUMYqEEsOESeK7W8eqkbJis;

    invoke-direct {v1, p0}, Lcom/android/server/-$Lambda$lhXyqUMYqEEsOESeK7W8eqkbJis;-><init>(Ljava/lang/Object;)V

    invoke-virtual {v0, v1}, Ljava/util/Optional;->ifPresent(Ljava/util/function/Consumer;)V

    return-void
.end method

# virtual methods
.method asBinder()Landroid/os/IBinder;
    .locals 2

    const/4 v1, 0x0

    invoke-virtual {p0}, Lcom/android/server/SdpManagerService$StateListener;->get()Landroid/os/ISdpListener;

    move-result-object v0

    if-nez v0, :cond_0

    :goto_0
    return-object v1

    :cond_0
    invoke-interface {v0}, Landroid/os/ISdpListener;->asBinder()Landroid/os/IBinder;

    move-result-object v1

    goto :goto_0
.end method

.method public binderDied()V
    .locals 3

    iget-object v0, p0, Lcom/android/server/SdpManagerService$StateListener;->this$0:Lcom/android/server/SdpManagerService;

    invoke-static {v0}, Lcom/android/server/SdpManagerService;->-get3(Lcom/android/server/SdpManagerService;)Ljava/util/Map;

    move-result-object v1

    monitor-enter v1

    :try_start_0
    invoke-virtual {p0}, Lcom/android/server/SdpManagerService$StateListener;->dispose()V

    iget-object v0, p0, Lcom/android/server/SdpManagerService$StateListener;->this$0:Lcom/android/server/SdpManagerService;

    iget v2, p0, Lcom/android/server/SdpManagerService$StateListener;->mEngineId:I

    invoke-static {v0, v2}, Lcom/android/server/SdpManagerService;->-wrap18(Lcom/android/server/SdpManagerService;I)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit v1

    return-void

    :catchall_0
    move-exception v0

    monitor-exit v1

    throw v0
.end method

.method dispose()V
    .locals 2

    iget-boolean v0, p0, Lcom/android/server/SdpManagerService$StateListener;->mIsValid:Z

    if-nez v0, :cond_0

    return-void

    :cond_0
    invoke-virtual {p0}, Lcom/android/server/SdpManagerService$StateListener;->getParent()Lcom/android/server/SdpManagerService$ListenerRoll;

    move-result-object v0

    if-eqz v0, :cond_1

    invoke-virtual {p0}, Lcom/android/server/SdpManagerService$StateListener;->getParent()Lcom/android/server/SdpManagerService$ListenerRoll;

    move-result-object v0

    invoke-virtual {v0, p0}, Lcom/android/server/SdpManagerService$ListenerRoll;->disenroll(Lcom/android/server/SdpManagerService$StateListener;)Z

    :cond_1
    invoke-virtual {p0}, Lcom/android/server/SdpManagerService$StateListener;->asBinder()Landroid/os/IBinder;

    move-result-object v0

    invoke-static {v0}, Ljava/util/Optional;->ofNullable(Ljava/lang/Object;)Ljava/util/Optional;

    move-result-object v0

    new-instance v1, Lcom/android/server/-$Lambda$lhXyqUMYqEEsOESeK7W8eqkbJis$1;

    invoke-direct {v1, p0}, Lcom/android/server/-$Lambda$lhXyqUMYqEEsOESeK7W8eqkbJis$1;-><init>(Ljava/lang/Object;)V

    invoke-virtual {v0, v1}, Ljava/util/Optional;->ifPresent(Ljava/util/function/Consumer;)V

    invoke-virtual {p0}, Lcom/android/server/SdpManagerService$StateListener;->releaseReferences()V

    return-void
.end method

.method get()Landroid/os/ISdpListener;
    .locals 1

    iget-object v0, p0, Lcom/android/server/SdpManagerService$StateListener;->mWeakListener:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/os/ISdpListener;

    return-object v0
.end method

.method getParent()Lcom/android/server/SdpManagerService$ListenerRoll;
    .locals 2

    iget-object v0, p0, Lcom/android/server/SdpManagerService$StateListener;->this$0:Lcom/android/server/SdpManagerService;

    invoke-static {v0}, Lcom/android/server/SdpManagerService;->-get3(Lcom/android/server/SdpManagerService;)Ljava/util/Map;

    move-result-object v0

    iget v1, p0, Lcom/android/server/SdpManagerService$StateListener;->mEngineId:I

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/android/server/SdpManagerService$ListenerRoll;

    return-object v0
.end method

.method isValid()Z
    .locals 1

    iget-boolean v0, p0, Lcom/android/server/SdpManagerService$StateListener;->mIsValid:Z

    return v0
.end method

.method synthetic lambda$-com_android_server_SdpManagerService$StateListener_122703(Landroid/os/IBinder;)V
    .locals 3

    const/4 v1, 0x0

    :try_start_0
    invoke-interface {p1, p0, v1}, Landroid/os/IBinder;->linkToDeath(Landroid/os/IBinder$DeathRecipient;I)V

    const/4 v1, 0x1

    iput-boolean v1, p0, Lcom/android/server/SdpManagerService$StateListener;->mIsValid:Z
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    const-string/jumbo v1, "SdpManagerService"

    const-string/jumbo v2, "Failed to link death listener..."

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    invoke-virtual {p0}, Lcom/android/server/SdpManagerService$StateListener;->releaseReferences()V

    goto :goto_0
.end method

.method synthetic lambda$-com_android_server_SdpManagerService$StateListener_123942(Landroid/os/IBinder;)V
    .locals 4

    const/4 v2, 0x0

    :try_start_0
    invoke-interface {p1, p0, v2}, Landroid/os/IBinder;->unlinkToDeath(Landroid/os/IBinder$DeathRecipient;I)Z
    :try_end_0
    .catch Ljava/lang/NullPointerException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    const-string/jumbo v2, "SdpManagerService"

    const-string/jumbo v3, "Failed to unlink death listener"

    invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_0

    :catch_1
    move-exception v1

    const-string/jumbo v2, "SdpManagerService"

    const-string/jumbo v3, "Listener might be already finalized..."

    invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method releaseReferences()V
    .locals 1

    iget-object v0, p0, Lcom/android/server/SdpManagerService$StateListener;->mWeakListener:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->clear()V

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/android/server/SdpManagerService$StateListener;->mIsValid:Z

    return-void
.end method


text:
<bill session="115" type="sj" number="18" updated="2017-05-04T00:17:58Z">
  <state datetime="2017-02-01">REFERRED</state>
  <status>
    <introduced datetime="2017-02-01"/>
  </status>
  <introduced datetime="2017-02-01"/>
  <titles>
    <title type="official" as="introduced">A joint resolution providing for congressional disapproval under chapter 8 of title 5, United States Code, of the final rule submitted by the Department of the Interior relating to Non-Subsistence Take of Wildlife, and Public Participation and Closure Procedures, on National Wildlife Refuges in Alaska.</title>
    <title type="display">A joint resolution providing for congressional disapproval under chapter 8 of title 5, United States Code, of the final rule submitted by the Department of the Interior relating to Non-Subsistence Take of Wildlife, and Public Participation and Closure Procedures, on National Wildlife Refuges in Alaska.</title>
  </titles>
  <sponsor bioguide_id="S001198"/>
  <cosponsors>
    <cosponsor bioguide_id="F000444" joined="2017-02-27"/>
    <cosponsor bioguide_id="M001153" joined="2017-02-01"/>
  </cosponsors>
  <actions>
    <action datetime="2017-02-01">
      <text>Introduced in Senate</text>
    </action>
    <action datetime="2017-02-01" state="REFERRED">
      <text>Read twice and referred to the Committee on Energy and Natural Resources.</text>
    </action>
  </actions>
  <committees>
    <committee subcommittee="" code="SSEG" name="Senate Energy and Natural Resources" activity="Referral"/>
  </committees>
  <relatedbills>
    <bill type="hj" session="115" relation="unknown" number="35"/>
    <bill type="hj" session="115" relation="unknown" number="49"/>
    <bill type="hj" session="115" relation="unknown" number="69"/>
  </relatedbills>
  <subjects>
    <term name="Public lands and natural resources"/>
    <term name="Administrative law and regulatory procedures"/>
    <term name="Alaska"/>
    <term name="Congressional oversight"/>
    <term name="Department of the Interior"/>
    <term name="Hunting and fishing"/>
    <term name="Wilderness and natural areas, wildlife refuges, wild rivers, habitats"/>
    <term name="Wildlife conservation and habitat protection"/>
  </subjects>
  <amendments/>
  <summary date="2017-02-01T05:00:00Z" status="Introduced in Senate">This joint resolution nullifies the rule finalized by the Department of the Interior on August 5, 2016, relating to non-subsistence takings of wildlife and public participation and closure procedures on National Wildlife Refuges in Alaska.</summary>
  <committee-reports/>
</bill>


text:
    html, body, div, span, object, iframe,
    h1, h2, h3, h4, h5, h6, p, blockquote, pre,
    abbr, address, cite, code,
    del, dfn, em, img, ins, kbd, q, samp,
    small, strong, sub, sup, var,
    b, i,
    dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td,
    article, aside, canvas, details, figcaption, figure,
    footer, header, hgroup, menu, nav, section, summary,
    time, mark, audio, video {
        margin:0;
        padding:0;
        border:0;
        outline:0;
        font-size:100%;
        vertical-align:baseline;
        background:transparent;
    }

    body {
        line-height:1;
    }

    img{
        max-width: 100%;
    }

    article,aside,details,figcaption,figure,
    footer,header,hgroup,menu,nav,section {
        display:block;
    }

    nav ul {
        list-style:none;
    }

    blockquote, q {
        quotes:none;
    }

    blockquote:before, blockquote:after,
    q:before, q:after {
        content:'';
        content:none;
    }

    a {
        margin:0;
        padding:0;
        font-size:100%;
        vertical-align:baseline;
        background:transparent;
        color: #454545;
    }

    /* change colours to suit your needs */
    ins {
        background-color:#ff9;
        color:#000;
        text-decoration:none;
    }

    /* change colours to suit your needs */
    mark {
        background-color:#ff9;
        color:#000;
        font-style:italic;
        font-weight:bold;
    }

    del {
        text-decoration: line-through;
    }

    abbr[title], dfn[title] {
        border-bottom:1px dotted;
        cursor:help;
    }

    table {
        border-collapse:collapse;
        border-spacing:0;
    }

    /* change border colour to suit your needs */
    hr {
        display:block;
        height:1px;
        border:0;
        border-top:1px solid #cccccc;
        margin:1em 0;
        padding:0;
    }

    input, select {
        vertical-align:middle;
    }


text:
using System;
using System.IO;
using System.Linq;
using System.Text;
using Pulse.Core;

namespace Pulse.FS
{
    public sealed class YkdBlockEntry : IStreamingContent
    {
        private const int NameSize = 16;

        public string Name;
        public YkdOffsets Offsets;
        public YkdFrames[] Frames;

        public int CalcSize()
        {
            YkdFrames[] frames = Frames ?? new YkdFrames[0];
            YkdOffsets offsets = new YkdOffsets {Offsets = new int[frames.Length]};

            return NameSize + offsets.CalcSize() + frames.Sum(t => t.CalcSize());
        }

        public unsafe void ReadFromStream(Stream stream)
        {
            byte[] name = stream.EnsureRead(NameSize);
            fixed (byte* namePtr = &name[0])
                Name = new string((sbyte*)namePtr, 0, NameSize, YkdFile.NamesEncoding).TrimEnd('\0');

            Offsets = stream.ReadContent<YkdOffsets>();
            Frames = new YkdFrames[Offsets.Count];
            for (int i = 0; i < Frames.Length; i++)
                Frames[i] = stream.ReadContent<YkdFrames>();
        }

        public void WriteToStream(Stream stream)
        {
            byte[] name = new byte[NameSize];
            YkdFile.NamesEncoding.GetBytes(Name, 0, Name.Length, name, 0);
            stream.Write(name, 0, name.Length);

            YkdOffsets.WriteToStream(stream, ref Offsets, ref Frames, b => b.CalcSize());
            stream.WriteContent(Frames);
        }
    }
}


text:
package shared

type ServerStateEnvironment struct {
	Addresses          []string `json:"addresses"`
	Architectures      []int    `json:"architectures"`
	Driver             string   `json:"driver"`
	DriverVersion      string   `json:"driver_version"`
	Kernel             string   `json:"kernel"`
	KernelArchitecture string   `json:"kernel_architecture"`
	KernelVersion      string   `json:"kernel_version"`
	Server             string   `json:"server"`
	ServerPid          int      `json:"server_pid"`
	ServerVersion      string   `json:"server_version"`
	Storage            string   `json:"storage"`
	StorageVersion     string   `json:"storage_version"`
	Processors         string   `json:"processors"`
	Cores              string   `json:"cores"`
	Memory              string  `json:"memory"`
}

type ServerState struct {
	APICompat   int                    `json:"api_compat"`
	Auth        string                 `json:"auth"`
	Environment ServerStateEnvironment `json:"environment"`
	Config      map[string]interface{} `json:"config"`
	Public      bool                   `json:"public"`
}

type BriefServerState struct {
	Config map[string]interface{} `json:"config"`
}

func (c *ServerState) BriefState() BriefServerState {
	retstate := BriefServerState{Config: c.Config}
	return retstate
}


text:
require 'colorize'
require 'numeric_range_utils'
require_relative '../protocols/user_interface'
require_relative '../views/text_user_interface' # default user_interface

class Game

  attr_accessor :player,         :before_turn,
                :after_turn,     :user_interface,
                :allow_wait

  attr_reader   :keywords,       :turn_rand

  def initialize(*args)
    if args.length == 2 &&
    !args.select { |o| o.class == Player }.empty? &&
    !args.select { |o| o.class != Player && o.conform_to?(UserInterface)}.empty?
      @player = args.select { |o| o.class == Player }
      @user_interface = args.select { |o| o.class != Player }
    elsif args.length == 1 && args[0].class == Hash
      @player = args[0][:player]
      @before_turn = args[0][:before_turn] if args[0][:before_turn]
      @after_turn = args[0][:after_turn] if args[0][:after_turn]
      @user_interface = args[0][:user_interface] if args[0][:user_interface]
      if args[0].keys.include? :allow_wait
        @allow_wait = args[0][:allow_wait]
        allow_wait_provided = true
      end
    elsif args.length == 1 && args[0].class == Player
      @player = args[0]
    else
      raise ArgumentError
    end
    @before_turn ||= -> {}
    @after_turn ||= -> {}
    @user_interface ||= TextUserInterface.new

    @keywords = %w{quit exit inventory equipment}
    @allow_wait = true unless allow_wait_provided
    @keywords << "wait" if @allow_wait
    @turn_rand = rand
  end

  def start
    @player.go @player.spawn_page

    chosen_option = ""
    new_turn = true
    loop do
      if new_turn
        @turn_rand = rand

        before_turn.call
      else
        new_turn = true
      end

      chosen_option = @user_interface.get_player_option player, @keywords

      case chosen_option
      when "wait"
        redo if @allow_wait
      when "quit", "exit"
        break
      end

      chosen_passage = @player.page.passages.select { |p|
        p.option == chosen_option
      }.first

      if chosen_passage
        if chosen_passage.condition.call
          @player.go chosen_passage.destination
          @user_interface.describe_chosen_passage chosen_passage
          chosen_passage.after_departure.call
        end
      elsif chosen_option =~ /\Aget .*\z/ || chosen_option =~ /\Ainspect .*\z/
        match_data = chosen_option.match(/\A(get|inspect) (.*)\z/)
        chosen_verb = match_data[1]
        chosen_item_name = match_data[2]
        chosen_page_item = @player.page.page_items.select { |pi|
          [pi.item.short_name.downcase, pi.item.name.downcase].
            include?(chosen_item_name.downcase)
        }.first
        unless chosen_page_item
          # TODO: user_interface should do this part
          new_turn = false
          redo
        end
        chosen_item = chosen_page_item.item
        if chosen_verb == "get"
          successful = @player.inventory.try_to_add(chosen_item)
          @user_interface.describe_trying_to_add_item_to_inventory(
            chosen_item,
            @player.inventory,
            successful
          )
          @player.page.page_items.delete chosen_page_item if successful
        elsif chosen_verb == "inspect"
          @user_interface.inspect_item(chosen_item)
        end
        new_turn = false
      elsif chosen_option == "inventory" || chosen_option == "equipment"
        @user_interface.inventory_and_equipment_menu(@player)
        new_turn = false
      end

    end

    return true
  end

  def turn_rand(values = nil)
    return @turn_rand unless values
    NumericRangeUtils.shift_proportions(@turn_rand, 0..1, (0..values - 1)).round
  end

end


text:
package org.onosproject.ovsdb.controller;

import static com.google.common.base.MoreObjects.toStringHelper;

import java.util.Objects;

/**
 * The class representing a port number. This class is immutable.
 */
public final class OvsdbPortNumber {

    private final long value;

    /**
     * Constructor from a long port number.
     *
     * @param value the port number to use
     */
    public OvsdbPortNumber(long value) {
        this.value = value;
    }

    /**
     * Gets the value of the port number.
     *
     * @return the value of the port number
     */
    public long value() {
        return value;
    }

    @Override
    public int hashCode() {
        return Objects.hash(value);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof OvsdbPortNumber) {
            final OvsdbPortNumber ovsdbPortNumber = (OvsdbPortNumber) obj;
            return Objects.equals(this.value, ovsdbPortNumber.value);
        }
        return false;
    }

    @Override
    public String toString() {
        return toStringHelper(this).add("value", value).toString();
    }
}


text:
<?php
$albumId = intval($_GET['albumId']);
$photoNo = intval($_GET['photoNo']);
$photoCount = intval($_GET['photoCount']);
$previous = $photoNo - 1;
$next = $photoNo + 1;

include("functions.php");
$db = new DataBase();
$albumTitle = __getSingleValue($db::PHOTOALBUMS_TITLECOL, $db::PHOTOALBUMS_TABLENAME, $db::PHOTOALBUMS_IDCOL, $albumId);
$albumTitleStripped = strtolower(str_replace(array('  ', ' '), '-', preg_replace('/[^a-zA-Z0-9 s]/', '', trim($albumTitle))));
$albumDescription = __getSingleValue($db::PHOTOALBUMS_DESCRIPTIONCOL, $db::PHOTOALBUMS_TABLENAME, $db::PHOTOALBUMS_IDCOL, $albumId);
$albumDate = __getSingleValue($db::PHOTOALBUMS_DATECOL, $db::PHOTOALBUMS_TABLENAME, $db::PHOTOALBUMS_IDCOL, $albumId);
$photographer = __getSingleValue($db::PHOTOALBUMS_PHOTOGRAPHERCOL, $db::PHOTOALBUMS_TABLENAME, $db::PHOTOALBUMS_IDCOL, $albumId);
$photographerStripped = strtolower(str_replace(array('  ', ' '), '-', preg_replace('/[^a-zA-Z0-9 s]/', '', trim($photographer))));

$photoDescription = __getPhotoDescription($albumId, $photoNo);

$albumDateStrTemp = strtotime($albumDate);
$albumDateStr = date("F j, Y", $albumDateStrTemp);

echo "
";
echo "
";
if ($photoNo < 10) {
    echo "";
} else {
    echo "";
}
echo "
";

    __getPhoto($albumId, $photoNo);

echo "
";

    echo "" . $albumTitle . "";

    echo "
";
        if ($photoNo > 1) {
            $previous = $photoNo - 1;
        } else {
            $previous = $photoCount;
        }
        echo "<button id='prevButton' value='" . $previous . "' onclick='showPhoto($albumId, $photoCount, this.value)' class='button'></button>";

        echo "";

        if ($photoNo < $photoCount) {
            $next = $photoNo + 1;
        } else {
            $next = 1;
        }
        echo "<button id='nextButton' value='" . $next . "' onclick='showPhoto($albumId, $photoCount, this.value)' class='button'></button>";

        echo "" . $photoNo . " of " . $photoCount . "";
    echo "
";

echo "
";

    echo "

";
echo "
";

echo "
";
    echo "";

    echo "
";
        echo "
" . $albumTitle . "
";
        echo "
" . $albumDateStr . "
";
        echo "
" . $photoDescription; "
";
        echo "
 Photo by " . $photographer . "
";
    echo "
";

echo "
";
?>


text:
var gulp = require('gulp'),
    requirejsOptimize = require('gulp-requirejs-optimize'),
    rename = require('gulp-rename'),
    notify = require('gulp-notify');

gulp.task('optimize', function() {
    return gulp.src('src/js/app.js')
        .pipe(requirejsOptimize({
            baseUrl: 'src/js',
            findNestedDependencies: true,
            name: 'app',
            paths: {
                "jquery": "lib/jquery"
            },
            shim: {
                "jquery": {
                    exports: ["jQuery", "$"]
                }
            }
        }))
        .pipe(rename("app-build.js"))
        .pipe(gulp.dest('src/js'))
        .pipe(notify("Done"));
});

gulp.task('watch', function() {
  gulp.watch(['src/js/**', '!src/js/app-build.js'], ['optimize']);
});

gulp.task('default', ['watch', 'optimize']);


text:
namespace boost
{
  namespace detail
  {
    class function_wrapper
    {
      struct impl_base
      {
        virtual void call()=0;
        virtual ~impl_base()
        {
        }
      };
      typedef boost::csbl::unique_ptr<impl_base> impl_base_type;
      impl_base_type impl;
      template <typename F>
      struct impl_type: impl_base
      {
        F f;
        impl_type(F const &f_)
          : f(f_)
        {}
        impl_type(BOOST_THREAD_RV_REF(F) f_)
          : f(boost::move(f_))
        {}

        void call()
        {
          f();
        }
      };
    public:
      BOOST_THREAD_MOVABLE_ONLY(function_wrapper)

//#if ! defined  BOOST_NO_CXX11_RVALUE_REFERENCES
      template<typename F>
      function_wrapper(F const& f):
      impl(new impl_type<F>(f))
      {}
//#endif
      template<typename F>
      function_wrapper(BOOST_THREAD_RV_REF(F) f):
      impl(new impl_type<F>(boost::forward<F>(f)))
      {}
      function_wrapper(BOOST_THREAD_RV_REF(function_wrapper) other) BOOST_NOEXCEPT :
      impl(other.impl)
      {
        other.impl = 0;
      }
      function_wrapper()
        : impl(0)
      {
      }
      ~function_wrapper()
      {
      }

      function_wrapper& operator=(BOOST_THREAD_RV_REF(function_wrapper) other) BOOST_NOEXCEPT
      {
        impl=other.impl;
        other.impl=0;
        return *this;
      }

      void operator()()
      { impl->call();}

    };
  }
}

#endif // header


text:
package com.amazonaws.services.iot.model.transform;

import java.util.Map;
import java.util.Map.Entry;

import com.amazonaws.services.iot.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * DetachThingPrincipalResult JSON Unmarshaller
 */
public class DetachThingPrincipalResultJsonUnmarshaller implements
        Unmarshaller<DetachThingPrincipalResult, JsonUnmarshallerContext> {

    public DetachThingPrincipalResult unmarshall(JsonUnmarshallerContext context)
            throws Exception {
        DetachThingPrincipalResult detachThingPrincipalResult = new DetachThingPrincipalResult();

        return detachThingPrincipalResult;
    }

    private static DetachThingPrincipalResultJsonUnmarshaller instance;

    public static DetachThingPrincipalResultJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new DetachThingPrincipalResultJsonUnmarshaller();
        return instance;
    }
}


text:
html,
button,
input,
select,
textarea{color:#222;}
body{font-size:1em;line-height:1.4;}
::-moz-selection{background:#b3d4fc;text-shadow:none;}
::selection{background:#b3d4fc;text-shadow:none;}
hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0;}
img{vertical-align:middle;}
fieldset{border:0;margin:0;padding:0;}
textarea{resize:vertical;}
.chromeframe{margin:0.2em 0;background:#ccc;color:#000;padding:0.2em 0;}
#site-info{margin-top:1.5em;font-size:0.7em;text-align:center;color:#38c5c5;}
#site-info a{color:#eeeeee;}
.side-shadow{-webkit-box-shadow:3px 0px 8px 0px #8e927e;-moz-box-shadow:3px 0px 8px 0px #8e927e;box-shadow:3px 0px 8px 0px #8e927e;}
.angle-shadow{-webkit-box-shadow:6px 6px 8px 3px #8e927e;-moz-box-shadow:6px 6px 8px 3px #8e927e;box-shadow:6px 6px 8px 3px #8e927e;}
.ir{background-color:transparent;border:0;overflow:hidden;*text-indent:-9999px;}
.ir:before{content:"";display:block;width:0;height:150%;}
.hidden{display:none !important;visibility:hidden;}
.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;}
.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto;}
.invisible{visibility:hidden;}
.clearfix:before,
.clearfix:after{content:" ";display:table;}
.clearfix:after{clear:both;}
.clearfix{*zoom:1;}
@media only screen and (min-width:35em){}
@media print, (-o-min-device-pixel-ratio:5/4), (-webkit-min-device-pixel-ratio:1.25), (min-resolution:120dpi){}
@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important;}
a,
a:visited{text-decoration:underline;}
a[href]:after{content:" (" attr(href) ")";}
abbr[title]:after{content:" (" attr(title) ")";}
.ir a:after,
a[href^="javascript:"]:after,
a[href^="#"]:after{content:"";}
pre,
blockquote{border:1px solid #999;page-break-inside:avoid;}
thead{display:table-header-group;}
tr,
img{page-break-inside:avoid;}
img{max-width:100% !important;}
@page{margin:0.5cm;}
p,
h2,
h3{orphans:3;widows:3;}
h2,
h3{page-break-after:avoid;}
}
#searchform{float: center; margin-top: 10px;}
#searchbox{background-color:#F5F4EF;border:1px solid #F5F4EF;border-radius:4px 4px 4px 4px;-moz-border-radius:4px 4px 4px 4px;-webkit-border-radius:4px 4px 4px 4px;height:20px;padding:4px;margin:0px 15px;vertical-align:top;
}
#footer{
    text-align: left;
}


text:
package chandu0101.scalajsreact.routing

import chandu0101.scalajsreact.components.{Footer, Menu, TopNav}
import chandu0101.scalajsreact.pages.{FacadeHelperPage, PickleHelperPage, ReactJSWrapperPage}
import japgolly.scalajs.react.extra.router2.{Resolution, RouterConfigDsl, RouterCtl, _}
import japgolly.scalajs.react.vdom.prefix_<^._
import org.scalajs.dom

object AppRouter {

  sealed trait AppPage

  case object ReactJSWrapper extends AppPage

  case object PickleHelper extends AppPage

  case object FacadeHelper extends AppPage

  val config = RouterConfigDsl[AppPage].buildConfig { dsl =>
    import dsl._
    (trimSlashes
      | staticRoute(root, ReactJSWrapper) ~> render(ReactJSWrapperPage())
      | staticRoute("#picklehelper", PickleHelper) ~> render(PickleHelperPage())
      | staticRoute("#facadehelper", FacadeHelper) ~> render(FacadeHelperPage())
      ).notFound(redirectToPage(ReactJSWrapper)(Redirect.Replace))
      .renderWith(layout)
  }

  val mainMenu = Vector(Menu("ReactJSWrapper", ReactJSWrapper),
    Menu("PickleHelper", PickleHelper),
    Menu("FacadeHelper", FacadeHelper)
  )

  def layout(c: RouterCtl[AppPage], r: Resolution[AppPage]) = {
    <.div(
      TopNav(TopNav.Props(mainMenu, r.page, c)),
      r.render(),
      Footer()
    )
  }

  val baseUrl = BaseUrl.fromWindowOrigin / "reactjs-scalajs/"

  val router = Router(baseUrl, config)

}