text:
<?php

namespace BearCMS\Internal;

use BearFramework\App;
use BearCMS\Internal\ElementsHelper as ElementsHelper;
use BearCMS\Internal\Themes as InternalThemes;
use BearCMS\Internal\Data as InternalData;
use BearCMS\Internal\ImportExport\ImportContext;
use IvoPetkov\HTML5DOMDocument;

/**
 * @internal
 * @codeCoverageIgnore
 */
class ElementsTypes
{

    /**
     *
     * @var string|null
     */
    static private $contextDir = null;

    /**
     *
     * @param string $typeCode
     * @param array $options
     * @return void
     */
    public static function add(string $typeCode, array $options = []): void
    {
        $app = App::get();
        if (self::$contextDir === null) {
            $context = $app->contexts->get(__DIR__);
            self::$contextDir = $context->dir;
        }
        $name = $options['componentSrc'];
        $app->components
            ->addAlias($name, 'file:' . self::$contextDir . '/components/bearcmsElement.php')
            ->addTag($name, 'file:' . self::$contextDir . '/components/bearcmsElement.php');
        ElementsHelper::$elementsTypesCodes[$name] = $typeCode;
        ElementsHelper::$elementsTypesFilenames[$name] = $options['componentFilename'];
        ElementsHelper::$elementsTypesOptions[$name] = $options;
    }

    /**
     *
     * @return void
     */
    public static function addDefault(): void
    {
        $app = App::get();
        if (self::$contextDir === null) {
            $context = $app->contexts->get(__DIR__);
            self::$contextDir = $context->dir;
        }

        $hasElements = Config::hasFeature('ELEMENTS');
        $hasThemes = Config::hasFeature('THEMES');

        if ($hasElements || Config::hasFeature('ELEMENTS_HEADING')) {
            self::add('heading', [
                'componentSrc' => 'bearcms-heading-element',
                'componentFilename' => self::$contextDir . '/components/bearcmsHeadingElement.php',
                'fields' => [
                    [
                        'id' => 'size',
                        'type' => 'list',
                        'defaultValue' => 'large',
                        'options' => [
                            [
                                'value' => 'large'
                            ],
                            [
                                'value' => 'medium'
                            ],
                            [
                                'value' => 'small'
                            ]
                        ]
                    ],
                    [
                        'id' => 'text',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'linkTargetID',
                        'type' => 'textbox'
                    ]
                ],
                'canStyle' => true
            ]);
            if ($hasThemes) {
                InternalThemes::$elementsOptions['heading'] = function ($options, $idPrefix, $parentSelector, $context, $details) {

                    if ($context === InternalThemes::OPTIONS_CONTEXT_ELEMENT) {
                        $options->addOption($idPrefix . "HeadingCSS", "css", '', [
                            "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                            "cssOutput" => [
                                ["rule", $parentSelector . " .bearcms-heading-element-large", "box-sizing:border-box;font-weight:normal;padding:0;margin:0;"],
                                ["rule", $parentSelector . " .bearcms-heading-element-medium", "box-sizing:border-box;font-weight:normal;padding:0;margin:0;"],
                                ["rule", $parentSelector . " .bearcms-heading-element-small", "box-sizing:border-box;font-weight:normal;padding:0;margin:0;"],
                                ["selector", $parentSelector . " .bearcms-heading-element-large"],
                                ["selector", $parentSelector . " .bearcms-heading-element-medium"],
                                ["selector", $parentSelector . " .bearcms-heading-element-small"]
                            ],
                            "elementType" => "heading"
                        ]);
                    } else {
                        $group = $options->addGroup(__("bearcms.themes.options.Heading"));
                        $customStyleSelector = ' .bearcms-elements-element-container:not([class*="bearcms-elements-element-style-"]) >';

                        $groupLarge = $group->addGroup(__("bearcms.themes.options.Large"));
                        $groupLarge->addOption($idPrefix . "HeadingLargeCSS", "css", '', [
                            "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                            "cssOutput" => [
                                ["rule", $parentSelector . " .bearcms-heading-element-large", "box-sizing:border-box;font-weight:normal;padding:0;margin:0;"],
                                ["selector", $parentSelector . $customStyleSelector . " .bearcms-heading-element-large"]
                            ],
                            "elementType" => "heading"
                        ]);

                        $groupMedium = $group->addGroup(__("bearcms.themes.options.Medium"));
                        $groupMedium->addOption($idPrefix . "HeadingMediumCSS", "css", '', [
                            "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                            "cssOutput" => [
                                ["rule", $parentSelector . " .bearcms-heading-element-medium", "box-sizing:border-box;font-weight:normal;padding:0;margin:0;"],
                                ["selector", $parentSelector . $customStyleSelector . " .bearcms-heading-element-medium"]
                            ],
                            "elementType" => "heading"
                        ]);

                        $groupSmall = $group->addGroup(__("bearcms.themes.options.Small"));
                        $groupSmall->addOption($idPrefix . "HeadingSmallCSS", "css", '', [
                            "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                            "cssOutput" => [
                                ["rule", $parentSelector . " .bearcms-heading-element-small", "box-sizing:border-box;font-weight:normal;padding:0;margin:0;"],
                                ["selector", $parentSelector . $customStyleSelector . " .bearcms-heading-element-small"]
                            ],
                            "elementType" => "heading"
                        ]);
                    }
                };
            }
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_TEXT')) {
            self::add('text', [
                'componentSrc' => 'bearcms-text-element',
                'componentFilename' => self::$contextDir . '/components/bearcmsTextElement.php',
                'fields' => [
                    [
                        'id' => 'text',
                        'type' => 'textbox'
                    ]
                ],
                'canStyle' => true
            ]);
            if ($hasThemes) {
                InternalThemes::$elementsOptions['text'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                    if ($context === InternalThemes::OPTIONS_CONTEXT_ELEMENT) {
                        $optionsGroup = $options;
                        $customStyleSelector = '';
                    } else {
                        $optionsGroup = $options->addGroup(__("bearcms.themes.options.Text"));
                        $customStyleSelector = ' .bearcms-elements-element-container:not([class*="bearcms-elements-element-style-"]) >';
                    }
                    $optionsGroup->addOption($idPrefix . "TextCSS", "css", '', [
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-text-element", "box-sizing:border-box;"],
                            ["rule", $parentSelector . " .bearcms-text-element ul", "list-style-position:inside;margin:0;padding:0;"],
                            ["rule", $parentSelector . " .bearcms-text-element ol", "list-style-position:inside;margin:0;padding:0;"],
                            ["rule", $parentSelector . " .bearcms-text-element li", "list-style-position:inside;margin:0;padding:0;"],
                            ["rule", $parentSelector . " .bearcms-text-element p", "margin:0;padding:0;"],
                            ["rule", $parentSelector . " .bearcms-text-element input", "margin:0;padding:0;"],
                            ["selector", $parentSelector . $customStyleSelector . " .bearcms-text-element"]
                        ],
                        "elementType" => "text"
                    ]);

                    $groupLinks = $optionsGroup->addGroup(__("bearcms.themes.options.Links"));
                    $groupLinks->addOption($idPrefix . "TextLinkCSS", "css", '', [
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssTypes" => ["cssText", "cssTextShadow"],
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-text-element a", "text-decoration:none;"],
                            ["selector", $parentSelector . $customStyleSelector . " .bearcms-text-element a"]
                        ],
                        "elementType" => "text"
                    ]);
                };
            }
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_LINK')) {
            self::add('link', [
                'componentSrc' => 'bearcms-link-element',
                'componentFilename' => self::$contextDir . '/components/bearcmsLinkElement.php',
                'fields' => [
                    [
                        'id' => 'url',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'text',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'title',
                        'type' => 'textbox'
                    ]
                ],
                'canStyle' => true
            ]);
            if ($hasThemes) {
                InternalThemes::$elementsOptions['link'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                    if ($context === InternalThemes::OPTIONS_CONTEXT_ELEMENT) {
                        $optionsGroup = $options;
                        $customStyleSelector = '';
                    } else {
                        $optionsGroup = $options->addGroup(__("bearcms.themes.options.Link"));
                        $customStyleSelector = ' .bearcms-elements-element-container:not([class*="bearcms-elements-element-style-"]) >';
                    }

                    $optionsGroup->addOption($idPrefix . "LinkCSS", "css", '', [
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-link-element a", "text-decoration:none;box-sizing:border-box;display:inline-block;"],
                            ["selector", $parentSelector . $customStyleSelector . " .bearcms-link-element a"]
                        ],
                        "elementType" => "link"
                    ]);

                    $groupContainer = $optionsGroup->addGroup(__("bearcms.themes.options.Container"));
                    $groupContainer->addOption($idPrefix . "LinkContainerCSS", "css", '', [
                        "cssTypes" => ["cssPadding", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssBackground", "cssSize", "cssTextAlign"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-link-element", "box-sizing:border-box;"],
                            ["selector", $parentSelector . $customStyleSelector . " .bearcms-link-element"]
                        ],
                        "elementType" => "link"
                    ]);
                };
            }
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_IMAGE')) {
            self::add('image', [
                'componentSrc' => 'bearcms-image-element',
                'componentFilename' => self::$contextDir . '/components/bearcmsImageElement.php',
                'fields' => [
                    [
                        'id' => 'filename',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'title',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'alt',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'onClick',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'url',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'fileWidth',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'fileHeight',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'width', // Deprecated on 14 August 2021
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'align', // Deprecated on 14 August 2021
                        'type' => 'list',
                        'defaultValue' => 'left',
                        'options' => [
                            [
                                'value' => 'left'
                            ],
                            [
                                'value' => 'center'
                            ],
                            [
                                'value' => 'right'
                            ]
                        ]
                    ],
                ],
                'onDelete' => function ($data) {
                    $filename = isset($data['filename']) ? (string)$data['filename'] : '';
                    InternalData::deleteElementAsset($filename);
                },
                'onDuplicate' => function ($data) {
                    $filename = isset($data['filename']) ? (string)$data['filename'] : '';
                    if (strlen($filename) > 0) {
                        $data['filename'] = InternalData::duplicateElementAsset($filename);
                    }
                    return $data;
                },
                'onExport' => function ($data, $add) {
                    $filename = isset($data['filename']) ? (string)$data['filename'] : '';
                    if (strlen($filename) > 0) {
                        $data['filename'] = InternalData::exportElementAsset($filename, 'file', $add);
                    }
                    return $data;
                },
                'onImport' => function (array $data, ImportContext $context) {
                    $filename = isset($data['filename']) ? (string)$data['filename'] : '';
                    if (strlen($filename) > 0) {
                        $data['filename'] = InternalData::importElementAsset($filename, 'bearcms/files/image/', $context);
                    }
                    return $data;
                },
                'getUploadsSizeItems' => function ($data) {
                    $filename = isset($data['filename']) ? (string)$data['filename'] : '';
                    if (strlen($filename) > 0) {
                        return [InternalData::getFilenameDataKey($filename)];
                    }
                    return [];
                },
                'optimizeData' => function ($data) {
                    $app = App::get();
                    $hasChange = false;
                    $filename = isset($data['filename']) ? (string)$data['filename'] : '';
                    if (strlen($filename) > 0) {
                        $realFilenameWithOptions = InternalData::getRealFilename($filename);
                        $realFilenameWithoutOptions = InternalData::removeFilenameOptions($realFilenameWithOptions);
                        $shortFilenameWithOptions = InternalData::getShortFilename($realFilenameWithOptions);
                        if (strpos($realFilenameWithoutOptions, 'appdata://') === 0) {
                            if ($data['filename'] !== $shortFilenameWithOptions) {
                                $data['filename'] = $shortFilenameWithOptions;
                                $hasChange = true;
                            }
                            if (!isset($data['fileWidth']) || !isset($data['fileHeight'])) {
                                $details = $app->assets->getDetails($realFilenameWithoutOptions, ['width', 'height']);
                                $data['fileWidth'] = $details['width'] !== null ? $details['width'] : 0;
                                $data['fileHeight'] = $details['height'] !== null ? $details['height'] : 0;
                                $hasChange = true;
                            }
                        }
                    }
                    if ($hasChange) {
                        return $data;
                    }
                },
                'canStyle' => true
            ]);
            if ($hasThemes) {
                InternalThemes::$elementsOptions['image'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                    $isElementContext = $context === InternalThemes::OPTIONS_CONTEXT_ELEMENT;
                    if ($isElementContext) {
                        $optionsGroup = $options;
                        $customStyleSelector = '';
                    } else {
                        $optionsGroup = $options->addGroup(__("bearcms.themes.options.Image"));
                        $customStyleSelector = ' .bearcms-elements-element-container:not([class*="bearcms-elements-element-style-"]) >';
                    }

                    $optionsGroup->addOption($idPrefix . "ImageCSS", "css", '', [
                        "cssTypes" => ["cssBorder", "cssRadius", "cssShadow"],
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-image-element", "overflow:hidden;"],
                            ["rule", $parentSelector . " .bearcms-image-element img", "border:0;"],
                            ["selector", $parentSelector . $customStyleSelector . " .bearcms-image-element"]
                        ],
                        "elementType" => "image"
                    ]);
                    if ($isElementContext) {
                        $optionsGroup->addOption($idPrefix . "elementContainerCSS", "css", '', [
                            "cssTypes" => ["cssSize"],
                            "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                            "cssOutput" => [
                                ["selector", $parentSelector . $customStyleSelector]
                            ],
                            "elementType" => "image"
                        ]);
                    }
                };
            }
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_IMAGE_GALLERY')) {
            self::add('imageGallery', [
                'componentSrc' => 'bearcms-image-gallery-element',
                'componentFilename' => self::$contextDir . '/components/bearcmsImageGalleryElement.php',
                'fields' => [
                    [
                        'id' => 'type',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'columnsCount',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'imageSize',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'imageAspectRatio',
                        'type' => 'textbox'
                    ]
                ],
                'updateComponentFromData' => function ($component, $data) {
                    if (isset($data['files']) && is_array($data['files'])) {
                        $innerHTML = '';
                        foreach ($data['files'] as $file) {
                            if (isset($file['filename'])) {
                                $innerHTML .= '<file '
                                    . 'filename="' . htmlentities($file['filename']) . '" '
                                    . 'fileWidth="' . (isset($file['width']) ? htmlentities($file['width']) : null) . '" '
                                    . 'fileHeight="' . (isset($file['height']) ? htmlentities($file['height']) : null) . '"'
                                    . 'title="' . (isset($file['title']) ? htmlentities($file['title']) : null) . '"'
                                    . 'alt="' . (isset($file['alt']) ? htmlentities($file['alt']) : null) . '"'
                                    . '/>';
                            }
                        }
                        $component->innerHTML = $innerHTML;
                    }
                    return $component;
                },
                'updateDataFromComponent' => function ($component, $data) {
                    $domDocument = new HTML5DOMDocument();
                    $domDocument->loadHTML($component->innerHTML, HTML5DOMDocument::ALLOW_DUPLICATE_IDS);
                    $files = [];
                    $filesElements = $domDocument->querySelectorAll('file');
                    foreach ($filesElements as $fileElement) {
                        $file = ['filename' => $fileElement->getAttribute('filename')];
                        $width = (string)$fileElement->getAttribute('filewidth');
                        if (isset($width[0])) {
                            $file['width'] = $width[0];
                        }
                        $height = (string)$fileElement->getAttribute('fileheight');
                        if (isset($height[0])) {
                            $file['height'] = $height[0];
                        }
                        $files[] = $file;
                    }
                    $data['files'] = $files;
                    return $data;
                },
                'onDelete' => function ($data) use ($app) {
                    if (isset($data['files']) && is_array($data['files'])) {
                        foreach ($data['files'] as $file) {
                            $filename = isset($file['filename']) ? (string)$file['filename'] : '';
                            InternalData::deleteElementAsset($filename);
                        }
                    }
                },
                'onDuplicate' => function ($data) {
                    if (isset($data['files']) && is_array($data['files'])) {
                        foreach ($data['files'] as $index => $file) {
                            $filename = isset($file['filename']) ? (string)$file['filename'] : '';
                            if ($filename !== '') {
                                $data['files'][$index]['filename'] = InternalData::duplicateElementAsset($filename);
                            }
                        }
                    }
                    return $data;
                },
                'onExport' => function ($data, $add) {
                    if (isset($data['files']) && is_array($data['files'])) {
                        foreach ($data['files'] as $index => $file) {
                            $filename = isset($file['filename']) ? (string)$file['filename'] : '';
                            if ($filename !== '') {
                                $data['files'][$index]['filename'] = InternalData::exportElementAsset($filename, 'file' . ($index + 1), $add);
                            }
                        }
                    }
                    return $data;
                },
                'onImport' => function (array $data, ImportContext $context) {
                    if (isset($data['files']) && is_array($data['files'])) {
                        foreach ($data['files'] as $index => $file) {
                            $filename = isset($file['filename']) ? (string)$file['filename'] : '';
                            if ($filename !== '') {
                                $data['files'][$index]['filename'] = InternalData::importElementAsset($filename, 'bearcms/files/imagegallery/', $context);
                            }
                        }
                    }
                    return $data;
                },
                'getUploadsSizeItems' => function ($data) {
                    $result = [];
                    if (isset($data['files']) && is_array($data['files'])) {
                        foreach ($data['files'] as $file) {
                            if (isset($file['filename'])) {
                                $filename = isset($file['filename']) ? (string)$file['filename'] : '';
                                if (strlen($filename) > 0) {
                                    $result[] = InternalData::getFilenameDataKey($filename);
                                }
                            }
                        }
                    }
                    return $result;
                },
                'optimizeData' => function ($data) {
                    $app = App::get();
                    $hasChange = false;
                    if (isset($data['files']) && is_array($data['files'])) {
                        foreach ($data['files'] as $index => $file) {
                            if (isset($file['filename'])) {
                                $filename = isset($file['filename']) ? (string)$file['filename'] : '';
                                if (strlen($filename) > 0) {
                                    $realFilenameWithOptions = InternalData::getRealFilename($filename);
                                    $realFilenameWithoutOptions = InternalData::removeFilenameOptions($realFilenameWithOptions);
                                    $shortFilenameWithOptions = InternalData::getShortFilename($realFilenameWithOptions);
                                    if (strpos($realFilenameWithoutOptions, 'appdata://') === 0) {
                                        if ($file['filename'] !== $shortFilenameWithOptions) {
                                            $file['filename'] = $shortFilenameWithOptions;
                                            $hasChange = true;
                                        }
                                        if (!isset($file['width']) || !isset($file['height'])) {
                                            $details = $app->assets->getDetails($realFilenameWithoutOptions, ['width', 'height']);
                                            $file['width'] = $details['width'] !== null ? $details['width'] : 0;
                                            $file['height'] = $details['height'] !== null ? $details['height'] : 0;
                                            $hasChange = true;
                                        }
                                        $data['files'][$index] = $file;
                                    }
                                }
                            }
                        }
                    }
                    if ($hasChange) {
                        return $data;
                    }
                },
            ]);
            if ($hasThemes) {
                InternalThemes::$elementsOptions['imageGallery'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                    $groupImageGallery = $options->addGroup(__("bearcms.themes.options.Image gallery"));
                    $groupImageGallery->addOption($idPrefix . "ImageGalleryCSS", "css", '', [
                        "cssTypes" => ["cssPadding", "cssBorder", "cssRadius", "cssShadow", "cssBackground"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["selector", $parentSelector . " .bearcms-image-gallery-element"]
                        ]
                    ]);

                    $groupImage = $groupImageGallery->addGroup(__("bearcms.themes.options.Image"));
                    $groupImage->addOption($idPrefix . "ImageGalleryImageCSS", "css", '', [
                        "cssTypes" => ["cssBorder", "cssRadius", "cssShadow"],
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-image-gallery-element-image", "overflow:hidden;"],
                            ["rule", $parentSelector . " .bearcms-image-gallery-element-image img", "border:0;"],
                            ["selector", $parentSelector . " .bearcms-image-gallery-element-image"]
                        ]
                    ]);
                };
            }
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_VIDEO')) {
            self::add('video', [
                'componentSrc' => 'bearcms-video-element',
                'componentFilename' => self::$contextDir . '/components/bearcmsVideoElement.php',
                'fields' => [
                    [
                        'id' => 'url',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'filename',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'width',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'align',
                        'type' => 'list',
                        'defaultValue' => 'left',
                        'options' => [
                            [
                                'value' => 'left'
                            ],
                            [
                                'value' => 'center'
                            ],
                            [
                                'value' => 'right'
                            ]
                        ]
                    ],
                ],
                'onDelete' => function ($data) use ($app) {
                    $filename = isset($data['filename']) ? (string)$data['filename'] : '';
                    InternalData::deleteElementAsset($filename);
                },
                'onDuplicate' => function ($data) {
                    $filename = isset($data['filename']) ? (string)$data['filename'] : '';
                    if (strlen($filename) > 0) {
                        $data['filename'] = InternalData::duplicateElementAsset($filename);
                    }
                    return $data;
                },
                'onExport' => function ($data, $add) {
                    $filename = isset($data['filename']) ? (string)$data['filename'] : '';
                    if (strlen($filename) > 0) {
                        $data['filename'] = InternalData::exportElementAsset($filename, 'file', $add);
                    }
                    return $data;
                },
                'onImport' => function (array $data, ImportContext $context) {
                    $filename = isset($data['filename']) ? (string)$data['filename'] : '';
                    if (strlen($filename) > 0) {
                        $data['filename'] = InternalData::importElementAsset($filename, 'bearcms/files/video/', $context);
                    }
                    return $data;
                },
                'getUploadsSizeItems' => function ($data) {
                    $filename = isset($data['filename']) ? (string)$data['filename'] : '';
                    if (strlen($filename) > 0) {
                        return [InternalData::getFilenameDataKey($filename)];
                    }
                    return [];
                }
            ]);
            if ($hasThemes) {
                InternalThemes::$elementsOptions['video'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                    $group = $options->addGroup(__("bearcms.themes.options.Video"));
                    $group->addOption($idPrefix . "VideoCSS", "css", '', [
                        "cssTypes" => ["cssBorder", "cssRadius", "cssShadow"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-video-element", "overflow:hidden;"],
                            ["selector", $parentSelector . " .bearcms-video-element"]
                        ]
                    ]);
                };
            }
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_NAVIGATION')) {
            self::add('navigation', [
                'componentSrc' => 'bearcms-navigation-element',
                'componentFilename' => self::$contextDir . '/components/bearcmsNavigationElement.php',
                'fields' => [
                    [
                        'id' => 'source',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'sourceParentPageID',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'showHomeLink',
                        'type' => 'checkbox'
                    ],
                    [
                        'id' => 'showSearchButton',
                        'type' => 'checkbox'
                    ],
                    [
                        'id' => 'showStoreCartButton',
                        'type' => 'checkbox'
                    ],
                    [
                        'id' => 'homeLinkText',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'itemsType',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'items',
                        'type' => 'textbox'
                    ]
                ]
            ]);
            if ($hasThemes) {
                InternalThemes::$elementsOptions['navigation'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                    $groupNavigation = $options->addGroup(__("bearcms.themes.options.Navigation"));
                    $groupNavigation->addOption($idPrefix . "NavigationCSS", "css", '', [
                        "cssTypes" => ["cssPadding", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssBorder", "cssBackground"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-navigation-element", "margin:0;padding:0;"],
                            ["rule", $parentSelector . " .bearcms-navigation-element ul", "margin:0;padding:0;"],
                            ["selector", $parentSelector . " .bearcms-navigation-element"]
                        ]
                    ]);

                    $groupElements = $groupNavigation->addGroup(__("bearcms.themes.options.Elements"));
                    $groupElements->addOption($idPrefix . "NavigationItemLinkCSS", "css", '', [
                        "cssTypes" => ["cssText", "cssTextShadow"],
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-navigation-element-item a", "text-decoration:none;"], // treat as text link // no max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
                            ["selector", $parentSelector . " .bearcms-navigation-element-item a"]
                        ]
                    ]);

                    $groupElementsContainer = $groupElements->addGroup(__("bearcms.themes.options.Container"));
                    $groupElementsContainer->addOption($idPrefix . "NavigationItemLinkContainerCSS", "css", '', [
                        "cssTypes" => ["cssPadding", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssBackground", "cssSize"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-navigation-element-item", "box-sizing:border-box;"],
                            ["selector", $parentSelector . " .bearcms-navigation-element-item"]
                        ]
                    ]);
                };
            }
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_HTML')) {
            self::add('html', [
                'componentSrc' => 'bearcms-html-element',
                'componentFilename' => self::$contextDir . '/components/bearcmsHtmlElement.php',
                'fields' => [
                    [
                        'id' => 'code',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'originalCode',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'renderMode',
                        'type' => 'textbox'
                    ]
                ]
            ]);
            if ($hasThemes) {
                InternalThemes::$elementsOptions['html'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                    $groupHTMLCode = $options->addGroup(__("bearcms.themes.options.HTML code"));
                    $groupHTMLCode->addOption($idPrefix . "HtmlCSS", "css", '', [
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-html-element ul", "list-style-position:inside;margin:0;padding:0;"],
                            ["rule", $parentSelector . " .bearcms-html-element ol", "list-style-position:inside;margin:0;padding:0;"],
                            ["rule", $parentSelector . " .bearcms-html-element li", "list-style-position:inside;margin:0;padding:0;"],
                            ["rule", $parentSelector . " .bearcms-html-element p", "margin:0;padding:0;"],
                            ["rule", $parentSelector . " .bearcms-html-element input", "margin:0;padding:0;"],
                            ["selector", $parentSelector . " .bearcms-html-element"]
                        ]
                    ]);

                    $groupLinks = $groupHTMLCode->addGroup(__("bearcms.themes.options.Links"));
                    $groupLinks->addOption($idPrefix . "HtmlLinkCSS", "css", '', [
                        "cssTypes" => ["cssText", "cssTextShadow"],
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-html-element a", "text-decoration:none;"],
                            ["selector", $parentSelector . " .bearcms-html-element a"]
                        ]
                    ]);
                };
            }
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_BLOG_POSTS')) {
            self::add('blogPosts', [
                'componentSrc' => 'bearcms-blog-posts-element',
                'componentFilename' => self::$contextDir . '/components/bearcmsBlogPostsElement.php',
                'fields' => [
                    [
                        'id' => 'source',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'sourceCategoriesIDs',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'type',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'showDate',
                        'type' => 'checkbox'
                    ],
                    [
                        'id' => 'showSummaryReadMoreButton',
                        'type' => 'checkbox'
                    ],
                    [
                        'id' => 'limit',
                        'type' => 'number'
                    ],
                    [
                        'id' => 'showLoadMoreButton',
                        'type' => 'checkbox'
                    ]
                ]
            ]);
            if ($hasThemes) {
                InternalThemes::$elementsOptions['blogPosts'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                    $groupBlogPosts = $options->addGroup(__("bearcms.themes.options.Blog posts"));
                    $groupBlogPosts->addOption($idPrefix . "BlogPostsCSS", "css", '', [
                        "cssTypes" => ["cssPadding", "cssBorder", "cssRadius", "cssShadow", "cssBackground"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["selector", $parentSelector . " .bearcms-blog-posts-element"]
                        ]
                    ]);

                    $groupBlogPosts->addOption($idPrefix . "BlogPostsSpacing", "htmlUnit", __("bearcms.themes.options.Posts spacing"), [
                        "defaultValue" => "0",
                        "cssOutput" => [
                            ["selector", $parentSelector . " .bearcms-blog-posts-element-post:not(:first-child)", "margin-top:{value};"]
                        ],
                        "onHighlight" => [['cssSelector', $parentSelector . " .bearcms-blog-posts-element-post"]]
                    ]);

                    $groupPost = $groupBlogPosts->addGroup(__("bearcms.themes.options.Post"));
                    $groupPost->addOption($idPrefix . "BlogPostsPostCSS", "css", '', [
                        "cssTypes" => ["cssBorder", "cssBackground", "cssShadow"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["selector", $parentSelector . " .bearcms-blog-posts-element-post"]
                        ]
                    ]);

                    $groupPostTitle = $groupPost->addGroup(__("bearcms.themes.options.Title"));
                    $groupPostTitle->addOption($idPrefix . "BlogPostsPostTitleCSS", "css", '', [
                        "cssTypes" => ["cssText", "cssTextShadow"],
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-blog-posts-element-post-title", "text-decoration:none;"],
                            ["selector", $parentSelector . " .bearcms-blog-posts-element-post-title"]
                        ]
                    ]);

                    $groupPostTitleContainer = $groupPostTitle->addGroup(__("bearcms.themes.options.Container"));
                    $groupPostTitleContainer->addOption($idPrefix . "BlogPostsPostTitleContainerCSS", "css", '', [
                        "cssTypes" => ["cssPadding", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssBackground", "cssSize"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-blog-posts-element-post-title-container", "box-sizing:border-box;"],
                            ["selector", $parentSelector . " .bearcms-blog-posts-element-post-title-container"]
                        ]
                    ]);

                    $groupPostDate = $groupPost->addGroup(__("bearcms.themes.options.Date"));
                    $groupPostDate->addOption($idPrefix . "BlogPostsPostDateCSS", "css", '', [
                        "cssTypes" => ["cssText", "cssTextShadow"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["selector", $parentSelector . " .bearcms-blog-posts-element-post-date"]
                        ]
                    ]);

                    $groupPostDateContainer = $groupPostDate->addGroup(__("bearcms.themes.options.Container"));
                    $groupPostDateContainer->addOption($idPrefix . "BlogPostsPostDateContainerCSS", "css", '', [
                        "cssTypes" => ["cssPadding", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssBackground", "cssSize"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-blog-posts-element-post-date-container", "box-sizing:border-box;"],
                            ["selector", $parentSelector . " .bearcms-blog-posts-element-post-date-container"]
                        ]
                    ]);

                    $groupPostContent = $groupPost->addGroup(__("bearcms.themes.options.Content"));
                    $groupPostContent->addOption($idPrefix . "BlogPostsPostContentCSS", "css", '', [
                        "cssTypes" => ["cssPadding", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssBackground", "cssSize"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-blog-posts-element-post-content", "box-sizing:border-box;"],
                            ["selector", $parentSelector . " .bearcms-blog-posts-element-post-content"]
                        ]
                    ]);

                    $groupShowMoreButton = $groupBlogPosts->addGroup(__('bearcms.themes.options.blogPosts.Show more button'));
                    $groupShowMoreButton->addOption($idPrefix . "BlogPostsShowMoreButtonCSS", "css", '', [
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-blog-posts-element-show-more-button", "box-sizing:border-box;display:inline-block;text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;"],
                            ["selector", $parentSelector . " .bearcms-blog-posts-element-show-more-button"]
                        ]
                    ]);

                    $groupShowMoreButtonContainer = $groupShowMoreButton->addGroup(__("bearcms.themes.options.Container"));
                    $groupShowMoreButtonContainer->addOption($idPrefix . "BlogPostsShowMoreButtonContainerCSS", "css", '', [
                        "cssTypes" => ["cssPadding", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssBackground", "cssSize"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-blog-posts-element-show-more-button-container", "box-sizing:border-box;"],
                            ["selector", $parentSelector . " .bearcms-blog-posts-element-show-more-button-container"]
                        ]
                    ]);
                };
            }
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_COMMENTS')) {
            self::add('comments', [
                'componentSrc' => 'bearcms-comments-element',
                'componentFilename' => self::$contextDir . '/components/bearcmsCommentsElement.php',
                'fields' => [
                    [
                        'id' => 'threadID',
                        'type' => 'textbox'
                    ],
                    [
                        'id' => 'count',
                        'type' => 'number'
                    ]
                ],
                'onDelete' => function ($data) {
                    if (isset($data['threadID'])) {
                        InternalData\Comments::deleteThread($data['threadID']);
                    }
                },
                'onDuplicate' => function ($data) {
                    if (isset($data['threadID'])) {
                        $newThreadID = InternalData\Comments::generateNewThreadID();
                        InternalData\Comments::copyThread($data['threadID'], $newThreadID);
                        $data['threadID'] = $newThreadID;
                    }
                    return $data;
                }
            ]);
            if ($hasThemes) {
                InternalThemes::$elementsOptions['comments'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                    $groupComments = $options->addGroup(__("bearcms.themes.options.Comments"));

                    $groupComment = $groupComments->addGroup(__("bearcms.themes.options.comments.Comment"));
                    $groupComment->addOption($idPrefix . "CommentsCommentCSS", "css", '', [
                        "cssTypes" => ["cssPadding", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssBackground", "cssSize"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-comments-comment", "box-sizing:border-box;"],
                            ["selector", $parentSelector . " .bearcms-comments-comment"]
                        ]
                    ]);

                    $groupCommentAuthorName = $groupComment->addGroup(__("bearcms.themes.options.comments.Author name"));
                    $groupCommentAuthorName->addOption($idPrefix . "CommentsAuthorNameCSS", "css", '', [
                        "cssTypes" => ["cssText", "cssTextShadow"],
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["selector", $parentSelector . " .bearcms-comments-comment-author-name"]
                        ]
                    ]);

                    $groupCommentAuthorImage = $groupComment->addGroup(__("bearcms.themes.options.comments.Author image"));
                    $groupCommentAuthorImage->addOption($idPrefix . "CommentsAuthorImageCSS", "css", '', [
                        "cssTypes" => ["cssPadding", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssBackground", "cssSize"],
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-comments-comment-author-image", "box-sizing:border-box;"],
                            ["selector", $parentSelector . " .bearcms-comments-comment-author-image"]
                        ]
                    ]);

                    $groupCommentDate = $groupComment->addGroup(__("bearcms.themes.options.comments.Date"));
                    $groupCommentDate->addOption($idPrefix . "CommentsDateCSS", "css", '', [
                        "cssTypes" => ["cssText", "cssTextShadow"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["selector", $parentSelector . " .bearcms-comments-comment-date"]
                        ]
                    ]);

                    $groupCommentText = $groupComment->addGroup(__("bearcms.themes.options.comments.Text"));
                    $groupCommentText->addOption($idPrefix . "CommentsTextCSS", "css", '', [
                        "cssTypes" => ["cssText", "cssTextShadow"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["selector", $parentSelector . " .bearcms-comments-comment-text"]
                        ]
                    ]);

                    $groupCommentTextLinks = $groupComment->addGroup(__("bearcms.themes.options.comments.Text links"));
                    $groupCommentTextLinks->addOption($idPrefix . "CommentsTextLinksCSS", "css", '', [
                        "cssTypes" => ["cssText", "cssTextShadow"],
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["selector", $parentSelector . " .bearcms-comments-comment-text a"]
                        ]
                    ]);

                    $groupTextInput = $groupComments->addGroup(__("bearcms.themes.options.comments.Text input"));
                    $groupTextInput->addOption($idPrefix . "CommentsTextInputCSS", "css", '', [
                        "cssTypes" => ["cssText", "cssTextShadow", "cssPadding", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssBackground", "cssSize"],
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-comments-element-text-input", "box-sizing:border-box;border:0;margin:0;padding:0;"],
                            ["selector", $parentSelector . " .bearcms-comments-element-text-input"]
                        ]
                    ]);

                    $groupSendButton = $groupComments->addGroup(__("bearcms.themes.options.comments.Send button"));
                    $groupSendButton->addOption($idPrefix . "CommentsSendButtonCSS", "css", '', [
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-comments-element-send-button", "box-sizing:border-box;display:inline-block;text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;"],
                            ["selector", $parentSelector . " .bearcms-comments-element-send-button"]
                        ]
                    ]);

                    $groupSendButtonWaiting = $groupSendButton->addGroup(__("bearcms.themes.options.comments.Send button waiting"));
                    $groupSendButtonWaiting->addOption($idPrefix . "CommentsSendButtonWaitingCSS", "css", '', [
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-comments-element-send-button-waiting", "box-sizing:border-box;display:inline-block;text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;"],
                            ["selector", $parentSelector . " .bearcms-comments-element-send-button-waiting"]
                        ]
                    ]);

                    $groupShowMoreButton = $groupComments->addGroup(__("bearcms.themes.options.comments.Show more button"));
                    $groupShowMoreButton->addOption($idPrefix . "CommentsShowMoreButtonCSS", "css", '', [
                        "cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-comments-show-more-button", "box-sizing:border-box;display:inline-block;text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;"],
                            ["selector", $parentSelector . " .bearcms-comments-show-more-button"]
                        ]
                    ]);

                    $groupShowMoreButtonContainer = $groupShowMoreButton->addGroup(__("bearcms.themes.options.comments.Container"));
                    $groupShowMoreButtonContainer->addOption($idPrefix . "CommentsShowMoreButtonContainerCSS", "css", '', [
                        "cssTypes" => ["cssPadding", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssBackground", "cssSize"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["rule", $parentSelector . " .bearcms-comments-show-more-button-container", "box-sizing:border-box;"],
                            ["selector", $parentSelector . " .bearcms-comments-show-more-button-container"]
                        ]
                    ]);
                };
            }
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_SEPARATOR')) {
            self::add('separator', [
                'componentSrc' => 'bearcms-separator-element',
                'componentFilename' => self::$contextDir . '/components/bearcmsSeparatorElement.php',
                'fields' => [
                    [
                        'id' => 'size',
                        'type' => 'list',
                        'defaultValue' => 'large',
                        'options' => [
                            [
                                'value' => 'large'
                            ],
                            [
                                'value' => 'medium'
                            ],
                            [
                                'value' => 'small'
                            ]
                        ]
                    ]
                ]
            ]);
            if ($hasThemes) {
                InternalThemes::$elementsOptions['separator'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                    $group = $options->addGroup(__("bearcms.themes.options.Separator"));

                    $groupLarge = $group->addGroup(__("bearcms.themes.options.Separator.Large"));
                    $groupLarge->addOption($idPrefix . "SeparatorLargeCSS", "css", '', [
                        "cssTypes" => ["cssBackground", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssSize"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["selector", $parentSelector . " .bearcms-separator-element-large"]
                        ],
                        "defaultValue" => '{"background-color":"#555","height":"1px","margin-left":"auto","margin-right":"auto","margin-top":"2rem","margin-bottom":"2rem","width":"90%"}'
                    ]);

                    $groupMedium = $group->addGroup(__("bearcms.themes.options.Separator.Medium"));
                    $groupMedium->addOption($idPrefix . "SeparatorMediumCSS", "css", '', [
                        "cssTypes" => ["cssBackground", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssSize"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["selector", $parentSelector . " .bearcms-separator-element-medium"]
                        ],
                        "defaultValue" => '{"background-color":"#555","height":"1px","margin-left":"auto","margin-right":"auto","margin-top":"2rem","margin-bottom":"2rem","width":"60%"}'
                    ]);

                    $groupSmall = $group->addGroup(__("bearcms.themes.options.Separator.Small"));
                    $groupSmall->addOption($idPrefix . "SeparatorSmallCSS", "css", '', [
                        "cssTypes" => ["cssBackground", "cssMargin", "cssBorder", "cssRadius", "cssShadow", "cssSize"],
                        "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                        "cssOutput" => [
                            ["selector", $parentSelector . " .bearcms-separator-element-small"]
                        ],
                        "defaultValue" => '{"background-color":"#555","height":"1px","margin-left":"auto","margin-right":"auto","margin-top":"2rem","margin-bottom":"2rem","width":"30%"}'
                    ]);
                };
            }
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_COLUMNS')) {
            InternalThemes::$elementsOptions['columns'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                if ($context === InternalThemes::OPTIONS_CONTEXT_ELEMENT) {
                    $optionsGroup = $options;
                } else {
                    throw new \Exception('Not supported in other contexts!');
                }
                $optionsGroup->addOption($idPrefix . "widths", "columnsWidths", __('bearcms.themes.options.columns.ColumnsCount'), [
                    "defaultValue" => ",",
                    "onHighlight" => [['cssSelector', $parentSelector]]
                ]);
                $optionsGroup->addOption($idPrefix . "autoVerticalWidth", "columnsAutoVerticalWidth",  __('bearcms.themes.options.columns.AutoVertical'), [
                    "defaultValue" => "500px",
                    "onHighlight" => [['cssSelector', $parentSelector]]
                ]);
                $optionsGroup->addOption($idPrefix . "elementsSpacing", "columnsElementsSpacing",  __('bearcms.themes.options.columns.ElementsSpacing'), [
                    "onHighlight" => [['cssSelector', $parentSelector]]
                ]);
            };
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_FLOATING_BOX')) {
            InternalThemes::$elementsOptions['floatingBox'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                if ($context === InternalThemes::OPTIONS_CONTEXT_ELEMENT) {
                    $optionsGroup = $options;
                } else {
                    throw new \Exception('Not supported in other contexts!');
                }
                $optionsGroup->addOption($idPrefix . "position", "floatingBoxPosition", __('bearcms.themes.options.floatingBox.Position'), [
                    "defaultValue" => "left",
                    "onHighlight" => [['cssSelector', $parentSelector]]
                ]);
                $optionsGroup->addOption($idPrefix . "width", "floatingBoxWidth", __('bearcms.themes.options.floatingBox.Width'), [
                    "defaultValue" => "50%",
                    "onHighlight" => [['cssSelector', $parentSelector]]
                ]);
                $optionsGroup->addOption($idPrefix . "autoVerticalWidth", "floatingBoxAutoVerticalWidth",  __('bearcms.themes.options.floatingBox.AutoVertical'), [
                    "defaultValue" => "500px",
                    "onHighlight" => [['cssSelector', $parentSelector]]
                ]);
                $optionsGroup->addOption($idPrefix . "elementsSpacing", "floatingBoxElementsSpacing",  __('bearcms.themes.options.floatingBox.ElementsSpacing'), [
                    "onHighlight" => [['cssSelector', $parentSelector]]
                ]);
            };
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_FLEXIBLE_BOX')) {
            InternalThemes::$elementsOptions['flexibleBox'] = function ($options, $idPrefix, $parentSelector, $context, $details) {
                if ($context === InternalThemes::OPTIONS_CONTEXT_ELEMENT) {
                    $optionsGroup = $options;
                } else {
                    throw new \Exception('Not supported in other contexts!');
                }
                $optionsGroup->addOption($idPrefix . "direction", "flexibleBoxDirection", __('bearcms.themes.options.flexibleBox.Direction'), [
                    "defaultValue" => "column",
                    "onHighlight" => [['cssSelector', $parentSelector]]
                ]);
                $optionsGroup->addOption($idPrefix . "rowAlignment", "flexibleBoxRowAlignment",  __('bearcms.themes.options.flexibleBox.RowAlignment'), [
                    "defaultValue" => "left",
                    "onHighlight" => [['cssSelector', $parentSelector]]
                ]);
                $optionsGroup->addOption($idPrefix . "autoVerticalWidth", "flexibleBoxAutoVerticalWidth",  __('bearcms.themes.options.flexibleBox.AutoVertical'), [
                    "defaultValue" => "500px",
                    "onHighlight" => [['cssSelector', $parentSelector]]
                ]);
                $optionsGroup->addOption($idPrefix . "elementsSpacing", "flexibleBoxElementsSpacing",  __('bearcms.themes.options.flexibleBox.ElementsSpacing'), [
                    "onHighlight" => [['cssSelector', $parentSelector]]
                ]);
                $optionsGroup->addOption($idPrefix . "css", "css", '', [
                    "cssTypes" => ["cssPadding", "cssBorder", "cssRadius", "cssShadow", "cssBackground", "cssSize"], // cssMargin conflicts with the elements spacing margin-bottom
                    "cssOptions" => array_diff(isset($details['cssOptions']) ? $details['cssOptions'] : [], ["*/focusState"]),
                    "cssOutput" => [
                        ["selector", $parentSelector]
                    ]
                ]);
            };
        }
        if ($hasElements || Config::hasFeature('ELEMENTS_CANVAS')) {
            self::add('canvas', [
                'componentSrc' => 'bearcms-canvas-element',
                'componentFilename' => self::$contextDir . '/components/bearcmsCanvasElement.php',
                'fields' => [
                    [
                        'id' => 'value',
                        'type' => 'textbox'
                    ]
                ],
                'onDelete' => function ($data) use ($app) {
                    if (isset($data['value'])) {
                        $files = CanvasElementHelper::getFilesInValue((string)$data['value']);
                        foreach ($files as $filename) {
                            InternalData::deleteElementAsset($filename);
                        }
                    }
                },
                'onDuplicate' => function ($data) {
                    if (isset($data['value'])) {
                        $value = (string)$data['value'];
                        $files = CanvasElementHelper::getFilesInValue($value, true);
                        $filesToUpdate = [];
                        foreach ($files as $filename) {
                            $filesToUpdate[$filename] = InternalData::duplicateElementAsset($filename);
                        }
                        if (!empty($filesToUpdate)) {
                            $data['value'] = CanvasElementHelper::updateFilesInValue($value, $filesToUpdate);
                        }
                    }
                    return $data;
                },
                'onExport' => function ($data, $add) {
                    if (isset($data['value'])) {
                        $value = (string)$data['value'];
                        $files = CanvasElementHelper::getFilesInValue($value, true);
                        $filesToUpdate = [];
                        foreach ($files as $i => $filename) {
                            $filesToUpdate[$filename] = InternalData::exportElementAsset($filename, 'file' . ($i + 1), $add);
                        }
                        if (!empty($filesToUpdate)) {
                            $data['value'] = CanvasElementHelper::updateFilesInValue($value, $filesToUpdate);
                        }
                    }
                    return $data;
                },
                'onImport' => function (array $data, ImportContext $context) {
                    if (isset($data['value'])) {
                        $value = (string)$data['value'];
                        $files = CanvasElementHelper::getFilesInValue($value, true);
                        $filesToUpdate = [];
                        foreach ($files as $filename) {
                            $filesToUpdate[$filename] = InternalData::importElementAsset($filename, 'bearcms/files/canvasstyleimage/', $context);
                        }
                        if (!empty($filesToUpdate)) {
                            $data['value'] = CanvasElementHelper::updateFilesInValue($value, $filesToUpdate);
                        }
                    }
                    return $data;
                },
                'getUploadsSizeItems' => function ($data) {
                    $result = [];
                    if (isset($data['value'])) {
                        $files = CanvasElementHelper::getFilesInValue((string)$data['value']);
                        foreach ($files as $filename) {
                            $result[] = InternalData::getFilenameDataKey($filename);
                        }
                    }
                    return $result;
                }
            ]);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
Why the military should work with scientists to study the UFO phenomenon
By Chris Impey
The image from video provided by the Department of Defense labelled Gimbal, from 2015, an unexplained object is seen at center as it is tracked as it soars high along the clouds, traveling against the wind. (Department of Defense via AP)
UFOs have been in the news a lot lately. I am a research astronomer who has written and edited books and created a free online course about the search for life in the universe. While I think we are making progress on detecting life beyond Earth, I view UFOs from a skeptical standpoint, since the evidence that they represent aliens visiting the Earth is unconvincing.
Last month, a report from the Office of the Director on National Intelligence dropped on Congress. It described 144 sightings by military personnel over a 17-year period, preferring to use the term UAP, for unidentified aerial phenomenon, in part to avoid the stigma attached to UFOs.
For those like me waiting for definitive statements, the report was a big disappointment. It declined to draw any conclusions, saying the available data is "largely inconclusive" and noting it is limited and inconsistently reported. The report worried about increased air "clutter," and left open the possibility that some UAP sightings represent advanced technologies of foreign adversaries, with significant national security implications.
As for UFOs as alien spacecraft, the report was agnostic. It scrupulously avoided using the words alien or extraterrestrial. That will do little to discourage "true believers." Nearly half of all Americans think aliens are visiting the Earth, and the UFO phenomenon has become enmeshed in a web of conspiracy theories that include accounts of abduction by aliens and crop circles. These conspiracy theories have undoubtedly been fueled in part by the fact that the military has been secretly investigating UFOs for decades. Any rational debate over UFOs must contend with the fact that they have taken deep root in the public consciousness.
Will the report, and increased transparency by the military, change anything? Will it help draw scientists like me into a serious study of the phenomenon?
Scientists will have to get over their reticence to engage with the sightings. We are in an awkward position. Rapid progress in finding planets orbiting other stars has led to a projection of 300 million habitable planets in our galaxy. There has been plenty of time for life on some of those planets to evolve intelligence and technology. We don't deny the possibility of aliens traveling from their star system to ours. We are just unconvinced by the data presented so far. Most sightings can be attributed to weather balloons or astronomical phenomena such as meteors, fireballs, and Venus. There are many resources giving mundane explanations for UFO sightings.
There have been academic studies of UFOs before. In 1968, the Condon Report said that that no scientific knowledge had been gained from two decades of study of the phenomenon. But 20 years later, a review led by Stanford professor Peter Sturrock concluded that some sightings are accompanied by physical evidence that warrants investigation. It is telling that after decades of studies and hundreds of thousands of sightings, UFOs have not reached the gold standard in science for confirming any hypothesis: reproducible evidence.
For their part, the military and intelligence communities will have to more actively engage with scientists, and ask for their help and expertise in understanding the sightings in the report, and many others that have not been made public. There are signs that this might happen. Under Avril Haynes, the Office of the DNI has been drawing on its expert group of 500 scientists who consult with the intelligence agencies on scientific problems. A model for this type of collaboration is the two panels of scientists and medical experts that were recently set up to understand the "Havana syndrome" that has afflicted American diplomats since 2016.
What would a collaboration with scientists look like, and what kind of data would it take to "move the needle" on understanding the UAP phenomenon?
The recent report shows how difficult it is to interpret the sightings, even with expert observers and data from multiple sensors. In all but one of 144 cases, there was too little information to even broadly characterize the event. Deputy Defense Secretary Kathleen Hicks acknowledged this deficiency when she called for more timely and consistent data collection on UAPs. The Defense Department has just over two months to develop a new strategy and report back to Congress.
Sensors malfunction and even expert observers can be fooled when seeing something outside their realm of experience. With optical and infrared imaging, it is extremely difficult to gauge the distance, size, and speed of an object. For example, the three Navy videos that have been in heavy circulation on the Internet seem impressive and inexplicable, but they could easily be artifacts of camera optics and tracking systems.
The military should invite a select group of experts to examine all the evidence (with suitable clearance given when the sensor technology involved is classified). It should be an interdisciplinary team, comprised to address all the observational characteristics of the phenomena. Ideally, data should be shared among our allies, since UAP appear globally. Scientists can bring their assets to bear on the problem as well. For example, civilian satellites are being used to detect and monitor UAPs and machine learning can be used to sift the data for anomalous events.
Scientists are curious and they love a challenging problem. I would lend my hand to the effort if asked. Let's hope the government will harness scientific expertise to shine light on this decades-long mystery.
Chris Impey is a professor of astronomy at the University of Arizona. He is the author of hundreds of research papers on observational cosmology and education, and he has written popular books on black holes, the future of space travel, teaching cosmology to Buddhist monks, how the universe began, and how the universe will end. His massive open online courses have enrolled over 300,000 people.
Editor's note: This is an Op-Ed and as such, the opinions expressed are those of the author. If you would like to respond, or have an editorial of your own you would like to submit, please contact Military Times senior managing editor Howard Altman, haltman@militarytimes.com.
Hollywood version couldn't prepare veteran for war realities
I wonder what came first: the movie version informing real life or real life informing the movie version.
Deterring Russia requires a capable bridge tanker and Congressional support
A key element of U.S. deterrence strategy must be to provide NATO air power with sufficient legs — in the form of a modern, capable, interoperable tanker force.
We have a new approach to the Army Combat Fitness Test grading scale
"We can do better! The new scoring system needs to be normalized by body weight and scored based on physiological gender differences."
The US is safer from jihadi terrorism 20 years after 9/11
Al-Qaida's ability to mount another attack on U.S. soil has been seriously diminished over the past 20 years.
Cyber innovation and partnerships are key to future deterrence
Most people naturally think of deterrence in terms of weaponry.

redpajama_set_name: RedPajamaCommonCrawl


Shipping Now from all warehouses.
Planet of the Apes first burst onto the silver screen in 1968 and went on to spawn a science fiction media franchise. Weta Digital contributed visual effects to the latest films in the series: Rise of the Planet of the Apes, Dawn of the Planet of the Apes, and War for the Planet of the Apes - all three released to critical acclaim. Now, Weta Workshop is proud to launch its own exclusive collectibles, celebrating 50 years of this iconic sci-fi franchise.
Please note: images are of a pre-production prototype. Minor variations will occur.
Weta Workshop's high-quality collectibles are designed by the very same artists and technicians who work on our film projects. It takes 400-800 hours to design, sculpt, model make, mold, and paint the prototype for each new piece. Whether it be a prop replica, beautiful environment or iconic character, we treat our collectibles with the same level of care and attention to detail that we bring to our film work.


text:
\section{Introduction}
Traditionally, a network with complex topology is mathematically
described by a random graph from the ER model proposed by
Erd\"{o}s and R\'enyi \cite{E-R:1960}, which has ever dominated
scientists' thinking about complex networks for almost 40 years.
Till recently, the discoveries of small-world networks \cite
{W-S:1998} and scale-free networks \cite{B-A:1999} pioneered a
revolution in the theoretic study of complex networks, and,
surprisingly, many real-life large-scale complex networking
systems are in the categories of small-world and(or) scale-free
networks, ranging from biological to engineering systems, and even
to social and economic systems \cite{A-B:2002}-\cite{L-J-C}.

It has been argued that network topologies significantly affect
the emergent network dynamics \cite{Strogatz:2001}, and the
small-world phenomena and scale-free features of complex networks
have led to a fascinating set of common problems concerning how
the complexity of network topology facilitates and constrains
synchronous behaviors of networks \cite{Wang:2002}.

Collective synchronization in a large population of oscillators
having natural different frequencies is one of the focal points in
the synchronization literature, which is a typical phenomenon in
the fields of biology, physics, and engineering
\cite{Strogatz:2000}. After the first mathematical description by
Wiener \cite{Wiener:1961} and the later fruitful study by Winfree
\cite{Winfree:1967}, Kuramoto refined this connection between
nonlinear dynamics and statical physics, and formalized the
solution to a network of globally coupled limit-cycle oscillators
\cite{Kuramoto:1984}, answering the situation why the oscillators
are completely de-synchronized until the coupling strength
overcomes a criticality $C_{syn}$.

The recent discoveries of topological complexity accelerate the
understanding of this cooperative phenomenon in the frame of
random complex networks \cite{H-C-K:2002}-\cite{M-V-P:2004}.
Especially, Hong et al. reported their synchronization
observations of a larger criticality of coupling strength on
small-world networks than that of globally coupled networks
\cite{H-C-K:2002}. And, the latest investigation stated the
absence of critical coupling strength in frequency synchronization
of a swarm of oscillators connected as a scale-free network having
a power-law exponent $2<\gamma\le 3$ \cite{Ichinomiya:2004}.

All these fruits indicate that the topology of complex networks
does play an important role in collective synchronization, and
different categories of networks may hold significantly different
critical coupling strengths for the occurrence of synchrony in
mutually coupled oscillators. However, it should be pointed out
that most of these issues hold an assumption that every pair of
connected nodes are coupled together with the identical coupling
strength. In practice, it is more general that pairs of nodes are
connected with non-identical and asymmetric couplings. Therefore,
it is natural to ask the question that whether the collective
synchronous behaviors of complex networks with non-identical and
asymmetric coupling schemes still depend on the network
topologies? In this paper, we try to explore this question, and
the answer is that there does exist a uniform criticality of
coupling strength to synchronize diversely random networks of
limit-cycle oscillators.

The whole paper is organized as follows. Section II describes the
phase evolving model of a complex network of limit-cycle
oscillators, whose couplings are non-identical and asymmetric as
specified in this work. A uniform critical coupling strength for
collective synchrony among oscillators is analytically arrived at
the same section, whose validity is verified for categories of
random complex networks by numerical simulations in Section III.
Section IV finally concludes this investigation.

\section{Model description and main result}
We consider a network of $N$ coupled limit-cycle oscillators whose
phases $\theta_i, i=1,2,\cdots,N,$ evolve as
\begin{equation}
\label{eq0a}\frac{d\theta_i}{dt}=\omega_i+\sum_{j=1}^N
C_{ij}a_{ij}\mbox{sin}(\theta_j-\theta_i),
\end{equation}
where $C_{ij}$ is the coupling strength between node (oscillator)
$i$ and node (oscillator) $j$, and $a_{ij}$ is 1(or 0) if node $i$
is connected (or disconnected) with node $j$. Frequencies
$\omega_i, i=1,2,\cdots, N,$ are randomly distributed following
the given frequency distribution $g(\omega)$, which is assumed
that $g(\omega)=g(-\omega)$.

Define the non-identical asymmetric coupling scheme
\begin{equation}
\label{eq0b} C_{ij}=C_j=\frac{C}{k_i},\qquad i,j=1,\cdots,N,
\end{equation}
where $C$ is a positive constant, and $k_i$ is the degree of node
$i$, which fits the given degree distribution $P(k)$ of a network.
Therefore, we have
\begin{equation}
\label{eq1}\frac{d\theta_i}{dt}=\omega_i+\frac{C}{k_i}\sum_{j=1}^N
a_{ij}\mbox{sin}(\theta_j-\theta_i).
\end{equation}
If for every node $i$, its degree $k_i=N, i=1,2,\cdots, N$, model
(\ref{eq1}) equals the classic Kuramoto model for globally coupled
networks in \cite{Kuramoto:1984,Strogatz:2001,Strogatz:2000}.

Define the order parameter $(r,\Psi)$ as \cite{Ichinomiya:2004}:
\begin{equation}
\label{eq2}re^{i\Psi}=\frac{\int d\omega\int dk \int d\theta
g(\omega)P(k)k\rho(k,\omega;t,\theta)e^{i\theta}}{\int dkP(k)k},
\end{equation}
where $\rho(k,\omega;t,\theta)$ is the density of oscillators with
phase $\theta$ at time $t$ with the given frequency $\omega$ and
degree $k$, which satisfies the normalization as
\begin{equation}
\label{eq3} \int_0^{2\pi}\rho(k,\omega;t,\theta)d\theta=1.
\end{equation}

Assume $v$ to be the continuum limit of the right-hand side
(r.h.s.) of Eq. (\ref{eq1}), and each randomly selected edge is
connected to the oscillator having degree $k$, frequency $\omega$,
and phase $\theta$ with probability
$\frac{kP(k)g(\omega)\rho(k,\omega;t,\theta)}{\int dkP(k)k}$.
Therefore, determined by the continuity equation
\begin{equation}
\label{eq4}\frac{\partial\rho}{\partial t}=-\frac{\partial (\rho
v)}{\partial\theta},
\end{equation}
the density $\rho(k,\omega;t,\theta)$ evolves as
\begin{equation}
\label{eq5} \frac{\partial \rho(k,\omega;t,\theta)}{\partial
t}=-\frac{\partial}{\partial \theta}\left
[\rho(k,\omega;t,\theta)\left (\omega+\frac{C}{k}k\frac{\int
d\omega'\int dk'\int d\theta'
g(\omega')P(k')k'\rho(k',\omega';t,\theta')}{\int
dk'P(k')k'}\mbox{sin}(\theta-\theta')\right ) \right ].
\end{equation}

Substituting Eq. (\ref{eq2}) into Eq. (\ref{eq5}) yields
\begin{equation}
\label{eq6}\frac{\partial \rho (k,\omega;t,\theta)}{\partial
t}=-\frac{\partial}{\partial \theta}\left
\{\rho(k,\omega;t,\theta)\left
[\omega+Cr\mbox{sin}(\Psi-\theta)\right ]\right \},
\end{equation}
whose solution independent of time is
\begin{equation}
\label{eq7}\frac{\partial}{\partial \theta}\left
\{\rho(k,\omega;\theta)\left
[\omega+Cr\mbox{sin}(\Psi-\theta)\right ]\right \}=0.
\end{equation}
where $\rho(k,\omega;\theta)$ could be assumed to be
\begin{equation}
\label{eq8} \rho(k,\omega;\theta)=\left \{\begin{array}{l}
\delta\left (\theta-\mbox{arcsin}\left (\frac{\omega}{Cr}\right )
\right )\;\;\;\;\mbox {if}\;\frac{|\omega|}{Cr}\le 1\\
\frac{D(k,\omega)}{|\omega-Cr\mbox{sin}\theta|}\;\;\;\;\qquad\qquad\mbox{otherwise.}
\end{array}\right .
\end{equation}
Here, we assume $\psi=0$ without loss of generality, and
$D(k,\omega)$ is the normalized factor. Recall
$g(-\omega)=g(\omega)$, and substitute Eq. (\ref{eq8}) into Eq.
(\ref{eq2}). We therefore arrive at
\begin{eqnarray}
\label{eq9}r=\frac{\int dk\int_{-Cr}^{Cr} d\omega
g(\omega)kP(k)e^{i\;\mbox{arcsin}\;\left(\frac{\omega}{Cr}\right)}}{\int
dkkP(k)}\\
=\int_{-Cr}^{Cr}d\omega
g(\omega)\sqrt{1-\left(\frac{\omega}{Cr}\right)^2}\qquad\qquad\quad\\
=Cr\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\mbox{cos}^2\theta
g(Cr\mbox{sin}\theta)d\theta.\qquad\quad\quad\quad\;
\end{eqnarray}
From this self-consistency equation we finally come to
\begin{equation}
\label{eq10} C_{syn}=\frac{2}{\pi g(0)},
\end{equation}
which is surprisingly the same as the critical coupling strength
of globally coupled networks investigated by Kuramoto
\cite{Kuramoto:1984,Strogatz:2000}.

The main point of criticality (\ref{eq10}) is that, with the
non-identical and asymmetric coupling scheme (\ref{eq0b}),
different networks may exhibit the same transition of collective
synchronous behaviors regardless of the significant difference of
their degree distributions, i.e., the complexity of network
topology. We will verify this point through extensive simulations.

\section{Numerical simulations}
Define the average order parameter as
\begin{equation}
\label{eq11}
r_{av}=\left<\left[\frac{\sum_{i=1}^Nk_ie^{i\theta_i}}{\sum_{i=1}^N
k_i}\right]\right>,
\end{equation}
where $\left<\cdots\right>$ and $[\cdots]$ denote the averages
over different realizations of intrinsic networks and over
different realizations of intrinsic frequencies, respectively. In
all the simulations, $r_{av}$ is averaged over 10 groups of
networks satisfying the same degree distribution $P(k)$, and each
network has 5 sets of frequencies with the distribution
$g(\omega)$. We further specify
\begin{equation}
\label{eq12} g(\omega)=\left\{\begin{array}{l}
0.5,\qquad\mbox{if} -1<\omega<1\\
0,\qquad\quad\mbox{otherwise}.\end{array}\right .
\end{equation}
Therefore, $C_{syn}\approx 1.273$ by Eq.(\ref{eq10}) and Eq.
(\ref{eq12}).

We first numerically simulate the case of scale-free networks of
the BA model \cite{B-A-J:1999} whose degree distribution is in the
power-law form of $P(k)\propto k^{-3}$. Figures
\ref{fig-KuraBARav}-\ref{fig-KuraBARavN} show the simulating
outcomes on scale-free networks of BA model with $m=m_0=3$, and
$N=256,512,1024,2048$, respectively. It can be clearly observed
that even having the finite-size effect for $N=256,512,1024,2048$,
respectively, the average order parameter $r_{av}$ shows a rapid
increase after the critical coupling strength
$C_{syn}=\frac{2}{g(0)\pi}$, indicating that when $C_{syn}\le C$,
the scale-free network of oscillators begin to cluster with
synchrony. In Fig. \ref{fig-KuraBARavN}, $r_{av}N^{0.25}$ shows a
similar dependence on the coupling strength $C$, which rapidly
increased when $C_{syn}\le C$.

\begin{figure}
\includegraphics[width=12cm]{Kura_BA_Rav}
\caption{\label{fig-KuraBARav} The average order parameter
$r_{av}$ vs the coupling strength $C$ for scale-free networks of
the BA model with $N=256,512,1024,2048$, respectively. All
networks are started from $m=m_0=3$.}
\end{figure}

\begin{figure}
\includegraphics[width=12cm]{Kura_BA_RavN}
\caption{\label{fig-KuraBARavN} The average $r_{av}N^{0.25}$ vs
the coupling strength $C$ for scale-free networks of the BA model
with $N=256,512,1024,2048$, respectively. All networks are started
from $m=m_0=3$.}
\end{figure}

\begin{figure}[t]
\includegraphics[width=12cm]{Kura_Net2048_Rav}
\caption{\label{fig-KuraNet2048Rav} The average order parameter
$r_{av}$ vs the coupling strength $C$ for networks generated by
the ER model (dashed line with circle markers), the Local-World
model (dotted line with square markers), the BA model (solid line
with diamond markers), and the GKK model having power-law exponent
$\gamma=6$ (dash-dot line with right triangle markers). All
networks have the same scale $N=2048$ and the same average degree
$\left<k\right>=6$.}
\end{figure}

\begin{figure}[t]
\includegraphics[width=12cm]{Kura_Net2048_RavN}
\caption{\label{fig-KuraNet2048RavN} The average $r_{av}N^{0.25}$
vs the coupling strength $C$ for networks generated by the ER
model (dashed line with circle markers), the Local-World model
(dotted line with square markers), the BA model (solid line with
diamond markers), and the GKK model having power-law exponent
$\gamma=6$ (dash-dot line with right triangle markers). All
networks have the same scale $N=2048$ and the same average degree
$\left<k\right>=6$.}
\end{figure}

From this simulation example of the same scale-invariant power-law
degree distribution $P(k)\propto k^{-3}$ with different network
scale $N$, we clearly conclude that the nonzero constant
criticality $C_{syn}$ is independent of the finite size of a
network, showing a difference from the investigated case of
scale-free identical-coupled oscillators in
\cite{Ichinomiya:2004}.

To investigate the independence of $C_{syn}$ on different degree
distributions $P(k)$, we fix the scale $N=2048$, and the average
degree $\left<k\right>=6$. Therefore, all networks have the same
number of nodes and edges with different connectivity patterns in
the next simulation studies.

Two main categories of degree distributions of random complex
networks are in the forms of $P_{power}(k)\propto k^{-\gamma}$ and
$P_{exp}(k)\propto e^{-k}$. Therefore, we select the famous ER
model \cite{E-R:1960} to generate networks having an exponential
degree distribution $P_{exp}(k)\propto e^{-k}$, and nominate the
BA model and the GKK model \cite{G-K-K:2001} to generate networks
having the scale-invariant power-law degree distribution
$P_{power}(k)\propto k^{-\gamma}$ with $\gamma=3,6$, respectively.
The proposed local-world evolving network \cite{L-C:2003} owns a
transition between the exponential degree distribution and the
power-law degree distribution, therefore it is adopted as the
final prototype for the coming simulations with the parameters
$M=10$, $m=m_0=3$.

The simulating results of Figs.
\ref{fig-KuraNet2048Rav}-\ref{fig-KuraNet2048RavN} are not out of
expectation of criticality (\ref{eq10}). There is a common
critical coupling strength of the value
$C_{syn}=\frac{2}{g(0)\pi}$ in these four categories of networked
limit-cycle oscillators, and both the average order parameter
$r_{av}$ and the average $r_{av}N^{0.25}$ increased sharply when
$C_{syn}\le C$. In other words, the significant difference among
complex network topologies does not show effect on the collective
synchrony of the non-identically asymmetrically coupled
limit-cycle oscillators (\ref{eq1}). However, as concluded from
\cite{H-C-K:2002,M-V-P:2004,Ichinomiya:2004}, there is no such a
same critical coupling strength of collective synchrony in
different random complex networks of identically symmetrically
coupled limit-cycle oscillators.

\section{Conclusion}
To summarize, we have investigated the collective synchronous
behaviors of complex networks of oscillators having non-identical
asymmetric coupling strengths, which show a uniform synchrony
criticality regardless of the complexity of networking topologies.
One of the direct extensions is that for scale-free networks, when
synchronization is not preferred in some practical situations
\cite{L-C:2003-2}, the proposed asymmetric coupling scheme
(\ref{eq0b}) could be applied to obtain a nonzero synchrony
criticality which is independent of the network topologies. More
important to note is the investigation in this paper indicates
that, with the embedment of complicated coupling schemes, the
interactions previously observed between the network collective
behaviors and network complex topologies are still a small tip of
an huge iceberg, most of which are left for further explorations.

\section*{Acknowledgements}
The author thanks Dr. Takashi Ichinomiya for his valuable
discussion. This work was partially supported by the National
Natural Science Foundation of P.R. China under Grants No. 90412004
and 70431002,
and the author also acknowledges the support from the Alexander
von Humboldt Foundation and the SRF for ROCS, SEM.

redpajama_set_name: RedPajamaArXiv


text:
Results for: Feminism
Gail Collins, a best-selling author and New York Times columnist, is one of America's leading political commentators. Read More
In 2001 Gail Collins became the first woman appointed editor of the New York Times' editorial page, and she resumed her twice weekly syndicated opinion column for the New York Times in 2007. Collins also writes for "The Conversation," a Times blog in which she discusses political issues with David Brooks.
In her recent books, America's Women and When Everything Changed, Collins offers insightful research and historical perspective, with characteristic wit and humanity. In the New York Times Book Review, Amy Bloom praised When Everything Changed as a "smart, thorough, often droll and extremely readable account of women's recent history" that provides the "best summary of American women's social and political history that I've read." Of her columns, New York Magazine finds that "in an age of outbursts, Collins has subverted the pundit's rude role, performing what amounts to a sly soft-shoe over a rising wave of ideological bombast."
A native of Cincinnati, Collins earned a bachelor's degree in journalism at Marquette and a master's in government at University of Massachusetts. Before joining The Times, Collins was a columnist at New York Newsday and the New York Daily News, and a reporter for United Press International. Her first jobs in journalism were in Connecticut, where she founded the Connecticut State News Bureau (CSNB), which provided coverage of the state capitol and Connecticut politics.


text:
Robert John Welch
William Grey Ellison Macartney (1852 - 1924):
Politician and colonial governor
William Ellison Macartnev was born in Dublin and was educated at Eton and Oxford. He was called to the Bar in 1878 and served as member of parliament for South Antrim for eighteen years until 1903, when he became Deputy Master of the Royal Mint. From 1913 to 1917 he was Governor of Tasmania, and for the next three years, Governor of Western Australia. He was a privy councillor, and was knighted in 1913. He died in London.