From d82f29fbe529b086d733258473a5211a7f8a5f56 Mon Sep 17 00:00:00 2001 From: taoser Date: Mon, 1 Apr 2024 10:04:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/addon/Addons.php | 9 +- app/admin/middleware.php | 2 +- app/admin/view/public/admin_form.html | 1 + app/common/lib/JwtAuth.php | 66 + app/common/lib/Uploads.php | 72 + app/index/controller/Login.php | 2 +- app/middleware/AdminAuth.php | 117 ++ app/middleware/Auth.php | 119 +- app/middleware/Auths.php | 33 + composer.json | 6 +- composer.lock | 301 +-- config/taoler.php | 2 +- public/static/component/layui/css/layui.css | 2 +- public/static/component/layui/layui.js | 2 +- .../static/component/pear/module/imagecut.js | 105 + public/static/res/mods/imagecut.js | 2 +- vendor/composer/autoload_files.php | 2 +- vendor/composer/autoload_psr4.php | 8 +- vendor/composer/autoload_static.php | 44 +- vendor/composer/installed.json | 381 ++-- vendor/composer/installed.php | 86 +- vendor/firebase/php-jwt/CHANGELOG.md | 156 ++ vendor/firebase/php-jwt/README.md | 337 +++- vendor/firebase/php-jwt/composer.json | 12 +- vendor/firebase/php-jwt/src/CachedKeySet.php | 268 +++ vendor/firebase/php-jwt/src/JWK.php | 229 ++- vendor/firebase/php-jwt/src/JWT.php | 419 ++-- vendor/firebase/php-jwt/src/Key.php | 35 +- .../league/mime-type-detection/CHANGELOG.md | 18 + vendor/league/mime-type-detection/LICENSE | 2 +- .../league/mime-type-detection/composer.json | 6 +- .../src/ExtensionLookup.php | 14 + .../src/ExtensionMimeTypeDetector.php | 16 +- .../src/FinfoMimeTypeDetector.php | 16 +- .../src/GeneratedExtensionToMimeTypeMap.php | 1076 +++++++++- vendor/overtrue/easy-sms/.editorconfig | 20 + vendor/overtrue/easy-sms/.github/FUNDING.yml | 3 + .../easy-sms/.github/workflows/tests.yml | 24 + .../overtrue/easy-sms/.php-cs-fixer.dist.php | 49 + vendor/overtrue/easy-sms/LICENSE | 21 + vendor/overtrue/easy-sms/README.md | 1007 ++++++++++ vendor/overtrue/easy-sms/composer.json | 62 + vendor/overtrue/easy-sms/psalm.xml | 15 + .../src/Contracts/GatewayInterface.php | 38 + .../src/Contracts/MessageInterface.php | 63 + .../src/Contracts/PhoneNumberInterface.php | 53 + .../src/Contracts/StrategyInterface.php | 27 + vendor/overtrue/easy-sms/src/EasySms.php | 326 +++ .../easy-sms/src/Exceptions/Exception.php | 21 + .../src/Exceptions/GatewayErrorException.php | 37 + .../Exceptions/InvalidArgumentException.php | 19 + .../NoGatewayAvailableException.php | 81 + .../easy-sms/src/Gateways/AliyunGateway.php | 107 + .../src/Gateways/AliyunIntlGateway.php | 97 + .../src/Gateways/AliyunrestGateway.php | 107 + .../src/Gateways/AvatardataGateway.php | 60 + .../easy-sms/src/Gateways/BaiduGateway.php | 174 ++ .../src/Gateways/ChuanglanGateway.php | 156 ++ .../src/Gateways/Chuanglanv1Gateway.php | 147 ++ .../easy-sms/src/Gateways/ErrorlogGateway.php | 50 + .../easy-sms/src/Gateways/Gateway.php | 120 ++ .../easy-sms/src/Gateways/HuaweiGateway.php | 148 ++ .../easy-sms/src/Gateways/HuaxinGateway.php | 73 + .../easy-sms/src/Gateways/HuyiGateway.php | 77 + .../easy-sms/src/Gateways/JuheGateway.php | 76 + .../easy-sms/src/Gateways/KingttoGateway.php | 61 + .../easy-sms/src/Gateways/LuosimaoGateway.php | 74 + .../easy-sms/src/Gateways/MaapGateway.php | 72 + .../easy-sms/src/Gateways/ModuyunGateway.php | 99 + .../easy-sms/src/Gateways/NowcnGateway.php | 34 + .../easy-sms/src/Gateways/QcloudGateway.php | 137 ++ .../easy-sms/src/Gateways/QiniuGateway.php | 148 ++ .../src/Gateways/RongcloudGateway.php | 134 ++ .../src/Gateways/RongheyunGateway.php | 69 + .../src/Gateways/SendcloudGateway.php | 95 + .../easy-sms/src/Gateways/SmsbaoGateway.php | 77 + .../easy-sms/src/Gateways/SubmailGateway.php | 88 + .../src/Gateways/TianyiwuxianGateway.php | 84 + .../easy-sms/src/Gateways/TiniyoGateway.php | 85 + .../easy-sms/src/Gateways/TinreeGateway.php | 77 + .../easy-sms/src/Gateways/TwilioGateway.php | 91 + .../easy-sms/src/Gateways/UcloudGateway.php | 130 ++ .../easy-sms/src/Gateways/Ue35Gateway.php | 77 + .../src/Gateways/VolcengineGateway.php | 311 +++ .../easy-sms/src/Gateways/YunpianGateway.php | 101 + .../src/Gateways/YuntongxunGateway.php | 123 ++ .../easy-sms/src/Gateways/YunxinGateway.php | 162 ++ .../src/Gateways/YunzhixunGateway.php | 121 ++ .../easy-sms/src/Gateways/ZzyunGateway.php | 63 + vendor/overtrue/easy-sms/src/Message.php | 187 ++ vendor/overtrue/easy-sms/src/Messenger.php | 92 + vendor/overtrue/easy-sms/src/PhoneNumber.php | 126 ++ .../easy-sms/src/Strategies/OrderStrategy.php | 32 + .../src/Strategies/RandomStrategy.php | 34 + .../overtrue/easy-sms/src/Support/Config.php | 147 ++ .../easy-sms/src/Traits/HasHttpRequest.php | 136 ++ vendor/php-di/invoker/README.md | 10 +- vendor/phpmailer/phpmailer/README.md | 4 +- vendor/phpmailer/phpmailer/VERSION | 2 +- vendor/phpmailer/phpmailer/composer.json | 4 +- .../phpmailer/language/phpmailer.lang-fi.php | 1 - .../phpmailer/language/phpmailer.lang-fr.php | 1 - .../phpmailer/language/phpmailer.lang-nb.php | 45 +- .../phpmailer/language/phpmailer.lang-si.php | 34 + .../language/phpmailer.lang-zh_cn.php | 11 +- .../phpmailer/src/DSNConfigurator.php | 4 +- vendor/phpmailer/phpmailer/src/PHPMailer.php | 4 +- vendor/phpmailer/phpmailer/src/POP3.php | 2 +- vendor/phpmailer/phpmailer/src/SMTP.php | 6 +- vendor/services.php | 2 +- vendor/symfony/polyfill-mbstring/LICENSE | 2 +- vendor/symfony/polyfill-mbstring/Mbstring.php | 87 +- .../Resources/unidata/caseFolding.php | 119 ++ .../symfony/polyfill-mbstring/bootstrap.php | 4 + .../symfony/polyfill-mbstring/bootstrap80.php | 4 + .../symfony/polyfill-mbstring/composer.json | 2 +- vendor/symfony/polyfill-php72/LICENSE | 2 +- vendor/symfony/polyfill-php72/composer.json | 2 +- vendor/symfony/polyfill-php80/LICENSE | 2 +- vendor/symfony/polyfill-php80/composer.json | 2 +- vendor/topthink/think-migration/.gitignore | 1 + vendor/topthink/think-migration/composer.json | 34 +- .../think-migration/phinx/Config/Config.php | 553 ++++++ .../phinx/Config/ConfigInterface.php | 171 ++ .../phinx/Config/FeatureFlags.php | 41 + .../phinx/Config/NamespaceAwareInterface.php | 33 + .../phinx/Config/NamespaceAwareTrait.php | 74 + .../phinx/Db/Action/Action.php | 38 + .../phinx/Db/Action/AddColumn.php | 62 + .../phinx/Db/Action/AddForeignKey.php | 78 + .../phinx/Db/Action/AddIndex.php | 67 + .../phinx/Db/Action/ChangeColumn.php | 87 + .../phinx/Db/Action/ChangeComment.php | 42 + .../phinx/Db/Action/ChangePrimaryKey.php | 42 + .../phinx/Db/Action/CreateTable.php | 12 + .../phinx/Db/Action/DropForeignKey.php | 68 + .../phinx/Db/Action/DropIndex.php | 75 + .../phinx/Db/Action/DropTable.php | 12 + .../phinx/Db/Action/RemoveColumn.php | 59 + .../phinx/Db/Action/RenameColumn.php | 79 + .../phinx/Db/Action/RenameTable.php | 42 + .../phinx/Db/Adapter/AbstractAdapter.php | 412 ++++ .../phinx/Db/Adapter/AdapterFactory.php | 172 ++ .../phinx/Db/Adapter/AdapterInterface.php | 505 +++++ .../phinx/Db/Adapter/AdapterWrapper.php | 487 +++++ .../Db/Adapter/DirectActionInterface.php | 139 ++ .../phinx/Db/Adapter/MysqlAdapter.php | 1548 +++++++++++++++ .../phinx/Db/Adapter/PdoAdapter.php | 1003 ++++++++++ .../phinx/Db/Adapter/PostgresAdapter.php | 1600 +++++++++++++++ .../phinx/Db/Adapter/ProxyAdapter.php | 129 ++ .../phinx/Db/Adapter/SQLiteAdapter.php | 1767 +++++++++++++++++ .../phinx/Db/Adapter/SqlServerAdapter.php | 1377 +++++++++++++ .../phinx/Db/Adapter/TablePrefixAdapter.php | 494 +++++ .../phinx/Db/Adapter/TimedOutputAdapter.php | 423 ++++ .../UnsupportedColumnTypeException.php | 19 + .../phinx/Db/Adapter/WrapperInterface.php | 39 + .../phinx/Db/Plan/AlterTable.php | 72 + .../think-migration/phinx/Db/Plan/Intent.php | 55 + .../phinx/Db/Plan/NewTable.php | 101 + .../think-migration/phinx/Db/Plan/Plan.php | 492 +++++ .../phinx/Db/Plan/Solver/ActionSplitter.php | 103 + .../think-migration/phinx/Db/Table.php | 721 +++++++ .../think-migration/phinx/Db/Table/Column.php | 801 ++++++++ .../phinx/Db/Table/ForeignKey.php | 237 +++ .../think-migration/phinx/Db/Table/Index.php | 227 +++ .../think-migration/phinx/Db/Table/Table.php | 84 + .../phinx/Db/Util/AlterInstructions.php | 122 ++ vendor/topthink/think-migration/phinx/LICENSE | 4 +- .../phinx/Migration/AbstractMigration.php | 338 ++++ .../Migration/AbstractTemplateCreation.php | 74 + .../phinx/Migration/CreationInterface.php | 69 + .../IrreversibleMigrationException.php | 20 + .../phinx/Migration/Manager.php | 1141 +++++++++++ .../phinx/Migration/Manager/Environment.php | 398 ++++ .../Migration.change.template.php.dist | 23 + .../Migration.up_down.template.php.dist | 17 + .../phinx/Migration/MigrationInterface.php | 269 +++ .../topthink/think-migration/phinx/README.md | 37 +- .../phinx/Seed/AbstractSeed.php | 222 +++ .../phinx/Seed/Seed.template.php.dist | 20 + .../phinx/Seed/SeedInterface.php | 188 ++ .../think-migration/phinx/Util/Expression.php | 41 + .../think-migration/phinx/Util/Literal.php | 41 + .../think-migration/phinx/Util/Util.php | 361 ++++ .../topthink/think-migration/src/Command.php | 11 +- .../topthink/think-migration/src/Migrator.php | 4 +- .../think-migration/src/NullOutput.php | 13 + .../topthink/think-migration/src/UsePhinx.php | 116 ++ .../think-migration/src/command/Migrate.php | 17 +- .../think-migration/src/db/Column.php | 2 +- .../topthink/think-migration/src/db/Table.php | 66 +- vendor/yzh52521/easyhttp/composer.json | 2 +- vendor/yzh52521/easyhttp/src/Http.php | 13 +- vendor/yzh52521/easyhttp/src/Request.php | 117 +- 194 files changed, 28295 insertions(+), 975 deletions(-) create mode 100644 app/common/lib/JwtAuth.php create mode 100644 app/middleware/AdminAuth.php create mode 100644 app/middleware/Auths.php create mode 100644 public/static/component/pear/module/imagecut.js create mode 100644 vendor/firebase/php-jwt/CHANGELOG.md create mode 100644 vendor/firebase/php-jwt/src/CachedKeySet.php create mode 100644 vendor/league/mime-type-detection/src/ExtensionLookup.php create mode 100644 vendor/overtrue/easy-sms/.editorconfig create mode 100644 vendor/overtrue/easy-sms/.github/FUNDING.yml create mode 100644 vendor/overtrue/easy-sms/.github/workflows/tests.yml create mode 100644 vendor/overtrue/easy-sms/.php-cs-fixer.dist.php create mode 100644 vendor/overtrue/easy-sms/LICENSE create mode 100644 vendor/overtrue/easy-sms/README.md create mode 100644 vendor/overtrue/easy-sms/composer.json create mode 100644 vendor/overtrue/easy-sms/psalm.xml create mode 100644 vendor/overtrue/easy-sms/src/Contracts/GatewayInterface.php create mode 100644 vendor/overtrue/easy-sms/src/Contracts/MessageInterface.php create mode 100644 vendor/overtrue/easy-sms/src/Contracts/PhoneNumberInterface.php create mode 100644 vendor/overtrue/easy-sms/src/Contracts/StrategyInterface.php create mode 100644 vendor/overtrue/easy-sms/src/EasySms.php create mode 100644 vendor/overtrue/easy-sms/src/Exceptions/Exception.php create mode 100644 vendor/overtrue/easy-sms/src/Exceptions/GatewayErrorException.php create mode 100644 vendor/overtrue/easy-sms/src/Exceptions/InvalidArgumentException.php create mode 100644 vendor/overtrue/easy-sms/src/Exceptions/NoGatewayAvailableException.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/AliyunGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/AliyunIntlGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/AliyunrestGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/AvatardataGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/BaiduGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/ChuanglanGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/Chuanglanv1Gateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/ErrorlogGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/Gateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/HuaweiGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/HuaxinGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/HuyiGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/JuheGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/KingttoGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/LuosimaoGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/MaapGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/ModuyunGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/NowcnGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/QcloudGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/QiniuGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/RongcloudGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/RongheyunGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/SendcloudGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/SmsbaoGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/SubmailGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/TianyiwuxianGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/TiniyoGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/TinreeGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/TwilioGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/UcloudGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/Ue35Gateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/VolcengineGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/YunpianGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/YuntongxunGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/YunxinGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/YunzhixunGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Gateways/ZzyunGateway.php create mode 100644 vendor/overtrue/easy-sms/src/Message.php create mode 100644 vendor/overtrue/easy-sms/src/Messenger.php create mode 100644 vendor/overtrue/easy-sms/src/PhoneNumber.php create mode 100644 vendor/overtrue/easy-sms/src/Strategies/OrderStrategy.php create mode 100644 vendor/overtrue/easy-sms/src/Strategies/RandomStrategy.php create mode 100644 vendor/overtrue/easy-sms/src/Support/Config.php create mode 100644 vendor/overtrue/easy-sms/src/Traits/HasHttpRequest.php create mode 100644 vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php create mode 100644 vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php create mode 100644 vendor/topthink/think-migration/phinx/Config/Config.php create mode 100644 vendor/topthink/think-migration/phinx/Config/ConfigInterface.php create mode 100644 vendor/topthink/think-migration/phinx/Config/FeatureFlags.php create mode 100644 vendor/topthink/think-migration/phinx/Config/NamespaceAwareInterface.php create mode 100644 vendor/topthink/think-migration/phinx/Config/NamespaceAwareTrait.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/Action.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/AddColumn.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/AddForeignKey.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/AddIndex.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/ChangeColumn.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/ChangeComment.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/ChangePrimaryKey.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/CreateTable.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/DropForeignKey.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/DropIndex.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/DropTable.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/RemoveColumn.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/RenameColumn.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Action/RenameTable.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/AbstractAdapter.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/AdapterFactory.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/AdapterInterface.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/AdapterWrapper.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/DirectActionInterface.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/MysqlAdapter.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/PdoAdapter.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/PostgresAdapter.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/ProxyAdapter.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/SQLiteAdapter.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/SqlServerAdapter.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/TablePrefixAdapter.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/TimedOutputAdapter.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/UnsupportedColumnTypeException.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Adapter/WrapperInterface.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Plan/AlterTable.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Plan/Intent.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Plan/NewTable.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Plan/Plan.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Plan/Solver/ActionSplitter.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Table.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Table/Column.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Table/ForeignKey.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Table/Index.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Table/Table.php create mode 100644 vendor/topthink/think-migration/phinx/Db/Util/AlterInstructions.php create mode 100644 vendor/topthink/think-migration/phinx/Migration/AbstractMigration.php create mode 100644 vendor/topthink/think-migration/phinx/Migration/AbstractTemplateCreation.php create mode 100644 vendor/topthink/think-migration/phinx/Migration/CreationInterface.php create mode 100644 vendor/topthink/think-migration/phinx/Migration/IrreversibleMigrationException.php create mode 100644 vendor/topthink/think-migration/phinx/Migration/Manager.php create mode 100644 vendor/topthink/think-migration/phinx/Migration/Manager/Environment.php create mode 100644 vendor/topthink/think-migration/phinx/Migration/Migration.change.template.php.dist create mode 100644 vendor/topthink/think-migration/phinx/Migration/Migration.up_down.template.php.dist create mode 100644 vendor/topthink/think-migration/phinx/Migration/MigrationInterface.php create mode 100644 vendor/topthink/think-migration/phinx/Seed/AbstractSeed.php create mode 100644 vendor/topthink/think-migration/phinx/Seed/Seed.template.php.dist create mode 100644 vendor/topthink/think-migration/phinx/Seed/SeedInterface.php create mode 100644 vendor/topthink/think-migration/phinx/Util/Expression.php create mode 100644 vendor/topthink/think-migration/phinx/Util/Literal.php create mode 100644 vendor/topthink/think-migration/phinx/Util/Util.php create mode 100644 vendor/topthink/think-migration/src/NullOutput.php create mode 100644 vendor/topthink/think-migration/src/UsePhinx.php diff --git a/app/admin/controller/addon/Addons.php b/app/admin/controller/addon/Addons.php index 3f0a531..a02af75 100644 --- a/app/admin/controller/addon/Addons.php +++ b/app/admin/controller/addon/Addons.php @@ -341,11 +341,11 @@ class Addons extends AdminController { $name = input('name'); $config = get_addons_config($name); -// halt($config); + if(empty($config)) return json(['code'=>-1,'msg'=>'无配置项!无需操作']); if(Request::isAjax()){ $params = Request::param('params/a',[],'trim'); -// halt($params); + if ($params) { foreach ($config as $k => &$v) { if (isset($params[$k])) { @@ -359,6 +359,9 @@ class Addons extends AdminController $value = $params[$k]; $v['content'] = $value; $v['value'] = $value; + } elseif ($v['type'] == 'select'){ + $value = [(int)$params[$k]]; + $v['value'] = $value; } else { $value = $params[$k]; } @@ -371,7 +374,7 @@ class Addons extends AdminController } return json(['code'=>0,'msg'=>'配置成功!']); } -//halt($config); + //模板引擎初始化 $view = ['formData'=>$config,'title'=>'title']; View::assign($view); diff --git a/app/admin/middleware.php b/app/admin/middleware.php index a56776a..6993a0c 100644 --- a/app/admin/middleware.php +++ b/app/admin/middleware.php @@ -4,5 +4,5 @@ return [ // 检测安装 \app\middleware\Install::class, // 权限检测 - app\middleware\Auth::class, + app\middleware\AdminAuth::class, ]; \ No newline at end of file diff --git a/app/admin/view/public/admin_form.html b/app/admin/view/public/admin_form.html index 89132fe..dae6646 100644 --- a/app/admin/view/public/admin_form.html +++ b/app/admin/view/public/admin_form.html @@ -4,6 +4,7 @@ {block name="title"}TaoLerCMS后台管理系统{/block} + {block name="link"}{/block} {block name="body"}内容{/block} diff --git a/app/common/lib/JwtAuth.php b/app/common/lib/JwtAuth.php new file mode 100644 index 0000000..1487c50 --- /dev/null +++ b/app/common/lib/JwtAuth.php @@ -0,0 +1,66 @@ + self::ISS, + "aud" => self::AUD, + "iat" => $time, + "nbf" => $time, + 'exp' => $time + 86400 * 30, + 'data' => $data, + ]; + $token = JWT::encode($payload, self::KEY, self::ALG); + return $token; + } + + /** + * + * 对 token 进行编码验证 + * @param string $token + * @param integer $user_id + */ + public static function decode(string $token) + { + try { + // 对 token 进行编码 + $decoded = JWT::decode($token, new Key(self::KEY, self::ALG)); + // 检测 token 附加数据中是否存在用户id + if (!empty($decoded->data->uid)) { + $data = $decoded->data; + } else { + throw new \Exception('token 中没有用户信息'); + } + } catch (\Exception $e) { + throw new \Exception($e->getMessage(), 201); + } + return $data; // 用户信息 + } + + public static function getHeaderToken(array $header) + { + return str_replace('Bearer ', '', $header['authorization']); + } +} \ No newline at end of file diff --git a/app/common/lib/Uploads.php b/app/common/lib/Uploads.php index 1c244f5..d535a14 100644 --- a/app/common/lib/Uploads.php +++ b/app/common/lib/Uploads.php @@ -155,6 +155,7 @@ class Uploads ->check(['file'=>$file]); } catch (ValidateException $e) { + halt($e->getMessage()); return json(['status'=>-1,'msg'=>$e->getMessage()]); } @@ -200,4 +201,75 @@ class Uploads return json(['status'=>0,'msg'=>'上传成功','url'=> $name_path, 'location'=>$name_path]); } + /** + * 上传文件 + * @param string $fileName 文件名 + * @param string $dirName 目录名 + * @param int $fileSize 文件大小 + * @param string $fileType 文件类型 + * @param string $rule 文件命名规则 默认md5,uniqid,date,sha1,_self为上传文件名称作为文件名,或者自定义如a.jpg文件名 + * @return \think\response\Json + */ + public function put_api(string $fileName, string $dirName, int $fileSize, string $fileType, int $uid, string $rule = '' ) + { + if(stripos($fileName,'http') !== false) { + $file = $fileName; + } else { + $file = request()->file($fileName); + } + + $fileExt = $this->getFileInfo($fileType,'ext'); + $fileMime = $this->getFileInfo($fileType,'mime'); + + try { + validate([$fileName=>['fileSize'=>$fileSize * 1024,'fileExt'=>$fileExt,'fileMime'=>$fileMime]]) + ->check(['file'=>$file]); + + } catch (ValidateException $e) { + halt($e->getMessage()); + return json(['status'=>-1,'msg'=>$e->getMessage()]); + } + + // 解析存储位置 SYS_开头为系统位置 + $isSys = stripos($dirName, 'SYS_'); + if($isSys) { + $disk = 'sys'; + $dirName = substr($dirName,4); + $uploadDir = Config::get('filesystem.disks.sys.url'); + $path = DIRECTORY_SEPARATOR . $disk . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR . date('Ymd'); + } else { + $disk = 'public'; + $dirName = $uid . DIRECTORY_SEPARATOR . $dirName; + $uploadDir = Config::get('filesystem.disks.public.url'); + $path = DIRECTORY_SEPARATOR . 'storage' . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR . date('Ymd'); + } + + $realPath = app()->getRootPath() . 'public' . $path; + + $rules = ['md5','date','sha1','uniqid']; + + try{ + // 解析是否自定义文件名 + if(in_array($rule, $rules)) { + // rule命名 + $info = $file->move($realPath, $file->hashName($rule)); + } elseif(!empty($rule)) { + // 自定义文件名 + if(stripos($rule, '_self')) { + $info = $file->move($realPath, $file->getOriginalName()); + } + $info = $file->move($realPath, $rule); + } else { + // 默认 + $info = $file->move($realPath, $file->hashName()); + } + } catch (\Exception $e) { + return json(['code' => -1, 'msg' => $e->getMessage()]); + } + + $name_path = str_replace('\\',"/", $path . '/' . $info->getBasename()); + + return json(['code' => 1,'msg'=>'上传成功', 'data' => ['url'=> $name_path]]); + } + } \ No newline at end of file diff --git a/app/index/controller/Login.php b/app/index/controller/Login.php index a9ed8ef..a9e6a8d 100644 --- a/app/index/controller/Login.php +++ b/app/index/controller/Login.php @@ -42,7 +42,7 @@ class Login extends BaseController // 检验登录是否开放 if(config('taoler.config.is_login') == 0 ) return json(['code'=>-1,'msg'=>'抱歉,网站维护中,暂时不能登录哦!']); //登陆前数据校验 - $data = Request::param(); + $data = Request::only(['name','email','phone','password','captcha']); if(Config::get('taoler.config.login_captcha') == 1) { //先校验验证码 diff --git a/app/middleware/AdminAuth.php b/app/middleware/AdminAuth.php new file mode 100644 index 0000000..37e55d7 --- /dev/null +++ b/app/middleware/AdminAuth.php @@ -0,0 +1,117 @@ + + * @Date: 2021-12-06 16:04:50 + * @LastEditTime: 2022-04-22 06:24:03 + * @LastEditors: TaoLer + * @Description: 搜索引擎SEO优化设置 + * @FilePath: \TaoLer\app\middleware\Auth.php + * Copyright (c) 2020~2022 http://www.aieok.com All rights reserved. + */ +declare(strict_types=1); + +namespace app\middleware; + +use taoser\think\Auth as UserAuth; +use think\facade\Session; +use think\facade\Cookie; +use think\facade\Db; +use think\facade\Config; +use think\facade\Request; + +class AdminAuth +{ + /** + * 处理请求 + * + * @param Request $request + * @param \Closure $next + * @return Response + */ + public function handle($request, \Closure $next) + { +// var_dump(Request::url(),Request::pathinfo(),$request->baseUrl(),$request->controller()); + //访问路径 +// $path = app('http')->getName().'/'.stristr($request->pathinfo(),".html",true); + $path = stristr($request->pathinfo(),".html",true) ?: Request::pathinfo(); +// var_dump($path); + //登陆前获取加密的Cookie + $cooAuth = Cookie::get('adminAuth'); + + if(!empty($cooAuth)){ + $resArr = explode(':',$cooAuth); + $userId = end($resArr); + //检验用户 + $user = Db::name('admin')->where('id',$userId)->find(); + if(!empty($user)){ + //验证cookie + $salt = Config::get('taoler.salt'); + $auth = md5($user['username'].$salt).":".$userId; + if($auth == $cooAuth){ + Session::set('admin_name',$user['username']); + Session::set('admin_id',$userId); + } + } + + } + +// //没有登录及当前非登录页重定向登录页 +// if(!Session::has('admin_id') && $path !== 'admin/login/index' && !(stristr($request->pathinfo(),"captcha.html") || stristr($request->pathinfo(),"addons")) ) +// { +// return redirect((string) url('login/index')); +// } +// //登陆后无法访问登录页 +// if(Session::has('admin_id') && $path == 'admin/login/index'){ +// return redirect((string) url('index/index')); +// } +// // 排除公共权限 +// $not_check = ['admin/','index/index', 'admin/menu/getMenuNavbar','admin/login/index','admin/index/index','admin/index/home','admin/Admin/info','admin/Admin/repass','admin/Admin/logout','admin/Index/news','admin/Index/cunsult','admin/Index/replys','admin/Index/reply','admin/captcha','addons/socail/','admin/addons/social/oauth/login','admin/addons/bacimg/index/getImages']; + + + //没有登录及当前非登录页重定向登录页 + if(!Session::has('admin_id') && $path !== 'login/index' && !(stristr($request->pathinfo(),"captcha.html") || stristr($request->pathinfo(),"addons")) ) + { + return redirect((string) url('login/index')); + } + //登陆后无法访问登录页 + if(Session::has('admin_id') && $path == 'login/index' || $path == ''){ + return redirect((string) url('index/index')); + } + + // 排除公共权限 + $not_check = [ + 'captcha', + 'login/index', + 'admin/index', + 'system.menu/getnav', + 'index/index', + 'index/console1', + 'index/console2', + 'index/news', + 'menu/getMenuNavbar', + 'index/home', + 'Admin/info', + 'system.admin/repass', + 'system.admin/logout', + 'Index/cunsult', + 'Index/replys', + 'Index/reply', + 'admin/captcha', + 'addons/socail/', + 'addons/social/oauth/login', + 'addons/bacimg/index/getImages' + ]; + + if (!in_array($path, $not_check)) { + $auth = new UserAuth(); + $admin_id = Session::get('admin_id'); //登录用户的id + + if (!$auth->check($path, $admin_id) && $admin_id != 1) { + //return view('public/auth'); + //return response(""); + return json(['code'=>-1,'msg'=>'无权限']); + } + } + return $next($request); + } +} diff --git a/app/middleware/Auth.php b/app/middleware/Auth.php index f0df0ef..404aa36 100644 --- a/app/middleware/Auth.php +++ b/app/middleware/Auth.php @@ -1,117 +1,32 @@ - * @Date: 2021-12-06 16:04:50 - * @LastEditTime: 2022-04-22 06:24:03 - * @LastEditors: TaoLer - * @Description: 搜索引擎SEO优化设置 - * @FilePath: \TaoLer\app\middleware\Auth.php - * Copyright (c) 2020~2022 http://www.aieok.com All rights reserved. - */ -declare(strict_types=1); namespace app\middleware; -use taoser\think\Auth as UserAuth; -use think\facade\Session; -use think\facade\Cookie; -use think\facade\Db; -use think\facade\Config; -use think\facade\Request; +use app\common\lib\JwtAuth; class Auth { - /** - * 处理请求 - * - * @param Request $request - * @param \Closure $next - * @return Response - */ public function handle($request, \Closure $next) { -// var_dump(Request::url(),Request::pathinfo(),$request->baseUrl(),$request->controller()); - //访问路径 -// $path = app('http')->getName().'/'.stristr($request->pathinfo(),".html",true); - $path = stristr($request->pathinfo(),".html",true) ?: Request::pathinfo(); -// var_dump($path); - //登陆前获取加密的Cookie - $cooAuth = Cookie::get('adminAuth'); + $header = $request->header(); - if(!empty($cooAuth)){ - $resArr = explode(':',$cooAuth); - $userId = end($resArr); - //检验用户 - $user = Db::name('admin')->where('id',$userId)->find(); - if(!empty($user)){ - //验证cookie - $salt = Config::get('taoler.salt'); - $auth = md5($user['username'].$salt).":".$userId; - if($auth == $cooAuth){ - Session::set('admin_name',$user['username']); - Session::set('admin_id',$userId); - } + if(isset($header['authorization'])) { + $token = trim(ltrim($request->header('authorization'), 'Bearer')); + + try{ + $data = JwtAuth::decode($token); + + $request->uid = $data->uid; + + } catch(\Exception $e) { + return $e->getMessage(); } + } else { + return json(['code' => -1, 'msg' => 'no auth']); } - -// //没有登录及当前非登录页重定向登录页 -// if(!Session::has('admin_id') && $path !== 'admin/login/index' && !(stristr($request->pathinfo(),"captcha.html") || stristr($request->pathinfo(),"addons")) ) -// { -// return redirect((string) url('login/index')); -// } -// //登陆后无法访问登录页 -// if(Session::has('admin_id') && $path == 'admin/login/index'){ -// return redirect((string) url('index/index')); -// } -// // 排除公共权限 -// $not_check = ['admin/','index/index', 'admin/menu/getMenuNavbar','admin/login/index','admin/index/index','admin/index/home','admin/Admin/info','admin/Admin/repass','admin/Admin/logout','admin/Index/news','admin/Index/cunsult','admin/Index/replys','admin/Index/reply','admin/captcha','addons/socail/','admin/addons/social/oauth/login','admin/addons/bacimg/index/getImages']; - - - //没有登录及当前非登录页重定向登录页 - if(!Session::has('admin_id') && $path !== 'login/index' && !(stristr($request->pathinfo(),"captcha.html") || stristr($request->pathinfo(),"addons")) ) - { - return redirect((string) url('login/index')); - } - //登陆后无法访问登录页 - if(Session::has('admin_id') && $path == 'login/index' || $path == ''){ - return redirect((string) url('index/index')); - } - - // 排除公共权限 - $not_check = [ - 'captcha', - 'login/index', - 'admin/index', - 'system.menu/getnav', - 'index/index', - 'index/console1', - 'index/console2', - 'index/news', - 'menu/getMenuNavbar', - 'index/home', - 'Admin/info', - 'system.admin/repass', - 'system.admin/logout', - 'Index/cunsult', - 'Index/replys', - 'Index/reply', - 'admin/captcha', - 'addons/socail/', - 'addons/social/oauth/login', - 'addons/bacimg/index/getImages' - ]; - - if (!in_array($path, $not_check)) { - $auth = new UserAuth(); - $admin_id = Session::get('admin_id'); //登录用户的id - - if (!$auth->check($path, $admin_id) && $admin_id != 1) { - //return view('public/auth'); - //return response(""); - return json(['code'=>-1,'msg'=>'无权限']); - } - } - return $next($request); + //登陆前获取加密的Cookie + + return $next($request); } } diff --git a/app/middleware/Auths.php b/app/middleware/Auths.php new file mode 100644 index 0000000..2797227 --- /dev/null +++ b/app/middleware/Auths.php @@ -0,0 +1,33 @@ +header(); + + if(isset($header['authorization'])) { + $token = trim(ltrim($request->header('authorization'), 'Bearer')); + + try{ + $data = JwtAuth::decode($token); + + $request->uid = $data->uid; + + } catch(\Exception $e) { + return $e->getMessage(); + } + + + } else { + return json(['code' => -1, 'msg' => 'no auth']); + } + //登陆前获取加密的Cookie + + return $next($request); + } +} diff --git a/composer.json b/composer.json index 9ca524c..7980909 100644 --- a/composer.json +++ b/composer.json @@ -24,8 +24,6 @@ "topthink/think-view": "^1.0", "topthink/think-captcha": "^3.0", "phpmailer/phpmailer": "^6.1", - "lotofbadcode/phpspirit_databackup": "^1.1", - "wamkj/thinkphp6.0-databackup": "^1.0", "taoser/think-addons": "^1.0", "liliuwei/thinkphp-social": "^1.3", "taoser/think-setarr": "^0.0.3", @@ -38,7 +36,9 @@ "workerman/phpsocket.io": "^1.1", "jaeger/querylist": "^4.2", "symfony/var-exporter": "^5.4", - "yzh52521/easyhttp": "^1.0" + "yzh52521/easyhttp": "^1.0", + "firebase/php-jwt": "^6.8", + "overtrue/easy-sms": "^2.5" }, "require-dev": { "symfony/var-dumper": "^4.2", diff --git a/composer.lock b/composer.lock index f155291..f5e6967 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "20dad4ba0451f20b1191711c63ad21c7", + "content-hash": "6be3b456c215d7ae6d3ba8a28f6697b4", "packages": [ { "name": "bacon/bacon-qr-code", @@ -257,16 +257,16 @@ }, { "name": "dasprid/enum", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/DASPRiD/Enum.git", - "reference": "8e6b6ea76eabbf19ea2bf5b67b98e1860474012f" + "reference": "6faf451159fb8ba4126b925ed2d78acfce0dc016" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/8e6b6ea76eabbf19ea2bf5b67b98e1860474012f", - "reference": "8e6b6ea76eabbf19ea2bf5b67b98e1860474012f", + "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/6faf451159fb8ba4126b925ed2d78acfce0dc016", + "reference": "6faf451159fb8ba4126b925ed2d78acfce0dc016", "shasum": "" }, "require": { @@ -301,9 +301,9 @@ ], "support": { "issues": "https://github.com/DASPRiD/Enum/issues", - "source": "https://github.com/DASPRiD/Enum/tree/1.0.4" + "source": "https://github.com/DASPRiD/Enum/tree/1.0.5" }, - "time": "2023-03-01T18:44:03+00:00" + "time": "2023-08-25T16:18:39+00:00" }, { "name": "endroid/qr-code", @@ -377,6 +377,69 @@ ], "time": "2022-10-26T08:48:17+00:00" }, + { + "name": "firebase/php-jwt", + "version": "v6.8.1", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/5dbc8959427416b8ee09a100d7a8588c00fb2e26", + "reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26", + "shasum": "" + }, + "require": { + "php": "^7.4||^8.0" + }, + "require-dev": { + "guzzlehttp/guzzle": "^6.5||^7.4", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "psr/cache": "^1.0||^2.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0" + }, + "suggest": { + "ext-sodium": "Support EdDSA (Ed25519) signatures", + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/v6.8.1" + }, + "time": "2023-07-14T18:33:00+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "7.0.0", @@ -950,26 +1013,26 @@ }, { "name": "league/mime-type-detection", - "version": "1.11.0", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "ff6248ea87a9f116e78edd6002e39e5128a0d4dd" + "reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ff6248ea87a9f116e78edd6002e39e5128a0d4dd", - "reference": "ff6248ea87a9f116e78edd6002e39e5128a0d4dd", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/a6dfb1194a2946fcdc1f38219445234f65b35c96", + "reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96", "shasum": "" }, "require": { "ext-fileinfo": "*", - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.2", "phpstan/phpstan": "^0.12.68", - "phpunit/phpunit": "^8.5.8 || ^9.3" + "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0" }, "type": "library", "autoload": { @@ -990,7 +1053,7 @@ "description": "Mime-type detection for Flysystem", "support": { "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.11.0" + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.13.0" }, "funding": [ { @@ -1002,7 +1065,7 @@ "type": "tidelift" } ], - "time": "2022-04-17T13:12:02+00:00" + "time": "2023-08-05T12:09:49+00:00" }, { "name": "liliuwei/thinkphp-social", @@ -1080,61 +1143,83 @@ "time": "2021-01-13T05:11:12+00:00" }, { - "name": "lotofbadcode/phpspirit_databackup", - "version": "v1.2", + "name": "overtrue/easy-sms", + "version": "2.5.0", "source": { "type": "git", - "url": "https://github.com/lotofbadcode/phpspirit_databackup.git", - "reference": "77c2421f8461392c044cf8c29918f495c22a5612" + "url": "https://github.com/overtrue/easy-sms.git", + "reference": "81d4deec69bbb6de6e5fdd7ab90cc933bd3e3046" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lotofbadcode/phpspirit_databackup/zipball/77c2421f8461392c044cf8c29918f495c22a5612", - "reference": "77c2421f8461392c044cf8c29918f495c22a5612", + "url": "https://api.github.com/repos/overtrue/easy-sms/zipball/81d4deec69bbb6de6e5fdd7ab90cc933bd3e3046", + "reference": "81d4deec69bbb6de6e5fdd7ab90cc933bd3e3046", "shasum": "" }, "require": { - "php": ">=7.0" + "ext-json": "*", + "guzzlehttp/guzzle": "^6.2 || ^7.0", + "php": ">=5.6" + }, + "require-dev": { + "brainmaestro/composer-git-hooks": "^2.8", + "jetbrains/phpstorm-attributes": "^1.0", + "mockery/mockery": "~1.3.3 || ^1.4.2", + "phpunit/phpunit": "^5.7 || ^7.5 || ^8.5.19 || ^9.5.8" }, "type": "library", + "extra": { + "hooks": { + "pre-commit": [ + "composer check-style", + "composer psalm", + "composer test" + ], + "pre-push": [ + "composer check-style" + ] + } + }, "autoload": { "psr-4": { - "phpspirit\\databackup\\": "src/" + "Overtrue\\EasySms\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache-2.0" + "MIT" ], "authors": [ { - "name": "代码庸医", - "email": "3359964266@qq.com" + "name": "overtrue", + "email": "i@overtrue.me" } ], - "description": "一个PHP数据库备份恢复的插件", - "keywords": [ - "library", - "php" - ], + "description": "The easiest way to send short message.", "support": { - "issues": "https://github.com/lotofbadcode/phpspirit_databackup/issues", - "source": "https://github.com/lotofbadcode/phpspirit_databackup/tree/v1.2" + "issues": "https://github.com/overtrue/easy-sms/issues", + "source": "https://github.com/overtrue/easy-sms/tree/2.5.0" }, - "time": "2023-05-12T12:02:05+00:00" + "funding": [ + { + "url": "https://github.com/overtrue", + "type": "github" + } + ], + "time": "2023-08-07T07:51:17+00:00" }, { "name": "php-di/invoker", - "version": "2.3.3", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/PHP-DI/Invoker.git", - "reference": "cd6d9f267d1a3474bdddf1be1da079f01b942786" + "reference": "33234b32dafa8eb69202f950a1fc92055ed76a86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/cd6d9f267d1a3474bdddf1be1da079f01b942786", - "reference": "cd6d9f267d1a3474bdddf1be1da079f01b942786", + "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/33234b32dafa8eb69202f950a1fc92055ed76a86", + "reference": "33234b32dafa8eb69202f950a1fc92055ed76a86", "shasum": "" }, "require": { @@ -1168,7 +1253,7 @@ ], "support": { "issues": "https://github.com/PHP-DI/Invoker/issues", - "source": "https://github.com/PHP-DI/Invoker/tree/2.3.3" + "source": "https://github.com/PHP-DI/Invoker/tree/2.3.4" }, "funding": [ { @@ -1176,7 +1261,7 @@ "type": "github" } ], - "time": "2021-12-13T09:22:56+00:00" + "time": "2023-09-08T09:24:21+00:00" }, { "name": "php-di/php-di", @@ -1298,16 +1383,16 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.8.0", + "version": "v6.8.1", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "df16b615e371d81fb79e506277faea67a1be18f1" + "reference": "e88da8d679acc3824ff231fdc553565b802ac016" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/df16b615e371d81fb79e506277faea67a1be18f1", - "reference": "df16b615e371d81fb79e506277faea67a1be18f1", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e88da8d679acc3824ff231fdc553565b802ac016", + "reference": "e88da8d679acc3824ff231fdc553565b802ac016", "shasum": "" }, "require": { @@ -1317,13 +1402,13 @@ "php": ">=5.5.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "doctrine/annotations": "^1.2.6 || ^1.13.3", "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.7.1", + "squizlabs/php_codesniffer": "^3.7.2", "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { @@ -1366,7 +1451,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.8.0" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.8.1" }, "funding": [ { @@ -1374,7 +1459,7 @@ "type": "github" } ], - "time": "2023-03-06T14:43:22+00:00" + "time": "2023-08-29T08:26:30+00:00" }, { "name": "psr/cache", @@ -1775,16 +1860,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { @@ -1799,7 +1884,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1838,7 +1923,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -1854,20 +1939,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", "shasum": "" }, "require": { @@ -1876,7 +1961,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1914,7 +1999,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0" }, "funding": [ { @@ -1930,20 +2015,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { @@ -1952,7 +2037,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1997,7 +2082,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -2013,7 +2098,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/var-dumper", @@ -2592,24 +2677,27 @@ }, { "name": "topthink/think-migration", - "version": "v3.0.6", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/top-think/think-migration.git", - "reference": "82c4226cb14f973b9377c7fc6e89c525cbb8b030" + "reference": "22c44058e1454f3af1d346e7f6524fbe654de7fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-migration/zipball/82c4226cb14f973b9377c7fc6e89c525cbb8b030", - "reference": "82c4226cb14f973b9377c7fc6e89c525cbb8b030", + "url": "https://api.github.com/repos/top-think/think-migration/zipball/22c44058e1454f3af1d346e7f6524fbe654de7fb", + "reference": "22c44058e1454f3af1d346e7f6524fbe654de7fb", "shasum": "" }, "require": { + "php": ">=7.2", "topthink/framework": "^6.0 || ^8.0", "topthink/think-helper": "^3.0.3" }, "require-dev": { - "fzaninotto/faker": "^1.8" + "composer/composer": "^2.5.8", + "fzaninotto/faker": "^1.8", + "robmorgan/phinx": "^0.13.4" }, "suggest": { "fzaninotto/faker": "Required to use the factory builder (^1.8)." @@ -2624,7 +2712,7 @@ }, "autoload": { "psr-4": { - "Phinx\\": "phinx/src/Phinx", + "Phinx\\": "phinx", "think\\migration\\": "src" } }, @@ -2640,9 +2728,9 @@ ], "support": { "issues": "https://github.com/top-think/think-migration/issues", - "source": "https://github.com/top-think/think-migration/tree/v3.0.6" + "source": "https://github.com/top-think/think-migration/tree/v3.1.1" }, - "time": "2023-07-01T11:01:52+00:00" + "time": "2023-09-14T05:51:31+00:00" }, { "name": "topthink/think-multi-app", @@ -2829,51 +2917,6 @@ }, "time": "2019-11-06T11:40:13+00:00" }, - { - "name": "wamkj/thinkphp6.0-databackup", - "version": "v1.0", - "source": { - "type": "git", - "url": "https://github.com/wamkj/thinkphp6.0-databackup.git", - "reference": "28a0e406d827132942723a3c9f69bb20c98e652f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wamkj/thinkphp6.0-databackup/zipball/28a0e406d827132942723a3c9f69bb20c98e652f", - "reference": "28a0e406d827132942723a3c9f69bb20c98e652f", - "shasum": "" - }, - "require": { - "php": ">=7.1.0", - "topthink/framework": "^6.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "wamkj\\thinkphp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "wamkj", - "email": "1149183529@qq.com" - } - ], - "description": "thinkphp6.0的数据库自动备份扩展", - "keywords": [ - "think-databackup", - "thinkphp" - ], - "support": { - "issues": "https://github.com/wamkj/thinkphp6.0-databackup/issues", - "source": "https://github.com/wamkj/thinkphp6.0-databackup/tree/v1.0" - }, - "time": "2020-02-15T13:04:16+00:00" - }, { "name": "workerman/channel", "version": "v1.2.0", @@ -3159,21 +3202,21 @@ }, { "name": "yzh52521/easyhttp", - "version": "v1.0.7", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/yzh52521/easyhttp.git", - "reference": "52cb9aba60a725bef77acd9c4c48ecc78931af9e" + "reference": "78ec5cea1884d6da0709cac95a1e4d23fe9bfc65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yzh52521/easyhttp/zipball/52cb9aba60a725bef77acd9c4c48ecc78931af9e", - "reference": "52cb9aba60a725bef77acd9c4c48ecc78931af9e", + "url": "https://api.github.com/repos/yzh52521/easyhttp/zipball/78ec5cea1884d6da0709cac95a1e4d23fe9bfc65", + "reference": "78ec5cea1884d6da0709cac95a1e4d23fe9bfc65", "shasum": "" }, "require": { "guzzlehttp/guzzle": "^6.0|^7.0", - "php": "^7.2.5|^8.0", + "php": ">=7.2.5", "psr/log": "^1.0|^2.0|^3.0" }, "type": "library", @@ -3205,9 +3248,9 @@ ], "support": { "issues": "https://github.com/yzh52521/easyhttp/issues", - "source": "https://github.com/yzh52521/easyhttp/tree/v1.0.7" + "source": "https://github.com/yzh52521/easyhttp/tree/v1.1.0" }, - "time": "2023-02-16T03:04:02+00:00" + "time": "2023-08-31T06:20:52+00:00" } ], "packages-dev": [ diff --git a/config/taoler.php b/config/taoler.php index 5a0ecd3..ed84243 100644 --- a/config/taoler.php +++ b/config/taoler.php @@ -16,7 +16,7 @@ return [ // 应用名,此项不可更改 'appname' => 'TaoLer', // 版本配置 - 'version' => '2.3.9', + 'version' => '2.3.12', // 加盐 'salt' => 'taoler', // 数据库备份目录 diff --git a/public/static/component/layui/css/layui.css b/public/static/component/layui/css/layui.css index f20e2a6..c1c2d9f 100644 --- a/public/static/component/layui/css/layui.css +++ b/public/static/component/layui/css/layui.css @@ -1 +1 @@ -blockquote,body,button,dd,div,dl,dt,form,h1,h2,h3,h4,h5,h6,input,li,ol,p,pre,td,textarea,th,ul{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}a:active,a:hover{outline:0}img{display:inline-block;border:none;vertical-align:middle}li{list-style:none}table{border-collapse:collapse;border-spacing:0}h1,h2,h3,h4{font-weight:700}h5,h6{font-weight:500;font-size:100%}button,input,select,textarea{font-size:100%}button,input,optgroup,option,select,textarea{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;outline:0}pre{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}body{line-height:1.6;color:#333;color:rgba(0,0,0,.85);font:14px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}hr{height:0;line-height:0;margin:10px 0;padding:0;border:none!important;border-bottom:1px solid #eee!important;clear:both;overflow:hidden;background:0 0}a{color:#333;text-decoration:none}a:hover{color:#777}a cite{font-style:normal;*cursor:pointer}.layui-border-box,.layui-border-box *{box-sizing:border-box}.layui-box,.layui-box *{box-sizing:content-box}.layui-clear{clear:both;*zoom:1}.layui-clear:after{content:'\20';clear:both;*zoom:1;display:block;height:0}.layui-clear-space{word-spacing:-5px}.layui-inline{position:relative;display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.layui-edge{position:relative;display:inline-block;vertical-align:middle;width:0;height:0;border-width:6px;border-style:dashed;border-color:transparent;overflow:hidden}.layui-edge-top{top:-4px;border-bottom-color:#999;border-bottom-style:solid}.layui-edge-right{border-left-color:#999;border-left-style:solid}.layui-edge-bottom{top:2px;border-top-color:#999;border-top-style:solid}.layui-edge-left{border-right-color:#999;border-right-style:solid}.layui-elip{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-disabled,.layui-icon,.layui-unselect{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-disabled,.layui-disabled:hover{color:#d2d2d2!important;cursor:not-allowed!important}.layui-circle{border-radius:100%}.layui-show{display:block!important}.layui-hide{display:none!important}.layui-show-v{visibility:visible!important}.layui-hide-v{visibility:hidden!important}@font-face{font-family:layui-icon;src:url(../font/iconfont.eot?v=282);src:url(../font/iconfont.eot?v=282#iefix) format('embedded-opentype'),url(../font/iconfont.woff2?v=282) format('woff2'),url(../font/iconfont.woff?v=282) format('woff'),url(../font/iconfont.ttf?v=282) format('truetype'),url(../font/iconfont.svg?v=282#layui-icon) format('svg')}.layui-icon{font-family:layui-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-icon-leaf:before{content:"\e701"}.layui-icon-folder:before{content:"\eabe"}.layui-icon-folder-open:before{content:"\eac1"}.layui-icon-gitee:before{content:"\e69b"}.layui-icon-github:before{content:"\e6a7"}.layui-icon-disabled:before{content:"\e6cc"}.layui-icon-moon:before{content:"\e6c2"}.layui-icon-error:before{content:"\e693"}.layui-icon-success:before{content:"\e697"}.layui-icon-question:before{content:"\e699"}.layui-icon-lock:before{content:"\e69a"}.layui-icon-eye:before{content:"\e695"}.layui-icon-eye-invisible:before{content:"\e696"}.layui-icon-backspace:before{content:"\e694"}.layui-icon-tips-fill:before{content:"\eb2e"}.layui-icon-test:before{content:"\e692"}.layui-icon-clear:before{content:"\e788"}.layui-icon-heart-fill:before{content:"\e68f"}.layui-icon-light:before{content:"\e748"}.layui-icon-music:before{content:"\e690"}.layui-icon-time:before{content:"\e68d"}.layui-icon-ie:before{content:"\e7bb"}.layui-icon-firefox:before{content:"\e686"}.layui-icon-at:before{content:"\e687"}.layui-icon-bluetooth:before{content:"\e689"}.layui-icon-chrome:before{content:"\e68a"}.layui-icon-edge:before{content:"\e68b"}.layui-icon-heart:before{content:"\e68c"}.layui-icon-key:before{content:"\e683"}.layui-icon-android:before{content:"\e684"}.layui-icon-mike:before{content:"\e6dc"}.layui-icon-mute:before{content:"\e685"}.layui-icon-gift:before{content:"\e627"}.layui-icon-windows:before{content:"\e67f"}.layui-icon-ios:before{content:"\e680"}.layui-icon-logout:before{content:"\e682"}.layui-icon-wifi:before{content:"\e7e0"}.layui-icon-rss:before{content:"\e808"}.layui-icon-email:before{content:"\e618"}.layui-icon-reduce-circle:before{content:"\e616"}.layui-icon-transfer:before{content:"\e691"}.layui-icon-service:before{content:"\e626"}.layui-icon-addition:before{content:"\e624"}.layui-icon-subtraction:before{content:"\e67e"}.layui-icon-slider:before{content:"\e714"}.layui-icon-print:before{content:"\e66d"}.layui-icon-export:before{content:"\e67d"}.layui-icon-cols:before{content:"\e610"}.layui-icon-screen-full:before{content:"\e622"}.layui-icon-screen-restore:before{content:"\e758"}.layui-icon-rate-half:before{content:"\e6c9"}.layui-icon-rate-solid:before{content:"\e67a"}.layui-icon-rate:before{content:"\e67b"}.layui-icon-cellphone:before{content:"\e678"}.layui-icon-vercode:before{content:"\e679"}.layui-icon-login-weibo:before{content:"\e675"}.layui-icon-login-qq:before{content:"\e676"}.layui-icon-login-wechat:before{content:"\e677"}.layui-icon-username:before{content:"\e66f"}.layui-icon-password:before{content:"\e673"}.layui-icon-refresh-3:before{content:"\e9aa"}.layui-icon-auz:before{content:"\e672"}.layui-icon-shrink-right:before{content:"\e668"}.layui-icon-spread-left:before{content:"\e66b"}.layui-icon-snowflake:before{content:"\e6b1"}.layui-icon-tips:before{content:"\e702"}.layui-icon-note:before{content:"\e66e"}.layui-icon-senior:before{content:"\e674"}.layui-icon-refresh-1:before{content:"\e666"}.layui-icon-refresh:before{content:"\e669"}.layui-icon-flag:before{content:"\e66c"}.layui-icon-theme:before{content:"\e66a"}.layui-icon-notice:before{content:"\e667"}.layui-icon-console:before{content:"\e665"}.layui-icon-website:before{content:"\e7ae"}.layui-icon-face-surprised:before{content:"\e664"}.layui-icon-set:before{content:"\e716"}.layui-icon-template:before{content:"\e663"}.layui-icon-app:before{content:"\e653"}.layui-icon-template-1:before{content:"\e656"}.layui-icon-home:before{content:"\e68e"}.layui-icon-female:before{content:"\e661"}.layui-icon-male:before{content:"\e662"}.layui-icon-tread:before{content:"\e6c5"}.layui-icon-praise:before{content:"\e6c6"}.layui-icon-rmb:before{content:"\e65e"}.layui-icon-more:before{content:"\e65f"}.layui-icon-camera:before{content:"\e660"}.layui-icon-cart-simple:before{content:"\e698"}.layui-icon-face-cry:before{content:"\e69c"}.layui-icon-face-smile:before{content:"\e6af"}.layui-icon-survey:before{content:"\e6b2"}.layui-icon-read:before{content:"\e705"}.layui-icon-location:before{content:"\e715"}.layui-icon-dollar:before{content:"\e659"}.layui-icon-diamond:before{content:"\e735"}.layui-icon-return:before{content:"\e65c"}.layui-icon-camera-fill:before{content:"\e65d"}.layui-icon-fire:before{content:"\e756"}.layui-icon-more-vertical:before{content:"\e671"}.layui-icon-cart:before{content:"\e657"}.layui-icon-star-fill:before{content:"\e658"}.layui-icon-prev:before{content:"\e65a"}.layui-icon-next:before{content:"\e65b"}.layui-icon-upload:before{content:"\e67c"}.layui-icon-upload-drag:before{content:"\e681"}.layui-icon-user:before{content:"\e770"}.layui-icon-file-b:before{content:"\e655"}.layui-icon-component:before{content:"\e857"}.layui-icon-find-fill:before{content:"\e670"}.layui-icon-loading:before{content:"\e63d"}.layui-icon-loading-1:before{content:"\e63e"}.layui-icon-add-1:before{content:"\e654"}.layui-icon-pause:before{content:"\e651"}.layui-icon-play:before{content:"\e652"}.layui-icon-video:before{content:"\e6ed"}.layui-icon-headset:before{content:"\e6fc"}.layui-icon-voice:before{content:"\e688"}.layui-icon-speaker:before{content:"\e645"}.layui-icon-fonts-del:before{content:"\e64f"}.layui-icon-fonts-html:before{content:"\e64b"}.layui-icon-fonts-code:before{content:"\e64e"}.layui-icon-fonts-strong:before{content:"\e62b"}.layui-icon-unlink:before{content:"\e64d"}.layui-icon-picture:before{content:"\e64a"}.layui-icon-link:before{content:"\e64c"}.layui-icon-face-smile-b:before{content:"\e650"}.layui-icon-align-center:before{content:"\e647"}.layui-icon-align-right:before{content:"\e648"}.layui-icon-align-left:before{content:"\e649"}.layui-icon-fonts-u:before{content:"\e646"}.layui-icon-fonts-i:before{content:"\e644"}.layui-icon-tabs:before{content:"\e62a"}.layui-icon-circle:before{content:"\e63f"}.layui-icon-radio:before{content:"\e643"}.layui-icon-share:before{content:"\e641"}.layui-icon-edit:before{content:"\e642"}.layui-icon-delete:before{content:"\e640"}.layui-icon-engine:before{content:"\e628"}.layui-icon-chart-screen:before{content:"\e629"}.layui-icon-chart:before{content:"\e62c"}.layui-icon-table:before{content:"\e62d"}.layui-icon-tree:before{content:"\e62e"}.layui-icon-upload-circle:before{content:"\e62f"}.layui-icon-templeate-1:before{content:"\e630"}.layui-icon-util:before{content:"\e631"}.layui-icon-layouts:before{content:"\e632"}.layui-icon-prev-circle:before{content:"\e633"}.layui-icon-carousel:before{content:"\e634"}.layui-icon-code-circle:before{content:"\e635"}.layui-icon-water:before{content:"\e636"}.layui-icon-date:before{content:"\e637"}.layui-icon-layer:before{content:"\e638"}.layui-icon-fonts-clear:before{content:"\e639"}.layui-icon-dialogue:before{content:"\e63a"}.layui-icon-cellphone-fine:before{content:"\e63b"}.layui-icon-form:before{content:"\e63c"}.layui-icon-file:before{content:"\e621"}.layui-icon-triangle-r:before{content:"\e623"}.layui-icon-triangle-d:before{content:"\e625"}.layui-icon-set-sm:before{content:"\e620"}.layui-icon-add-circle:before{content:"\e61f"}.layui-icon-layim-download:before{content:"\e61e"}.layui-icon-layim-uploadfile:before{content:"\e61d"}.layui-icon-404:before{content:"\e61c"}.layui-icon-about:before{content:"\e60b"}.layui-icon-layim-theme:before{content:"\e61b"}.layui-icon-down:before{content:"\e61a"}.layui-icon-up:before{content:"\e619"}.layui-icon-circle-dot:before{content:"\e617"}.layui-icon-set-fill:before{content:"\e614"}.layui-icon-search:before{content:"\e615"}.layui-icon-friends:before{content:"\e612"}.layui-icon-group:before{content:"\e613"}.layui-icon-reply-fill:before{content:"\e611"}.layui-icon-menu-fill:before{content:"\e60f"}.layui-icon-face-smile-fine:before{content:"\e60c"}.layui-icon-picture-fine:before{content:"\e60d"}.layui-icon-log:before{content:"\e60e"}.layui-icon-list:before{content:"\e60a"}.layui-icon-release:before{content:"\e609"}.layui-icon-add-circle-fine:before{content:"\e608"}.layui-icon-ok:before{content:"\e605"}.layui-icon-help:before{content:"\e607"}.layui-icon-chat:before{content:"\e606"}.layui-icon-top:before{content:"\e604"}.layui-icon-right:before{content:"\e602"}.layui-icon-left:before{content:"\e603"}.layui-icon-star:before{content:"\e600"}.layui-icon-download-circle:before{content:"\e601"}.layui-icon-close:before{content:"\1006"}.layui-icon-close-fill:before{content:"\1007"}.layui-icon-ok-circle:before{content:"\1005"}.layui-main{position:relative;width:1160px;margin:0 auto}.layui-header{position:relative;z-index:1000;height:60px}.layui-header a:hover{transition:all .5s;-webkit-transition:all .5s}.layui-side{position:fixed;left:0;top:0;bottom:0;z-index:999;width:200px;overflow-x:hidden}.layui-side-scroll{position:relative;width:220px;height:100%;overflow-x:hidden}.layui-body{position:relative;left:200px;right:0;top:0;bottom:0;z-index:900;width:auto;box-sizing:border-box}.layui-layout-body{overflow-x:hidden}.layui-layout-admin .layui-header{position:fixed;top:0;left:0;right:0;background-color:#23292e}.layui-layout-admin .layui-side{top:60px;width:200px;overflow-x:hidden}.layui-layout-admin .layui-body{position:absolute;top:60px;padding-bottom:44px}.layui-layout-admin .layui-main{width:auto;margin:0 15px}.layui-layout-admin .layui-footer{position:fixed;left:200px;right:0;bottom:0;z-index:990;height:44px;line-height:44px;padding:0 15px;box-shadow:-1px 0 4px rgb(0 0 0 / 12%);background-color:#fafafa}.layui-layout-admin .layui-logo{position:absolute;left:0;top:0;width:200px;height:100%;line-height:60px;text-align:center;color:#16baaa;font-size:16px;box-shadow:0 1px 2px 0 rgb(0 0 0 / 15%)}.layui-layout-admin .layui-header .layui-nav{background:0 0}.layui-layout-left{position:absolute!important;left:200px;top:0}.layui-layout-right{position:absolute!important;right:0;top:0}.layui-container{position:relative;margin:0 auto;box-sizing:border-box}.layui-fluid{position:relative;margin:0 auto;padding:0 15px}.layui-row:after,.layui-row:before{content:"";display:block;clear:both}.layui-col-lg1,.layui-col-lg10,.layui-col-lg11,.layui-col-lg12,.layui-col-lg2,.layui-col-lg3,.layui-col-lg4,.layui-col-lg5,.layui-col-lg6,.layui-col-lg7,.layui-col-lg8,.layui-col-lg9,.layui-col-md1,.layui-col-md10,.layui-col-md11,.layui-col-md12,.layui-col-md2,.layui-col-md3,.layui-col-md4,.layui-col-md5,.layui-col-md6,.layui-col-md7,.layui-col-md8,.layui-col-md9,.layui-col-sm1,.layui-col-sm10,.layui-col-sm11,.layui-col-sm12,.layui-col-sm2,.layui-col-sm3,.layui-col-sm4,.layui-col-sm5,.layui-col-sm6,.layui-col-sm7,.layui-col-sm8,.layui-col-sm9,.layui-col-xl1,.layui-col-xl10,.layui-col-xl11,.layui-col-xl12,.layui-col-xl2,.layui-col-xl3,.layui-col-xl4,.layui-col-xl5,.layui-col-xl6,.layui-col-xl7,.layui-col-xl8,.layui-col-xl9,.layui-col-xs1,.layui-col-xs10,.layui-col-xs11,.layui-col-xs12,.layui-col-xs2,.layui-col-xs3,.layui-col-xs4,.layui-col-xs5,.layui-col-xs6,.layui-col-xs7,.layui-col-xs8,.layui-col-xs9{position:relative;display:block;box-sizing:border-box}.layui-col-xs1,.layui-col-xs10,.layui-col-xs11,.layui-col-xs12,.layui-col-xs2,.layui-col-xs3,.layui-col-xs4,.layui-col-xs5,.layui-col-xs6,.layui-col-xs7,.layui-col-xs8,.layui-col-xs9{float:left}.layui-col-xs1{width:8.33333333%}.layui-col-xs2{width:16.66666667%}.layui-col-xs3{width:25%}.layui-col-xs4{width:33.33333333%}.layui-col-xs5{width:41.66666667%}.layui-col-xs6{width:50%}.layui-col-xs7{width:58.33333333%}.layui-col-xs8{width:66.66666667%}.layui-col-xs9{width:75%}.layui-col-xs10{width:83.33333333%}.layui-col-xs11{width:91.66666667%}.layui-col-xs12{width:100%}.layui-col-xs-offset1{margin-left:8.33333333%}.layui-col-xs-offset2{margin-left:16.66666667%}.layui-col-xs-offset3{margin-left:25%}.layui-col-xs-offset4{margin-left:33.33333333%}.layui-col-xs-offset5{margin-left:41.66666667%}.layui-col-xs-offset6{margin-left:50%}.layui-col-xs-offset7{margin-left:58.33333333%}.layui-col-xs-offset8{margin-left:66.66666667%}.layui-col-xs-offset9{margin-left:75%}.layui-col-xs-offset10{margin-left:83.33333333%}.layui-col-xs-offset11{margin-left:91.66666667%}.layui-col-xs-offset12{margin-left:100%}@media screen and (max-width:767.98px){.layui-container{padding:0 15px}.layui-hide-xs{display:none!important}.layui-show-xs-block{display:block!important}.layui-show-xs-inline{display:inline!important}.layui-show-xs-inline-block{display:inline-block!important}}@media screen and (min-width:768px){.layui-container{width:720px}.layui-hide-sm{display:none!important}.layui-show-sm-block{display:block!important}.layui-show-sm-inline{display:inline!important}.layui-show-sm-inline-block{display:inline-block!important}.layui-col-sm1,.layui-col-sm10,.layui-col-sm11,.layui-col-sm12,.layui-col-sm2,.layui-col-sm3,.layui-col-sm4,.layui-col-sm5,.layui-col-sm6,.layui-col-sm7,.layui-col-sm8,.layui-col-sm9{float:left}.layui-col-sm1{width:8.33333333%}.layui-col-sm2{width:16.66666667%}.layui-col-sm3{width:25%}.layui-col-sm4{width:33.33333333%}.layui-col-sm5{width:41.66666667%}.layui-col-sm6{width:50%}.layui-col-sm7{width:58.33333333%}.layui-col-sm8{width:66.66666667%}.layui-col-sm9{width:75%}.layui-col-sm10{width:83.33333333%}.layui-col-sm11{width:91.66666667%}.layui-col-sm12{width:100%}.layui-col-sm-offset1{margin-left:8.33333333%}.layui-col-sm-offset2{margin-left:16.66666667%}.layui-col-sm-offset3{margin-left:25%}.layui-col-sm-offset4{margin-left:33.33333333%}.layui-col-sm-offset5{margin-left:41.66666667%}.layui-col-sm-offset6{margin-left:50%}.layui-col-sm-offset7{margin-left:58.33333333%}.layui-col-sm-offset8{margin-left:66.66666667%}.layui-col-sm-offset9{margin-left:75%}.layui-col-sm-offset10{margin-left:83.33333333%}.layui-col-sm-offset11{margin-left:91.66666667%}.layui-col-sm-offset12{margin-left:100%}}@media screen and (min-width:992px){.layui-container{width:960px}.layui-hide-md{display:none!important}.layui-show-md-block{display:block!important}.layui-show-md-inline{display:inline!important}.layui-show-md-inline-block{display:inline-block!important}.layui-col-md1,.layui-col-md10,.layui-col-md11,.layui-col-md12,.layui-col-md2,.layui-col-md3,.layui-col-md4,.layui-col-md5,.layui-col-md6,.layui-col-md7,.layui-col-md8,.layui-col-md9{float:left}.layui-col-md1{width:8.33333333%}.layui-col-md2{width:16.66666667%}.layui-col-md3{width:25%}.layui-col-md4{width:33.33333333%}.layui-col-md5{width:41.66666667%}.layui-col-md6{width:50%}.layui-col-md7{width:58.33333333%}.layui-col-md8{width:66.66666667%}.layui-col-md9{width:75%}.layui-col-md10{width:83.33333333%}.layui-col-md11{width:91.66666667%}.layui-col-md12{width:100%}.layui-col-md-offset1{margin-left:8.33333333%}.layui-col-md-offset2{margin-left:16.66666667%}.layui-col-md-offset3{margin-left:25%}.layui-col-md-offset4{margin-left:33.33333333%}.layui-col-md-offset5{margin-left:41.66666667%}.layui-col-md-offset6{margin-left:50%}.layui-col-md-offset7{margin-left:58.33333333%}.layui-col-md-offset8{margin-left:66.66666667%}.layui-col-md-offset9{margin-left:75%}.layui-col-md-offset10{margin-left:83.33333333%}.layui-col-md-offset11{margin-left:91.66666667%}.layui-col-md-offset12{margin-left:100%}}@media screen and (min-width:1200px){.layui-container{width:1150px}.layui-hide-lg{display:none!important}.layui-show-lg-block{display:block!important}.layui-show-lg-inline{display:inline!important}.layui-show-lg-inline-block{display:inline-block!important}.layui-col-lg1,.layui-col-lg10,.layui-col-lg11,.layui-col-lg12,.layui-col-lg2,.layui-col-lg3,.layui-col-lg4,.layui-col-lg5,.layui-col-lg6,.layui-col-lg7,.layui-col-lg8,.layui-col-lg9{float:left}.layui-col-lg1{width:8.33333333%}.layui-col-lg2{width:16.66666667%}.layui-col-lg3{width:25%}.layui-col-lg4{width:33.33333333%}.layui-col-lg5{width:41.66666667%}.layui-col-lg6{width:50%}.layui-col-lg7{width:58.33333333%}.layui-col-lg8{width:66.66666667%}.layui-col-lg9{width:75%}.layui-col-lg10{width:83.33333333%}.layui-col-lg11{width:91.66666667%}.layui-col-lg12{width:100%}.layui-col-lg-offset1{margin-left:8.33333333%}.layui-col-lg-offset2{margin-left:16.66666667%}.layui-col-lg-offset3{margin-left:25%}.layui-col-lg-offset4{margin-left:33.33333333%}.layui-col-lg-offset5{margin-left:41.66666667%}.layui-col-lg-offset6{margin-left:50%}.layui-col-lg-offset7{margin-left:58.33333333%}.layui-col-lg-offset8{margin-left:66.66666667%}.layui-col-lg-offset9{margin-left:75%}.layui-col-lg-offset10{margin-left:83.33333333%}.layui-col-lg-offset11{margin-left:91.66666667%}.layui-col-lg-offset12{margin-left:100%}}@media screen and (min-width:1400px){.layui-container{width:1330px}.layui-hide-xl{display:none!important}.layui-show-xl-block{display:block!important}.layui-show-xl-inline{display:inline!important}.layui-show-xl-inline-block{display:inline-block!important}.layui-col-xl1,.layui-col-xl10,.layui-col-xl11,.layui-col-xl12,.layui-col-xl2,.layui-col-xl3,.layui-col-xl4,.layui-col-xl5,.layui-col-xl6,.layui-col-xl7,.layui-col-xl8,.layui-col-xl9{float:left}.layui-col-xl1{width:8.33333333%}.layui-col-xl2{width:16.66666667%}.layui-col-xl3{width:25%}.layui-col-xl4{width:33.33333333%}.layui-col-xl5{width:41.66666667%}.layui-col-xl6{width:50%}.layui-col-xl7{width:58.33333333%}.layui-col-xl8{width:66.66666667%}.layui-col-xl9{width:75%}.layui-col-xl10{width:83.33333333%}.layui-col-xl11{width:91.66666667%}.layui-col-xl12{width:100%}.layui-col-xl-offset1{margin-left:8.33333333%}.layui-col-xl-offset2{margin-left:16.66666667%}.layui-col-xl-offset3{margin-left:25%}.layui-col-xl-offset4{margin-left:33.33333333%}.layui-col-xl-offset5{margin-left:41.66666667%}.layui-col-xl-offset6{margin-left:50%}.layui-col-xl-offset7{margin-left:58.33333333%}.layui-col-xl-offset8{margin-left:66.66666667%}.layui-col-xl-offset9{margin-left:75%}.layui-col-xl-offset10{margin-left:83.33333333%}.layui-col-xl-offset11{margin-left:91.66666667%}.layui-col-xl-offset12{margin-left:100%}}.layui-col-space1{margin:-.5px}.layui-col-space1>*{padding:.5px}.layui-col-space2{margin:-1px}.layui-col-space2>*{padding:1px}.layui-col-space4{margin:-2px}.layui-col-space4>*{padding:2px}.layui-col-space5{margin:-2.5px}.layui-col-space5>*{padding:2.5px}.layui-col-space6{margin:-3px}.layui-col-space6>*{padding:3px}.layui-col-space8{margin:-4px}.layui-col-space8>*{padding:4px}.layui-col-space10{margin:-5px}.layui-col-space10>*{padding:5px}.layui-col-space12{margin:-6px}.layui-col-space12>*{padding:6px}.layui-col-space14{margin:-7px}.layui-col-space14>*{padding:7px}.layui-col-space15{margin:-7.5px}.layui-col-space15>*{padding:7.5px}.layui-col-space16{margin:-8px}.layui-col-space16>*{padding:8px}.layui-col-space18{margin:-9px}.layui-col-space18>*{padding:9px}.layui-col-space20{margin:-10px}.layui-col-space20>*{padding:10px}.layui-col-space22{margin:-11px}.layui-col-space22>*{padding:11px}.layui-col-space24{margin:-12px}.layui-col-space24>*{padding:12px}.layui-col-space25{margin:-12.5px}.layui-col-space25>*{padding:12.5px}.layui-col-space26{margin:-13px}.layui-col-space26>*{padding:13px}.layui-col-space28{margin:-14px}.layui-col-space28>*{padding:14px}.layui-col-space30{margin:-15px}.layui-col-space30>*{padding:15px}.layui-col-space32{margin:-16px}.layui-col-space32>*{padding:16px}.layui-btn,.layui-input,.layui-select,.layui-textarea,.layui-upload-button{outline:0;-webkit-appearance:none;transition:all .3s;-webkit-transition:all .3s;box-sizing:border-box}.layui-elem-quote{margin-bottom:10px;padding:15px;line-height:1.8;border-left:5px solid #16b777;border-radius:0 2px 2px 0;background-color:#fafafa}.layui-quote-nm{border-style:solid;border-width:1px;border-left-width:5px;background:0 0}.layui-elem-field{margin-bottom:10px;padding:0;border-width:1px;border-style:solid}.layui-elem-field legend{margin-left:20px;padding:0 10px;font-size:20px}.layui-field-title{margin:16px 0;border-width:0;border-top-width:1px}.layui-field-box{padding:15px}.layui-field-title .layui-field-box{padding:10px 0}.layui-progress{position:relative;height:6px;border-radius:20px;background-color:#eee}.layui-progress-bar{position:absolute;left:0;top:0;width:0;max-width:100%;height:6px;border-radius:20px;text-align:right;background-color:#16b777;transition:all .3s;-webkit-transition:all .3s}.layui-progress-big,.layui-progress-big .layui-progress-bar{height:18px;line-height:18px}.layui-progress-text{position:relative;top:-20px;line-height:18px;font-size:12px;color:#5f5f5f}.layui-progress-big .layui-progress-text{position:static;padding:0 10px;color:#fff}.layui-collapse{border-width:1px;border-style:solid;border-radius:2px}.layui-colla-content,.layui-colla-item{border-top-width:1px;border-top-style:solid}.layui-colla-item:first-child{border-top:none}.layui-colla-title{position:relative;height:42px;line-height:42px;padding:0 15px 0 35px;color:#333;background-color:#fafafa;cursor:pointer;font-size:14px;overflow:hidden}.layui-colla-content{display:none;padding:10px 15px;line-height:1.6;color:#5f5f5f}.layui-colla-icon{position:absolute;left:15px;top:0;font-size:14px}.layui-card{margin-bottom:15px;border-radius:2px;background-color:#fff;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}.layui-card:last-child{margin-bottom:0}.layui-card-header{position:relative;height:42px;line-height:42px;padding:0 15px;border-bottom:1px solid #f8f8f8;color:#333;border-radius:2px 2px 0 0;font-size:14px}.layui-card-body{position:relative;padding:10px 15px;line-height:24px}.layui-card-body[pad15]{padding:15px}.layui-card-body[pad20]{padding:20px}.layui-card-body .layui-table{margin:5px 0}.layui-card .layui-tab{margin:0}.layui-panel{position:relative;border-width:1px;border-style:solid;border-radius:2px;box-shadow:1px 1px 4px rgb(0 0 0 / 8%);background-color:#fff;color:#5f5f5f}.layui-panel-window{position:relative;padding:15px;border-radius:0;border-top:5px solid #eee;background-color:#fff}.layui-auxiliar-moving{position:fixed;left:0;right:0;top:0;bottom:0;width:100%;height:100%;background:0 0;z-index:9999999999}.layui-scollbar-hide{overflow:hidden!important}.layui-bg-red{background-color:#ff5722!important;color:#fff!important}.layui-bg-orange{background-color:#ffb800!important;color:#fff!important}.layui-bg-green{background-color:#16baaa!important;color:#fff!important}.layui-bg-cyan{background-color:#2f4056!important;color:#fff!important}.layui-bg-blue{background-color:#1e9fff!important;color:#fff!important}.layui-bg-purple{background-color:#a233c6!important;color:#fff!important}.layui-bg-black{background-color:#2f363c!important;color:#fff!important}.layui-bg-gray{background-color:#fafafa!important;color:#5f5f5f!important}.layui-badge-rim,.layui-border,.layui-colla-content,.layui-colla-item,.layui-collapse,.layui-elem-field,.layui-form-pane .layui-form-item[pane],.layui-form-pane .layui-form-label,.layui-input,.layui-input-split,.layui-panel,.layui-quote-nm,.layui-select,.layui-tab-bar,.layui-tab-card,.layui-tab-title,.layui-tab-title .layui-this:after,.layui-textarea{border-color:#eee}.layui-border{border-width:1px;border-style:solid;color:#5f5f5f!important}.layui-border-red{border-width:1px;border-style:solid;border-color:#ff5722!important;color:#ff5722!important}.layui-border-orange{border-width:1px;border-style:solid;border-color:#ffb800!important;color:#ffb800!important}.layui-border-green{border-width:1px;border-style:solid;border-color:#16baaa!important;color:#16baaa!important}.layui-border-cyan{border-width:1px;border-style:solid;border-color:#2f4056!important;color:#2f4056!important}.layui-border-blue{border-width:1px;border-style:solid;border-color:#1e9fff!important;color:#1e9fff!important}.layui-border-purple{border-width:1px;border-style:solid;border-color:#a233c6!important;color:#a233c6!important}.layui-border-black{border-width:1px;border-style:solid;border-color:#2f363c!important;color:#2f363c!important}.layui-timeline-item:before{background-color:#eee}.layui-text{line-height:1.8;font-size:14px}.layui-text h1,.layui-text h2,.layui-text h3,.layui-text h4,.layui-text h5,.layui-text h6{color:#3a3a3a}.layui-text h1{font-size:32px}.layui-text h2{font-size:24px}.layui-text h3{font-size:18px}.layui-text h4{font-size:16px}.layui-text h5{font-size:14px}.layui-text h6{font-size:13px}.layui-text ol,.layui-text ul{padding-left:15px}.layui-text ul li{margin-top:5px;list-style-type:disc}.layui-text ol li{margin-top:5px;list-style-type:decimal}.layui-text-em,.layui-word-aux{color:#999!important;padding-left:5px!important;padding-right:5px!important}.layui-text p{margin:15px 0}.layui-text p:first-child{margin-top:0}.layui-text p:last-child{margin-bottom:0}.layui-text a:not(.layui-btn){color:#01aaed}.layui-text a:not(.layui-btn):hover{text-decoration:underline}.layui-text blockquote:not(.layui-elem-quote){padding:5px 15px;border-left:5px solid #eee}.layui-text pre>code:not(.layui-code){padding:15px;font-family:Courier New,Lucida Console,Consolas;background-color:#fafafa}.layui-font-12{font-size:12px!important}.layui-font-13{font-size:13px!important}.layui-font-14{font-size:14px!important}.layui-font-16{font-size:16px!important}.layui-font-18{font-size:18px!important}.layui-font-20{font-size:20px!important}.layui-font-22{font-size:22px!important}.layui-font-24{font-size:24px!important}.layui-font-26{font-size:26px!important}.layui-font-28{font-size:28px!important}.layui-font-30{font-size:30px!important}.layui-font-32{font-size:32px!important}.layui-font-red{color:#ff5722!important}.layui-font-orange{color:#ffb800!important}.layui-font-green{color:#16baaa!important}.layui-font-cyan{color:#2f4056!important}.layui-font-blue{color:#01aaed!important}.layui-font-purple{color:#a233c6!important}.layui-font-black{color:#000!important}.layui-font-gray{color:#c2c2c2!important}.layui-btn{display:inline-block;vertical-align:middle;height:38px;line-height:38px;border:1px solid transparent;padding:0 18px;background-color:#16baaa;color:#fff;white-space:nowrap;text-align:center;font-size:14px;border-radius:2px;cursor:pointer;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-btn:hover{opacity:.8;filter:alpha(opacity=80);color:#fff}.layui-btn:active{opacity:1;filter:alpha(opacity=100)}.layui-btn+.layui-btn{margin-left:10px}.layui-btn-container{word-spacing:-5px}.layui-btn-container .layui-btn{margin-right:10px;margin-bottom:10px;word-spacing:normal}.layui-btn-container .layui-btn+.layui-btn{margin-left:0}.layui-table .layui-btn-container .layui-btn{margin-bottom:9px}.layui-btn-radius{border-radius:100px}.layui-btn .layui-icon{padding:0 2px;vertical-align:middle\0;vertical-align:bottom}.layui-btn-primary{border-color:#d2d2d2;background:0 0;color:#5f5f5f}.layui-btn-primary:hover{border-color:#16baaa;color:#333}.layui-btn-normal{background-color:#1e9fff}.layui-btn-warm{background-color:#ffb800}.layui-btn-danger{background-color:#ff5722}.layui-btn-checked{background-color:#16b777}.layui-btn-disabled,.layui-btn-disabled:active,.layui-btn-disabled:hover{border-color:#eee!important;background-color:#fbfbfb!important;color:#d2d2d2!important;cursor:not-allowed!important;opacity:1}.layui-btn-lg{height:44px;line-height:44px;padding:0 25px;font-size:16px}.layui-btn-sm{height:30px;line-height:30px;padding:0 10px;font-size:12px}.layui-btn-xs{height:22px;line-height:22px;padding:0 5px;font-size:12px}.layui-btn-xs i{font-size:12px!important}.layui-btn-group{display:inline-block;vertical-align:middle;font-size:0}.layui-btn-group .layui-btn{margin-left:0!important;margin-right:0!important;border-left:1px solid rgba(255,255,255,.5);border-radius:0}.layui-btn-group .layui-btn-primary{border-left:none}.layui-btn-group .layui-btn-primary:hover{border-color:#d2d2d2;color:#16baaa}.layui-btn-group .layui-btn:first-child{border-left:none;border-radius:2px 0 0 2px}.layui-btn-group .layui-btn-primary:first-child{border-left:1px solid #d2d2d2}.layui-btn-group .layui-btn:last-child{border-radius:0 2px 2px 0}.layui-btn-group .layui-btn+.layui-btn{margin-left:0}.layui-btn-group+.layui-btn-group{margin-left:10px}.layui-btn-fluid{width:100%}.layui-input,.layui-select,.layui-textarea{height:38px;line-height:1.3;line-height:38px\9;border-width:1px;border-style:solid;background-color:#fff;color:rgba(0,0,0,.85);border-radius:2px}.layui-input::-webkit-input-placeholder,.layui-select::-webkit-input-placeholder,.layui-textarea::-webkit-input-placeholder{line-height:1.3}.layui-input,.layui-textarea{display:block;width:100%;padding-left:10px}.layui-input:hover,.layui-textarea:hover{border-color:#d2d2d2!important}.layui-input:focus,.layui-textarea:focus{border-color:#16b777!important;box-shadow:0 0 0 3px rgba(22,183,119,.08)}.layui-textarea{position:relative;min-height:100px;height:auto;line-height:20px;padding:6px 10px;resize:vertical}.layui-select{padding:0 10px}.layui-form input[type=checkbox],.layui-form input[type=radio],.layui-form select{display:none}.layui-form [lay-ignore]{display:initial}.layui-form-item{position:relative;margin-bottom:15px;clear:both;*zoom:1}.layui-form-item:after{content:'\20';clear:both;*zoom:1;display:block;height:0}.layui-form-label{position:relative;float:left;display:block;padding:9px 15px;width:80px;font-weight:400;line-height:20px;text-align:right}.layui-form-label-col{display:block;float:none;padding:9px 0;line-height:20px;text-align:left}.layui-form-item .layui-inline{margin-bottom:5px;margin-right:10px}.layui-input-block,.layui-input-inline{position:relative}.layui-input-block{margin-left:110px;min-height:36px}.layui-input-inline{display:inline-block;vertical-align:middle}.layui-form-item .layui-input-inline{float:left;width:190px;margin-right:10px}.layui-form-text .layui-input-inline{width:auto}.layui-form-mid{position:relative;float:left;display:block;padding:9px 0!important;line-height:20px;margin-right:10px}.layui-form-danger+.layui-form-select .layui-input,.layui-form-danger:focus{border-color:#ff5722!important;box-shadow:0 0 0 3px rgba(255,87,34,.08)}.layui-input-prefix,.layui-input-split,.layui-input-suffix,.layui-input-suffix .layui-input-affix{position:absolute;right:0;top:0;padding:0 10px;width:35px;height:100%;text-align:center;transition:all .3s;box-sizing:border-box}.layui-input-prefix{left:0;border-radius:2px 0 0 2px}.layui-input-suffix{right:0;border-radius:0 2px 2px 0}.layui-input-split{border-width:1px;border-style:solid}.layui-input-prefix .layui-icon,.layui-input-split .layui-icon,.layui-input-suffix .layui-icon{position:relative;font-size:16px;color:#5f5f5f;transition:all .3s}.layui-input-group{position:relative;display:table;box-sizing:border-box}.layui-input-group>*{display:table-cell;vertical-align:middle;position:relative}.layui-input-group .layui-input{padding-right:15px}.layui-input-group .layui-input-prefix{width:auto;border-right:0}.layui-input-group .layui-input-suffix{width:auto;border-left:0}.layui-input-group .layui-input-split{white-space:nowrap}.layui-input-wrap{position:relative;line-height:38px}.layui-input-wrap .layui-input{padding-right:35px}.layui-input-wrap .layui-input::-ms-clear,.layui-input-wrap .layui-input::-ms-reveal{display:none}.layui-input-wrap .layui-input-prefix+.layui-input,.layui-input-wrap .layui-input-prefix~* .layui-input{padding-left:35px}.layui-input-wrap .layui-input-split+.layui-input,.layui-input-wrap .layui-input-split~* .layui-input{padding-left:45px}.layui-input-wrap .layui-input-prefix~.layui-form-select{position:static}.layui-input-wrap .layui-input-prefix,.layui-input-wrap .layui-input-split,.layui-input-wrap .layui-input-suffix{pointer-events:none}.layui-input-wrap .layui-input:focus+.layui-input-split{border-color:#16b777}.layui-input-wrap .layui-input-prefix.layui-input-split{border-width:0;border-right-width:1px}.layui-input-affix{line-height:38px}.layui-input-suffix .layui-input-affix{right:auto;left:-35px}.layui-input-affix .layui-icon{color:rgba(0,0,0,.8);pointer-events:auto!important;cursor:pointer}.layui-input-affix .layui-icon-clear{color:rgba(0,0,0,.3)}.layui-input-affix .layui-icon:hover{color:rgba(0,0,0,.6)}.layui-form-select{position:relative;color:#5f5f5f}.layui-form-select .layui-input{padding-right:30px;cursor:pointer}.layui-form-select .layui-edge{position:absolute;right:10px;top:50%;margin-top:-3px;cursor:pointer;border-width:6px;border-top-color:#c2c2c2;border-top-style:solid;transition:all .3s;-webkit-transition:all .3s}.layui-form-select dl{display:none;position:absolute;left:0;top:42px;padding:5px 0;z-index:899;min-width:100%;border:1px solid #eee;max-height:300px;overflow-y:auto;background-color:#fff;border-radius:2px;box-shadow:1px 1px 4px rgb(0 0 0 / 8%);box-sizing:border-box}.layui-form-select dl dd,.layui-form-select dl dt{padding:0 10px;line-height:36px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.layui-form-select dl dt{font-size:12px;color:#999}.layui-form-select dl dd{cursor:pointer}.layui-form-select dl dd:hover{background-color:#f8f8f8;-webkit-transition:.5s all;transition:.5s all}.layui-form-select .layui-select-group dd{padding-left:20px}.layui-form-select dl dd.layui-select-tips{padding-left:10px!important;color:#999}.layui-form-select dl dd.layui-this{background-color:#f8f8f8;color:#16b777;font-weight:700}.layui-form-select dl dd.layui-disabled{background-color:#fff}.layui-form-selected dl{display:block}.layui-form-selected .layui-edge{margin-top:-9px;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.layui-form-selected .layui-edge{margin-top:-3px\0}:root .layui-form-selected .layui-edge{margin-top:-9px\0/IE9}.layui-form-selectup dl{top:auto;bottom:42px}.layui-select-none{margin:5px 0;text-align:center;color:#999}.layui-select-disabled .layui-disabled{border-color:#eee!important}.layui-select-disabled .layui-edge{border-top-color:#d2d2d2}.layui-form-checkbox{position:relative;display:inline-block;vertical-align:middle;height:30px;line-height:30px;margin-right:10px;padding-right:30px;background-color:#fff;cursor:pointer;font-size:0;-webkit-transition:.1s linear;transition:.1s linear;box-sizing:border-box}.layui-form-checkbox>*{display:inline-block;vertical-align:middle}.layui-form-checkbox>div{padding:0 11px;font-size:14px;border-radius:2px 0 0 2px;background-color:#d2d2d2;color:#fff;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.layui-form-checkbox:hover>div{background-color:#c2c2c2}.layui-form-checkbox>i{position:absolute;right:0;top:0;width:30px;height:100%;border:1px solid #d2d2d2;border-left:none;border-radius:0 2px 2px 0;color:#fff;color:rgba(255,255,255,0);font-size:20px;text-align:center;box-sizing:border-box}.layui-form-checkbox:hover>i{border-color:#c2c2c2;color:#c2c2c2}.layui-form-checked,.layui-form-checked:hover{border-color:#16b777}.layui-form-checked:hover>div,.layui-form-checked>div{background-color:#16b777}.layui-form-checked:hover>i,.layui-form-checked>i{color:#16b777}.layui-form-item .layui-form-checkbox{margin-top:4px}.layui-form-checkbox.layui-checkbox-disabled>div{background-color:#eee!important}.layui-form [lay-checkbox]{display:none}.layui-form-checkbox[lay-skin=primary]{height:auto!important;line-height:normal!important;min-width:18px;min-height:18px;border:none!important;margin-right:0;padding-left:24px;padding-right:0;background:0 0}.layui-form-checkbox[lay-skin=primary]>div{margin-top:-1px;padding-left:0;padding-right:15px;line-height:18px;background:0 0;color:#5f5f5f}.layui-form-checkbox[lay-skin=primary]>i{right:auto;left:0;width:16px;height:16px;line-height:14px;border:1px solid #d2d2d2;font-size:12px;border-radius:2px;background-color:#fff;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-checkbox[lay-skin=primary]:hover>i{border-color:#16b777;color:#fff}.layui-form-checked[lay-skin=primary]>i{border-color:#16b777!important;background-color:#16b777;color:#fff}.layui-checkbox-disabled[lay-skin=primary]>div{background:0 0!important}.layui-form-checked.layui-checkbox-disabled[lay-skin=primary]>i{background:#eee!important;border-color:#eee!important}.layui-checkbox-disabled[lay-skin=primary]:hover>i{border-color:#d2d2d2}.layui-form-item .layui-form-checkbox[lay-skin=primary]{margin-top:10px}.layui-form-checkbox[lay-skin=primary]>.layui-icon-indeterminate{border-color:#16b777}.layui-form-checkbox[lay-skin=primary]>.layui-icon-indeterminate:before{content:'';display:inline-block;vertical-align:middle;position:relative;width:50%;height:1px;margin:-1px auto 0;background-color:#16b777}.layui-form-switch{position:relative;display:inline-block;vertical-align:middle;height:24px;line-height:22px;min-width:44px;padding:0 5px;margin-top:8px;border:1px solid #d2d2d2;border-radius:20px;cursor:pointer;box-sizing:border-box;background-color:#fff;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-switch>i{position:absolute;left:5px;top:3px;width:16px;height:16px;border-radius:20px;background-color:#d2d2d2;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-switch>div{position:relative;top:0;margin-left:21px;padding:0!important;text-align:center!important;color:#999!important;font-style:normal!important;font-size:12px}.layui-form-onswitch{border-color:#16b777;background-color:#16b777}.layui-form-onswitch>i{left:100%;margin-left:-21px;background-color:#fff}.layui-form-onswitch>div{margin-left:0;margin-right:21px;color:#fff!important}.layui-checkbox-disabled{border-color:#eee!important}.layui-checkbox-disabled>div{color:#c2c2c2!important}.layui-checkbox-disabled>i{border-color:#eee!important}.layui-checkbox-disabled:hover>i{color:#fff!important}.layui-form-radio{display:inline-block;vertical-align:middle;line-height:28px;margin:6px 10px 0 0;padding-right:10px;cursor:pointer;font-size:0}.layui-form-radio>*{display:inline-block;vertical-align:middle;font-size:14px}.layui-form-radio>i{margin-right:8px;font-size:22px;color:#c2c2c2}.layui-form-radio:hover>*,.layui-form-radioed,.layui-form-radioed>i{color:#16b777}.layui-radio-disabled>i{color:#eee!important}.layui-radio-disabled>*{color:#c2c2c2!important}.layui-form [lay-radio]{display:none}.layui-form-pane .layui-form-label{width:110px;padding:8px 15px;height:38px;line-height:20px;border-width:1px;border-style:solid;border-radius:2px 0 0 2px;text-align:center;background-color:#fafafa;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;box-sizing:border-box}.layui-form-pane .layui-input-inline{margin-left:-1px}.layui-form-pane .layui-input-block{margin-left:110px;left:-1px}.layui-form-pane .layui-input{border-radius:0 2px 2px 0}.layui-form-pane .layui-form-text .layui-form-label{float:none;width:100%;border-radius:2px;box-sizing:border-box;text-align:left}.layui-form-pane .layui-form-text .layui-input-inline{display:block;margin:0;top:-1px;clear:both}.layui-form-pane .layui-form-text .layui-input-block{margin:0;left:0;top:-1px}.layui-form-pane .layui-form-text .layui-textarea{min-height:100px;border-radius:0 0 2px 2px}.layui-form-pane .layui-form-checkbox{margin:4px 0 4px 10px}.layui-form-pane .layui-form-radio,.layui-form-pane .layui-form-switch{margin-top:6px;margin-left:10px}.layui-form-pane .layui-form-item[pane]{position:relative;border-width:1px;border-style:solid}.layui-form-pane .layui-form-item[pane] .layui-form-label{position:absolute;left:0;top:0;height:100%;border-width:0;border-right-width:1px}.layui-form-pane .layui-form-item[pane] .layui-input-inline{margin-left:110px}@media screen and (max-width:450px){.layui-form-item .layui-form-label{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-form-item .layui-inline{display:block;margin-right:0;margin-bottom:20px;clear:both}.layui-form-item .layui-inline:after{content:'\20';clear:both;display:block;height:0}.layui-form-item .layui-input-inline{display:block;float:none;left:-3px;width:auto!important;margin:0 0 10px 112px}.layui-form-item .layui-input-inline+.layui-form-mid{margin-left:110px;top:-5px;padding:0}.layui-form-item .layui-form-checkbox{margin-right:5px;margin-bottom:5px}}.layui-laypage{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;margin:10px 0;font-size:0}.layui-laypage>a:first-child,.layui-laypage>a:first-child em{border-radius:2px 0 0 2px}.layui-laypage>a:last-child,.layui-laypage>a:last-child em{border-radius:0 2px 2px 0}.layui-laypage>:first-child{margin-left:0!important}.layui-laypage>:last-child{margin-right:0!important}.layui-laypage a,.layui-laypage button,.layui-laypage input,.layui-laypage select,.layui-laypage span{border:1px solid #eee}.layui-laypage a,.layui-laypage span{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;padding:0 15px;height:28px;line-height:28px;margin:0 -1px 5px 0;background-color:#fff;color:#333;font-size:12px}.layui-laypage a[data-page]{color:#333}.layui-laypage a{text-decoration:none!important;cursor:pointer}.layui-laypage a:hover{color:#16baaa}.layui-laypage em{font-style:normal}.layui-laypage .layui-laypage-spr{color:#999;font-weight:700}.layui-laypage .layui-laypage-curr{position:relative}.layui-laypage .layui-laypage-curr em{position:relative;color:#fff}.layui-laypage .layui-laypage-curr .layui-laypage-em{position:absolute;left:-1px;top:-1px;padding:1px;width:100%;height:100%;background-color:#16baaa}.layui-laypage-em{border-radius:2px}.layui-laypage-next em,.layui-laypage-prev em{font-family:Sim sun;font-size:16px}.layui-laypage .layui-laypage-count,.layui-laypage .layui-laypage-limits,.layui-laypage .layui-laypage-refresh,.layui-laypage .layui-laypage-skip{margin-left:10px;margin-right:10px;padding:0;border:none}.layui-laypage .layui-laypage-limits,.layui-laypage .layui-laypage-refresh{vertical-align:top}.layui-laypage .layui-laypage-refresh i{font-size:18px;cursor:pointer}.layui-laypage select{height:22px;padding:3px;border-radius:2px;cursor:pointer}.layui-laypage .layui-laypage-skip{height:30px;line-height:30px;color:#999}.layui-laypage button,.layui-laypage input{height:30px;line-height:30px;border-radius:2px;vertical-align:top;background-color:#fff;box-sizing:border-box}.layui-laypage input{display:inline-block;width:40px;margin:0 10px;padding:0 3px;text-align:center}.layui-laypage input:focus,.layui-laypage select:focus{border-color:#16baaa!important}.layui-laypage button{margin-left:10px;padding:0 10px;cursor:pointer}.layui-flow-more{margin:10px 0;text-align:center;color:#999;font-size:14px;clear:both}.layui-flow-more a{height:32px;line-height:32px}.layui-flow-more a *{display:inline-block;vertical-align:top}.layui-flow-more a cite{padding:0 20px;border-radius:3px;background-color:#eee;color:#333;font-style:normal}.layui-flow-more a cite:hover{opacity:.8}.layui-flow-more a i{font-size:30px;color:#737383}.layui-table{width:100%;margin:10px 0;background-color:#fff;color:#5f5f5f}.layui-table tr{transition:all .3s;-webkit-transition:all .3s}.layui-table th{text-align:left;font-weight:600}.layui-table-mend{background-color:#fff}.layui-table-click,.layui-table-hover,.layui-table[lay-even] tbody tr:nth-child(even){background-color:#f8f8f8}.layui-table-checked{background-color:#dbfbf0}.layui-table-checked.layui-table-click,.layui-table-checked.layui-table-hover{background-color:#abf8dd}.layui-table td,.layui-table th,.layui-table-col-set,.layui-table-fixed-r,.layui-table-grid-down,.layui-table-header,.layui-table-mend,.layui-table-page,.layui-table-tips-main,.layui-table-tool,.layui-table-total,.layui-table-view,.layui-table[lay-skin=line],.layui-table[lay-skin=row]{border-width:1px;border-style:solid;border-color:#eee}.layui-table td,.layui-table th{position:relative;padding:9px 15px;min-height:20px;line-height:20px;font-size:14px}.layui-table[lay-skin=line] td,.layui-table[lay-skin=line] th{border-width:0;border-bottom-width:1px}.layui-table[lay-skin=row] td,.layui-table[lay-skin=row] th{border-width:0;border-right-width:1px}.layui-table[lay-skin=nob] td,.layui-table[lay-skin=nob] th{border:none}.layui-table img{max-width:100px}.layui-table[lay-size=lg] td,.layui-table[lay-size=lg] th{padding-top:15px;padding-right:30px;padding-bottom:15px;padding-left:30px}.layui-table-view .layui-table[lay-size=lg] .layui-table-cell{height:50px;line-height:40px}.layui-table[lay-size=sm] td,.layui-table[lay-size=sm] th{padding-top:5px;padding-right:10px;padding-bottom:5px;padding-left:10px;font-size:12px}.layui-table-view .layui-table[lay-size=sm] .layui-table-cell{height:30px;line-height:20px;padding-top:5px;padding-left:11px;padding-right:11px}.layui-table[lay-data],.layui-table[lay-options]{display:none}.layui-table-box{position:relative;overflow:hidden}.layui-table-view{clear:both}.layui-table-view .layui-table{position:relative;width:auto;margin:0;border:0;border-collapse:separate}.layui-table-view .layui-table[lay-skin=line]{border-width:0;border-right-width:1px}.layui-table-view .layui-table[lay-skin=row]{border-width:0;border-bottom-width:1px}.layui-table-view .layui-table td,.layui-table-view .layui-table th{padding:0;border-top:none;border-left:none}.layui-table-view .layui-table th [lay-event],.layui-table-view .layui-table th.layui-unselect .layui-table-cell span{cursor:pointer}.layui-table-view .layui-table td,.layui-table-view .layui-table th span{cursor:default}.layui-table-view .layui-table td[data-edit]{cursor:text}.layui-table-view .layui-table td[data-edit]:hover:after{position:absolute;left:0;top:0;width:100%;height:100%;box-sizing:border-box;border:1px solid #16b777;pointer-events:none;content:""}.layui-table-view .layui-form-checkbox[lay-skin=primary] i{width:18px;height:18px;line-height:16px}.layui-table-view .layui-form-radio{line-height:0;padding:0}.layui-table-view .layui-form-radio>i{margin:0;font-size:20px}.layui-table-init{position:absolute;left:0;top:0;width:100%;height:100%;text-align:center;z-index:199}.layui-table-init .layui-icon{position:absolute;left:50%;top:50%;margin:-15px 0 0 -15px;font-size:30px;color:#c2c2c2}.layui-table-header{border-width:0;border-bottom-width:1px;overflow:hidden}.layui-table-header .layui-table{margin-bottom:-1px}.layui-table-column{position:relative;width:100%;min-height:41px;padding:8px 16px;border-width:0;border-bottom-width:1px}.layui-table-column .layui-btn-container{margin-bottom:-8px}.layui-table-column .layui-btn-container .layui-btn{margin-right:8px;margin-bottom:8px}.layui-table-tool .layui-inline[lay-event]{position:relative;width:26px;height:26px;padding:5px;line-height:16px;margin-right:10px;text-align:center;color:#333;border:1px solid #ccc;cursor:pointer;-webkit-transition:.5s all;transition:.5s all}.layui-table-tool .layui-inline[lay-event]:hover{border:1px solid #999}.layui-table-tool-temp{padding-right:120px}.layui-table-tool-self{position:absolute;right:17px;top:10px}.layui-table-tool .layui-table-tool-self .layui-inline[lay-event]{margin:0 0 0 10px}.layui-table-tool-panel{position:absolute;top:29px;left:-1px;z-index:399;padding:5px 0!important;min-width:150px;min-height:40px;border:1px solid #d2d2d2;text-align:left;overflow-y:auto;background-color:#fff;box-shadow:0 2px 4px rgba(0,0,0,.12)}.layui-table-tool-panel li{padding:0 10px;margin:0!important;line-height:30px;list-style-type:none!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-webkit-transition:.5s all;transition:.5s all}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary]{width:100%}.layui-table-tool-panel li:hover{background-color:#f8f8f8}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary]{padding-left:28px}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary] i{position:absolute;left:0;top:0}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary] span{padding:0}.layui-table-tool .layui-table-tool-self .layui-table-tool-panel{left:auto;right:-1px}.layui-table-col-set{position:absolute;right:0;top:0;width:20px;height:100%;border-width:0;border-left-width:1px;background-color:#fff}.layui-table-sort{width:10px;height:20px;margin-left:5px;cursor:pointer!important}.layui-table-sort .layui-edge{position:absolute;left:5px;border-width:5px}.layui-table-sort .layui-table-sort-asc{top:3px;border-top:none;border-bottom-style:solid;border-bottom-color:#b2b2b2}.layui-table-sort .layui-table-sort-asc:hover{border-bottom-color:#5f5f5f}.layui-table-sort .layui-table-sort-desc{bottom:5px;border-bottom:none;border-top-style:solid;border-top-color:#b2b2b2}.layui-table-sort .layui-table-sort-desc:hover{border-top-color:#5f5f5f}.layui-table-sort[lay-sort=asc] .layui-table-sort-asc{border-bottom-color:#000}.layui-table-sort[lay-sort=desc] .layui-table-sort-desc{border-top-color:#000}.layui-table-cell{height:38px;line-height:28px;padding:6px 15px;position:relative;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;box-sizing:border-box}.layui-table-cell .layui-form-checkbox[lay-skin=primary]{top:-1px;padding:0}.layui-table-cell .layui-table-link{color:#01aaed}.layui-table-cell .layui-btn{vertical-align:inherit}.layui-table-cell[align=center]{-webkit-box-pack:center}.layui-table-cell[align=right]{-webkit-box-pack:end}.laytable-cell-checkbox,.laytable-cell-numbers,.laytable-cell-radio,.laytable-cell-space{text-align:center;-webkit-box-pack:center}.layui-table-body{position:relative;overflow:auto;margin-right:-1px;margin-bottom:-1px}.layui-table-body .layui-none{line-height:26px;padding:30px 15px;text-align:center;color:#999}.layui-table-fixed{position:absolute;left:0;top:0;z-index:101}.layui-table-fixed .layui-table-body{overflow:hidden}.layui-table-fixed-l{box-shadow:1px 0 8px rgba(0,0,0,.08)}.layui-table-fixed-r{left:auto;right:-1px;border-width:0;border-left-width:1px;box-shadow:-1px 0 8px rgba(0,0,0,.08)}.layui-table-fixed-r .layui-table-header{position:relative;overflow:visible}.layui-table-mend{position:absolute;right:-49px;top:0;height:100%;width:50px;border-width:0;border-left-width:1px}.layui-table-tool{position:relative;width:100%;min-height:50px;line-height:30px;padding:10px 15px;border-width:0;border-bottom-width:1px}.layui-table-tool .layui-btn-container{margin-bottom:-10px}.layui-table-total{margin-bottom:-1px;border-width:0;border-top-width:1px;overflow:hidden}.layui-table-page{border-width:0;border-top-width:1px;margin-bottom:-1px;white-space:nowrap;overflow:hidden}.layui-table-page>div{height:26px}.layui-table-page .layui-laypage{margin:0}.layui-table-page .layui-laypage a,.layui-table-page .layui-laypage span{height:26px;line-height:26px;margin-bottom:10px;border:none;background:0 0}.layui-table-page .layui-laypage a,.layui-table-page .layui-laypage span.layui-laypage-curr{padding:0 12px}.layui-table-page .layui-laypage span{margin-left:0;padding:0}.layui-table-page .layui-laypage .layui-laypage-prev{margin-left:-11px!important}.layui-table-page .layui-laypage .layui-laypage-curr .layui-laypage-em{left:0;top:0;padding:0}.layui-table-page .layui-laypage button,.layui-table-page .layui-laypage input{height:26px;line-height:26px}.layui-table-page .layui-laypage input{width:40px}.layui-table-page .layui-laypage button{padding:0 10px}.layui-table-page select{height:18px}.layui-table-pagebar{float:right;line-height:23px}.layui-table-pagebar .layui-btn-sm{margin-top:-1px}.layui-table-pagebar .layui-btn-xs{margin-top:2px}.layui-table-view select[lay-ignore]{display:inline-block}.layui-table-patch .layui-table-cell{padding:0;width:30px}.layui-table-edit{position:absolute;left:0;top:0;z-index:189;min-width:100%;min-height:100%;padding:5px 14px;border-radius:0;box-shadow:1px 1px 20px rgba(0,0,0,.15);background-color:#fff}.layui-table-edit:focus{border-color:#16b777!important}input.layui-input.layui-table-edit{height:100%}select.layui-table-edit{padding:0 0 0 10px;border-color:#d2d2d2}.layui-table-view .layui-form-checkbox,.layui-table-view .layui-form-radio,.layui-table-view .layui-form-switch{top:0;margin:0}.layui-table-view .layui-form-checkbox{top:-1px;height:26px;line-height:26px}.layui-table-view .layui-form-checkbox i{height:26px}.layui-table-grid .layui-table-cell{overflow:visible}.layui-table-grid-down{position:absolute;top:0;right:0;width:26px;height:100%;padding:5px 0;border-width:0;border-left-width:1px;text-align:center;background-color:#fff;color:#999;cursor:pointer}.layui-table-grid-down .layui-icon{position:absolute;top:50%;left:50%;margin:-8px 0 0 -8px}.layui-table-grid-down:hover{background-color:#fbfbfb}body .layui-table-tips .layui-layer-content{background:0 0;padding:0;box-shadow:0 1px 6px rgba(0,0,0,.12)}.layui-table-tips-main{margin:-49px 0 0 -1px;max-height:150px;padding:8px 15px;font-size:14px;overflow-y:scroll;background-color:#fff;color:#5f5f5f}.layui-table-tips-c{position:absolute;right:-3px;top:-13px;width:20px;height:20px;padding:3px;cursor:pointer;background-color:#5f5f5f;border-radius:50%;color:#fff}.layui-table-tips-c:hover{background-color:#777}.layui-table-tips-c:before{position:relative;right:-2px}.layui-table-tree-nodeIcon{max-width:20px}.layui-table-tree-nodeIcon>*{width:100%}.layui-table-tree-flexIcon,.layui-table-tree-nodeIcon{margin-right:2px}.layui-table-tree-flexIcon{cursor:pointer}.layui-upload-file{display:none!important;opacity:.01;filter:Alpha(opacity=1)}.layui-upload-list{margin:11px 0}.layui-upload-choose{max-width:200px;padding:0 10px;color:#999;font-size:14px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-upload-drag{position:relative;display:inline-block;padding:30px;border:1px dashed #e2e2e2;background-color:#fff;text-align:center;cursor:pointer;color:#999}.layui-upload-drag .layui-icon{font-size:50px;color:#16baaa}.layui-upload-drag[lay-over]{border-color:#16baaa}.layui-upload-form{display:inline-block}.layui-upload-iframe{position:absolute;width:0;height:0;border:0;visibility:hidden}.layui-upload-wrap{position:relative;display:inline-block;vertical-align:middle}.layui-upload-wrap .layui-upload-file{display:block!important;position:absolute;left:0;top:0;z-index:10;font-size:100px;width:100%;height:100%;opacity:.01;filter:Alpha(opacity=1);cursor:pointer}.layui-btn-container .layui-upload-choose{padding-left:0}.layui-menu{position:relative;margin:5px 0;background-color:#fff;box-sizing:border-box}.layui-menu *{box-sizing:border-box}.layui-menu li,.layui-menu-body-title,.layui-menu-body-title a{padding:5px 15px;color:initial}.layui-menu li{position:relative;margin:1px 0;line-height:26px;color:rgba(0,0,0,.8);font-size:14px;white-space:nowrap;cursor:pointer;transition:all .3s}.layui-menu li:hover{background-color:#f8f8f8}.layui-menu li.layui-disabled,.layui-menu li.layui-disabled *{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important}.layui-menu-item-parent:hover>.layui-menu-body-panel{display:block;animation-name:layui-fadein;animation-duration:.3s;animation-fill-mode:both;animation-delay:.2s}.layui-menu-item-group>.layui-menu-body-title,.layui-menu-item-parent>.layui-menu-body-title{padding-right:38px}.layui-menu .layui-menu-item-divider:hover,.layui-menu .layui-menu-item-group:hover,.layui-menu .layui-menu-item-none:hover{background:0 0;cursor:default}.layui-menu .layui-menu-item-group>ul{margin:5px 0 -5px}.layui-menu .layui-menu-item-group>.layui-menu-body-title{color:rgba(0,0,0,.35);user-select:none}.layui-menu .layui-menu-item-none{color:rgba(0,0,0,.35);cursor:default}.layui-menu .layui-menu-item-none{text-align:center}.layui-menu .layui-menu-item-divider{margin:5px 0;padding:0;height:0;line-height:0;border-bottom:1px solid #eee;overflow:hidden}.layui-menu .layui-menu-item-down:hover,.layui-menu .layui-menu-item-up:hover{cursor:pointer}.layui-menu .layui-menu-item-up>.layui-menu-body-title{color:rgba(0,0,0,.8)}.layui-menu .layui-menu-item-up>ul{visibility:hidden;height:0;overflow:hidden}.layui-menu .layui-menu-item-down:hover>.layui-menu-body-title>.layui-icon,.layui-menu .layui-menu-item-up>.layui-menu-body-title:hover>.layui-icon{color:#000}.layui-menu .layui-menu-item-down>ul{visibility:visible;height:auto}.layui-menu .layui-menu-item-checked,.layui-menu .layui-menu-item-checked2{background-color:#f8f8f8!important;color:#16b777}.layui-menu .layui-menu-item-checked a,.layui-menu .layui-menu-item-checked2 a{color:#16b777}.layui-menu .layui-menu-item-checked:after{position:absolute;right:-1px;top:0;bottom:0;border-right:3px solid #16b777;content:""}.layui-menu-body-title{position:relative;margin:-5px -15px;overflow:hidden;text-overflow:ellipsis}.layui-menu-body-title a{display:block;margin:-5px -15px;color:rgba(0,0,0,.8)}.layui-menu-body-title a:hover{transition:all .3s}.layui-menu-body-title>.layui-icon{position:absolute;right:15px;top:50%;margin-top:-6px;line-height:normal;font-size:14px}.layui-menu-body-title>.layui-icon:hover{transition:all .3s}.layui-menu-body-title>.layui-icon-right{right:14px}.layui-menu-body-panel{display:none;position:absolute;top:-7px;left:100%;z-index:1000;margin-left:13px;padding:5px 0}.layui-menu-body-panel:before{content:"";position:absolute;width:20px;left:-16px;top:0;bottom:0}.layui-menu-body-panel-left{left:auto;right:100%;margin:0 13px 0}.layui-menu-body-panel-left:before{left:auto;right:-16px}.layui-menu-lg li{line-height:32px}.layui-menu-lg .layui-menu-body-title a:hover,.layui-menu-lg li:hover{background:0 0;color:#16b777}.layui-menu-lg li .layui-menu-body-panel{margin-left:14px}.layui-menu-lg li .layui-menu-body-panel-left{margin:0 15px 0}.layui-dropdown{position:absolute;left:-999999px;top:-999999px;z-index:77777777;margin:5px 0;min-width:100px}.layui-dropdown:before{content:"";position:absolute;width:100%;height:6px;left:0;top:-6px}.layui-dropdown-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px");position:fixed;_position:absolute;pointer-events:auto}.layui-nav{position:relative;padding:0 15px;background-color:#2f363c;color:#fff;border-radius:2px;font-size:0;box-sizing:border-box}.layui-nav *{font-size:14px}.layui-nav .layui-nav-item{position:relative;display:inline-block;*display:inline;*zoom:1;margin-top:0;list-style:none;vertical-align:middle;line-height:60px}.layui-nav .layui-nav-item a{display:block;padding:0 20px;color:#fff;color:rgba(255,255,255,.7);transition:all .3s;-webkit-transition:all .3s}.layui-nav .layui-this:after,.layui-nav-bar{content:"";position:absolute;left:0;top:0;width:0;height:3px;background-color:#16b777;transition:all .2s;-webkit-transition:all .2s;pointer-events:none}.layui-nav-bar{z-index:1000}.layui-nav[lay-bar=disabled] .layui-nav-bar{display:none}.layui-nav .layui-nav-item a:hover,.layui-nav .layui-this a{color:#fff;text-decoration:none}.layui-nav .layui-this:after{top:auto;bottom:0;width:100%}.layui-nav-img{width:30px;height:30px;margin-right:10px;border-radius:50%}.layui-nav .layui-nav-more{position:absolute;top:0;right:3px;left:auto!important;margin-top:0;font-size:12px;cursor:pointer;transition:all .2s;-webkit-transition:all .2s}.layui-nav .layui-nav-mored,.layui-nav-itemed>a .layui-nav-more{transform:rotate(180deg)}.layui-nav-child{display:none;position:absolute;left:0;top:65px;min-width:100%;line-height:36px;padding:5px 0;box-shadow:0 2px 4px rgba(0,0,0,.12);border:1px solid #eee;background-color:#fff;z-index:100;border-radius:2px;white-space:nowrap;box-sizing:border-box}.layui-nav .layui-nav-child a{color:#5f5f5f;color:rgba(0,0,0,.8)}.layui-nav .layui-nav-child a:hover{background-color:#f8f8f8;color:rgba(0,0,0,.8)}.layui-nav-child dd{margin:1px 0;position:relative}.layui-nav-child dd.layui-this{background-color:#f8f8f8;color:#000}.layui-nav-child dd.layui-this:after{display:none}.layui-nav-child-r{left:auto;right:0}.layui-nav-child-c{text-align:center}.layui-nav.layui-nav-tree{width:200px;padding:0}.layui-nav-tree .layui-nav-item{display:block;width:100%;line-height:40px}.layui-nav-tree .layui-nav-item a{position:relative;height:40px;line-height:40px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-nav-tree .layui-nav-item>a{padding-top:5px;padding-bottom:5px}.layui-nav-tree .layui-nav-more{right:15px}.layui-nav-tree .layui-nav-item>a .layui-nav-more{padding:5px 0}.layui-nav-tree .layui-nav-bar{width:5px;height:0}.layui-side .layui-nav-tree .layui-nav-bar{width:2px}.layui-nav-tree .layui-nav-child dd.layui-this,.layui-nav-tree .layui-nav-child dd.layui-this a,.layui-nav-tree .layui-this,.layui-nav-tree .layui-this>a,.layui-nav-tree .layui-this>a:hover{background-color:#16baaa;color:#fff}.layui-nav-tree .layui-this:after{display:none}.layui-nav-itemed>a,.layui-nav-tree .layui-nav-title a,.layui-nav-tree .layui-nav-title a:hover{color:#fff!important}.layui-nav-tree .layui-nav-bar{background-color:#16baaa}.layui-nav-tree .layui-nav-child{position:relative;z-index:0;top:0;border:none;box-shadow:none}.layui-nav-tree .layui-nav-child dd{margin:0}.layui-nav-tree .layui-nav-child a{color:#fff;color:rgba(255,255,255,.7)}.layui-nav-tree .layui-nav-child,.layui-nav-tree .layui-nav-child a:hover{background:0 0;color:#fff}.layui-nav-itemed>.layui-nav-child{display:block;background-color:rgba(0,0,0,.3)!important}.layui-nav-itemed>.layui-nav-child>.layui-this>.layui-nav-child{display:block}.layui-nav-side{position:fixed;top:0;bottom:0;left:0;overflow-x:hidden;z-index:999}.layui-nav-tree.layui-bg-gray a,.layui-nav.layui-bg-gray .layui-nav-item a{color:rgba(0,0,0,.8)}.layui-nav-tree.layui-bg-gray{padding:6px 0}.layui-nav-tree.layui-bg-gray .layui-nav-itemed>a{color:#000!important}.layui-nav.layui-bg-gray .layui-this a{color:#16b777}.layui-nav-tree.layui-bg-gray .layui-nav-itemed>.layui-nav-child{padding-left:11px;background:0 0!important}.layui-nav-tree.layui-bg-gray .layui-nav-item>a{padding-top:0;padding-bottom:0}.layui-nav-tree.layui-bg-gray .layui-nav-item>a .layui-nav-more{padding:0}.layui-nav-tree.layui-bg-gray .layui-nav-child dd.layui-this,.layui-nav-tree.layui-bg-gray .layui-nav-child dd.layui-this a,.layui-nav-tree.layui-bg-gray .layui-this,.layui-nav-tree.layui-bg-gray .layui-this>a{background:0 0!important;color:#16b777!important;font-weight:700}.layui-nav-tree.layui-bg-gray .layui-nav-bar{background-color:#16b777}.layui-breadcrumb{visibility:hidden;font-size:0}.layui-breadcrumb>*{font-size:14px}.layui-breadcrumb a{color:#999!important}.layui-breadcrumb a:hover{color:#16b777!important}.layui-breadcrumb a cite{color:#5f5f5f;font-style:normal}.layui-breadcrumb span[lay-separator]{margin:0 10px;color:#999}.layui-tab{margin:10px 0;text-align:left!important}.layui-tab[overflow]>.layui-tab-title{overflow:hidden}.layui-tab .layui-tab-title{position:relative;left:0;height:40px;white-space:nowrap;font-size:0;border-bottom-width:1px;border-bottom-style:solid;transition:all .2s;-webkit-transition:all .2s}.layui-tab .layui-tab-title li{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;font-size:14px;transition:all .2s;-webkit-transition:all .2s}.layui-tab .layui-tab-title li{position:relative;line-height:40px;min-width:65px;margin:0;padding:0 15px;text-align:center;cursor:pointer}.layui-tab .layui-tab-title li a{display:block;padding:0 15px;margin:0 -15px}.layui-tab-title .layui-this{color:#000}.layui-tab-title .layui-this:after{position:absolute;left:0;top:0;content:"";width:100%;height:41px;border-width:1px;border-style:solid;border-bottom-color:#fff;border-radius:2px 2px 0 0;box-sizing:border-box;pointer-events:none}.layui-tab-bar{position:absolute;right:0;top:0;z-index:10;width:30px;height:39px;line-height:39px;border-width:1px;border-style:solid;border-radius:2px;text-align:center;background-color:#fff;cursor:pointer}.layui-tab-bar .layui-icon{position:relative;display:inline-block;top:3px;transition:all .3s;-webkit-transition:all .3s}.layui-tab-item{display:none}.layui-tab-more{padding-right:30px;height:auto!important;white-space:normal!important}.layui-tab-more li.layui-this:after{border-bottom-color:#eee;border-radius:2px}.layui-tab-more .layui-tab-bar .layui-icon{top:-2px;top:3px\0;-webkit-transform:rotate(180deg);transform:rotate(180deg)}:root .layui-tab-more .layui-tab-bar .layui-icon{top:-2px\0/IE9}.layui-tab-content{padding:15px 0}.layui-tab-title li .layui-tab-close{position:relative;display:inline-block;width:18px;height:18px;line-height:20px;margin-left:8px;top:1px;text-align:center;font-size:14px;color:#c2c2c2;transition:all .2s;-webkit-transition:all .2s}.layui-tab-title li .layui-tab-close:hover{border-radius:2px;background-color:#ff5722;color:#fff}.layui-tab-brief>.layui-tab-title .layui-this{color:#16baaa}.layui-tab-brief>.layui-tab-more li.layui-this:after,.layui-tab-brief>.layui-tab-title .layui-this:after{border:none;border-radius:0;border-bottom:2px solid #16b777}.layui-tab-brief[overflow]>.layui-tab-title .layui-this:after{top:-1px}.layui-tab-card{border-width:1px;border-style:solid;border-radius:2px;box-shadow:0 2px 5px 0 rgba(0,0,0,.1)}.layui-tab-card>.layui-tab-title{background-color:#fafafa}.layui-tab-card>.layui-tab-title li{margin-right:-1px;margin-left:-1px}.layui-tab-card>.layui-tab-title .layui-this{background-color:#fff}.layui-tab-card>.layui-tab-title .layui-this:after{border-top:none;border-width:1px;border-bottom-color:#fff}.layui-tab-card>.layui-tab-title .layui-tab-bar{height:40px;line-height:40px;border-radius:0;border-top:none;border-right:none}.layui-tab-card>.layui-tab-more .layui-this{background:0 0;color:#16b777}.layui-tab-card>.layui-tab-more .layui-this:after{border:none}.layui-timeline{padding-left:5px}.layui-timeline-item{position:relative;padding-bottom:20px}.layui-timeline-axis{position:absolute;left:-5px;top:0;z-index:10;width:20px;height:20px;line-height:20px;background-color:#fff;color:#16b777;border-radius:50%;text-align:center;cursor:pointer}.layui-timeline-axis:hover{color:#ff5722}.layui-timeline-item:before{content:"";position:absolute;left:5px;top:0;z-index:0;width:1px;height:100%}.layui-timeline-item:first-child:before{display:block}.layui-timeline-item:last-child:before{display:none}.layui-timeline-content{padding-left:25px}.layui-timeline-title{position:relative;margin-bottom:10px;line-height:22px}.layui-badge,.layui-badge-dot,.layui-badge-rim{position:relative;display:inline-block;padding:0 6px;font-size:12px;text-align:center;background-color:#ff5722;color:#fff;border-radius:2px}.layui-badge{height:18px;line-height:18px}.layui-badge-dot{width:8px;height:8px;padding:0;border-radius:50%}.layui-badge-rim{height:18px;line-height:18px;border-width:1px;border-style:solid;background-color:#fff;color:#5f5f5f}.layui-btn .layui-badge,.layui-btn .layui-badge-dot{margin-left:5px}.layui-nav .layui-badge,.layui-nav .layui-badge-dot{position:absolute;top:50%;margin:-5px 6px 0}.layui-nav .layui-badge{margin-top:-10px}.layui-tab-title .layui-badge,.layui-tab-title .layui-badge-dot{left:5px;top:-2px}.layui-carousel{position:relative;left:0;top:0;background-color:#f8f8f8}.layui-carousel>[carousel-item]{position:relative;width:100%;height:100%;overflow:hidden}.layui-carousel>[carousel-item]:before{position:absolute;content:'\e63d';left:50%;top:50%;width:100px;line-height:20px;margin:-10px 0 0 -50px;text-align:center;color:#c2c2c2;font-family:layui-icon!important;font-size:30px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-carousel>[carousel-item]>*{display:none;position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f8f8f8;transition-duration:.3s;-webkit-transition-duration:.3s}.layui-carousel-updown>*{-webkit-transition:.3s ease-in-out up;transition:.3s ease-in-out up}.layui-carousel-arrow{display:none\0;opacity:0;position:absolute;left:10px;top:50%;margin-top:-18px;width:36px;height:36px;line-height:36px;text-align:center;font-size:20px;border:none 0;border-radius:50%;background-color:rgba(0,0,0,.2);color:#fff;-webkit-transition-duration:.3s;transition-duration:.3s;cursor:pointer}.layui-carousel-arrow[lay-type=add]{left:auto!important;right:10px}.layui-carousel[lay-arrow=always] .layui-carousel-arrow{opacity:1;left:20px}.layui-carousel[lay-arrow=always] .layui-carousel-arrow[lay-type=add]{right:20px}.layui-carousel[lay-arrow=none] .layui-carousel-arrow{display:none}.layui-carousel-arrow:hover,.layui-carousel-ind ul:hover{background-color:rgba(0,0,0,.35)}.layui-carousel:hover .layui-carousel-arrow{display:block\0;opacity:1;left:20px}.layui-carousel:hover .layui-carousel-arrow[lay-type=add]{right:20px}.layui-carousel-ind{position:relative;top:-35px;width:100%;line-height:0!important;text-align:center;font-size:0}.layui-carousel[lay-indicator=outside]{margin-bottom:30px}.layui-carousel[lay-indicator=outside] .layui-carousel-ind{top:10px}.layui-carousel[lay-indicator=outside] .layui-carousel-ind ul{background-color:rgba(0,0,0,.5)}.layui-carousel[lay-indicator=none] .layui-carousel-ind{display:none}.layui-carousel-ind ul{display:inline-block;padding:5px;background-color:rgba(0,0,0,.2);border-radius:10px;-webkit-transition-duration:.3s;transition-duration:.3s}.layui-carousel-ind ul li{display:inline-block;width:10px;height:10px;margin:0 3px;font-size:14px;background-color:#eee;background-color:rgba(255,255,255,.5);border-radius:50%;cursor:pointer;-webkit-transition-duration:.3s;transition-duration:.3s}.layui-carousel-ind ul li:hover{background-color:rgba(255,255,255,.7)}.layui-carousel-ind ul li.layui-this{background-color:#fff}.layui-carousel>[carousel-item]>.layui-carousel-next,.layui-carousel>[carousel-item]>.layui-carousel-prev,.layui-carousel>[carousel-item]>.layui-this{display:block}.layui-carousel>[carousel-item]>.layui-this{left:0}.layui-carousel>[carousel-item]>.layui-carousel-prev{left:-100%}.layui-carousel>[carousel-item]>.layui-carousel-next{left:100%}.layui-carousel>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel>[carousel-item]>.layui-carousel-prev.layui-carousel-right{left:0}.layui-carousel>[carousel-item]>.layui-this.layui-carousel-left{left:-100%}.layui-carousel>[carousel-item]>.layui-this.layui-carousel-right{left:100%}.layui-carousel[lay-anim=updown] .layui-carousel-arrow{left:50%!important;top:20px;margin:0 0 0 -18px}.layui-carousel[lay-anim=updown] .layui-carousel-arrow[lay-type=add]{top:auto!important;bottom:20px}.layui-carousel[lay-anim=updown] .layui-carousel-ind{position:absolute;top:50%;right:20px;width:auto;height:auto}.layui-carousel[lay-anim=updown] .layui-carousel-ind ul{padding:3px 5px}.layui-carousel[lay-anim=updown] .layui-carousel-ind li{display:block;margin:6px 0}.layui-carousel[lay-anim=updown]>[carousel-item]>*{left:0!important}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this{top:0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-prev{top:-100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-next{top:100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-prev.layui-carousel-right{top:0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this.layui-carousel-left{top:-100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this.layui-carousel-right{top:100%}.layui-carousel[lay-anim=fade]>[carousel-item]>*{left:0!important}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-next,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-prev{opacity:0}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-prev.layui-carousel-right{opacity:1}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-this.layui-carousel-left,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-this.layui-carousel-right{opacity:0}.layui-fixbar{position:fixed;right:16px;bottom:16px;z-index:999999}.layui-fixbar li{width:50px;height:50px;line-height:50px;margin-bottom:1px;text-align:center;cursor:pointer;font-size:30px;background-color:#9f9f9f;color:#fff;border-radius:2px;opacity:.95}.layui-fixbar li:hover{opacity:.85}.layui-fixbar li:active{opacity:1}.layui-fixbar .layui-fixbar-top{display:none;font-size:40px}body .layui-util-face{border:none;background:0 0}body .layui-util-face .layui-layer-content{padding:0;background-color:#fff;color:#5f5f5f;box-shadow:none}.layui-util-face .layui-layer-TipsG{display:none}.layui-util-face ul{position:relative;width:372px;padding:10px;border:1px solid #d9d9d9;background-color:#fff;box-shadow:0 0 20px rgba(0,0,0,.2)}.layui-util-face ul li{cursor:pointer;float:left;border:1px solid #e8e8e8;height:22px;width:26px;overflow:hidden;margin:-1px 0 0 -1px;padding:4px 2px;text-align:center}.layui-util-face ul li:hover{position:relative;z-index:2;border:1px solid #eb7350;background:#fff9ec}.layui-code{position:relative;margin:10px 0;padding:15px;line-height:20px;border:1px solid #eee;border-left-width:6px;background-color:#fafafa;color:#333;font-family:Courier New,Lucida Console,Consolas;font-size:12px}.layui-transfer-box,.layui-transfer-header,.layui-transfer-search{border-width:0;border-style:solid;border-color:#eee}.layui-transfer-box{position:relative;display:inline-block;vertical-align:middle;border-width:1px;width:200px;height:360px;border-radius:2px;background-color:#fff}.layui-transfer-box .layui-form-checkbox{width:100%;margin:0!important}.layui-transfer-header{height:38px;line-height:38px;padding:0 11px;border-bottom-width:1px}.layui-transfer-search{position:relative;padding:11px;border-bottom-width:1px}.layui-transfer-search .layui-input{height:32px;padding-left:30px;font-size:12px}.layui-transfer-search .layui-icon-search{position:absolute;left:20px;top:50%;line-height:normal;margin-top:-8px;color:#5f5f5f}.layui-transfer-active{margin:0 15px;display:inline-block;vertical-align:middle}.layui-transfer-active .layui-btn{display:block;margin:0;padding:0 15px;background-color:#16b777;border-color:#16b777;color:#fff}.layui-transfer-active .layui-btn-disabled{background-color:#fbfbfb;border-color:#eee;color:#d2d2d2}.layui-transfer-active .layui-btn:first-child{margin-bottom:15px}.layui-transfer-active .layui-btn .layui-icon{margin:0;font-size:14px!important}.layui-transfer-data{padding:5px 0;overflow:auto}.layui-transfer-data li{height:32px;line-height:32px;margin-top:0!important;padding:0 11px;list-style-type:none!important}.layui-transfer-data li:hover{background-color:#f8f8f8;transition:.5s all}.layui-transfer-data .layui-none{padding:15px 11px;text-align:center;color:#999}.layui-rate,.layui-rate *{display:inline-block;vertical-align:middle}.layui-rate{padding:11px 6px 11px 0;font-size:0}.layui-rate li{margin-top:0!important}.layui-rate li i.layui-icon{font-size:20px;color:#ffb800}.layui-rate li i.layui-icon{margin-right:5px;transition:all .3s;-webkit-transition:all .3s}.layui-rate li i:hover{cursor:pointer;transform:scale(1.12);-webkit-transform:scale(1.12)}.layui-rate[readonly] li i:hover{cursor:default;transform:scale(1)}.layui-colorpicker{width:38px;height:38px;border:1px solid #eee;padding:5px;border-radius:2px;line-height:24px;display:inline-block;cursor:pointer;transition:all .3s;-webkit-transition:all .3s;box-sizing:border-box}.layui-colorpicker:hover{border-color:#d2d2d2}.layui-colorpicker.layui-colorpicker-lg{width:44px;height:44px;line-height:30px}.layui-colorpicker.layui-colorpicker-sm{width:30px;height:30px;line-height:20px;padding:3px}.layui-colorpicker.layui-colorpicker-xs{width:22px;height:22px;line-height:16px;padding:1px}.layui-colorpicker-trigger-bgcolor{display:block;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);border-radius:2px}.layui-colorpicker-trigger-span{display:block;height:100%;box-sizing:border-box;border:1px solid rgba(0,0,0,.15);border-radius:2px;text-align:center}.layui-colorpicker-trigger-i{display:inline-block;color:#fff;font-size:12px}.layui-colorpicker-trigger-i.layui-icon-close{color:#999}.layui-colorpicker-main{position:absolute;left:-999999px;top:-999999px;z-index:77777777;width:280px;margin:5px 0;padding:7px;background:#fff;border:1px solid #d2d2d2;border-radius:2px;box-shadow:0 2px 4px rgba(0,0,0,.12)}.layui-colorpicker-main-wrapper{height:180px;position:relative}.layui-colorpicker-basis{width:260px;height:100%;position:relative}.layui-colorpicker-basis-white{width:100%;height:100%;position:absolute;top:0;left:0;background:linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.layui-colorpicker-basis-black{width:100%;height:100%;position:absolute;top:0;left:0;background:linear-gradient(0deg,#000,transparent)}.layui-colorpicker-basis-cursor{width:10px;height:10px;border:1px solid #fff;border-radius:50%;position:absolute;top:-3px;right:-3px;cursor:pointer}.layui-colorpicker-side{position:absolute;top:0;right:0;width:12px;height:100%;background:linear-gradient(red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.layui-colorpicker-side-slider{width:100%;height:5px;box-shadow:0 0 1px #888;box-sizing:border-box;background:#fff;border-radius:1px;border:1px solid #f0f0f0;cursor:pointer;position:absolute;left:0}.layui-colorpicker-main-alpha{display:none;height:12px;margin-top:7px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.layui-colorpicker-alpha-bgcolor{height:100%;position:relative}.layui-colorpicker-alpha-slider{width:5px;height:100%;box-shadow:0 0 1px #888;box-sizing:border-box;background:#fff;border-radius:1px;border:1px solid #f0f0f0;cursor:pointer;position:absolute;top:0}.layui-colorpicker-main-pre{padding-top:7px;font-size:0}.layui-colorpicker-pre{width:20px;height:20px;border-radius:2px;display:inline-block;margin-left:6px;margin-bottom:7px;cursor:pointer}.layui-colorpicker-pre:nth-child(11n+1){margin-left:0}.layui-colorpicker-pre-isalpha{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.layui-colorpicker-pre.layui-this{box-shadow:0 0 3px 2px rgba(0,0,0,.15)}.layui-colorpicker-pre>div{height:100%;border-radius:2px}.layui-colorpicker-main-input{text-align:right;padding-top:7px}.layui-colorpicker-main-input .layui-btn-container .layui-btn{margin:0 0 0 10px}.layui-colorpicker-main-input div.layui-inline{float:left;margin-right:10px;font-size:14px}.layui-colorpicker-main-input input.layui-input{width:150px;height:30px;color:#5f5f5f}.layui-slider{height:4px;background:#eee;border-radius:3px;position:relative;cursor:pointer}.layui-slider-bar{border-radius:3px;position:absolute;height:100%}.layui-slider-step{position:absolute;top:0;width:4px;height:4px;border-radius:50%;background:#fff;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.layui-slider-wrap{width:36px;height:36px;position:absolute;top:-16px;-webkit-transform:translateX(-50%);transform:translateX(-50%);z-index:10;text-align:center}.layui-slider-wrap-btn{width:12px;height:12px;border-radius:50%;background:#fff;display:inline-block;vertical-align:middle;cursor:pointer;transition:.3s}.layui-slider-wrap:after{content:"";height:100%;display:inline-block;vertical-align:middle}.layui-slider-wrap-btn.layui-slider-hover,.layui-slider-wrap-btn:hover{transform:scale(1.2)}.layui-slider-wrap-btn.layui-disabled:hover{transform:scale(1)!important}.layui-slider-tips{position:absolute;top:-42px;z-index:77777777;white-space:nowrap;display:none;-webkit-transform:translateX(-50%);transform:translateX(-50%);color:#fff;background:#000;border-radius:3px;height:25px;line-height:25px;padding:0 10px}.layui-slider-tips:after{content:"";position:absolute;bottom:-12px;left:50%;margin-left:-6px;width:0;height:0;border-width:6px;border-style:solid;border-color:#000 transparent transparent transparent}.layui-slider-input{width:70px;height:32px;border:1px solid #eee;border-radius:3px;font-size:16px;line-height:32px;position:absolute;right:0;top:-14px}.layui-slider-input-btn{position:absolute;top:0;right:0;width:20px;height:100%;border-left:1px solid #eee}.layui-slider-input-btn i{cursor:pointer;position:absolute;right:0;bottom:0;width:20px;height:50%;font-size:12px;line-height:16px;text-align:center;color:#999}.layui-slider-input-btn i:first-child{top:0;border-bottom:1px solid #eee}.layui-slider-input-txt{height:100%;font-size:14px}.layui-slider-input-txt input{height:100%;border:none}.layui-slider-input-btn i:hover{color:#16baaa}.layui-slider-vertical{width:4px;margin-left:33px}.layui-slider-vertical .layui-slider-bar{width:4px}.layui-slider-vertical .layui-slider-step{top:auto;left:0;-webkit-transform:translateY(50%);transform:translateY(50%)}.layui-slider-vertical .layui-slider-wrap{top:auto;left:-16px;-webkit-transform:translateY(50%);transform:translateY(50%)}.layui-slider-vertical .layui-slider-tips{top:auto;left:2px}@media \0screen{.layui-slider-wrap-btn{margin-left:-20px}.layui-slider-vertical .layui-slider-wrap-btn{margin-left:0;margin-bottom:-20px}.layui-slider-vertical .layui-slider-tips{margin-left:-8px}.layui-slider>span{margin-left:8px}}.layui-tree{line-height:22px}.layui-tree .layui-form-checkbox{margin:0!important}.layui-tree-set{width:100%;position:relative}.layui-tree-pack{display:none;padding-left:20px;position:relative}.layui-tree-line .layui-tree-pack{padding-left:27px}.layui-tree-line .layui-tree-set .layui-tree-set:after{content:"";position:absolute;top:14px;left:-9px;width:17px;height:0;border-top:1px dotted #c0c4cc}.layui-tree-entry{position:relative;padding:3px 0;height:20px;white-space:nowrap}.layui-tree-entry:hover{background-color:#eee}.layui-tree-line .layui-tree-entry:hover{background-color:rgba(0,0,0,0)}.layui-tree-line .layui-tree-entry:hover .layui-tree-txt{color:#999;text-decoration:underline;transition:.3s}.layui-tree-main{display:inline-block;vertical-align:middle;cursor:pointer;padding-right:10px}.layui-tree-line .layui-tree-set:before{content:"";position:absolute;top:0;left:-9px;width:0;height:100%;border-left:1px dotted #c0c4cc}.layui-tree-line .layui-tree-set.layui-tree-setLineShort:before{height:13px}.layui-tree-line .layui-tree-set.layui-tree-setHide:before{height:0}.layui-tree-iconClick{display:inline-block;vertical-align:middle;position:relative;height:20px;line-height:20px;margin:0 10px;color:#c0c4cc}.layui-tree-icon{height:12px;line-height:12px;width:12px;text-align:center;border:1px solid #c0c4cc}.layui-tree-iconClick .layui-icon{font-size:18px}.layui-tree-icon .layui-icon{font-size:12px;color:#5f5f5f}.layui-tree-iconArrow{padding:0 5px}.layui-tree-iconArrow:after{content:"";position:absolute;left:4px;top:3px;z-index:100;width:0;height:0;border-width:5px;border-style:solid;border-color:transparent transparent transparent #c0c4cc;transition:.5s}.layui-tree-spread>.layui-tree-entry .layui-tree-iconClick>.layui-tree-iconArrow:after{transform:rotate(90deg) translate(3px,4px)}.layui-tree-txt{display:inline-block;vertical-align:middle;color:#555}.layui-tree-search{margin-bottom:15px;color:#5f5f5f}.layui-tree-btnGroup{visibility:hidden;display:inline-block;vertical-align:middle;position:relative}.layui-tree-btnGroup .layui-icon{display:inline-block;vertical-align:middle;padding:0 2px;cursor:pointer}.layui-tree-btnGroup .layui-icon:hover{color:#999;transition:.3s}.layui-tree-entry:hover .layui-tree-btnGroup{visibility:visible}.layui-tree-editInput{position:relative;display:inline-block;vertical-align:middle;height:20px;line-height:20px;padding:0 3px;border:none;background-color:rgba(0,0,0,.05)}.layui-tree-emptyText{text-align:center;color:#999}.layui-anim{-webkit-animation-duration:.3s;-webkit-animation-fill-mode:both;animation-duration:.3s;animation-fill-mode:both}.layui-anim.layui-icon{display:inline-block}.layui-anim-loop{-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.layui-trans,.layui-trans a{transition:all .2s;-webkit-transition:all .2s}@-webkit-keyframes layui-rotate{from{-webkit-transform:rotate(0)}to{-webkit-transform:rotate(360deg)}}@keyframes layui-rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}.layui-anim-rotate{-webkit-animation-name:layui-rotate;animation-name:layui-rotate;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes layui-up{from{-webkit-transform:translate3d(0,100%,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes layui-up{from{transform:translate3d(0,100%,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-anim-up{-webkit-animation-name:layui-up;animation-name:layui-up}@-webkit-keyframes layui-upbit{from{-webkit-transform:translate3d(0,15px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes layui-upbit{from{transform:translate3d(0,15px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-anim-upbit{-webkit-animation-name:layui-upbit;animation-name:layui-upbit}@keyframes layui-down{0%{opacity:.3;transform:translate3d(0,-100%,0)}100%{opacity:1;transform:translate3d(0,0,0)}}.layui-anim-down{animation-name:layui-down}@keyframes layui-downbit{0%{opacity:.3;transform:translate3d(0,-5px,0)}100%{opacity:1;transform:translate3d(0,0,0)}}.layui-anim-downbit{animation-name:layui-downbit}@-webkit-keyframes layui-scale{0%{opacity:.3;-webkit-transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1)}}@keyframes layui-scale{0%{opacity:.3;-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-ms-transform:scale(1);transform:scale(1)}}.layui-anim-scale{-webkit-animation-name:layui-scale;animation-name:layui-scale}@-webkit-keyframes layui-scale-spring{0%{opacity:.5;-webkit-transform:scale(.5)}80%{opacity:.8;-webkit-transform:scale(1.1)}100%{opacity:1;-webkit-transform:scale(1)}}@keyframes layui-scale-spring{0%{opacity:.5;transform:scale(.5)}80%{opacity:.8;transform:scale(1.1)}100%{opacity:1;transform:scale(1)}}.layui-anim-scaleSpring{-webkit-animation-name:layui-scale-spring;animation-name:layui-scale-spring}@keyframes layui-scalesmall{0%{opacity:.3;transform:scale(1.5)}100%{opacity:1;transform:scale(1)}}.layui-anim-scalesmall{animation-name:layui-scalesmall}@keyframes layui-scalesmall-spring{0%{opacity:.3;transform:scale(1.5)}80%{opacity:.8;transform:scale(.9)}100%{opacity:1;transform:scale(1)}}.layui-anim-scalesmall-spring{animation-name:layui-scalesmall-spring}@-webkit-keyframes layui-fadein{0%{opacity:0}100%{opacity:1}}@keyframes layui-fadein{0%{opacity:0}100%{opacity:1}}.layui-anim-fadein{-webkit-animation-name:layui-fadein;animation-name:layui-fadein}@-webkit-keyframes layui-fadeout{0%{opacity:1}100%{opacity:0}}@keyframes layui-fadeout{0%{opacity:1}100%{opacity:0}}.layui-anim-fadeout{-webkit-animation-name:layui-fadeout;animation-name:layui-fadeout}html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-view{display:block;position:relative;margin:11px 0;padding:0;border:1px solid #eee;border-left-width:6px;background-color:#fafafa;color:#333;font-family:Courier New;font-size:13px}.layui-code-title{position:relative;padding:0 10px;height:40px;line-height:40px;border-bottom:1px solid #eee;font-size:12px}.layui-code-title>.layui-code-about{position:absolute;right:10px;top:0;color:#b7b7b7}.layui-code-about>a{padding-left:10px}.layui-code-view>.layui-code-ol,.layui-code-view>.layui-code-ul{max-height:100%;padding:0!important;position:relative;overflow:auto}.layui-code-view>.layui-code-ol>li{position:relative;margin-top:0!important;margin-left:45px!important;line-height:20px;padding:0 10px!important;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view>.layui-code-ol>li:first-child,.layui-code-view>.layui-code-ul>li:first-child{padding-top:10px!important}.layui-code-view>.layui-code-ol>li:last-child,.layui-code-view>.layui-code-ul>li:last-child{padding-bottom:10px!important}.layui-code-view>.layui-code-ul>li{position:relative;line-height:20px;padding:0 10px!important;list-style-type:none;*list-style-type:none;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-dark{border:1px solid #0c0c0c;border-left-color:#3f3f3f;background-color:#0c0c0c;color:#c2be9e}.layui-code-dark>.layui-code-title{border-bottom:none}.layui-code-dark>.layui-code-ol>li,.layui-code-dark>.layui-code-ul>li{background-color:#3f3f3f;border-left:none}.layui-code-dark>.layui-code-ul>li{margin-left:6px}.layui-code textarea{display:none}.layui-code-preview>.layui-code{margin:0}.layui-code-preview>.layui-tab{position:relative;z-index:1;margin-bottom:0}.layui-code-preview>.layui-tab>.layui-tab-title{border-bottom:none}.layui-code-preview>.layui-code>.layui-code-title{display:none}.layui-code-preview .layui-code-item{display:none}.layui-code-item-preview{position:relative;padding:16px}.layui-code-item-preview>iframe{position:absolute;top:0;left:0;width:100%;height:100%;border:none}.layui-code-tools{position:absolute;right:11px;top:3px}.layui-code-tools>i{display:inline-block;margin-left:6px;padding:3px;cursor:pointer}.layui-code-tools>i.layui-icon-file-b{color:#999}.layui-code-tools>i:hover{color:#16b777}.layui-code-copy{position:absolute;right:6px;top:6px;cursor:pointer;display:none}.layui-code-copy .layui-icon{color:#777;transition:all .3s}.layui-code-copy:hover .layui-icon{color:#16b777}.layui-code-view:hover>.layui-code-copy{display:block}.layui-code-copy-offset{margin-right:17px}.layui-code-preview>.layui-code-view>.layui-code-copy{display:none!important}.layui-code-full{position:fixed;left:0;top:0;z-index:1111111;width:100%;height:100%;background-color:#fff}.layui-code-full .layui-code-item{width:100%!important;border-width:0!important;border-top-width:1px!important}.layui-code-full .layui-code-item,.layui-code-full .layui-code-ol,.layui-code-full .layui-code-ul{height:calc(100vh - 51px)!important;box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate,.layui-laydate *{box-sizing:border-box}.layui-laydate{position:absolute;z-index:99999999;margin:5px 0;border-radius:2px;font-size:14px;line-height:normal;-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}.layui-laydate-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px");position:fixed;_position:absolute;pointer-events:auto}@keyframes laydate-downbit{0%{opacity:.3;transform:translate3d(0,-5px,0)}100%{opacity:1;transform:translate3d(0,0,0)}}.layui-laydate{animation-name:laydate-downbit}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;padding:0 5px;color:#999;font-size:18px;cursor:pointer}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;box-sizing:border-box;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-set-ym span{padding:0 10px;cursor:pointer}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:0;text-align:center}.layui-laydate-content th{font-weight:400}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.laydate-day-holidays:before{position:absolute;left:0;top:0;font-size:12px;transform:scale(.7)}.laydate-day-holidays:before{content:'\4F11';color:#ff5722}.laydate-day-holidays[type=work]:before{content:'\73ED';color:inherit}.layui-laydate .layui-this .laydate-day-holidays:before{color:#fff}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px}.layui-laydate-footer span{display:inline-block;vertical-align:top;height:26px;line-height:24px;padding:0 10px;border:1px solid #c9c9c9;border-radius:2px;background-color:#fff;font-size:12px;cursor:pointer;white-space:nowrap;transition:all .3s}.layui-laydate-footer span:hover{color:#16b777}.layui-laydate-footer span.layui-laydate-preview{cursor:default;border-color:transparent!important}.layui-laydate-footer span.layui-laydate-preview:hover{color:#777}.layui-laydate-footer span:first-child.layui-laydate-preview{padding-left:0}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{margin:0 0 0 -1px;border-radius:0}.laydate-footer-btns span:first-child{border-radius:2px 0 0 2px}.laydate-footer-btns span:last-child{border-radius:0 2px 2px 0}.layui-laydate-shortcut{width:80px;padding:6px 0;display:inline-block;vertical-align:top;overflow:auto;max-height:276px;text-align:center}.layui-laydate-shortcut+.layui-laydate-main{display:inline-block;border-left:1px solid #e2e2e2}.layui-laydate-shortcut>li{padding:5px 8px;cursor:pointer;line-height:18px}.layui-laydate .layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;box-sizing:border-box;background-color:#fff}.layui-laydate .layui-laydate-list>li{position:relative;display:inline-block;width:33.3%;height:36px;line-height:36px;margin:3px 0;vertical-align:middle;text-align:center;cursor:pointer;list-style:none}.layui-laydate .laydate-month-list>li{width:25%;margin:17px 0}.layui-laydate .laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.layui-laydate .laydate-time-list p{position:relative;top:-4px;margin:0;line-height:29px}.layui-laydate .laydate-time-list ol{height:181px;overflow:hidden}.layui-laydate .laydate-time-list>li:hover ol{overflow-y:auto}.layui-laydate .laydate-time-list ol li{width:130%;padding-left:33px;height:30px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px;color:#ff5722}.layui-laydate-range{width:546px}.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle;max-width:50%}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content,.layui-laydate-range .laydate-main-list-1 .layui-laydate-header{border-left:1px solid #e2e2e2}.layui-laydate-range.layui-laydate-linkage .laydate-main-list-0 .laydate-next-m,.layui-laydate-range.layui-laydate-linkage .laydate-main-list-0 .laydate-next-y,.layui-laydate-range.layui-laydate-linkage .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range.layui-laydate-linkage .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#777}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#16b777}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{color:#333}.layui-laydate-content td{color:#777}.layui-laydate-content td.laydate-day-now{color:#16b777}.layui-laydate-content td.laydate-day-now:after{content:'';position:absolute;width:100%;height:30px;left:0;top:0;border:1px solid #16b777;box-sizing:border-box}.layui-laydate-linkage .layui-laydate-content td.laydate-selected>div{background-color:#00f7de}.layui-laydate-linkage .laydate-selected:hover>div{background-color:#00f7de!important}.layui-laydate-content td.laydate-selected:after,.layui-laydate-content td:hover:after{content:none}.layui-laydate-content td>div:hover,.layui-laydate-list li:hover,.layui-laydate-shortcut>li:hover{background-color:#eee;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.layui-laydate-linkage .laydate-selected.laydate-day-next>div,.layui-laydate-linkage .laydate-selected.laydate-day-prev>div{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#ff5722}.laydate-day-mark::after{background-color:#16b777}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#16b777}.layui-laydate .layui-this,.layui-laydate .layui-this>div{background-color:#16baaa!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content td>div{padding:7px 0;height:100%}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#16baaa}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead{border:1px solid #e2e2e2}.layui-laydate-linkage.laydate-theme-grid .laydate-selected,.layui-laydate-linkage.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#16baaa!important}.layui-laydate-linkage.laydate-theme-grid .laydate-selected.laydate-day-next,.layui-laydate-linkage.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px}.laydate-theme-grid .layui-laydate-content td>div{height:29px;margin-top:-1px}.laydate-theme-circle .layui-laydate-content td.layui-this>div,.laydate-theme-circle .layui-laydate-content td>div{width:28px;height:28px;line-height:28px;border-radius:14px;margin:0 4px;padding:0}.layui-laydate.laydate-theme-circle .layui-laydate-content table td.layui-this{background-color:transparent!important}.laydate-theme-grid.laydate-theme-circle .layui-laydate-content td>div{margin:0 3.5px}.laydate-theme-fullpanel .layui-laydate-main{width:526px}.laydate-theme-fullpanel .layui-laydate-list{width:252px;left:272px}.laydate-theme-fullpanel .laydate-set-ym span{display:none}.laydate-theme-fullpanel .laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-theme-fullpanel .laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-theme-fullpanel .laydate-time-show .layui-laydate-header .layui-icon{display:inline-block!important}.laydate-theme-fullpanel .laydate-btns-time{display:none}html #layuicss-layer{display:none;position:absolute;width:1989px}.layui-layer,.layui-layer-shade{position:fixed;_position:absolute;pointer-events:auto}.layui-layer-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px")}.layui-layer{-webkit-overflow-scrolling:touch}.layui-layer{top:150px;left:0;margin:0;padding:0;background-color:#fff;-webkit-background-clip:content;border-radius:2px;box-shadow:1px 1px 50px rgba(0,0,0,.3)}.layui-layer-close{position:absolute}.layui-layer-content{position:relative}.layui-layer-border{border:1px solid #b2b2b2;border:1px solid rgba(0,0,0,.1);box-shadow:1px 1px 5px rgba(0,0,0,.2)}.layui-layer-btn a,.layui-layer-setwin span{display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-move{display:none;position:fixed;*position:absolute;left:0;top:0;width:100%;height:100%;cursor:move;opacity:0;filter:alpha(opacity=0);background-color:#fff;z-index:2147483647}.layui-layer-resize{position:absolute;width:15px;height:15px;right:0;bottom:0;cursor:se-resize}.layer-anim{-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.3s;animation-duration:.3s}@-webkit-keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-00{-webkit-animation-name:layer-bounceIn;animation-name:layer-bounceIn}@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown}@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig}@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft}@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);-ms-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn}@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn}@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes layer-slide-down{from{transform:translate3d(0,-100%,0)}to{transform:translate3d(0,0,0)}}@keyframes layer-slide-down-out{from{transform:translate3d(0,0,0)}to{transform:translate3d(0,-100%,0)}}.layer-anim-slide-down{animation-name:layer-slide-down}.layer-anim-slide-down-out{animation-name:layer-slide-down-out}@keyframes layer-slide-left{from{transform:translate3d(100%,0,0)}to{transform:translate3d(0,0,0)}}@keyframes layer-slide-left-out{from{transform:translate3d(0,0,0)}to{transform:translate3d(100%,0,0)}}.layer-anim-slide-left{animation-name:layer-slide-left}.layer-anim-slide-left-out{animation-name:layer-slide-left-out}@keyframes layer-slide-up{from{transform:translate3d(0,100%,0)}to{transform:translate3d(0,0,0)}}@keyframes layer-slide-up-out{from{transform:translate3d(0,0,0)}to{transform:translate3d(0,100%,0)}}.layer-anim-slide-up{animation-name:layer-slide-up}.layer-anim-slide-up-out{animation-name:layer-slide-up-out}@keyframes layer-slide-right{from{transform:translate3d(-100%,0,0)}to{transform:translate3d(0,0,0)}}@keyframes layer-slide-right-out{from{transform:translate3d(0,0,0)}to{transform:translate3d(-100%,0,0)}}.layer-anim-slide-right{animation-name:layer-slide-right}.layer-anim-slide-right-out{animation-name:layer-slide-right-out}.layui-layer-title{padding:0 81px 0 16px;height:50px;line-height:50px;border-bottom:1px solid #f0f0f0;font-size:14px;color:#333;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:2px 2px 0 0}.layui-layer-setwin{position:absolute;right:15px;*right:0;top:16px;font-size:0;line-height:initial}.layui-layer-setwin span{position:relative;width:16px;height:16px;line-height:18px;margin-left:10px;text-align:center;font-size:16px;cursor:pointer;color:#000;_overflow:hidden}.layui-layer-setwin .layui-layer-min:before{content:'';position:absolute;width:12px;height:1px;left:50%;top:50%;margin:-.5px 0 0 -6px;background-color:#2e2d3c;cursor:pointer;_overflow:hidden}.layui-layer-setwin .layui-layer-min:hover:before{background-color:#2d93ca}.layui-layer-setwin .layui-layer-max:after,.layui-layer-setwin .layui-layer-max:before{content:'';position:absolute;left:50%;top:50%;z-index:1;width:9px;height:9px;margin:-5px 0 0 -5px;border:1px solid #2e2d3c}.layui-layer-setwin .layui-layer-max:hover:after,.layui-layer-setwin .layui-layer-max:hover:before{border-color:#2d93ca}.layui-layer-setwin .layui-layer-min:hover:before{background-color:#2d93ca}.layui-layer-setwin .layui-layer-maxmin:after,.layui-layer-setwin .layui-layer-maxmin:before{width:7px;height:7px;margin:-3px 0 0 -3px;background-color:#fff}.layui-layer-setwin .layui-layer-maxmin:after{z-index:0;margin:-5px 0 0 -1px}.layui-layer-setwin .layui-layer-close{cursor:pointer}.layui-layer-setwin .layui-layer-close:hover{opacity:.7}.layui-layer-setwin .layui-layer-close2{position:absolute;right:-28px;top:-28px;color:#fff;background-color:#787878;padding:3px;border:3px solid;width:18px;height:18px;font-size:18px;font-weight:bolder;border-radius:50%;margin-left:0;*right:-18px;_display:none}.layui-layer-setwin .layui-layer-close2:hover{opacity:unset;background-color:#3888f6}.layui-layer-btn{text-align:right;padding:0 15px 12px;pointer-events:auto;user-select:none;-webkit-user-select:none}.layui-layer-btn a{height:28px;line-height:28px;margin:5px 5px 0;padding:0 15px;border:1px solid #dedede;background-color:#fff;color:#333;border-radius:2px;font-weight:400;cursor:pointer;text-decoration:none}.layui-layer-btn a:hover{opacity:.9;text-decoration:none}.layui-layer-btn a:active{opacity:.8}.layui-layer-btn .layui-layer-btn0{border-color:#1e9fff;background-color:#1e9fff;color:#fff}.layui-layer-btn-l{text-align:left}.layui-layer-btn-c{text-align:center}.layui-layer-dialog{min-width:240px}.layui-layer-dialog .layui-layer-content{position:relative;padding:16px;line-height:24px;word-break:break-all;overflow:hidden;font-size:14px;overflow-x:hidden;overflow-y:auto}.layui-layer-dialog .layui-layer-content .layui-layer-face{position:absolute;top:18px;left:16px;color:#959595;font-size:32px;_left:-40px}.layui-layer-dialog .layui-layer-content .layui-icon-tips{color:#f39b12}.layui-layer-dialog .layui-layer-content .layui-icon-success{color:#16b777}.layui-layer-dialog .layui-layer-content .layui-icon-error{top:19px;color:#ff5722}.layui-layer-dialog .layui-layer-content .layui-icon-question{color:#ffb800}.layui-layer-dialog .layui-layer-content .layui-icon-lock{color:#787878}.layui-layer-dialog .layui-layer-content .layui-icon-face-cry{color:#ff5722}.layui-layer-dialog .layui-layer-content .layui-icon-face-smile{color:#16b777}.layui-layer-rim{border:6px solid #8d8d8d;border:6px solid rgba(0,0,0,.3);border-radius:5px;box-shadow:none}.layui-layer-msg{min-width:180px;border:1px solid #d3d4d3;box-shadow:none}.layui-layer-hui{min-width:100px;background-color:#000;filter:alpha(opacity=60);background-color:rgba(0,0,0,.6);color:#fff;border:none}.layui-layer-hui .layui-layer-close{color:#fff}.layui-layer-hui .layui-layer-content{padding:11px 24px;text-align:center}.layui-layer-dialog .layui-layer-padding{padding:18px 24px 18px 58px;text-align:left}.layui-layer-page .layui-layer-content{position:relative;overflow:auto}.layui-layer-iframe .layui-layer-btn,.layui-layer-page .layui-layer-btn{padding-top:10px}.layui-layer-nobg{background:0 0}.layui-layer-iframe iframe{display:block;width:100%}.layui-layer-loading{border-radius:100%;background:0 0;box-shadow:none;border:none}.layui-layer-loading .layui-layer-content{width:76px;height:38px;line-height:38px;text-align:center}.layui-layer-loading-icon{font-size:38px;color:#959595}.layui-layer-loading2{text-align:center}.layui-layer-loading-2{position:relative;height:38px}.layui-layer-loading-2:after,.layui-layer-loading-2:before{content:'';position:absolute;left:50%;top:50%;width:38px;height:38px;margin:-19px 0 0 -19px;border-radius:50%;border:3px solid #d2d2d2;box-sizing:border-box}.layui-layer-loading-2:after{border-color:transparent;border-left-color:#1e9fff}.layui-layer-tips{background:0 0;box-shadow:none;border:none}.layui-layer-tips .layui-layer-content{position:relative;line-height:22px;min-width:12px;padding:8px 15px;font-size:12px;_float:left;border-radius:2px;box-shadow:1px 1px 3px rgba(0,0,0,.2);background-color:#000;color:#fff}.layui-layer-tips .layui-layer-close{right:-2px;top:-1px}.layui-layer-tips i.layui-layer-TipsG{position:absolute;width:0;height:0;border-width:8px;border-color:transparent;border-style:dashed;*overflow:hidden}.layui-layer-tips i.layui-layer-TipsB,.layui-layer-tips i.layui-layer-TipsT{left:5px;border-right-style:solid;border-right-color:#000}.layui-layer-tips i.layui-layer-TipsT{bottom:-8px}.layui-layer-tips i.layui-layer-TipsB{top:-8px}.layui-layer-tips i.layui-layer-TipsL,.layui-layer-tips i.layui-layer-TipsR{top:5px;border-bottom-style:solid;border-bottom-color:#000}.layui-layer-tips i.layui-layer-TipsR{left:-8px}.layui-layer-tips i.layui-layer-TipsL{right:-8px}.layui-layer-lan .layui-layer-title{background:#4476a7;color:#fff;border:none}.layui-layer-lan .layui-layer-btn{padding:5px 10px 10px;border-top:1px solid #e9e7e7}.layui-layer-lan .layui-layer-btn a{background:#fff;border-color:#e9e7e7;color:#333}.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#c9c5c5}.layui-layer-molv .layui-layer-title{background:#009f95;color:#fff;border:none}.layui-layer-molv .layui-layer-btn a{background:#009f95;border-color:#009f95}.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92b8b1}.layui-layer-lan .layui-layer-setwin .layui-icon,.layui-layer-molv .layui-layer-setwin .layui-icon{color:#fff}.layui-layer-win10{border:1px solid #aaa;box-shadow:1px 1px 6px rgba(0,0,0,.3);border-radius:none}.layui-layer-win10 .layui-layer-title{height:32px;line-height:32px;padding-left:8px;border-bottom:none;font-size:12px}.layui-layer-win10 .layui-layer-setwin{right:0;top:0}.layui-layer-win10 .layui-layer-setwin span{margin-left:0;padding:8px}.layui-layer-win10.layui-layer-page .layui-layer-setwin span{padding:8px 11px}.layui-layer-win10 .layui-layer-setwin span:hover{background-color:#e5e5e5}.layui-layer-win10 .layui-layer-setwin span.layui-icon-close:hover{background-color:#e81123;color:#fff}.layui-layer-win10.layui-layer-dialog .layui-layer-content{padding:8px 16px 32px;color:#0033bc}.layui-layer-win10.layui-layer-dialog .layui-layer-padding{padding-top:18px;padding-left:58px}.layui-layer-win10 .layui-layer-btn{padding:5px 5px 10px;border-top:1px solid #dfdfdf;background-color:#f0f0f0}.layui-layer-win10 .layui-layer-btn a{height:18px;line-height:18px;background-color:#e1e1e1;border-color:#adadad;color:#000;font-size:12px;transition:all .3s}.layui-layer-win10 .layui-layer-btn a:hover{border-color:#2a8edd;background-color:#e5f1fb}.layui-layer-win10 .layui-layer-btn .layui-layer-btn0{border-color:#0078d7}.layui-layer-prompt .layui-layer-input{display:block;width:260px;height:36px;margin:0 auto;line-height:30px;padding-left:10px;border:1px solid #e6e6e6;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px;padding:6px 10px}.layui-layer-prompt .layui-layer-content{padding:16px}.layui-layer-prompt .layui-layer-btn{padding-top:0}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;overflow:visible}.layui-layer-tab .layui-layer-title span{position:relative;display:inline-block;vertical-align:top;border-left:1px solid transparent;border-right:1px solid transparent;min-width:80px;max-width:300px;padding:0 16px;text-align:center;cursor:default;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;cursor:pointer}.layui-layer-tab .layui-layer-title span.layui-this{height:51px;border-left-color:#eee;border-right-color:#eee;background-color:#fff;z-index:10}.layui-layer-tab .layui-layer-title span:first-child{border-left-color:transparent}.layui-layer-tabmain{line-height:24px;clear:both}.layui-layer-tabmain .layui-layer-tabli{display:none}.layui-layer-tabmain .layui-layer-tabli.layui-this{display:block}.layui-layer-photos{background:0 0;box-shadow:none}.layui-layer-photos .layui-layer-content{overflow:hidden;text-align:center}.layui-layer-photos .layui-layer-phimg img{position:relative;width:100%;display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-imgnext,.layui-layer-imgprev{position:fixed;top:50%;width:52px;height:52px;line-height:52px;margin-top:-26px;cursor:pointer;font-size:52px;color:#717171}.layui-layer-imgprev{left:32px}.layui-layer-imgnext{right:32px}.layui-layer-imgnext:hover,.layui-layer-imgprev:hover{color:#959595}.layui-layer-imgbar{position:fixed;left:0;right:0;bottom:0;width:100%;height:40px;line-height:40px;background-color:#000\9;filter:Alpha(opacity=60);background-color:rgba(2,0,0,.35);color:#fff;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:0}.layui-layer-imgtit *{display:inline-block;*display:inline;*zoom:1;vertical-align:top;padding:0 5px;font-size:12px;color:#fff}.layui-layer-imgtit h3{max-width:65%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-weight:300}.layui-layer-imgtit a:hover{color:#fff;text-decoration:underline}.layui-layer-imgtit em{font-style:normal}@-webkit-keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);-ms-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);-ms-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-close{-webkit-animation-name:layer-bounceOut;animation-name:layer-bounceOut;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@media screen and (max-width:1100px){.layui-layer-iframe{overflow-y:auto;-webkit-overflow-scrolling:touch}} \ No newline at end of file +blockquote,body,button,dd,div,dl,dt,form,h1,h2,h3,h4,h5,h6,input,li,ol,p,pre,td,textarea,th,ul{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}a:active,a:hover{outline:0}img{display:inline-block;border:none;vertical-align:middle}li{list-style:none}table{border-collapse:collapse;border-spacing:0}h1,h2,h3,h4{font-weight:700}h5,h6{font-weight:500;font-size:100%}button,input,select,textarea{font-size:100%}button,input,optgroup,option,select,textarea{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;outline:0}pre{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}body{line-height:1.6;color:#333;color:rgba(0,0,0,.85);font:14px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}hr{height:0;line-height:0;margin:10px 0;padding:0;border:none!important;border-bottom:1px solid #eee!important;clear:both;overflow:hidden;background:0 0}a{color:#333;text-decoration:none}a:hover{color:#777}a cite{font-style:normal;*cursor:pointer}.layui-border-box,.layui-border-box *{box-sizing:border-box}.layui-box,.layui-box *{box-sizing:content-box}.layui-clear{clear:both;*zoom:1}.layui-clear:after{content:'\20';clear:both;*zoom:1;display:block;height:0}.layui-clear-space{word-spacing:-5px}.layui-inline{position:relative;display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.layui-edge{position:relative;display:inline-block;vertical-align:middle;width:0;height:0;border-width:6px;border-style:dashed;border-color:transparent;overflow:hidden}.layui-edge-top{top:-4px;border-bottom-color:#999;border-bottom-style:solid}.layui-edge-right{border-left-color:#999;border-left-style:solid}.layui-edge-bottom{top:2px;border-top-color:#999;border-top-style:solid}.layui-edge-left{border-right-color:#999;border-right-style:solid}.layui-elip{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-disabled,.layui-icon,.layui-unselect{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-disabled,.layui-disabled:hover{color:#d2d2d2!important;cursor:not-allowed!important}.layui-circle{border-radius:100%}.layui-show{display:block!important}.layui-hide{display:none!important}.layui-show-v{visibility:visible!important}.layui-hide-v{visibility:hidden!important}@font-face{font-family:layui-icon;src:url(../font/iconfont.eot?v=282);src:url(../font/iconfont.eot?v=282#iefix) format('embedded-opentype'),url(../font/iconfont.woff2?v=282) format('woff2'),url(../font/iconfont.woff?v=282) format('woff'),url(../font/iconfont.ttf?v=282) format('truetype'),url(../font/iconfont.svg?v=282#layui-icon) format('svg')}.layui-icon{font-family:layui-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-icon-leaf:before{content:"\e701"}.layui-icon-folder:before{content:"\eabe"}.layui-icon-folder-open:before{content:"\eac1"}.layui-icon-gitee:before{content:"\e69b"}.layui-icon-github:before{content:"\e6a7"}.layui-icon-disabled:before{content:"\e6cc"}.layui-icon-moon:before{content:"\e6c2"}.layui-icon-error:before{content:"\e693"}.layui-icon-success:before{content:"\e697"}.layui-icon-question:before{content:"\e699"}.layui-icon-lock:before{content:"\e69a"}.layui-icon-eye:before{content:"\e695"}.layui-icon-eye-invisible:before{content:"\e696"}.layui-icon-backspace:before{content:"\e694"}.layui-icon-tips-fill:before{content:"\eb2e"}.layui-icon-test:before{content:"\e692"}.layui-icon-clear:before{content:"\e788"}.layui-icon-heart-fill:before{content:"\e68f"}.layui-icon-light:before{content:"\e748"}.layui-icon-music:before{content:"\e690"}.layui-icon-time:before{content:"\e68d"}.layui-icon-ie:before{content:"\e7bb"}.layui-icon-firefox:before{content:"\e686"}.layui-icon-at:before{content:"\e687"}.layui-icon-bluetooth:before{content:"\e689"}.layui-icon-chrome:before{content:"\e68a"}.layui-icon-edge:before{content:"\e68b"}.layui-icon-heart:before{content:"\e68c"}.layui-icon-key:before{content:"\e683"}.layui-icon-android:before{content:"\e684"}.layui-icon-mike:before{content:"\e6dc"}.layui-icon-mute:before{content:"\e685"}.layui-icon-gift:before{content:"\e627"}.layui-icon-windows:before{content:"\e67f"}.layui-icon-ios:before{content:"\e680"}.layui-icon-logout:before{content:"\e682"}.layui-icon-wifi:before{content:"\e7e0"}.layui-icon-rss:before{content:"\e808"}.layui-icon-email:before{content:"\e618"}.layui-icon-reduce-circle:before{content:"\e616"}.layui-icon-transfer:before{content:"\e691"}.layui-icon-service:before{content:"\e626"}.layui-icon-addition:before{content:"\e624"}.layui-icon-subtraction:before{content:"\e67e"}.layui-icon-slider:before{content:"\e714"}.layui-icon-print:before{content:"\e66d"}.layui-icon-export:before{content:"\e67d"}.layui-icon-cols:before{content:"\e610"}.layui-icon-screen-full:before{content:"\e622"}.layui-icon-screen-restore:before{content:"\e758"}.layui-icon-rate-half:before{content:"\e6c9"}.layui-icon-rate-solid:before{content:"\e67a"}.layui-icon-rate:before{content:"\e67b"}.layui-icon-cellphone:before{content:"\e678"}.layui-icon-vercode:before{content:"\e679"}.layui-icon-login-weibo:before{content:"\e675"}.layui-icon-login-qq:before{content:"\e676"}.layui-icon-login-wechat:before{content:"\e677"}.layui-icon-username:before{content:"\e66f"}.layui-icon-password:before{content:"\e673"}.layui-icon-refresh-3:before{content:"\e9aa"}.layui-icon-auz:before{content:"\e672"}.layui-icon-shrink-right:before{content:"\e668"}.layui-icon-spread-left:before{content:"\e66b"}.layui-icon-snowflake:before{content:"\e6b1"}.layui-icon-tips:before{content:"\e702"}.layui-icon-note:before{content:"\e66e"}.layui-icon-senior:before{content:"\e674"}.layui-icon-refresh-1:before{content:"\e666"}.layui-icon-refresh:before{content:"\e669"}.layui-icon-flag:before{content:"\e66c"}.layui-icon-theme:before{content:"\e66a"}.layui-icon-notice:before{content:"\e667"}.layui-icon-console:before{content:"\e665"}.layui-icon-website:before{content:"\e7ae"}.layui-icon-face-surprised:before{content:"\e664"}.layui-icon-set:before{content:"\e716"}.layui-icon-template:before{content:"\e663"}.layui-icon-app:before{content:"\e653"}.layui-icon-template-1:before{content:"\e656"}.layui-icon-home:before{content:"\e68e"}.layui-icon-female:before{content:"\e661"}.layui-icon-male:before{content:"\e662"}.layui-icon-tread:before{content:"\e6c5"}.layui-icon-praise:before{content:"\e6c6"}.layui-icon-rmb:before{content:"\e65e"}.layui-icon-more:before{content:"\e65f"}.layui-icon-camera:before{content:"\e660"}.layui-icon-cart-simple:before{content:"\e698"}.layui-icon-face-cry:before{content:"\e69c"}.layui-icon-face-smile:before{content:"\e6af"}.layui-icon-survey:before{content:"\e6b2"}.layui-icon-read:before{content:"\e705"}.layui-icon-location:before{content:"\e715"}.layui-icon-dollar:before{content:"\e659"}.layui-icon-diamond:before{content:"\e735"}.layui-icon-return:before{content:"\e65c"}.layui-icon-camera-fill:before{content:"\e65d"}.layui-icon-fire:before{content:"\e756"}.layui-icon-more-vertical:before{content:"\e671"}.layui-icon-cart:before{content:"\e657"}.layui-icon-star-fill:before{content:"\e658"}.layui-icon-prev:before{content:"\e65a"}.layui-icon-next:before{content:"\e65b"}.layui-icon-upload:before{content:"\e67c"}.layui-icon-upload-drag:before{content:"\e681"}.layui-icon-user:before{content:"\e770"}.layui-icon-file-b:before{content:"\e655"}.layui-icon-component:before{content:"\e857"}.layui-icon-find-fill:before{content:"\e670"}.layui-icon-loading:before{content:"\e63d"}.layui-icon-loading-1:before{content:"\e63e"}.layui-icon-add-1:before{content:"\e654"}.layui-icon-pause:before{content:"\e651"}.layui-icon-play:before{content:"\e652"}.layui-icon-video:before{content:"\e6ed"}.layui-icon-headset:before{content:"\e6fc"}.layui-icon-voice:before{content:"\e688"}.layui-icon-speaker:before{content:"\e645"}.layui-icon-fonts-del:before{content:"\e64f"}.layui-icon-fonts-html:before{content:"\e64b"}.layui-icon-fonts-code:before{content:"\e64e"}.layui-icon-fonts-strong:before{content:"\e62b"}.layui-icon-unlink:before{content:"\e64d"}.layui-icon-picture:before{content:"\e64a"}.layui-icon-link:before{content:"\e64c"}.layui-icon-face-smile-b:before{content:"\e650"}.layui-icon-align-center:before{content:"\e647"}.layui-icon-align-right:before{content:"\e648"}.layui-icon-align-left:before{content:"\e649"}.layui-icon-fonts-u:before{content:"\e646"}.layui-icon-fonts-i:before{content:"\e644"}.layui-icon-tabs:before{content:"\e62a"}.layui-icon-circle:before{content:"\e63f"}.layui-icon-radio:before{content:"\e643"}.layui-icon-share:before{content:"\e641"}.layui-icon-edit:before{content:"\e642"}.layui-icon-delete:before{content:"\e640"}.layui-icon-engine:before{content:"\e628"}.layui-icon-chart-screen:before{content:"\e629"}.layui-icon-chart:before{content:"\e62c"}.layui-icon-table:before{content:"\e62d"}.layui-icon-tree:before{content:"\e62e"}.layui-icon-upload-circle:before{content:"\e62f"}.layui-icon-templeate-1:before{content:"\e630"}.layui-icon-util:before{content:"\e631"}.layui-icon-layouts:before{content:"\e632"}.layui-icon-prev-circle:before{content:"\e633"}.layui-icon-carousel:before{content:"\e634"}.layui-icon-code-circle:before{content:"\e635"}.layui-icon-water:before{content:"\e636"}.layui-icon-date:before{content:"\e637"}.layui-icon-layer:before{content:"\e638"}.layui-icon-fonts-clear:before{content:"\e639"}.layui-icon-dialogue:before{content:"\e63a"}.layui-icon-cellphone-fine:before{content:"\e63b"}.layui-icon-form:before{content:"\e63c"}.layui-icon-file:before{content:"\e621"}.layui-icon-triangle-r:before{content:"\e623"}.layui-icon-triangle-d:before{content:"\e625"}.layui-icon-set-sm:before{content:"\e620"}.layui-icon-add-circle:before{content:"\e61f"}.layui-icon-layim-download:before{content:"\e61e"}.layui-icon-layim-uploadfile:before{content:"\e61d"}.layui-icon-404:before{content:"\e61c"}.layui-icon-about:before{content:"\e60b"}.layui-icon-layim-theme:before{content:"\e61b"}.layui-icon-down:before{content:"\e61a"}.layui-icon-up:before{content:"\e619"}.layui-icon-circle-dot:before{content:"\e617"}.layui-icon-set-fill:before{content:"\e614"}.layui-icon-search:before{content:"\e615"}.layui-icon-friends:before{content:"\e612"}.layui-icon-group:before{content:"\e613"}.layui-icon-reply-fill:before{content:"\e611"}.layui-icon-menu-fill:before{content:"\e60f"}.layui-icon-face-smile-fine:before{content:"\e60c"}.layui-icon-picture-fine:before{content:"\e60d"}.layui-icon-log:before{content:"\e60e"}.layui-icon-list:before{content:"\e60a"}.layui-icon-release:before{content:"\e609"}.layui-icon-add-circle-fine:before{content:"\e608"}.layui-icon-ok:before{content:"\e605"}.layui-icon-help:before{content:"\e607"}.layui-icon-chat:before{content:"\e606"}.layui-icon-top:before{content:"\e604"}.layui-icon-right:before{content:"\e602"}.layui-icon-left:before{content:"\e603"}.layui-icon-star:before{content:"\e600"}.layui-icon-download-circle:before{content:"\e601"}.layui-icon-close:before{content:"\1006"}.layui-icon-close-fill:before{content:"\1007"}.layui-icon-ok-circle:before{content:"\1005"}.layui-main{position:relative;width:1160px;margin:0 auto}.layui-header{position:relative;z-index:1000;height:60px}.layui-header a:hover{transition:all .5s;-webkit-transition:all .5s}.layui-side{position:fixed;left:0;top:0;bottom:0;z-index:999;width:200px;overflow-x:hidden}.layui-side-scroll{position:relative;width:220px;height:100%;overflow-x:hidden}.layui-body{position:relative;left:200px;right:0;top:0;bottom:0;z-index:900;width:auto;box-sizing:border-box}.layui-layout-body{overflow-x:hidden}.layui-layout-admin .layui-header{position:fixed;top:0;left:0;right:0;background-color:#23292e}.layui-layout-admin .layui-side{top:60px;width:200px;overflow-x:hidden}.layui-layout-admin .layui-body{position:absolute;top:60px;padding-bottom:44px}.layui-layout-admin .layui-main{width:auto;margin:0 15px}.layui-layout-admin .layui-footer{position:fixed;left:200px;right:0;bottom:0;z-index:990;height:44px;line-height:44px;padding:0 15px;box-shadow:-1px 0 4px rgb(0 0 0 / 12%);background-color:#fafafa}.layui-layout-admin .layui-logo{position:absolute;left:0;top:0;width:200px;height:100%;line-height:60px;text-align:center;color:#16baaa;font-size:16px;box-shadow:0 1px 2px 0 rgb(0 0 0 / 15%)}.layui-layout-admin .layui-header .layui-nav{background:0 0}.layui-layout-left{position:absolute!important;left:200px;top:0}.layui-layout-right{position:absolute!important;right:0;top:0}.layui-container{position:relative;margin:0 auto;box-sizing:border-box}.layui-fluid{position:relative;margin:0 auto;padding:0 15px}.layui-row:after,.layui-row:before{content:"";display:block;clear:both}.layui-col-lg1,.layui-col-lg10,.layui-col-lg11,.layui-col-lg12,.layui-col-lg2,.layui-col-lg3,.layui-col-lg4,.layui-col-lg5,.layui-col-lg6,.layui-col-lg7,.layui-col-lg8,.layui-col-lg9,.layui-col-md1,.layui-col-md10,.layui-col-md11,.layui-col-md12,.layui-col-md2,.layui-col-md3,.layui-col-md4,.layui-col-md5,.layui-col-md6,.layui-col-md7,.layui-col-md8,.layui-col-md9,.layui-col-sm1,.layui-col-sm10,.layui-col-sm11,.layui-col-sm12,.layui-col-sm2,.layui-col-sm3,.layui-col-sm4,.layui-col-sm5,.layui-col-sm6,.layui-col-sm7,.layui-col-sm8,.layui-col-sm9,.layui-col-xl1,.layui-col-xl10,.layui-col-xl11,.layui-col-xl12,.layui-col-xl2,.layui-col-xl3,.layui-col-xl4,.layui-col-xl5,.layui-col-xl6,.layui-col-xl7,.layui-col-xl8,.layui-col-xl9,.layui-col-xs1,.layui-col-xs10,.layui-col-xs11,.layui-col-xs12,.layui-col-xs2,.layui-col-xs3,.layui-col-xs4,.layui-col-xs5,.layui-col-xs6,.layui-col-xs7,.layui-col-xs8,.layui-col-xs9{position:relative;display:block;box-sizing:border-box}.layui-col-xs1,.layui-col-xs10,.layui-col-xs11,.layui-col-xs12,.layui-col-xs2,.layui-col-xs3,.layui-col-xs4,.layui-col-xs5,.layui-col-xs6,.layui-col-xs7,.layui-col-xs8,.layui-col-xs9{float:left}.layui-col-xs1{width:8.33333333%}.layui-col-xs2{width:16.66666667%}.layui-col-xs3{width:25%}.layui-col-xs4{width:33.33333333%}.layui-col-xs5{width:41.66666667%}.layui-col-xs6{width:50%}.layui-col-xs7{width:58.33333333%}.layui-col-xs8{width:66.66666667%}.layui-col-xs9{width:75%}.layui-col-xs10{width:83.33333333%}.layui-col-xs11{width:91.66666667%}.layui-col-xs12{width:100%}.layui-col-xs-offset1{margin-left:8.33333333%}.layui-col-xs-offset2{margin-left:16.66666667%}.layui-col-xs-offset3{margin-left:25%}.layui-col-xs-offset4{margin-left:33.33333333%}.layui-col-xs-offset5{margin-left:41.66666667%}.layui-col-xs-offset6{margin-left:50%}.layui-col-xs-offset7{margin-left:58.33333333%}.layui-col-xs-offset8{margin-left:66.66666667%}.layui-col-xs-offset9{margin-left:75%}.layui-col-xs-offset10{margin-left:83.33333333%}.layui-col-xs-offset11{margin-left:91.66666667%}.layui-col-xs-offset12{margin-left:100%}@media screen and (max-width:767.98px){.layui-container{padding:0 15px}.layui-hide-xs{display:none!important}.layui-show-xs-block{display:block!important}.layui-show-xs-inline{display:inline!important}.layui-show-xs-inline-block{display:inline-block!important}}@media screen and (min-width:768px){.layui-container{width:720px}.layui-hide-sm{display:none!important}.layui-show-sm-block{display:block!important}.layui-show-sm-inline{display:inline!important}.layui-show-sm-inline-block{display:inline-block!important}.layui-col-sm1,.layui-col-sm10,.layui-col-sm11,.layui-col-sm12,.layui-col-sm2,.layui-col-sm3,.layui-col-sm4,.layui-col-sm5,.layui-col-sm6,.layui-col-sm7,.layui-col-sm8,.layui-col-sm9{float:left}.layui-col-sm1{width:8.33333333%}.layui-col-sm2{width:16.66666667%}.layui-col-sm3{width:25%}.layui-col-sm4{width:33.33333333%}.layui-col-sm5{width:41.66666667%}.layui-col-sm6{width:50%}.layui-col-sm7{width:58.33333333%}.layui-col-sm8{width:66.66666667%}.layui-col-sm9{width:75%}.layui-col-sm10{width:83.33333333%}.layui-col-sm11{width:91.66666667%}.layui-col-sm12{width:100%}.layui-col-sm-offset1{margin-left:8.33333333%}.layui-col-sm-offset2{margin-left:16.66666667%}.layui-col-sm-offset3{margin-left:25%}.layui-col-sm-offset4{margin-left:33.33333333%}.layui-col-sm-offset5{margin-left:41.66666667%}.layui-col-sm-offset6{margin-left:50%}.layui-col-sm-offset7{margin-left:58.33333333%}.layui-col-sm-offset8{margin-left:66.66666667%}.layui-col-sm-offset9{margin-left:75%}.layui-col-sm-offset10{margin-left:83.33333333%}.layui-col-sm-offset11{margin-left:91.66666667%}.layui-col-sm-offset12{margin-left:100%}}@media screen and (min-width:992px){.layui-container{width:960px}.layui-hide-md{display:none!important}.layui-show-md-block{display:block!important}.layui-show-md-inline{display:inline!important}.layui-show-md-inline-block{display:inline-block!important}.layui-col-md1,.layui-col-md10,.layui-col-md11,.layui-col-md12,.layui-col-md2,.layui-col-md3,.layui-col-md4,.layui-col-md5,.layui-col-md6,.layui-col-md7,.layui-col-md8,.layui-col-md9{float:left}.layui-col-md1{width:8.33333333%}.layui-col-md2{width:16.66666667%}.layui-col-md3{width:25%}.layui-col-md4{width:33.33333333%}.layui-col-md5{width:41.66666667%}.layui-col-md6{width:50%}.layui-col-md7{width:58.33333333%}.layui-col-md8{width:66.66666667%}.layui-col-md9{width:75%}.layui-col-md10{width:83.33333333%}.layui-col-md11{width:91.66666667%}.layui-col-md12{width:100%}.layui-col-md-offset1{margin-left:8.33333333%}.layui-col-md-offset2{margin-left:16.66666667%}.layui-col-md-offset3{margin-left:25%}.layui-col-md-offset4{margin-left:33.33333333%}.layui-col-md-offset5{margin-left:41.66666667%}.layui-col-md-offset6{margin-left:50%}.layui-col-md-offset7{margin-left:58.33333333%}.layui-col-md-offset8{margin-left:66.66666667%}.layui-col-md-offset9{margin-left:75%}.layui-col-md-offset10{margin-left:83.33333333%}.layui-col-md-offset11{margin-left:91.66666667%}.layui-col-md-offset12{margin-left:100%}}@media screen and (min-width:1200px){.layui-container{width:1150px}.layui-hide-lg{display:none!important}.layui-show-lg-block{display:block!important}.layui-show-lg-inline{display:inline!important}.layui-show-lg-inline-block{display:inline-block!important}.layui-col-lg1,.layui-col-lg10,.layui-col-lg11,.layui-col-lg12,.layui-col-lg2,.layui-col-lg3,.layui-col-lg4,.layui-col-lg5,.layui-col-lg6,.layui-col-lg7,.layui-col-lg8,.layui-col-lg9{float:left}.layui-col-lg1{width:8.33333333%}.layui-col-lg2{width:16.66666667%}.layui-col-lg3{width:25%}.layui-col-lg4{width:33.33333333%}.layui-col-lg5{width:41.66666667%}.layui-col-lg6{width:50%}.layui-col-lg7{width:58.33333333%}.layui-col-lg8{width:66.66666667%}.layui-col-lg9{width:75%}.layui-col-lg10{width:83.33333333%}.layui-col-lg11{width:91.66666667%}.layui-col-lg12{width:100%}.layui-col-lg-offset1{margin-left:8.33333333%}.layui-col-lg-offset2{margin-left:16.66666667%}.layui-col-lg-offset3{margin-left:25%}.layui-col-lg-offset4{margin-left:33.33333333%}.layui-col-lg-offset5{margin-left:41.66666667%}.layui-col-lg-offset6{margin-left:50%}.layui-col-lg-offset7{margin-left:58.33333333%}.layui-col-lg-offset8{margin-left:66.66666667%}.layui-col-lg-offset9{margin-left:75%}.layui-col-lg-offset10{margin-left:83.33333333%}.layui-col-lg-offset11{margin-left:91.66666667%}.layui-col-lg-offset12{margin-left:100%}}@media screen and (min-width:1400px){.layui-container{width:1330px}.layui-hide-xl{display:none!important}.layui-show-xl-block{display:block!important}.layui-show-xl-inline{display:inline!important}.layui-show-xl-inline-block{display:inline-block!important}.layui-col-xl1,.layui-col-xl10,.layui-col-xl11,.layui-col-xl12,.layui-col-xl2,.layui-col-xl3,.layui-col-xl4,.layui-col-xl5,.layui-col-xl6,.layui-col-xl7,.layui-col-xl8,.layui-col-xl9{float:left}.layui-col-xl1{width:8.33333333%}.layui-col-xl2{width:16.66666667%}.layui-col-xl3{width:25%}.layui-col-xl4{width:33.33333333%}.layui-col-xl5{width:41.66666667%}.layui-col-xl6{width:50%}.layui-col-xl7{width:58.33333333%}.layui-col-xl8{width:66.66666667%}.layui-col-xl9{width:75%}.layui-col-xl10{width:83.33333333%}.layui-col-xl11{width:91.66666667%}.layui-col-xl12{width:100%}.layui-col-xl-offset1{margin-left:8.33333333%}.layui-col-xl-offset2{margin-left:16.66666667%}.layui-col-xl-offset3{margin-left:25%}.layui-col-xl-offset4{margin-left:33.33333333%}.layui-col-xl-offset5{margin-left:41.66666667%}.layui-col-xl-offset6{margin-left:50%}.layui-col-xl-offset7{margin-left:58.33333333%}.layui-col-xl-offset8{margin-left:66.66666667%}.layui-col-xl-offset9{margin-left:75%}.layui-col-xl-offset10{margin-left:83.33333333%}.layui-col-xl-offset11{margin-left:91.66666667%}.layui-col-xl-offset12{margin-left:100%}}.layui-col-space1{margin:-.5px}.layui-col-space1>*{padding:.5px}.layui-col-space2{margin:-1px}.layui-col-space2>*{padding:1px}.layui-col-space4{margin:-2px}.layui-col-space4>*{padding:2px}.layui-col-space5{margin:-2.5px}.layui-col-space5>*{padding:2.5px}.layui-col-space6{margin:-3px}.layui-col-space6>*{padding:3px}.layui-col-space8{margin:-4px}.layui-col-space8>*{padding:4px}.layui-col-space10{margin:-5px}.layui-col-space10>*{padding:5px}.layui-col-space12{margin:-6px}.layui-col-space12>*{padding:6px}.layui-col-space14{margin:-7px}.layui-col-space14>*{padding:7px}.layui-col-space15{margin:-7.5px}.layui-col-space15>*{padding:7.5px}.layui-col-space16{margin:-8px}.layui-col-space16>*{padding:8px}.layui-col-space18{margin:-9px}.layui-col-space18>*{padding:9px}.layui-col-space20{margin:-10px}.layui-col-space20>*{padding:10px}.layui-col-space22{margin:-11px}.layui-col-space22>*{padding:11px}.layui-col-space24{margin:-12px}.layui-col-space24>*{padding:12px}.layui-col-space25{margin:-12.5px}.layui-col-space25>*{padding:12.5px}.layui-col-space26{margin:-13px}.layui-col-space26>*{padding:13px}.layui-col-space28{margin:-14px}.layui-col-space28>*{padding:14px}.layui-col-space30{margin:-15px}.layui-col-space30>*{padding:15px}.layui-col-space32{margin:-16px}.layui-col-space32>*{padding:16px}.layui-btn,.layui-input,.layui-select,.layui-textarea,.layui-upload-button{outline:0;-webkit-appearance:none;transition:all .3s;-webkit-transition:all .3s;box-sizing:border-box}.layui-elem-quote{margin-bottom:10px;padding:15px;line-height:1.8;border-left:5px solid #16b777;border-radius:0 2px 2px 0;background-color:#fafafa}.layui-quote-nm{border-style:solid;border-width:1px;border-left-width:5px;background:0 0}.layui-elem-field{margin-bottom:10px;padding:0;border-width:1px;border-style:solid}.layui-elem-field legend{margin-left:20px;padding:0 10px;font-size:20px}.layui-field-title{margin:16px 0;border-width:0;border-top-width:1px}.layui-field-box{padding:15px}.layui-field-title .layui-field-box{padding:10px 0}.layui-progress{position:relative;height:6px;border-radius:20px;background-color:#eee}.layui-progress-bar{position:absolute;left:0;top:0;width:0;max-width:100%;height:6px;border-radius:20px;text-align:right;background-color:#16b777;transition:all .3s;-webkit-transition:all .3s}.layui-progress-big,.layui-progress-big .layui-progress-bar{height:18px;line-height:18px}.layui-progress-text{position:relative;top:-20px;line-height:18px;font-size:12px;color:#5f5f5f}.layui-progress-big .layui-progress-text{position:static;padding:0 10px;color:#fff}.layui-collapse{border-width:1px;border-style:solid;border-radius:2px}.layui-colla-content,.layui-colla-item{border-top-width:1px;border-top-style:solid}.layui-colla-item:first-child{border-top:none}.layui-colla-title{position:relative;height:42px;line-height:42px;padding:0 15px 0 35px;color:#333;background-color:#fafafa;cursor:pointer;font-size:14px;overflow:hidden}.layui-colla-content{display:none;padding:10px 15px;line-height:1.6;color:#5f5f5f}.layui-colla-icon{position:absolute;left:15px;top:0;font-size:14px}.layui-card{margin-bottom:15px;border-radius:2px;background-color:#fff;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}.layui-card:last-child{margin-bottom:0}.layui-card-header{position:relative;height:42px;line-height:42px;padding:0 15px;border-bottom:1px solid #f8f8f8;color:#333;border-radius:2px 2px 0 0;font-size:14px}.layui-card-body{position:relative;padding:10px 15px;line-height:24px}.layui-card-body[pad15]{padding:15px}.layui-card-body[pad20]{padding:20px}.layui-card-body .layui-table{margin:5px 0}.layui-card .layui-tab{margin:0}.layui-panel{position:relative;border-width:1px;border-style:solid;border-radius:2px;box-shadow:1px 1px 4px rgb(0 0 0 / 8%);background-color:#fff;color:#5f5f5f}.layui-panel-window{position:relative;padding:15px;border-radius:0;border-top:5px solid #eee;background-color:#fff}.layui-auxiliar-moving{position:fixed;left:0;right:0;top:0;bottom:0;width:100%;height:100%;background:0 0;z-index:9999999999}.layui-scrollbar-hide{overflow:hidden!important}.layui-bg-red{background-color:#ff5722!important;color:#fff!important}.layui-bg-orange{background-color:#ffb800!important;color:#fff!important}.layui-bg-green{background-color:#16baaa!important;color:#fff!important}.layui-bg-cyan{background-color:#2f4056!important;color:#fff!important}.layui-bg-blue{background-color:#1e9fff!important;color:#fff!important}.layui-bg-purple{background-color:#a233c6!important;color:#fff!important}.layui-bg-black{background-color:#2f363c!important;color:#fff!important}.layui-bg-gray{background-color:#fafafa!important;color:#5f5f5f!important}.layui-badge-rim,.layui-border,.layui-colla-content,.layui-colla-item,.layui-collapse,.layui-elem-field,.layui-form-pane .layui-form-item[pane],.layui-form-pane .layui-form-label,.layui-input,.layui-input-split,.layui-panel,.layui-quote-nm,.layui-select,.layui-tab-bar,.layui-tab-card,.layui-tab-title,.layui-tab-title .layui-this:after,.layui-textarea{border-color:#eee}.layui-border{border-width:1px;border-style:solid;color:#5f5f5f!important}.layui-border-red{border-width:1px;border-style:solid;border-color:#ff5722!important;color:#ff5722!important}.layui-border-orange{border-width:1px;border-style:solid;border-color:#ffb800!important;color:#ffb800!important}.layui-border-green{border-width:1px;border-style:solid;border-color:#16baaa!important;color:#16baaa!important}.layui-border-cyan{border-width:1px;border-style:solid;border-color:#2f4056!important;color:#2f4056!important}.layui-border-blue{border-width:1px;border-style:solid;border-color:#1e9fff!important;color:#1e9fff!important}.layui-border-purple{border-width:1px;border-style:solid;border-color:#a233c6!important;color:#a233c6!important}.layui-border-black{border-width:1px;border-style:solid;border-color:#2f363c!important;color:#2f363c!important}.layui-timeline-item:before{background-color:#eee}.layui-text{line-height:1.8;font-size:14px}.layui-text h1,.layui-text h2,.layui-text h3,.layui-text h4,.layui-text h5,.layui-text h6{color:#3a3a3a}.layui-text h1{font-size:32px}.layui-text h2{font-size:24px}.layui-text h3{font-size:18px}.layui-text h4{font-size:16px}.layui-text h5{font-size:14px}.layui-text h6{font-size:13px}.layui-text ol,.layui-text ul{padding-left:15px}.layui-text ul li{margin-top:5px;list-style-type:disc}.layui-text ol li{margin-top:5px;list-style-type:decimal}.layui-text-em,.layui-word-aux{color:#999!important;padding-left:5px!important;padding-right:5px!important}.layui-text p{margin:15px 0}.layui-text p:first-child{margin-top:0}.layui-text p:last-child{margin-bottom:0}.layui-text a:not(.layui-btn){color:#01aaed}.layui-text a:not(.layui-btn):hover{text-decoration:underline}.layui-text blockquote:not(.layui-elem-quote){padding:5px 15px;border-left:5px solid #eee}.layui-text pre>code:not(.layui-code){padding:15px;font-family:Courier New,Lucida Console,Consolas;background-color:#fafafa}.layui-font-12{font-size:12px!important}.layui-font-13{font-size:13px!important}.layui-font-14{font-size:14px!important}.layui-font-16{font-size:16px!important}.layui-font-18{font-size:18px!important}.layui-font-20{font-size:20px!important}.layui-font-22{font-size:22px!important}.layui-font-24{font-size:24px!important}.layui-font-26{font-size:26px!important}.layui-font-28{font-size:28px!important}.layui-font-30{font-size:30px!important}.layui-font-32{font-size:32px!important}.layui-font-red{color:#ff5722!important}.layui-font-orange{color:#ffb800!important}.layui-font-green{color:#16baaa!important}.layui-font-cyan{color:#2f4056!important}.layui-font-blue{color:#01aaed!important}.layui-font-purple{color:#a233c6!important}.layui-font-black{color:#000!important}.layui-font-gray{color:#c2c2c2!important}.layui-btn{display:inline-block;vertical-align:middle;height:38px;line-height:38px;border:1px solid transparent;padding:0 18px;background-color:#16baaa;color:#fff;white-space:nowrap;text-align:center;font-size:14px;border-radius:2px;cursor:pointer;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-btn:hover{opacity:.8;filter:alpha(opacity=80);color:#fff}.layui-btn:active{opacity:1;filter:alpha(opacity=100)}.layui-btn+.layui-btn{margin-left:10px}.layui-btn-container{word-spacing:-5px}.layui-btn-container .layui-btn{margin-right:10px;margin-bottom:10px;word-spacing:normal}.layui-btn-container .layui-btn+.layui-btn{margin-left:0}.layui-table .layui-btn-container .layui-btn{margin-bottom:9px}.layui-btn-radius{border-radius:100px}.layui-btn .layui-icon{padding:0 2px;vertical-align:middle\0;vertical-align:bottom}.layui-btn-primary{border-color:#d2d2d2;background:0 0;color:#5f5f5f}.layui-btn-primary:hover{border-color:#16baaa;color:#333}.layui-btn-normal{background-color:#1e9fff}.layui-btn-warm{background-color:#ffb800}.layui-btn-danger{background-color:#ff5722}.layui-btn-checked{background-color:#16b777}.layui-btn-disabled,.layui-btn-disabled:active,.layui-btn-disabled:hover{border-color:#eee!important;background-color:#fbfbfb!important;color:#d2d2d2!important;cursor:not-allowed!important;opacity:1}.layui-btn-lg{height:44px;line-height:44px;padding:0 25px;font-size:16px}.layui-btn-sm{height:30px;line-height:30px;padding:0 10px;font-size:12px}.layui-btn-xs{height:22px;line-height:22px;padding:0 5px;font-size:12px}.layui-btn-xs i{font-size:12px!important}.layui-btn-group{display:inline-block;vertical-align:middle;font-size:0}.layui-btn-group .layui-btn{margin-left:0!important;margin-right:0!important;border-left:1px solid rgba(255,255,255,.5);border-radius:0}.layui-btn-group .layui-btn-primary{border-left:none}.layui-btn-group .layui-btn-primary:hover{border-color:#d2d2d2;color:#16baaa}.layui-btn-group .layui-btn:first-child{border-left:none;border-radius:2px 0 0 2px}.layui-btn-group .layui-btn-primary:first-child{border-left:1px solid #d2d2d2}.layui-btn-group .layui-btn:last-child{border-radius:0 2px 2px 0}.layui-btn-group .layui-btn+.layui-btn{margin-left:0}.layui-btn-group+.layui-btn-group{margin-left:10px}.layui-btn-fluid{width:100%}.layui-input,.layui-select,.layui-textarea{height:38px;line-height:1.3;line-height:38px\9;border-width:1px;border-style:solid;background-color:#fff;color:rgba(0,0,0,.85);border-radius:2px}.layui-input::-webkit-input-placeholder,.layui-select::-webkit-input-placeholder,.layui-textarea::-webkit-input-placeholder{line-height:1.3}.layui-input,.layui-textarea{display:block;width:100%;padding-left:10px}.layui-input:hover,.layui-textarea:hover{border-color:#d2d2d2!important}.layui-input:focus,.layui-textarea:focus{border-color:#16b777!important;box-shadow:0 0 0 3px rgba(22,183,119,.08)}.layui-textarea{position:relative;min-height:100px;height:auto;line-height:20px;padding:6px 10px;resize:vertical}.layui-input[disabled],.layui-textarea[disabled]{background-color:#fafafa}.layui-select{padding:0 10px}.layui-form input[type=checkbox],.layui-form input[type=radio],.layui-form select{display:none}.layui-form [lay-ignore]{display:initial}.layui-form-item{position:relative;margin-bottom:15px;clear:both;*zoom:1}.layui-form-item:after{content:'\20';clear:both;*zoom:1;display:block;height:0}.layui-form-label{position:relative;float:left;display:block;padding:9px 15px;width:80px;font-weight:400;line-height:20px;text-align:right}.layui-form-label-col{display:block;float:none;padding:9px 0;line-height:20px;text-align:left}.layui-form-item .layui-inline{margin-bottom:5px;margin-right:10px}.layui-input-block,.layui-input-inline{position:relative}.layui-input-block{margin-left:110px;min-height:36px}.layui-input-inline{display:inline-block;vertical-align:middle}.layui-form-item .layui-input-inline{float:left;width:190px;margin-right:10px}.layui-form-text .layui-input-inline{width:auto}.layui-form-mid{position:relative;float:left;display:block;padding:9px 0!important;line-height:20px;margin-right:10px}.layui-form-danger+.layui-form-select .layui-input,.layui-form-danger:focus{border-color:#ff5722!important;box-shadow:0 0 0 3px rgba(255,87,34,.08)}.layui-input-prefix,.layui-input-split,.layui-input-suffix,.layui-input-suffix .layui-input-affix{position:absolute;right:0;top:0;padding:0 10px;width:35px;height:100%;text-align:center;transition:all .3s;box-sizing:border-box}.layui-input-prefix{left:0;border-radius:2px 0 0 2px}.layui-input-suffix{right:0;border-radius:0 2px 2px 0}.layui-input-split{border-width:1px;border-style:solid}.layui-input-prefix .layui-icon,.layui-input-split .layui-icon,.layui-input-suffix .layui-icon{position:relative;font-size:16px;color:#5f5f5f;transition:all .3s}.layui-input-group{position:relative;display:table;box-sizing:border-box}.layui-input-group>*{display:table-cell;vertical-align:middle;position:relative}.layui-input-group .layui-input{padding-right:15px}.layui-input-group>.layui-input-prefix{width:auto;border-right:0}.layui-input-group>.layui-input-suffix{width:auto;border-left:0}.layui-input-group .layui-input-split{white-space:nowrap}.layui-input-wrap{position:relative;line-height:38px}.layui-input-wrap .layui-input{padding-right:35px}.layui-input-wrap .layui-input::-ms-clear,.layui-input-wrap .layui-input::-ms-reveal{display:none}.layui-input-wrap .layui-input-prefix+.layui-input,.layui-input-wrap .layui-input-prefix~* .layui-input{padding-left:35px}.layui-input-wrap .layui-input-split+.layui-input,.layui-input-wrap .layui-input-split~* .layui-input{padding-left:45px}.layui-input-wrap .layui-input-prefix~.layui-form-select{position:static}.layui-input-wrap .layui-input-prefix,.layui-input-wrap .layui-input-split,.layui-input-wrap .layui-input-suffix{pointer-events:none}.layui-input-wrap .layui-input:hover+.layui-input-split{border-color:#d2d2d2}.layui-input-wrap .layui-input:focus+.layui-input-split{border-color:#16b777}.layui-input-wrap .layui-input-prefix.layui-input-split{border-width:0;border-right-width:1px}.layui-input-affix{line-height:38px}.layui-input-suffix .layui-input-affix{right:auto;left:-35px}.layui-input-affix .layui-icon{color:rgba(0,0,0,.8);pointer-events:auto!important;cursor:pointer}.layui-input-affix .layui-icon-clear{color:rgba(0,0,0,.3)}.layui-input-affix .layui-icon:hover{color:rgba(0,0,0,.6)}.layui-input-wrap .layui-input-number{width:24px;padding:0}.layui-input-wrap .layui-input-number .layui-icon{position:absolute;right:0;width:100%;height:50%;line-height:normal;font-size:12px}.layui-input-wrap .layui-input-number .layui-icon:before{position:absolute;left:50%;top:50%;margin-top:-6px;margin-left:-6px}.layui-input-wrap .layui-input-number .layui-icon:first-child{top:0;border-bottom:1px solid #eee}.layui-input-wrap .layui-input-number .layui-icon:last-child{bottom:0}.layui-input-wrap .layui-input-number .layui-icon:hover{font-weight:700}.layui-input-wrap .layui-input[type=number]::-webkit-inner-spin-button,.layui-input-wrap .layui-input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none!important}.layui-input-wrap .layui-input[type=number]{-moz-appearance:textfield}.layui-form-select{position:relative;color:#5f5f5f}.layui-form-select .layui-input{padding-right:30px;cursor:pointer}.layui-form-select .layui-edge{position:absolute;right:10px;top:50%;margin-top:-3px;cursor:pointer;border-width:6px;border-top-color:#c2c2c2;border-top-style:solid;transition:all .3s;-webkit-transition:all .3s}.layui-form-select dl{display:none;position:absolute;left:0;top:42px;padding:5px 0;z-index:899;min-width:100%;border:1px solid #eee;max-height:300px;overflow-y:auto;background-color:#fff;border-radius:2px;box-shadow:1px 1px 4px rgb(0 0 0 / 8%);box-sizing:border-box}.layui-form-select dl dd,.layui-form-select dl dt{padding:0 10px;line-height:36px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.layui-form-select dl dt{font-size:12px;color:#999}.layui-form-select dl dd{cursor:pointer}.layui-form-select dl dd:hover{background-color:#f8f8f8;-webkit-transition:.5s all;transition:.5s all}.layui-form-select .layui-select-group dd{padding-left:20px}.layui-form-select dl dd.layui-select-tips{padding-left:10px!important;color:#999}.layui-form-select dl dd.layui-this{background-color:#f8f8f8;color:#16b777;font-weight:700}.layui-form-select dl dd.layui-disabled{background-color:#fff}.layui-form-selected dl{display:block}.layui-form-selected .layui-edge{margin-top:-9px;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.layui-form-selected .layui-edge{margin-top:-3px\0}:root .layui-form-selected .layui-edge{margin-top:-9px\0/IE9}.layui-form-selectup dl{top:auto;bottom:42px}.layui-select-none{margin:5px 0;text-align:center;color:#999}.layui-select-disabled .layui-disabled{border-color:#eee!important}.layui-select-disabled .layui-edge{border-top-color:#d2d2d2}.layui-form-checkbox{position:relative;display:inline-block;vertical-align:middle;height:30px;line-height:30px;margin-right:10px;padding-right:30px;background-color:#fff;cursor:pointer;font-size:0;-webkit-transition:.1s linear;transition:.1s linear;box-sizing:border-box}.layui-form-checkbox>*{display:inline-block;vertical-align:middle}.layui-form-checkbox>div{padding:0 11px;font-size:14px;border-radius:2px 0 0 2px;background-color:#d2d2d2;color:#fff;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.layui-form-checkbox>div>.layui-icon{line-height:normal}.layui-form-checkbox:hover>div{background-color:#c2c2c2}.layui-form-checkbox>i{position:absolute;right:0;top:0;width:30px;height:100%;border:1px solid #d2d2d2;border-left:none;border-radius:0 2px 2px 0;color:#fff;color:rgba(255,255,255,0);font-size:20px;text-align:center;box-sizing:border-box}.layui-form-checkbox:hover>i{border-color:#c2c2c2;color:#c2c2c2}.layui-form-checked,.layui-form-checked:hover{border-color:#16b777}.layui-form-checked:hover>div,.layui-form-checked>div{background-color:#16b777}.layui-form-checked:hover>i,.layui-form-checked>i{color:#16b777}.layui-form-item .layui-form-checkbox{margin-top:4px}.layui-form-checkbox.layui-checkbox-disabled>div{background-color:#eee!important}.layui-form [lay-checkbox]{display:none}.layui-form-checkbox[lay-skin=primary]{height:auto!important;line-height:normal!important;min-width:18px;min-height:18px;border:none!important;margin-right:0;padding-left:24px;padding-right:0;background:0 0}.layui-form-checkbox[lay-skin=primary]>div{margin-top:-1px;padding-left:0;padding-right:15px;line-height:18px;background:0 0;color:#5f5f5f}.layui-form-checkbox[lay-skin=primary]>i{right:auto;left:0;width:16px;height:16px;line-height:14px;border:1px solid #d2d2d2;font-size:12px;border-radius:2px;background-color:#fff;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-checkbox[lay-skin=primary]:hover>i{border-color:#16b777;color:#fff}.layui-form-checked[lay-skin=primary]>i{border-color:#16b777!important;background-color:#16b777;color:#fff}.layui-checkbox-disabled[lay-skin=primary]>div{background:0 0!important}.layui-form-checked.layui-checkbox-disabled[lay-skin=primary]>i{background:#eee!important;border-color:#eee!important}.layui-checkbox-disabled[lay-skin=primary]:hover>i{border-color:#d2d2d2}.layui-form-item .layui-form-checkbox[lay-skin=primary]{margin-top:10px}.layui-form-checkbox[lay-skin=primary]>.layui-icon-indeterminate{border-color:#16b777}.layui-form-checkbox[lay-skin=primary]>.layui-icon-indeterminate:before{content:'';display:inline-block;vertical-align:middle;position:relative;width:50%;height:1px;margin:-1px auto 0;background-color:#16b777}.layui-form-switch{position:relative;display:inline-block;vertical-align:middle;height:24px;line-height:22px;min-width:44px;padding:0 5px;margin-top:8px;border:1px solid #d2d2d2;border-radius:20px;cursor:pointer;box-sizing:border-box;background-color:#fff;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-switch>i{position:absolute;left:5px;top:3px;width:16px;height:16px;border-radius:20px;background-color:#d2d2d2;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-switch>div{position:relative;top:0;margin-left:21px;padding:0!important;text-align:center!important;color:#999!important;font-style:normal!important;font-size:12px}.layui-form-onswitch{border-color:#16b777;background-color:#16b777}.layui-form-onswitch>i{left:100%;margin-left:-21px;background-color:#fff}.layui-form-onswitch>div{margin-left:0;margin-right:21px;color:#fff!important}.layui-checkbox-disabled{border-color:#eee!important}.layui-checkbox-disabled>div{color:#c2c2c2!important}.layui-checkbox-disabled>i{border-color:#eee!important}.layui-checkbox-disabled:hover>i{color:#fff!important}.layui-form-radio{display:inline-block;vertical-align:middle;line-height:28px;margin:6px 10px 0 0;padding-right:10px;cursor:pointer;font-size:0}.layui-form-radio>*{display:inline-block;vertical-align:middle;font-size:14px}.layui-form-radio>i{margin-right:8px;font-size:22px;color:#c2c2c2}.layui-form-radio:hover>*,.layui-form-radioed,.layui-form-radioed>i{color:#16b777}.layui-radio-disabled>i{color:#eee!important}.layui-radio-disabled>*{color:#c2c2c2!important}.layui-form [lay-radio]{display:none}.layui-form-pane .layui-form-label{width:110px;padding:8px 15px;height:38px;line-height:20px;border-width:1px;border-style:solid;border-radius:2px 0 0 2px;text-align:center;background-color:#fafafa;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;box-sizing:border-box}.layui-form-pane .layui-input-inline{margin-left:-1px}.layui-form-pane .layui-input-block{margin-left:110px;left:-1px}.layui-form-pane .layui-input{border-radius:0 2px 2px 0}.layui-form-pane .layui-form-text .layui-form-label{float:none;width:100%;border-radius:2px;box-sizing:border-box;text-align:left}.layui-form-pane .layui-form-text .layui-input-inline{display:block;margin:0;top:-1px;clear:both}.layui-form-pane .layui-form-text .layui-input-block{margin:0;left:0;top:-1px}.layui-form-pane .layui-form-text .layui-textarea{min-height:100px;border-radius:0 0 2px 2px}.layui-form-pane .layui-form-checkbox{margin:4px 0 4px 10px}.layui-form-pane .layui-form-radio,.layui-form-pane .layui-form-switch{margin-top:6px;margin-left:10px}.layui-form-pane .layui-form-item[pane]{position:relative;border-width:1px;border-style:solid}.layui-form-pane .layui-form-item[pane] .layui-form-label{position:absolute;left:0;top:0;height:100%;border-width:0;border-right-width:1px}.layui-form-pane .layui-form-item[pane] .layui-input-inline{margin-left:110px}@media screen and (max-width:450px){.layui-form-item .layui-form-label{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-form-item .layui-inline{display:block;margin-right:0;margin-bottom:20px;clear:both}.layui-form-item .layui-inline:after{content:'\20';clear:both;display:block;height:0}.layui-form-item .layui-input-inline{display:block;float:none;left:-3px;width:auto!important;margin:0 0 10px 112px}.layui-form-item .layui-input-inline+.layui-form-mid{margin-left:110px;top:-5px;padding:0}.layui-form-item .layui-form-checkbox{margin-right:5px;margin-bottom:5px}}.layui-laypage{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;margin:10px 0;font-size:0}.layui-laypage>a:first-child,.layui-laypage>a:first-child em{border-radius:2px 0 0 2px}.layui-laypage>a:last-child,.layui-laypage>a:last-child em{border-radius:0 2px 2px 0}.layui-laypage>:first-child{margin-left:0!important}.layui-laypage>:last-child{margin-right:0!important}.layui-laypage a,.layui-laypage button,.layui-laypage input,.layui-laypage select,.layui-laypage span{border:1px solid #eee}.layui-laypage a,.layui-laypage span{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;padding:0 15px;height:28px;line-height:28px;margin:0 -1px 5px 0;background-color:#fff;color:#333;font-size:12px}.layui-laypage a[data-page]{color:#333}.layui-laypage a{text-decoration:none!important;cursor:pointer}.layui-laypage a:hover{color:#16baaa}.layui-laypage em{font-style:normal}.layui-laypage .layui-laypage-spr{color:#999;font-weight:700}.layui-laypage .layui-laypage-curr{position:relative}.layui-laypage .layui-laypage-curr em{position:relative;color:#fff}.layui-laypage .layui-laypage-curr .layui-laypage-em{position:absolute;left:-1px;top:-1px;padding:1px;width:100%;height:100%;background-color:#16baaa}.layui-laypage-em{border-radius:2px}.layui-laypage-next em,.layui-laypage-prev em{font-family:Sim sun;font-size:16px}.layui-laypage .layui-laypage-count,.layui-laypage .layui-laypage-limits,.layui-laypage .layui-laypage-refresh,.layui-laypage .layui-laypage-skip{margin-left:10px;margin-right:10px;padding:0;border:none}.layui-laypage .layui-laypage-limits,.layui-laypage .layui-laypage-refresh{vertical-align:top}.layui-laypage .layui-laypage-refresh i{font-size:18px;cursor:pointer}.layui-laypage select{height:22px;padding:3px;border-radius:2px;cursor:pointer}.layui-laypage .layui-laypage-skip{height:30px;line-height:30px;color:#999}.layui-laypage button,.layui-laypage input{height:30px;line-height:30px;border-radius:2px;vertical-align:top;background-color:#fff;box-sizing:border-box}.layui-laypage input{display:inline-block;width:40px;margin:0 10px;padding:0 3px;text-align:center}.layui-laypage input:focus,.layui-laypage select:focus{border-color:#16baaa!important}.layui-laypage button{margin-left:10px;padding:0 10px;cursor:pointer}.layui-flow-more{margin:10px 0;text-align:center;color:#999;font-size:14px;clear:both}.layui-flow-more a{height:32px;line-height:32px}.layui-flow-more a *{display:inline-block;vertical-align:top}.layui-flow-more a cite{padding:0 20px;border-radius:3px;background-color:#eee;color:#333;font-style:normal}.layui-flow-more a cite:hover{opacity:.8}.layui-flow-more a i{font-size:30px;color:#737383}.layui-table{width:100%;margin:10px 0;background-color:#fff;color:#5f5f5f}.layui-table tr{transition:all .3s;-webkit-transition:all .3s}.layui-table th{text-align:left;font-weight:600}.layui-table-mend{background-color:#fff}.layui-table-click,.layui-table-hover,.layui-table[lay-even] tbody tr:nth-child(even){background-color:#f8f8f8}.layui-table-checked{background-color:#dbfbf0}.layui-table-checked.layui-table-click,.layui-table-checked.layui-table-hover{background-color:#abf8dd}.layui-table td,.layui-table th,.layui-table-col-set,.layui-table-fixed-r,.layui-table-grid-down,.layui-table-header,.layui-table-mend,.layui-table-page,.layui-table-tips-main,.layui-table-tool,.layui-table-total,.layui-table-view,.layui-table[lay-skin=line],.layui-table[lay-skin=row]{border-width:1px;border-style:solid;border-color:#eee}.layui-table td,.layui-table th{position:relative;padding:9px 15px;min-height:20px;line-height:20px;font-size:14px}.layui-table[lay-skin=line] td,.layui-table[lay-skin=line] th{border-width:0;border-bottom-width:1px}.layui-table[lay-skin=row] td,.layui-table[lay-skin=row] th{border-width:0;border-right-width:1px}.layui-table[lay-skin=nob] td,.layui-table[lay-skin=nob] th{border:none}.layui-table img{max-width:100px}.layui-table[lay-size=lg] td,.layui-table[lay-size=lg] th{padding-top:15px;padding-right:30px;padding-bottom:15px;padding-left:30px}.layui-table-view .layui-table[lay-size=lg] .layui-table-cell{height:50px;line-height:40px}.layui-table[lay-size=sm] td,.layui-table[lay-size=sm] th{padding-top:5px;padding-right:10px;padding-bottom:5px;padding-left:10px;font-size:12px}.layui-table-view .layui-table[lay-size=sm] .layui-table-cell{height:30px;line-height:20px;padding-top:5px;padding-left:11px;padding-right:11px}.layui-table[lay-data],.layui-table[lay-options]{display:none}.layui-table-box{position:relative;overflow:hidden}.layui-table-view{clear:both}.layui-table-view .layui-table{position:relative;width:auto;margin:0;border:0;border-collapse:separate}.layui-table-view .layui-table[lay-skin=line]{border-width:0;border-right-width:1px}.layui-table-view .layui-table[lay-skin=row]{border-width:0;border-bottom-width:1px}.layui-table-view .layui-table td,.layui-table-view .layui-table th{padding:0;border-top:none;border-left:none}.layui-table-view .layui-table th [lay-event],.layui-table-view .layui-table th.layui-unselect .layui-table-cell span{cursor:pointer}.layui-table-view .layui-table td,.layui-table-view .layui-table th span{cursor:default}.layui-table-view .layui-table td[data-edit]{cursor:text}.layui-table-view .layui-table td[data-edit]:hover:after{position:absolute;left:0;top:0;width:100%;height:100%;box-sizing:border-box;border:1px solid #16b777;pointer-events:none;content:""}.layui-table-view .layui-form-checkbox[lay-skin=primary] i{width:18px;height:18px;line-height:16px}.layui-table-view .layui-form-radio{line-height:0;padding:0}.layui-table-view .layui-form-radio>i{margin:0;font-size:20px}.layui-table-init{position:absolute;left:0;top:0;width:100%;height:100%;text-align:center;z-index:199}.layui-table-init .layui-icon{position:absolute;left:50%;top:50%;margin:-15px 0 0 -15px;font-size:30px;color:#c2c2c2}.layui-table-header{border-width:0;border-bottom-width:1px;overflow:hidden}.layui-table-header .layui-table{margin-bottom:-1px}.layui-table-column{position:relative;width:100%;min-height:41px;padding:8px 16px;border-width:0;border-bottom-width:1px}.layui-table-column .layui-btn-container{margin-bottom:-8px}.layui-table-column .layui-btn-container .layui-btn{margin-right:8px;margin-bottom:8px}.layui-table-tool .layui-inline[lay-event]{position:relative;width:26px;height:26px;padding:5px;line-height:16px;margin-right:10px;text-align:center;color:#333;border:1px solid #ccc;cursor:pointer;-webkit-transition:.5s all;transition:.5s all}.layui-table-tool .layui-inline[lay-event]:hover{border:1px solid #999}.layui-table-tool-temp{padding-right:120px}.layui-table-tool-self{position:absolute;right:17px;top:10px}.layui-table-tool .layui-table-tool-self .layui-inline[lay-event]{margin:0 0 0 10px}.layui-table-tool-panel{position:absolute;top:29px;left:-1px;z-index:399;padding:5px 0!important;min-width:150px;min-height:40px;border:1px solid #d2d2d2;text-align:left;overflow-y:auto;background-color:#fff;box-shadow:0 2px 4px rgba(0,0,0,.12)}.layui-table-tool-panel li{padding:0 10px;margin:0!important;line-height:30px;list-style-type:none!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-webkit-transition:.5s all;transition:.5s all}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary]{width:100%}.layui-table-tool-panel li:hover{background-color:#f8f8f8}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary]{padding-left:28px}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary] i{position:absolute;left:0;top:0}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary] span{padding:0}.layui-table-tool .layui-table-tool-self .layui-table-tool-panel{left:auto;right:-1px}.layui-table-col-set{position:absolute;right:0;top:0;width:20px;height:100%;border-width:0;border-left-width:1px;background-color:#fff}.layui-table-sort{width:10px;height:20px;margin-left:5px;cursor:pointer!important}.layui-table-sort .layui-edge{position:absolute;left:5px;border-width:5px}.layui-table-sort .layui-table-sort-asc{top:3px;border-top:none;border-bottom-style:solid;border-bottom-color:#b2b2b2}.layui-table-sort .layui-table-sort-asc:hover{border-bottom-color:#5f5f5f}.layui-table-sort .layui-table-sort-desc{bottom:5px;border-bottom:none;border-top-style:solid;border-top-color:#b2b2b2}.layui-table-sort .layui-table-sort-desc:hover{border-top-color:#5f5f5f}.layui-table-sort[lay-sort=asc] .layui-table-sort-asc{border-bottom-color:#000}.layui-table-sort[lay-sort=desc] .layui-table-sort-desc{border-top-color:#000}.layui-table-cell{height:38px;line-height:28px;padding:6px 15px;position:relative;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;box-sizing:border-box}.layui-table-cell .layui-form-checkbox[lay-skin=primary]{top:-1px;padding:0}.layui-table-cell .layui-form-checkbox[lay-skin=primary]>div{padding-left:24px}.layui-table-cell .layui-table-link{color:#01aaed}.layui-table-cell .layui-btn{vertical-align:inherit}.layui-table-cell[align=center]{-webkit-box-pack:center}.layui-table-cell[align=right]{-webkit-box-pack:end}.laytable-cell-checkbox,.laytable-cell-numbers,.laytable-cell-radio,.laytable-cell-space{text-align:center;-webkit-box-pack:center}.layui-table-body{position:relative;overflow:auto;margin-right:-1px;margin-bottom:-1px}.layui-table-body .layui-none{line-height:26px;padding:30px 15px;text-align:center;color:#999}.layui-table-fixed{position:absolute;left:0;top:0;z-index:101}.layui-table-fixed .layui-table-body{overflow:hidden}.layui-table-fixed-l{box-shadow:1px 0 8px rgba(0,0,0,.08)}.layui-table-fixed-r{left:auto;right:-1px;border-width:0;border-left-width:1px;box-shadow:-1px 0 8px rgba(0,0,0,.08)}.layui-table-fixed-r .layui-table-header{position:relative;overflow:visible}.layui-table-mend{position:absolute;right:-49px;top:0;height:100%;width:50px;border-width:0;border-left-width:1px}.layui-table-tool{position:relative;width:100%;min-height:50px;line-height:30px;padding:10px 15px;border-width:0;border-bottom-width:1px}.layui-table-tool .layui-btn-container{margin-bottom:-10px}.layui-table-total{margin-bottom:-1px;border-width:0;border-top-width:1px;overflow:hidden}.layui-table-page{border-width:0;border-top-width:1px;margin-bottom:-1px;white-space:nowrap;overflow:hidden}.layui-table-page>div{height:26px}.layui-table-page .layui-laypage{margin:0}.layui-table-page .layui-laypage a,.layui-table-page .layui-laypage span{height:26px;line-height:26px;margin-bottom:10px;border:none;background:0 0}.layui-table-page .layui-laypage a,.layui-table-page .layui-laypage span.layui-laypage-curr{padding:0 12px}.layui-table-page .layui-laypage span{margin-left:0;padding:0}.layui-table-page .layui-laypage .layui-laypage-prev{margin-left:-11px!important}.layui-table-page .layui-laypage .layui-laypage-curr .layui-laypage-em{left:0;top:0;padding:0}.layui-table-page .layui-laypage button,.layui-table-page .layui-laypage input{height:26px;line-height:26px}.layui-table-page .layui-laypage input{width:40px}.layui-table-page .layui-laypage button{padding:0 10px}.layui-table-page select{height:18px}.layui-table-pagebar{float:right;line-height:23px}.layui-table-pagebar .layui-btn-sm{margin-top:-1px}.layui-table-pagebar .layui-btn-xs{margin-top:2px}.layui-table-view select[lay-ignore]{display:inline-block}.layui-table-patch .layui-table-cell{padding:0;width:30px}.layui-table-edit{position:absolute;left:0;top:0;z-index:189;min-width:100%;min-height:100%;padding:5px 14px;border-radius:0;box-shadow:1px 1px 20px rgba(0,0,0,.15);background-color:#fff}.layui-table-edit:focus{border-color:#16b777!important}input.layui-input.layui-table-edit{height:100%}select.layui-table-edit{padding:0 0 0 10px;border-color:#d2d2d2}.layui-table-view .layui-form-checkbox,.layui-table-view .layui-form-radio,.layui-table-view .layui-form-switch{top:0;margin:0}.layui-table-view .layui-form-checkbox{top:-1px;height:26px;line-height:26px}.layui-table-view .layui-form-checkbox i{height:26px}.layui-table-grid .layui-table-cell{overflow:visible}.layui-table-grid-down{position:absolute;top:0;right:0;width:24px;height:100%;padding:5px 0;border-width:0;border-left-width:1px;text-align:center;background-color:#fff;color:#999;cursor:pointer}.layui-table-grid-down .layui-icon{position:absolute;top:50%;left:50%;margin:-8px 0 0 -8px;font-size:14px}.layui-table-grid-down:hover{background-color:#fbfbfb}.layui-table-expanded{height:95px}.layui-table-expanded .layui-table-cell,.layui-table-view .layui-table[lay-size=lg] .layui-table-expanded .layui-table-cell,.layui-table-view .layui-table[lay-size=sm] .layui-table-expanded .layui-table-cell{height:auto;max-height:94px;white-space:normal;text-overflow:clip}.layui-table-cell-c{position:absolute;bottom:-10px;right:50%;margin-right:-9px;width:20px;height:20px;line-height:18px;cursor:pointer;text-align:center;background-color:#fff;border:1px solid #eee;border-radius:50%;z-index:1000;transition:.3s all;font-size:14px}.layui-table-cell-c:hover{border-color:#16b777}.layui-table-expanded td:hover .layui-table-cell{overflow:auto}.layui-table-tree-nodeIcon{max-width:20px}.layui-table-tree-nodeIcon>*{width:100%}.layui-table-tree-flexIcon,.layui-table-tree-nodeIcon{margin-right:2px}.layui-table-tree-flexIcon{cursor:pointer}.layui-upload-file{display:none!important;opacity:.01;filter:Alpha(opacity=1)}.layui-upload-list{margin:11px 0}.layui-upload-choose{max-width:200px;padding:0 10px;color:#999;font-size:14px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-upload-drag{position:relative;display:inline-block;padding:30px;border:1px dashed #e2e2e2;background-color:#fff;text-align:center;cursor:pointer;color:#999}.layui-upload-drag .layui-icon{font-size:50px;color:#16baaa}.layui-upload-drag[lay-over]{border-color:#16baaa}.layui-upload-form{display:inline-block}.layui-upload-iframe{position:absolute;width:0;height:0;border:0;visibility:hidden}.layui-upload-wrap{position:relative;display:inline-block;vertical-align:middle}.layui-upload-wrap .layui-upload-file{display:block!important;position:absolute;left:0;top:0;z-index:10;font-size:100px;width:100%;height:100%;opacity:.01;filter:Alpha(opacity=1);cursor:pointer}.layui-btn-container .layui-upload-choose{padding-left:0}.layui-menu{position:relative;margin:5px 0;background-color:#fff;box-sizing:border-box}.layui-menu *{box-sizing:border-box}.layui-menu li,.layui-menu-body-title,.layui-menu-body-title a{padding:5px 15px;color:initial}.layui-menu li{position:relative;margin:1px 0;line-height:26px;color:rgba(0,0,0,.8);font-size:14px;white-space:nowrap;cursor:pointer;transition:all .3s}.layui-menu li:hover{background-color:#f8f8f8}.layui-menu li.layui-disabled,.layui-menu li.layui-disabled *{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important}.layui-menu-item-parent:hover>.layui-menu-body-panel{display:block;animation-name:layui-fadein;animation-duration:.3s;animation-fill-mode:both;animation-delay:.2s}.layui-menu-item-group>.layui-menu-body-title,.layui-menu-item-parent>.layui-menu-body-title{padding-right:38px}.layui-menu .layui-menu-item-divider:hover,.layui-menu .layui-menu-item-group:hover,.layui-menu .layui-menu-item-none:hover{background:0 0;cursor:default}.layui-menu .layui-menu-item-group>ul{margin:5px 0 -5px}.layui-menu .layui-menu-item-group>.layui-menu-body-title{color:rgba(0,0,0,.35);user-select:none}.layui-menu .layui-menu-item-none{color:rgba(0,0,0,.35);cursor:default}.layui-menu .layui-menu-item-none{text-align:center}.layui-menu .layui-menu-item-divider{margin:5px 0;padding:0;height:0;line-height:0;border-bottom:1px solid #eee;overflow:hidden}.layui-menu .layui-menu-item-down:hover,.layui-menu .layui-menu-item-up:hover{cursor:pointer}.layui-menu .layui-menu-item-up>.layui-menu-body-title{color:rgba(0,0,0,.8)}.layui-menu .layui-menu-item-up>ul{visibility:hidden;height:0;overflow:hidden}.layui-menu .layui-menu-item-down:hover>.layui-menu-body-title>.layui-icon,.layui-menu .layui-menu-item-up>.layui-menu-body-title:hover>.layui-icon{color:#000}.layui-menu .layui-menu-item-down>ul{visibility:visible;height:auto}.layui-menu .layui-menu-item-checked,.layui-menu .layui-menu-item-checked2{background-color:#f8f8f8!important;color:#16b777}.layui-menu .layui-menu-item-checked a,.layui-menu .layui-menu-item-checked2 a{color:#16b777}.layui-menu .layui-menu-item-checked:after{position:absolute;right:-1px;top:0;bottom:0;border-right:3px solid #16b777;content:""}.layui-menu-body-title{position:relative;margin:-5px -15px;overflow:hidden;text-overflow:ellipsis}.layui-menu-body-title a{display:block;margin:-5px -15px;color:rgba(0,0,0,.8)}.layui-menu-body-title a:hover{transition:all .3s}.layui-menu-body-title>.layui-icon{position:absolute;right:15px;top:50%;margin-top:-6px;line-height:normal;font-size:14px}.layui-menu-body-title>.layui-icon:hover{transition:all .3s}.layui-menu-body-title>.layui-icon-right{right:14px}.layui-menu-body-panel{display:none;position:absolute;top:-7px;left:100%;z-index:1000;margin-left:13px;padding:5px 0}.layui-menu-body-panel:before{content:"";position:absolute;width:20px;left:-16px;top:0;bottom:0}.layui-menu-body-panel-left{left:auto;right:100%;margin:0 13px 0}.layui-menu-body-panel-left:before{left:auto;right:-16px}.layui-menu-lg li{line-height:32px}.layui-menu-lg .layui-menu-body-title a:hover,.layui-menu-lg li:hover{background:0 0;color:#16b777}.layui-menu-lg li .layui-menu-body-panel{margin-left:14px}.layui-menu-lg li .layui-menu-body-panel-left{margin:0 15px 0}.layui-dropdown{position:absolute;left:-999999px;top:-999999px;z-index:77777777;margin:5px 0;min-width:100px}.layui-dropdown:before{content:"";position:absolute;width:100%;height:6px;left:0;top:-6px}.layui-dropdown-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px");position:fixed;_position:absolute;pointer-events:auto}.layui-nav{position:relative;padding:0 15px;background-color:#2f363c;color:#fff;border-radius:2px;font-size:0;box-sizing:border-box}.layui-nav *{font-size:14px}.layui-nav .layui-nav-item{position:relative;display:inline-block;*display:inline;*zoom:1;margin-top:0;list-style:none;vertical-align:middle;line-height:60px}.layui-nav .layui-nav-item a{display:block;padding:0 20px;color:#fff;color:rgba(255,255,255,.7);transition:all .3s;-webkit-transition:all .3s}.layui-nav .layui-this:after,.layui-nav-bar{content:"";position:absolute;left:0;top:0;width:0;height:3px;background-color:#16b777;transition:all .2s;-webkit-transition:all .2s;pointer-events:none}.layui-nav-bar{z-index:1000}.layui-nav[lay-bar=disabled] .layui-nav-bar{display:none}.layui-nav .layui-nav-item a:hover,.layui-nav .layui-this a{color:#fff;text-decoration:none}.layui-nav .layui-this:after{top:auto;bottom:0;width:100%}.layui-nav-img{width:30px;height:30px;margin-right:10px;border-radius:50%}.layui-nav .layui-nav-more{position:absolute;top:0;right:3px;left:auto!important;margin-top:0;font-size:12px;cursor:pointer;transition:all .2s;-webkit-transition:all .2s}.layui-nav .layui-nav-mored,.layui-nav-itemed>a .layui-nav-more{transform:rotate(180deg)}.layui-nav-child{display:none;position:absolute;left:0;top:65px;min-width:100%;line-height:36px;padding:5px 0;box-shadow:0 2px 4px rgba(0,0,0,.12);border:1px solid #eee;background-color:#fff;z-index:100;border-radius:2px;white-space:nowrap;box-sizing:border-box}.layui-nav .layui-nav-child a{color:#5f5f5f;color:rgba(0,0,0,.8)}.layui-nav .layui-nav-child a:hover{background-color:#f8f8f8;color:rgba(0,0,0,.8)}.layui-nav-child dd{margin:1px 0;position:relative}.layui-nav-child dd.layui-this{background-color:#f8f8f8;color:#000}.layui-nav-child dd.layui-this:after{display:none}.layui-nav-child-r{left:auto;right:0}.layui-nav-child-c{text-align:center}.layui-nav.layui-nav-tree{width:200px;padding:0}.layui-nav-tree .layui-nav-item{display:block;width:100%;line-height:40px}.layui-nav-tree .layui-nav-item a{position:relative;height:40px;line-height:40px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-nav-tree .layui-nav-item>a{padding-top:5px;padding-bottom:5px}.layui-nav-tree .layui-nav-more{right:15px}.layui-nav-tree .layui-nav-item>a .layui-nav-more{padding:5px 0}.layui-nav-tree .layui-nav-bar{width:5px;height:0}.layui-side .layui-nav-tree .layui-nav-bar{width:2px}.layui-nav-tree .layui-nav-child dd.layui-this,.layui-nav-tree .layui-nav-child dd.layui-this a,.layui-nav-tree .layui-this,.layui-nav-tree .layui-this>a,.layui-nav-tree .layui-this>a:hover{background-color:#16baaa;color:#fff}.layui-nav-tree .layui-this:after{display:none}.layui-nav-itemed>a,.layui-nav-tree .layui-nav-title a,.layui-nav-tree .layui-nav-title a:hover{color:#fff!important}.layui-nav-tree .layui-nav-bar{background-color:#16baaa}.layui-nav-tree .layui-nav-child{position:relative;z-index:0;top:0;border:none;box-shadow:none}.layui-nav-tree .layui-nav-child dd{margin:0}.layui-nav-tree .layui-nav-child a{color:#fff;color:rgba(255,255,255,.7)}.layui-nav-tree .layui-nav-child,.layui-nav-tree .layui-nav-child a:hover{background:0 0;color:#fff}.layui-nav-itemed>.layui-nav-child{display:block;background-color:rgba(0,0,0,.3)!important}.layui-nav-itemed>.layui-nav-child>.layui-this>.layui-nav-child{display:block}.layui-nav-side{position:fixed;top:0;bottom:0;left:0;overflow-x:hidden;z-index:999}.layui-nav-tree.layui-bg-gray a,.layui-nav.layui-bg-gray .layui-nav-item a{color:rgba(0,0,0,.8)}.layui-nav-tree.layui-bg-gray{padding:6px 0}.layui-nav-tree.layui-bg-gray .layui-nav-itemed>a{color:#000!important}.layui-nav.layui-bg-gray .layui-this a{color:#16b777}.layui-nav-tree.layui-bg-gray .layui-nav-itemed>.layui-nav-child{padding-left:11px;background:0 0!important}.layui-nav-tree.layui-bg-gray .layui-nav-item>a{padding-top:0;padding-bottom:0}.layui-nav-tree.layui-bg-gray .layui-nav-item>a .layui-nav-more{padding:0}.layui-nav-tree.layui-bg-gray .layui-nav-child dd.layui-this,.layui-nav-tree.layui-bg-gray .layui-nav-child dd.layui-this a,.layui-nav-tree.layui-bg-gray .layui-this,.layui-nav-tree.layui-bg-gray .layui-this>a{background:0 0!important;color:#16b777!important;font-weight:700}.layui-nav-tree.layui-bg-gray .layui-nav-bar{background-color:#16b777}.layui-breadcrumb{visibility:hidden;font-size:0}.layui-breadcrumb>*{font-size:14px}.layui-breadcrumb a{color:#999!important}.layui-breadcrumb a:hover{color:#16b777!important}.layui-breadcrumb a cite{color:#5f5f5f;font-style:normal}.layui-breadcrumb span[lay-separator]{margin:0 10px;color:#999}.layui-tab{margin:10px 0;text-align:left!important}.layui-tab[overflow]>.layui-tab-title{overflow:hidden}.layui-tab .layui-tab-title{position:relative;left:0;height:40px;white-space:nowrap;font-size:0;border-bottom-width:1px;border-bottom-style:solid;transition:all .2s;-webkit-transition:all .2s}.layui-tab .layui-tab-title li{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;font-size:14px;transition:all .2s;-webkit-transition:all .2s}.layui-tab .layui-tab-title li{position:relative;line-height:40px;min-width:65px;margin:0;padding:0 15px;text-align:center;cursor:pointer}.layui-tab .layui-tab-title li a{display:block;padding:0 15px;margin:0 -15px}.layui-tab-title .layui-this{color:#000}.layui-tab-title .layui-this:after{position:absolute;left:0;top:0;content:"";width:100%;height:41px;border-width:1px;border-style:solid;border-bottom-color:#fff;border-radius:2px 2px 0 0;box-sizing:border-box;pointer-events:none}.layui-tab-bar{position:absolute;right:0;top:0;z-index:10;width:30px;height:39px;line-height:39px;border-width:1px;border-style:solid;border-radius:2px;text-align:center;background-color:#fff;cursor:pointer}.layui-tab-bar .layui-icon{position:relative;display:inline-block;top:3px;transition:all .3s;-webkit-transition:all .3s}.layui-tab-item{display:none}.layui-tab-more{padding-right:30px;height:auto!important;white-space:normal!important}.layui-tab-more li.layui-this:after{border-bottom-color:#eee;border-radius:2px}.layui-tab-more .layui-tab-bar .layui-icon{top:-2px;top:3px\0;-webkit-transform:rotate(180deg);transform:rotate(180deg)}:root .layui-tab-more .layui-tab-bar .layui-icon{top:-2px\0/IE9}.layui-tab-content{padding:15px 0}.layui-tab-title li .layui-tab-close{position:relative;display:inline-block;width:18px;height:18px;line-height:20px;margin-left:8px;top:1px;text-align:center;font-size:14px;color:#c2c2c2;transition:all .2s;-webkit-transition:all .2s}.layui-tab-title li .layui-tab-close:hover{border-radius:2px;background-color:#ff5722;color:#fff}.layui-tab-brief>.layui-tab-title .layui-this{color:#16baaa}.layui-tab-brief>.layui-tab-more li.layui-this:after,.layui-tab-brief>.layui-tab-title .layui-this:after{border:none;border-radius:0;border-bottom:2px solid #16b777}.layui-tab-brief[overflow]>.layui-tab-title .layui-this:after{top:-1px}.layui-tab-card{border-width:1px;border-style:solid;border-radius:2px;box-shadow:0 2px 5px 0 rgba(0,0,0,.1)}.layui-tab-card>.layui-tab-title{background-color:#fafafa}.layui-tab-card>.layui-tab-title li{margin-right:-1px;margin-left:-1px}.layui-tab-card>.layui-tab-title .layui-this{background-color:#fff}.layui-tab-card>.layui-tab-title .layui-this:after{border-top:none;border-width:1px;border-bottom-color:#fff}.layui-tab-card>.layui-tab-title .layui-tab-bar{height:40px;line-height:40px;border-radius:0;border-top:none;border-right:none}.layui-tab-card>.layui-tab-more .layui-this{background:0 0;color:#16b777}.layui-tab-card>.layui-tab-more .layui-this:after{border:none}.layui-timeline{padding-left:5px}.layui-timeline-item{position:relative;padding-bottom:20px}.layui-timeline-axis{position:absolute;left:-5px;top:0;z-index:10;width:20px;height:20px;line-height:20px;background-color:#fff;color:#16b777;border-radius:50%;text-align:center;cursor:pointer}.layui-timeline-axis:hover{color:#ff5722}.layui-timeline-item:before{content:"";position:absolute;left:5px;top:0;z-index:0;width:1px;height:100%}.layui-timeline-item:first-child:before{display:block}.layui-timeline-item:last-child:before{display:none}.layui-timeline-content{padding-left:25px}.layui-timeline-title{position:relative;margin-bottom:10px;line-height:22px}.layui-badge,.layui-badge-dot,.layui-badge-rim{position:relative;display:inline-block;padding:0 6px;font-size:12px;text-align:center;background-color:#ff5722;color:#fff;border-radius:2px}.layui-badge{height:18px;line-height:18px}.layui-badge-dot{width:8px;height:8px;padding:0;border-radius:50%}.layui-badge-rim{height:18px;line-height:18px;border-width:1px;border-style:solid;background-color:#fff;color:#5f5f5f}.layui-btn .layui-badge,.layui-btn .layui-badge-dot{margin-left:5px}.layui-nav .layui-badge,.layui-nav .layui-badge-dot{position:absolute;top:50%;margin:-5px 6px 0}.layui-nav .layui-badge{margin-top:-10px}.layui-tab-title .layui-badge,.layui-tab-title .layui-badge-dot{left:5px;top:-2px}.layui-carousel{position:relative;left:0;top:0;background-color:#f8f8f8}.layui-carousel>[carousel-item]{position:relative;width:100%;height:100%;overflow:hidden}.layui-carousel>[carousel-item]:before{position:absolute;content:'\e63d';left:50%;top:50%;width:100px;line-height:20px;margin:-10px 0 0 -50px;text-align:center;color:#c2c2c2;font-family:layui-icon!important;font-size:30px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-carousel>[carousel-item]>*{display:none;position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f8f8f8;transition-duration:.3s;-webkit-transition-duration:.3s}.layui-carousel-updown>*{-webkit-transition:.3s ease-in-out up;transition:.3s ease-in-out up}.layui-carousel-arrow{display:none\0;opacity:0;position:absolute;left:10px;top:50%;margin-top:-18px;width:36px;height:36px;line-height:36px;text-align:center;font-size:20px;border:none 0;border-radius:50%;background-color:rgba(0,0,0,.2);color:#fff;-webkit-transition-duration:.3s;transition-duration:.3s;cursor:pointer}.layui-carousel-arrow[lay-type=add]{left:auto!important;right:10px}.layui-carousel[lay-arrow=always] .layui-carousel-arrow{opacity:1;left:20px}.layui-carousel[lay-arrow=always] .layui-carousel-arrow[lay-type=add]{right:20px}.layui-carousel[lay-arrow=none] .layui-carousel-arrow{display:none}.layui-carousel-arrow:hover,.layui-carousel-ind ul:hover{background-color:rgba(0,0,0,.35)}.layui-carousel:hover .layui-carousel-arrow{display:block\0;opacity:1;left:20px}.layui-carousel:hover .layui-carousel-arrow[lay-type=add]{right:20px}.layui-carousel-ind{position:relative;top:-35px;width:100%;line-height:0!important;text-align:center;font-size:0}.layui-carousel[lay-indicator=outside]{margin-bottom:30px}.layui-carousel[lay-indicator=outside] .layui-carousel-ind{top:10px}.layui-carousel[lay-indicator=outside] .layui-carousel-ind ul{background-color:rgba(0,0,0,.5)}.layui-carousel[lay-indicator=none] .layui-carousel-ind{display:none}.layui-carousel-ind ul{display:inline-block;padding:5px;background-color:rgba(0,0,0,.2);border-radius:10px;-webkit-transition-duration:.3s;transition-duration:.3s}.layui-carousel-ind ul li{display:inline-block;width:10px;height:10px;margin:0 3px;font-size:14px;background-color:#eee;background-color:rgba(255,255,255,.5);border-radius:50%;cursor:pointer;-webkit-transition-duration:.3s;transition-duration:.3s}.layui-carousel-ind ul li:hover{background-color:rgba(255,255,255,.7)}.layui-carousel-ind ul li.layui-this{background-color:#fff}.layui-carousel>[carousel-item]>.layui-carousel-next,.layui-carousel>[carousel-item]>.layui-carousel-prev,.layui-carousel>[carousel-item]>.layui-this{display:block}.layui-carousel>[carousel-item]>.layui-this{left:0}.layui-carousel>[carousel-item]>.layui-carousel-prev{left:-100%}.layui-carousel>[carousel-item]>.layui-carousel-next{left:100%}.layui-carousel>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel>[carousel-item]>.layui-carousel-prev.layui-carousel-right{left:0}.layui-carousel>[carousel-item]>.layui-this.layui-carousel-left{left:-100%}.layui-carousel>[carousel-item]>.layui-this.layui-carousel-right{left:100%}.layui-carousel[lay-anim=updown] .layui-carousel-arrow{left:50%!important;top:20px;margin:0 0 0 -18px}.layui-carousel[lay-anim=updown] .layui-carousel-arrow[lay-type=add]{top:auto!important;bottom:20px}.layui-carousel[lay-anim=updown] .layui-carousel-ind{position:absolute;top:50%;right:20px;width:auto;height:auto}.layui-carousel[lay-anim=updown] .layui-carousel-ind ul{padding:3px 5px}.layui-carousel[lay-anim=updown] .layui-carousel-ind li{display:block;margin:6px 0}.layui-carousel[lay-anim=updown]>[carousel-item]>*{left:0!important}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this{top:0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-prev{top:-100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-next{top:100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-prev.layui-carousel-right{top:0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this.layui-carousel-left{top:-100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this.layui-carousel-right{top:100%}.layui-carousel[lay-anim=fade]>[carousel-item]>*{left:0!important}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-next,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-prev{opacity:0}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-prev.layui-carousel-right{opacity:1}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-this.layui-carousel-left,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-this.layui-carousel-right{opacity:0}.layui-fixbar{position:fixed;right:16px;bottom:16px;z-index:999999}.layui-fixbar li{width:50px;height:50px;line-height:50px;margin-bottom:1px;text-align:center;cursor:pointer;font-size:30px;background-color:#9f9f9f;color:#fff;border-radius:2px;opacity:.95}.layui-fixbar li:hover{opacity:.85}.layui-fixbar li:active{opacity:1}.layui-fixbar .layui-fixbar-top{display:none;font-size:40px}body .layui-util-face{border:none;background:0 0}body .layui-util-face .layui-layer-content{padding:0;background-color:#fff;color:#5f5f5f;box-shadow:none}.layui-util-face .layui-layer-TipsG{display:none}.layui-util-face ul{position:relative;width:372px;padding:10px;border:1px solid #d9d9d9;background-color:#fff;box-shadow:0 0 20px rgba(0,0,0,.2)}.layui-util-face ul li{cursor:pointer;float:left;border:1px solid #e8e8e8;height:22px;width:26px;overflow:hidden;margin:-1px 0 0 -1px;padding:4px 2px;text-align:center}.layui-util-face ul li:hover{position:relative;z-index:2;border:1px solid #eb7350;background:#fff9ec}.layui-code{position:relative;margin:10px 0;padding:15px;line-height:20px;border:1px solid #eee;border-left-width:6px;background-color:#fafafa;color:#333;font-family:Courier New,Lucida Console,Consolas;font-size:12px}.layui-transfer-box,.layui-transfer-header,.layui-transfer-search{border-width:0;border-style:solid;border-color:#eee}.layui-transfer-box{position:relative;display:inline-block;vertical-align:middle;border-width:1px;width:200px;height:360px;border-radius:2px;background-color:#fff}.layui-transfer-box .layui-form-checkbox{width:100%;margin:0!important}.layui-transfer-header{height:38px;line-height:38px;padding:0 11px;border-bottom-width:1px}.layui-transfer-search{position:relative;padding:11px;border-bottom-width:1px}.layui-transfer-search .layui-input{height:32px;padding-left:30px;font-size:12px}.layui-transfer-search .layui-icon-search{position:absolute;left:20px;top:50%;line-height:normal;margin-top:-8px;color:#5f5f5f}.layui-transfer-active{margin:0 15px;display:inline-block;vertical-align:middle}.layui-transfer-active .layui-btn{display:block;margin:0;padding:0 15px;background-color:#16b777;border-color:#16b777;color:#fff}.layui-transfer-active .layui-btn-disabled{background-color:#fbfbfb;border-color:#eee;color:#d2d2d2}.layui-transfer-active .layui-btn:first-child{margin-bottom:15px}.layui-transfer-active .layui-btn .layui-icon{margin:0;font-size:14px!important}.layui-transfer-data{padding:5px 0;overflow:auto}.layui-transfer-data li{height:32px;line-height:32px;margin-top:0!important;padding:0 11px;list-style-type:none!important}.layui-transfer-data li:hover{background-color:#f8f8f8;transition:.5s all}.layui-transfer-data .layui-none{padding:15px 11px;text-align:center;color:#999}.layui-rate,.layui-rate *{display:inline-block;vertical-align:middle}.layui-rate{padding:11px 6px 11px 0;font-size:0}.layui-rate li{margin-top:0!important}.layui-rate li i.layui-icon{font-size:20px;color:#ffb800}.layui-rate li i.layui-icon{margin-right:5px;transition:all .3s;-webkit-transition:all .3s}.layui-rate li i:hover{cursor:pointer;transform:scale(1.12);-webkit-transform:scale(1.12)}.layui-rate[readonly] li i:hover{cursor:default;transform:scale(1)}.layui-colorpicker{width:38px;height:38px;border:1px solid #eee;padding:5px;border-radius:2px;line-height:24px;display:inline-block;cursor:pointer;transition:all .3s;-webkit-transition:all .3s;box-sizing:border-box}.layui-colorpicker:hover{border-color:#d2d2d2}.layui-colorpicker.layui-colorpicker-lg{width:44px;height:44px;line-height:30px}.layui-colorpicker.layui-colorpicker-sm{width:30px;height:30px;line-height:20px;padding:3px}.layui-colorpicker.layui-colorpicker-xs{width:22px;height:22px;line-height:16px;padding:1px}.layui-colorpicker-trigger-bgcolor{display:block;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);border-radius:2px}.layui-colorpicker-trigger-span{display:block;height:100%;box-sizing:border-box;border:1px solid rgba(0,0,0,.15);border-radius:2px;text-align:center}.layui-colorpicker-trigger-i{display:inline-block;color:#fff;font-size:12px}.layui-colorpicker-trigger-i.layui-icon-close{color:#999}.layui-colorpicker-main{position:absolute;left:-999999px;top:-999999px;z-index:77777777;width:280px;margin:5px 0;padding:7px;background:#fff;border:1px solid #d2d2d2;border-radius:2px;box-shadow:0 2px 4px rgba(0,0,0,.12)}.layui-colorpicker-main-wrapper{height:180px;position:relative}.layui-colorpicker-basis{width:260px;height:100%;position:relative}.layui-colorpicker-basis-white{width:100%;height:100%;position:absolute;top:0;left:0;background:linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.layui-colorpicker-basis-black{width:100%;height:100%;position:absolute;top:0;left:0;background:linear-gradient(0deg,#000,transparent)}.layui-colorpicker-basis-cursor{width:10px;height:10px;border:1px solid #fff;border-radius:50%;position:absolute;top:-3px;right:-3px;cursor:pointer}.layui-colorpicker-side{position:absolute;top:0;right:0;width:12px;height:100%;background:linear-gradient(red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.layui-colorpicker-side-slider{width:100%;height:5px;box-shadow:0 0 1px #888;box-sizing:border-box;background:#fff;border-radius:1px;border:1px solid #f0f0f0;cursor:pointer;position:absolute;left:0}.layui-colorpicker-main-alpha{display:none;height:12px;margin-top:7px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.layui-colorpicker-alpha-bgcolor{height:100%;position:relative}.layui-colorpicker-alpha-slider{width:5px;height:100%;box-shadow:0 0 1px #888;box-sizing:border-box;background:#fff;border-radius:1px;border:1px solid #f0f0f0;cursor:pointer;position:absolute;top:0}.layui-colorpicker-main-pre{padding-top:7px;font-size:0}.layui-colorpicker-pre{width:20px;height:20px;border-radius:2px;display:inline-block;margin-left:6px;margin-bottom:7px;cursor:pointer}.layui-colorpicker-pre:nth-child(11n+1){margin-left:0}.layui-colorpicker-pre-isalpha{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.layui-colorpicker-pre.layui-this{box-shadow:0 0 3px 2px rgba(0,0,0,.15)}.layui-colorpicker-pre>div{height:100%;border-radius:2px}.layui-colorpicker-main-input{text-align:right;padding-top:7px}.layui-colorpicker-main-input .layui-btn-container .layui-btn{margin:0 0 0 10px}.layui-colorpicker-main-input div.layui-inline{float:left;margin-right:10px;font-size:14px}.layui-colorpicker-main-input input.layui-input{width:150px;height:30px;color:#5f5f5f}.layui-slider{height:4px;background:#eee;border-radius:3px;position:relative;cursor:pointer}.layui-slider-bar{border-radius:3px;position:absolute;height:100%}.layui-slider-step{position:absolute;top:0;width:4px;height:4px;border-radius:50%;background:#fff;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.layui-slider-wrap{width:36px;height:36px;position:absolute;top:-16px;-webkit-transform:translateX(-50%);transform:translateX(-50%);z-index:10;text-align:center}.layui-slider-wrap-btn{width:12px;height:12px;border-radius:50%;background:#fff;display:inline-block;vertical-align:middle;cursor:pointer;transition:.3s}.layui-slider-wrap:after{content:"";height:100%;display:inline-block;vertical-align:middle}.layui-slider-wrap-btn.layui-slider-hover,.layui-slider-wrap-btn:hover{transform:scale(1.2)}.layui-slider-wrap-btn.layui-disabled:hover{transform:scale(1)!important}.layui-slider-tips{position:absolute;top:-42px;z-index:77777777;white-space:nowrap;display:none;-webkit-transform:translateX(-50%);transform:translateX(-50%);color:#fff;background:#000;border-radius:3px;height:25px;line-height:25px;padding:0 10px}.layui-slider-tips:after{content:"";position:absolute;bottom:-12px;left:50%;margin-left:-6px;width:0;height:0;border-width:6px;border-style:solid;border-color:#000 transparent transparent transparent}.layui-slider-input{width:70px;height:32px;border:1px solid #eee;border-radius:3px;font-size:16px;line-height:32px;position:absolute;right:0;top:-14px;box-sizing:border-box}.layui-slider-input-btn{position:absolute;top:0;right:0;width:20px;height:100%;border-left:1px solid #eee}.layui-slider-input-btn i{cursor:pointer;position:absolute;right:0;bottom:0;width:20px;height:50%;font-size:12px;line-height:16px;text-align:center;color:#999}.layui-slider-input-btn i:first-child{top:0;border-bottom:1px solid #eee}.layui-slider-input-txt{height:100%;font-size:14px}.layui-slider-input-txt input{height:100%;border:none;padding-right:21px}.layui-slider-input-btn i:hover{color:#16baaa}.layui-slider-vertical{width:4px;margin-left:33px}.layui-slider-vertical .layui-slider-bar{width:4px}.layui-slider-vertical .layui-slider-step{top:auto;left:0;-webkit-transform:translateY(50%);transform:translateY(50%)}.layui-slider-vertical .layui-slider-wrap{top:auto;left:-16px;-webkit-transform:translateY(50%);transform:translateY(50%)}.layui-slider-vertical .layui-slider-tips{top:auto;left:2px}@media \0screen{.layui-slider-wrap-btn{margin-left:-20px}.layui-slider-vertical .layui-slider-wrap-btn{margin-left:0;margin-bottom:-20px}.layui-slider-vertical .layui-slider-tips{margin-left:-8px}.layui-slider>span{margin-left:8px}}.layui-tree{line-height:22px}.layui-tree .layui-form-checkbox{margin:0!important}.layui-tree-set{width:100%;position:relative}.layui-tree-pack{display:none;padding-left:20px;position:relative}.layui-tree-line .layui-tree-pack{padding-left:27px}.layui-tree-line .layui-tree-set .layui-tree-set:after{content:"";position:absolute;top:14px;left:-9px;width:17px;height:0;border-top:1px dotted #c0c4cc}.layui-tree-entry{position:relative;padding:3px 0;height:26px;white-space:nowrap}.layui-tree-entry:hover{background-color:#eee}.layui-tree-line .layui-tree-entry:hover{background-color:rgba(0,0,0,0)}.layui-tree-line .layui-tree-entry:hover .layui-tree-txt{color:#999;text-decoration:underline;transition:.3s}.layui-tree-main{display:inline-block;vertical-align:middle;cursor:pointer;padding-right:10px}.layui-tree-line .layui-tree-set:before{content:"";position:absolute;top:0;left:-9px;width:0;height:100%;border-left:1px dotted #c0c4cc}.layui-tree-line .layui-tree-set.layui-tree-setLineShort:before{height:13px}.layui-tree-line .layui-tree-set.layui-tree-setHide:before{height:0}.layui-tree-iconClick{display:inline-block;vertical-align:middle;position:relative;height:20px;line-height:20px;margin:0 10px;color:#c0c4cc}.layui-tree-icon{height:14px;line-height:12px;width:14px;text-align:center;border:1px solid #c0c4cc}.layui-tree-iconClick .layui-icon{font-size:18px}.layui-tree-icon .layui-icon{font-size:12px;color:#5f5f5f}.layui-tree-iconArrow{padding:0 5px}.layui-tree-iconArrow:after{content:"";position:absolute;left:4px;top:3px;z-index:100;width:0;height:0;border-width:5px;border-style:solid;border-color:transparent transparent transparent #c0c4cc;transition:.5s}.layui-tree-spread>.layui-tree-entry .layui-tree-iconClick>.layui-tree-iconArrow:after{transform:rotate(90deg) translate(3px,4px)}.layui-tree-txt{display:inline-block;vertical-align:middle;color:#555}.layui-tree-search{margin-bottom:15px;color:#5f5f5f}.layui-tree-btnGroup{visibility:hidden;display:inline-block;vertical-align:middle;position:relative}.layui-tree-btnGroup .layui-icon{display:inline-block;vertical-align:middle;padding:0 2px;cursor:pointer}.layui-tree-btnGroup .layui-icon:hover{color:#999;transition:.3s}.layui-tree-entry:hover .layui-tree-btnGroup{visibility:visible}.layui-tree-editInput{position:relative;display:inline-block;vertical-align:middle;height:20px;line-height:20px;padding:0;border:none;background-color:rgba(0,0,0,.05)}.layui-tree-emptyText{text-align:center;color:#999}.layui-anim{-webkit-animation-duration:.3s;-webkit-animation-fill-mode:both;animation-duration:.3s;animation-fill-mode:both}.layui-anim.layui-icon{display:inline-block}.layui-anim-loop{-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.layui-trans,.layui-trans a{transition:all .2s;-webkit-transition:all .2s}@-webkit-keyframes layui-rotate{from{-webkit-transform:rotate(0)}to{-webkit-transform:rotate(360deg)}}@keyframes layui-rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}.layui-anim-rotate{-webkit-animation-name:layui-rotate;animation-name:layui-rotate;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes layui-up{from{-webkit-transform:translate3d(0,100%,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes layui-up{from{transform:translate3d(0,100%,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-anim-up{-webkit-animation-name:layui-up;animation-name:layui-up}@-webkit-keyframes layui-upbit{from{-webkit-transform:translate3d(0,15px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes layui-upbit{from{transform:translate3d(0,15px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-anim-upbit{-webkit-animation-name:layui-upbit;animation-name:layui-upbit}@keyframes layui-down{0%{opacity:.3;transform:translate3d(0,-100%,0)}100%{opacity:1;transform:translate3d(0,0,0)}}.layui-anim-down{animation-name:layui-down}@keyframes layui-downbit{0%{opacity:.3;transform:translate3d(0,-5px,0)}100%{opacity:1;transform:translate3d(0,0,0)}}.layui-anim-downbit{animation-name:layui-downbit}@-webkit-keyframes layui-scale{0%{opacity:.3;-webkit-transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1)}}@keyframes layui-scale{0%{opacity:.3;-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-ms-transform:scale(1);transform:scale(1)}}.layui-anim-scale{-webkit-animation-name:layui-scale;animation-name:layui-scale}@-webkit-keyframes layui-scale-spring{0%{opacity:.5;-webkit-transform:scale(.5)}80%{opacity:.8;-webkit-transform:scale(1.1)}100%{opacity:1;-webkit-transform:scale(1)}}@keyframes layui-scale-spring{0%{opacity:.5;transform:scale(.5)}80%{opacity:.8;transform:scale(1.1)}100%{opacity:1;transform:scale(1)}}.layui-anim-scaleSpring{-webkit-animation-name:layui-scale-spring;animation-name:layui-scale-spring}@keyframes layui-scalesmall{0%{opacity:.3;transform:scale(1.5)}100%{opacity:1;transform:scale(1)}}.layui-anim-scalesmall{animation-name:layui-scalesmall}@keyframes layui-scalesmall-spring{0%{opacity:.3;transform:scale(1.5)}80%{opacity:.8;transform:scale(.9)}100%{opacity:1;transform:scale(1)}}.layui-anim-scalesmall-spring{animation-name:layui-scalesmall-spring}@-webkit-keyframes layui-fadein{0%{opacity:0}100%{opacity:1}}@keyframes layui-fadein{0%{opacity:0}100%{opacity:1}}.layui-anim-fadein{-webkit-animation-name:layui-fadein;animation-name:layui-fadein}@-webkit-keyframes layui-fadeout{0%{opacity:1}100%{opacity:0}}@keyframes layui-fadeout{0%{opacity:1}100%{opacity:0}}.layui-anim-fadeout{-webkit-animation-name:layui-fadeout;animation-name:layui-fadeout}html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-view{display:block;position:relative;margin:11px 0;padding:0;border:1px solid #eee;border-left-width:6px;background-color:#fafafa;color:#333;font-family:Courier New;font-size:13px}.layui-code-title{position:relative;padding:0 10px;height:40px;line-height:40px;border-bottom:1px solid #eee;font-size:12px}.layui-code-title>.layui-code-about{position:absolute;right:10px;top:0;color:#b7b7b7}.layui-code-about>a{padding-left:10px}.layui-code-view>.layui-code-ol,.layui-code-view>.layui-code-ul{max-height:100%;padding:0!important;position:relative;overflow:auto}.layui-code-view>.layui-code-ol>li{position:relative;margin-top:0!important;margin-left:45px!important;line-height:20px;padding:0 10px!important;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view>.layui-code-ol>li:first-child,.layui-code-view>.layui-code-ul>li:first-child{padding-top:10px!important}.layui-code-view>.layui-code-ol>li:last-child,.layui-code-view>.layui-code-ul>li:last-child{padding-bottom:10px!important}.layui-code-view>.layui-code-ul>li{position:relative;line-height:20px;padding:0 10px!important;list-style-type:none;*list-style-type:none;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-dark{border:1px solid #0c0c0c;border-left-color:#3f3f3f;background-color:#0c0c0c;color:#c2be9e}.layui-code-dark>.layui-code-title{border-bottom:none}.layui-code-dark>.layui-code-ol>li,.layui-code-dark>.layui-code-ul>li{background-color:#3f3f3f;border-left:none}.layui-code-dark>.layui-code-ul>li{margin-left:6px}.layui-code textarea{display:none}.layui-code-preview>.layui-code{margin:0}.layui-code-preview>.layui-tab{position:relative;z-index:1;margin-bottom:0}.layui-code-preview>.layui-tab>.layui-tab-title{border-bottom:none}.layui-code-preview>.layui-code>.layui-code-title{display:none}.layui-code-preview .layui-code-item{display:none}.layui-code-item-preview{position:relative;padding:16px;overflow:auto}.layui-code-item-preview>iframe{position:absolute;top:0;left:0;width:100%;height:100%;border:none}.layui-code-tools{position:absolute;right:11px;top:3px}.layui-code-tools>i{display:inline-block;margin-left:6px;padding:3px;cursor:pointer}.layui-code-tools>i.layui-icon-file-b{color:#999}.layui-code-tools>i:hover{color:#16b777}.layui-code-copy{position:absolute;right:6px;top:6px;cursor:pointer;display:none}.layui-code-copy .layui-icon{color:#777;transition:all .3s}.layui-code-copy:hover .layui-icon{color:#16b777}.layui-code-view:hover>.layui-code-copy{display:block}.layui-code-copy-offset{margin-right:17px}.layui-code-preview>.layui-code-view>.layui-code-copy{display:none!important}.layui-code-full{position:fixed;left:0;top:0;z-index:1111111;width:100%;height:100%;background-color:#fff}.layui-code-full .layui-code-item{width:100%!important;border-width:0!important;border-top-width:1px!important}.layui-code-full .layui-code-item,.layui-code-full .layui-code-ol,.layui-code-full .layui-code-ul{height:calc(100vh - 51px)!important;box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate,.layui-laydate *{box-sizing:border-box}.layui-laydate{position:absolute;z-index:99999999;margin:5px 0;border-radius:2px;font-size:14px;line-height:normal;-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}.layui-laydate-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px");position:fixed;_position:absolute;pointer-events:auto}@keyframes laydate-downbit{0%{opacity:.3;transform:translate3d(0,-5px,0)}100%{opacity:1;transform:translate3d(0,0,0)}}.layui-laydate{animation-name:laydate-downbit}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;padding:0 5px;color:#999;font-size:18px;cursor:pointer}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;box-sizing:border-box;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-set-ym span{padding:0 10px;cursor:pointer}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:0;text-align:center}.layui-laydate-content th{font-weight:400}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.laydate-day-holidays:before{position:absolute;left:0;top:0;font-size:12px;transform:scale(.7)}.laydate-day-holidays:before{content:'\4F11';color:#ff5722}.laydate-day-holidays[type=work]:before{content:'\73ED';color:inherit}.layui-laydate .layui-this .laydate-day-holidays:before{color:#fff}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px}.layui-laydate-footer span{display:inline-block;vertical-align:top;height:26px;line-height:24px;padding:0 10px;border:1px solid #c9c9c9;border-radius:2px;background-color:#fff;font-size:12px;cursor:pointer;white-space:nowrap;transition:all .3s}.layui-laydate-footer span:hover{color:#16b777}.layui-laydate-footer span.layui-laydate-preview{cursor:default;border-color:transparent!important}.layui-laydate-footer span.layui-laydate-preview:hover{color:#777}.layui-laydate-footer span:first-child.layui-laydate-preview{padding-left:0}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{margin:0 0 0 -1px;border-radius:0}.laydate-footer-btns span:first-child{border-radius:2px 0 0 2px}.laydate-footer-btns span:last-child{border-radius:0 2px 2px 0}.layui-laydate-shortcut{width:80px;padding:6px 0;display:inline-block;vertical-align:top;overflow:auto;max-height:276px;text-align:center}.layui-laydate-shortcut+.layui-laydate-main{display:inline-block;border-left:1px solid #e2e2e2}.layui-laydate-shortcut>li{padding:5px 8px;cursor:pointer;line-height:18px}.layui-laydate .layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;box-sizing:border-box;background-color:#fff}.layui-laydate .layui-laydate-list>li{position:relative;display:inline-block;width:33.3%;height:36px;line-height:36px;margin:3px 0;vertical-align:middle;text-align:center;cursor:pointer;list-style:none}.layui-laydate .laydate-month-list>li{width:25%;margin:17px 0}.layui-laydate .laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.layui-laydate .laydate-time-list p{position:relative;top:-4px;margin:0;line-height:29px}.layui-laydate .laydate-time-list ol{height:181px;overflow:hidden}.layui-laydate .laydate-time-list>li:hover ol{overflow-y:auto}.layui-laydate .laydate-time-list ol li{width:130%;padding-left:33px;height:30px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px;color:#ff5722}.layui-laydate-range{width:546px}.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle;max-width:50%}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content,.layui-laydate-range .laydate-main-list-1 .layui-laydate-header{border-left:1px solid #e2e2e2}.layui-laydate-range.layui-laydate-linkage .laydate-main-list-0 .laydate-next-m,.layui-laydate-range.layui-laydate-linkage .laydate-main-list-0 .laydate-next-y,.layui-laydate-range.layui-laydate-linkage .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range.layui-laydate-linkage .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#777}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#16b777}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{color:#333}.layui-laydate-content td{color:#777}.layui-laydate-content td.laydate-day-now{color:#16b777}.layui-laydate-content td.laydate-day-now:after{content:'';position:absolute;width:100%;height:30px;left:0;top:0;border:1px solid #16b777;box-sizing:border-box}.layui-laydate-linkage .layui-laydate-content td.laydate-selected>div{background-color:#00f7de}.layui-laydate-linkage .laydate-selected:hover>div{background-color:#00f7de!important}.layui-laydate-content td.laydate-selected:after,.layui-laydate-content td:hover:after{content:none}.layui-laydate-content td>div:hover,.layui-laydate-list li:hover,.layui-laydate-shortcut>li:hover{background-color:#eee;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.layui-laydate-linkage .laydate-selected.laydate-day-next>div,.layui-laydate-linkage .laydate-selected.laydate-day-prev>div{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#ff5722}.laydate-day-mark::after{background-color:#16b777}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#16b777}.layui-laydate .layui-this,.layui-laydate .layui-this>div{background-color:#16baaa!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content td>div{padding:7px 0;height:100%}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#16baaa}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead{border:1px solid #e2e2e2}.layui-laydate-linkage.laydate-theme-grid .laydate-selected,.layui-laydate-linkage.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#16baaa!important}.layui-laydate-linkage.laydate-theme-grid .laydate-selected.laydate-day-next,.layui-laydate-linkage.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px}.laydate-theme-grid .layui-laydate-content td>div{height:29px;margin-top:-1px}.laydate-theme-circle .layui-laydate-content td.layui-this>div,.laydate-theme-circle .layui-laydate-content td>div{width:28px;height:28px;line-height:28px;border-radius:14px;margin:0 4px;padding:0}.layui-laydate.laydate-theme-circle .layui-laydate-content table td.layui-this{background-color:transparent!important}.laydate-theme-grid.laydate-theme-circle .layui-laydate-content td>div{margin:0 3.5px}.laydate-theme-fullpanel .layui-laydate-main{width:526px}.laydate-theme-fullpanel .layui-laydate-list{width:252px;left:272px}.laydate-theme-fullpanel .laydate-set-ym span{display:none}.laydate-theme-fullpanel .laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-theme-fullpanel .laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-theme-fullpanel .laydate-time-show .layui-laydate-header .layui-icon{display:inline-block!important}.laydate-theme-fullpanel .laydate-btns-time{display:none}html #layuicss-layer{display:none;position:absolute;width:1989px}.layui-layer,.layui-layer-shade{position:fixed;_position:absolute;pointer-events:auto}.layui-layer-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px")}.layui-layer{-webkit-overflow-scrolling:touch}.layui-layer{top:150px;left:0;margin:0;padding:0;background-color:#fff;-webkit-background-clip:content;border-radius:2px;box-shadow:1px 1px 50px rgba(0,0,0,.3)}.layui-layer-close{position:absolute}.layui-layer-content{position:relative}.layui-layer-border{border:1px solid #b2b2b2;border:1px solid rgba(0,0,0,.1);box-shadow:1px 1px 5px rgba(0,0,0,.2)}.layui-layer-btn a,.layui-layer-setwin span{display:inline-block;vertical-align:middle;*display:inline;*zoom:1}.layui-layer-move{display:none;position:fixed;*position:absolute;left:0;top:0;width:100%;height:100%;cursor:move;opacity:0;filter:alpha(opacity=0);background-color:#fff;z-index:2147483647}.layui-layer-resize{position:absolute;width:15px;height:15px;right:0;bottom:0;cursor:se-resize}.layer-anim{-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.3s;animation-duration:.3s}@-webkit-keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-00{-webkit-animation-name:layer-bounceIn;animation-name:layer-bounceIn}@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown}@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig}@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft}@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);-ms-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn}@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn}@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes layer-slide-down{from{transform:translate3d(0,-100%,0)}to{transform:translate3d(0,0,0)}}@keyframes layer-slide-down-out{from{transform:translate3d(0,0,0)}to{transform:translate3d(0,-100%,0)}}.layer-anim-slide-down{animation-name:layer-slide-down}.layer-anim-slide-down-out{animation-name:layer-slide-down-out}@keyframes layer-slide-left{from{transform:translate3d(100%,0,0)}to{transform:translate3d(0,0,0)}}@keyframes layer-slide-left-out{from{transform:translate3d(0,0,0)}to{transform:translate3d(100%,0,0)}}.layer-anim-slide-left{animation-name:layer-slide-left}.layer-anim-slide-left-out{animation-name:layer-slide-left-out}@keyframes layer-slide-up{from{transform:translate3d(0,100%,0)}to{transform:translate3d(0,0,0)}}@keyframes layer-slide-up-out{from{transform:translate3d(0,0,0)}to{transform:translate3d(0,100%,0)}}.layer-anim-slide-up{animation-name:layer-slide-up}.layer-anim-slide-up-out{animation-name:layer-slide-up-out}@keyframes layer-slide-right{from{transform:translate3d(-100%,0,0)}to{transform:translate3d(0,0,0)}}@keyframes layer-slide-right-out{from{transform:translate3d(0,0,0)}to{transform:translate3d(-100%,0,0)}}.layer-anim-slide-right{animation-name:layer-slide-right}.layer-anim-slide-right-out{animation-name:layer-slide-right-out}.layui-layer-title{padding:0 81px 0 16px;height:50px;line-height:50px;border-bottom:1px solid #f0f0f0;font-size:14px;color:#333;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:2px 2px 0 0}.layui-layer-setwin{position:absolute;right:15px;*right:0;top:16px;font-size:0;line-height:initial}.layui-layer-setwin span{position:relative;width:16px;height:16px;line-height:18px;margin-left:10px;text-align:center;font-size:16px;cursor:pointer;color:#000;_overflow:hidden;box-sizing:border-box}.layui-layer-setwin .layui-layer-min:before{content:'';position:absolute;width:12px;border-bottom:1px solid #2e2d3c;left:50%;top:50%;margin:-.5px 0 0 -6px;cursor:pointer;_overflow:hidden}.layui-layer-setwin .layui-layer-min:hover:before{background-color:#2d93ca}.layui-layer-setwin .layui-layer-max:after,.layui-layer-setwin .layui-layer-max:before{content:'';position:absolute;left:50%;top:50%;z-index:1;width:9px;height:9px;margin:-5px 0 0 -5px;border:1px solid #2e2d3c}.layui-layer-setwin .layui-layer-max:hover:after,.layui-layer-setwin .layui-layer-max:hover:before{border-color:#2d93ca}.layui-layer-setwin .layui-layer-min:hover:before{background-color:#2d93ca}.layui-layer-setwin .layui-layer-maxmin:after,.layui-layer-setwin .layui-layer-maxmin:before{width:7px;height:7px;margin:-3px 0 0 -3px;background-color:#fff}.layui-layer-setwin .layui-layer-maxmin:after{z-index:0;margin:-5px 0 0 -1px}.layui-layer-setwin .layui-layer-close{cursor:pointer}.layui-layer-setwin .layui-layer-close:hover{opacity:.7}.layui-layer-setwin .layui-layer-close2{position:absolute;right:-28px;top:-28px;color:#fff;background-color:#787878;padding:3px;border:3px solid;width:28px;height:28px;font-size:16px;font-weight:bolder;border-radius:50%;margin-left:0;*right:-18px;_display:none}.layui-layer-setwin .layui-layer-close2:hover{opacity:unset;background-color:#3888f6}.layui-layer-btn{text-align:right;padding:0 15px 12px;pointer-events:auto;user-select:none;-webkit-user-select:none}.layui-layer-btn a{height:30px;line-height:30px;margin:5px 5px 0;padding:0 16px;border:1px solid #dedede;background-color:#fff;color:#333;border-radius:2px;font-weight:400;cursor:pointer;text-decoration:none;box-sizing:border-box}.layui-layer-btn a:hover{opacity:.9;text-decoration:none}.layui-layer-btn a:active{opacity:.8}.layui-layer-btn .layui-layer-btn0{border-color:transparent;background-color:#1e9fff;color:#fff}.layui-layer-btn-l{text-align:left}.layui-layer-btn-c{text-align:center}.layui-layer-dialog{min-width:240px}.layui-layer-dialog .layui-layer-content{position:relative;padding:16px;line-height:24px;word-break:break-all;overflow:hidden;font-size:14px;overflow-x:hidden;overflow-y:auto}.layui-layer-dialog .layui-layer-content .layui-layer-face{position:absolute;top:18px;left:16px;color:#959595;font-size:32px;_left:-40px}.layui-layer-dialog .layui-layer-content .layui-icon-tips{color:#f39b12}.layui-layer-dialog .layui-layer-content .layui-icon-success{color:#16b777}.layui-layer-dialog .layui-layer-content .layui-icon-error{top:19px;color:#ff5722}.layui-layer-dialog .layui-layer-content .layui-icon-question{color:#ffb800}.layui-layer-dialog .layui-layer-content .layui-icon-lock{color:#787878}.layui-layer-dialog .layui-layer-content .layui-icon-face-cry{color:#ff5722}.layui-layer-dialog .layui-layer-content .layui-icon-face-smile{color:#16b777}.layui-layer-rim{border:6px solid #8d8d8d;border:6px solid rgba(0,0,0,.3);border-radius:5px;box-shadow:none}.layui-layer-msg{min-width:180px;border:1px solid #d3d4d3;box-shadow:none}.layui-layer-hui{min-width:100px;background-color:#000;filter:alpha(opacity=60);background-color:rgba(0,0,0,.6);color:#fff;border:none}.layui-layer-hui .layui-layer-close{color:#fff}.layui-layer-hui .layui-layer-content{padding:11px 24px;text-align:center}.layui-layer-dialog .layui-layer-padding{padding:18px 24px 18px 58px;text-align:left}.layui-layer-page .layui-layer-content{position:relative;overflow:auto}.layui-layer-iframe .layui-layer-btn,.layui-layer-page .layui-layer-btn{padding-top:10px}.layui-layer-nobg{background:0 0}.layui-layer-iframe iframe{display:block;width:100%}.layui-layer-loading{border-radius:100%;background:0 0;box-shadow:none;border:none}.layui-layer-loading .layui-layer-content{width:76px;height:38px;line-height:38px;text-align:center}.layui-layer-loading-icon{font-size:38px;color:#959595}.layui-layer-loading2{text-align:center}.layui-layer-loading-2{position:relative;height:38px}.layui-layer-loading-2:after,.layui-layer-loading-2:before{content:'';position:absolute;left:50%;top:50%;width:38px;height:38px;margin:-19px 0 0 -19px;border-radius:50%;border:3px solid #d2d2d2;box-sizing:border-box}.layui-layer-loading-2:after{border-color:transparent;border-left-color:#1e9fff}.layui-layer-tips{background:0 0;box-shadow:none;border:none}.layui-layer-tips .layui-layer-content{position:relative;line-height:22px;min-width:12px;padding:8px 15px;font-size:12px;_float:left;border-radius:2px;box-shadow:1px 1px 3px rgba(0,0,0,.2);background-color:#000;color:#fff}.layui-layer-tips .layui-layer-close{right:-2px;top:-1px}.layui-layer-tips i.layui-layer-TipsG{position:absolute;width:0;height:0;border-width:8px;border-color:transparent;border-style:dashed;*overflow:hidden}.layui-layer-tips i.layui-layer-TipsB,.layui-layer-tips i.layui-layer-TipsT{left:5px;border-right-style:solid;border-right-color:#000}.layui-layer-tips i.layui-layer-TipsT{bottom:-8px}.layui-layer-tips i.layui-layer-TipsB{top:-8px}.layui-layer-tips i.layui-layer-TipsL,.layui-layer-tips i.layui-layer-TipsR{top:5px;border-bottom-style:solid;border-bottom-color:#000}.layui-layer-tips i.layui-layer-TipsR{left:-8px}.layui-layer-tips i.layui-layer-TipsL{right:-8px}.layui-layer-lan .layui-layer-title{background:#4476a7;color:#fff;border:none}.layui-layer-lan .layui-layer-btn{padding:5px 10px 10px;border-top:1px solid #e9e7e7}.layui-layer-lan .layui-layer-btn a{background:#fff;border-color:#e9e7e7;color:#333}.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#c9c5c5}.layui-layer-molv .layui-layer-title{background:#009f95;color:#fff;border:none}.layui-layer-molv .layui-layer-btn a{background:#009f95;border-color:#009f95}.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92b8b1}.layui-layer-lan .layui-layer-setwin .layui-icon,.layui-layer-molv .layui-layer-setwin .layui-icon{color:#fff}.layui-layer-win10{border:1px solid #aaa;box-shadow:1px 1px 6px rgba(0,0,0,.3);border-radius:none}.layui-layer-win10 .layui-layer-title{height:32px;line-height:32px;padding-left:8px;border-bottom:none;font-size:12px}.layui-layer-win10 .layui-layer-setwin{right:0;top:0}.layui-layer-win10 .layui-layer-setwin span{margin-left:0;width:32px;height:32px;padding:8px}.layui-layer-win10.layui-layer-page .layui-layer-setwin span{width:38px}.layui-layer-win10 .layui-layer-setwin span:hover{background-color:#e5e5e5}.layui-layer-win10 .layui-layer-setwin span.layui-icon-close:hover{background-color:#e81123;color:#fff}.layui-layer-win10.layui-layer-dialog .layui-layer-content{padding:8px 16px 32px;color:#0033bc}.layui-layer-win10.layui-layer-dialog .layui-layer-padding{padding-top:18px;padding-left:58px}.layui-layer-win10 .layui-layer-btn{padding:5px 5px 10px;border-top:1px solid #dfdfdf;background-color:#f0f0f0}.layui-layer-win10 .layui-layer-btn a{height:20px;line-height:18px;background-color:#e1e1e1;border-color:#adadad;color:#000;font-size:12px;transition:all .3s}.layui-layer-win10 .layui-layer-btn a:hover{border-color:#2a8edd;background-color:#e5f1fb}.layui-layer-win10 .layui-layer-btn .layui-layer-btn0{border-color:#0078d7}.layui-layer-prompt .layui-layer-input{display:block;width:260px;height:36px;margin:0 auto;line-height:30px;padding-left:10px;border:1px solid #e6e6e6;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px;padding:6px 10px}.layui-layer-prompt .layui-layer-content{padding:16px}.layui-layer-prompt .layui-layer-btn{padding-top:0}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;overflow:visible}.layui-layer-tab .layui-layer-title span{position:relative;display:inline-block;vertical-align:top;border-left:1px solid transparent;border-right:1px solid transparent;min-width:80px;max-width:300px;padding:0 16px;text-align:center;cursor:default;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;cursor:pointer}.layui-layer-tab .layui-layer-title span.layui-this{height:51px;border-left-color:#eee;border-right-color:#eee;background-color:#fff;z-index:10}.layui-layer-tab .layui-layer-title span:first-child{border-left-color:transparent}.layui-layer-tabmain{line-height:24px;clear:both}.layui-layer-tabmain .layui-layer-tabli{display:none}.layui-layer-tabmain .layui-layer-tabli.layui-this{display:block}.layui-layer-photos{background:0 0;box-shadow:none}.layui-layer-photos .layui-layer-content{overflow:visible;text-align:center}.layui-layer-photos .layer-layer-photos-main img{position:relative;width:100%;display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-photos-next,.layui-layer-photos-prev{position:fixed;top:50%;width:52px;height:52px;line-height:52px;margin-top:-26px;cursor:pointer;font-size:52px;color:#717171}.layui-layer-photos-prev{left:32px}.layui-layer-photos-next{right:32px}.layui-layer-photos-next:hover,.layui-layer-photos-prev:hover{color:#959595}.layui-layer-photos-toolbar{position:fixed;left:0;right:0;bottom:0;width:100%;height:52px;line-height:52px;background-color:#000\9;filter:Alpha(opacity=60);background-color:rgba(0,0,0,.32);color:#fff;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:0}.layui-layer-photos-toolbar>*{display:inline-block;vertical-align:top;padding:0 16px;font-size:12px;color:#fff;*display:inline;*zoom:1}.layui-layer-photos-toolbar *{font-size:12px}.layui-layer-photos-header{top:0;bottom:auto}.layui-layer-photos-header>span{cursor:pointer}.layui-layer-photos-header>span:hover{background-color:rgba(51,51,51,.32)}.layui-layer-photos-header .layui-icon{font-size:18px}.layui-layer-photos-footer>h3{max-width:65%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-layer-photos-footer a:hover{text-decoration:underline}.layui-layer-photos-footer em{font-style:normal}@-webkit-keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);-ms-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);-ms-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-close{-webkit-animation-name:layer-bounceOut;animation-name:layer-bounceOut;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@media screen and (max-width:1100px){.layui-layer-iframe{overflow-y:auto;-webkit-overflow-scrolling:touch}} \ No newline at end of file diff --git a/public/static/component/layui/layui.js b/public/static/component/layui/layui.js index fe749d3..8d7a860 100644 --- a/public/static/component/layui/layui.js +++ b/public/static/component/layui/layui.js @@ -1 +1 @@ -/** v2.8.8 | MIT Licensed */;!function(d){"use strict";var t,h=d.document,m={modules:{},status:{},timeout:10,event:{}},o=function(){this.v="2.8.8"},e=d.LAYUI_GLOBAL||{},v=(t=h.currentScript?h.currentScript.src:function(){for(var t,e=h.scripts,n=e.length-1,o=n;01e3*m.timeout/4?g(u+" is not a valid module","error"):void(m.status[u]?c():setTimeout(o,4))}())}function c(){e.push(layui[u]),11e3*m.timeout/4?g(u+" is not a valid module","error"):void("string"==typeof m.modules[u]&&m.status[u]?c():setTimeout(f,4))}():((p=h.createElement("script"))["async"]=!0,p.charset="utf-8",p.src=y+((i=!0===m.version?m.v||(new Date).getTime():m.version||"")?"?v="+i:""),a.appendChild(p),!p.attachEvent||p.attachEvent.toString&&p.attachEvent.toString().indexOf("[native code")<0||b?p.addEventListener("load",function(t){s(t,y)},!1):p.attachEvent("onreadystatechange",function(t){s(t,y)}),m.modules[u]=y),r},o.prototype.disuse=function(t){var n=this;return t=n.isArray(t)?t:[t],n.each(t,function(t,e){m.status[e],delete n[e],delete N[e],delete n.modules[e],delete m.status[e],delete m.modules[e]}),n},o.prototype.getStyle=function(t,e){t=t.currentStyle||d.getComputedStyle(t,null);return t[t.getPropertyValue?"getPropertyValue":"getAttribute"](e)},o.prototype.link=function(n,o,t){var r=this,e=h.getElementsByTagName("head")[0],i=h.createElement("link"),a="layuicss-"+((t="string"==typeof o?o:t)||n).replace(/\.|\//g,""),u="creating",l=0;return i.href=n+(m.debug?"?v="+(new Date).getTime():""),i.rel="stylesheet",i.id=a,i.media="all",h.getElementById(a)||e.appendChild(i),"function"!=typeof o||function s(t){var e=h.getElementById(a);return++l>1e3*m.timeout/100?g(n+" timeout"):void(1989===parseInt(r.getStyle(e,"width"))?(t===u&&e.removeAttribute("lay-status"),e.getAttribute("lay-status")===u?setTimeout(s,100):o()):(e.setAttribute("lay-status",u),setTimeout(function(){s(u)},100)))}(),r},o.prototype.addcss=function(t,e,n){return layui.link(m.dir+"css/"+t,e,n)},m.callback={},o.prototype.factory=function(t){if(layui[t])return"function"==typeof m.callback[t]?m.callback[t]:null},o.prototype.img=function(t,e,n){var o=new Image;if(o.src=t,o.complete)return e(o);o.onload=function(){o.onload=null,"function"==typeof e&&e(o)},o.onerror=function(t){o.onerror=null,"function"==typeof n&&n(t)}},o.prototype.config=function(t){for(var e in t=t||{})m[e]=t[e];return this},o.prototype.modules=function(){var t,e={};for(t in N)e[t]=N[t];return e}(),o.prototype.extend=function(t){for(var e in t=t||{})this[e]||this.modules[e]?g(e+" Module already exists","error"):this.modules[e]=t[e];return this},o.prototype.router=o.prototype.hash=function(t){var n={path:[],search:{},hash:((t=t||location.hash).match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(t)&&(t=t.replace(/^#\//,""),n.href="/"+t,t=t.replace(/([^#])(#.*$)/,"$1").split("/")||[],this.each(t,function(t,e){/^\w+=/.test(e)?(e=e.split("="),n.search[e[0]]=e[1]):n.path.push(e)})),n},o.prototype.url=function(t){var r,e,n=this;return{pathname:(t?((t.match(/\.[^.]+?\/.+/)||[])[0]||"").replace(/^[^\/]+/,"").replace(/\?.+/,""):location.pathname).replace(/^\//,"").split("/"),search:(r={},e=(t?((t.match(/\?.+/)||[])[0]||"").replace(/\#.+/,""):location.search).replace(/^\?+/,"").split("&"),n.each(e,function(t,e){var n=e.indexOf("="),o=n<0?e.substr(0,e.length):0!==n&&e.substr(0,n);o&&(r[o]=0(s.innerHeight||l.documentElement.clientHeight)},h.position=function(t,e,n){var i,r,o,c,u,a,f;e&&(n=n||{},t!==l&&t!==h("body")[0]||(n.clickType="right"),u="right"===n.clickType?{left:(u=n.e||s.event||{}).clientX,top:u.clientY,right:u.clientX,bottom:u.clientY}:t.getBoundingClientRect(),a=e.offsetWidth,f=e.offsetHeight,i=function(t){return l.body[t=t?"scrollLeft":"scrollTop"]|l.documentElement[t]},o=u.left,c=u.bottom,"center"===n.align?o-=(a-t.offsetWidth)/2:"right"===n.align&&(o=o-a+t.offsetWidth),(o=o+a+5>(r=function(t){return l.documentElement[t?"clientWidth":"clientHeight"]})("width")?r("width")-a-5:o)<5&&(o=5),c+f+5>r()&&(u.top>f+5?c=u.top-f-10:"right"===n.clickType?(c=r()-f-10)<0&&(c=0):c=5),(a=n.position)&&(e.style.position=a),e.style.left=o+("fixed"===a?0:i(1))+"px",e.style.top=c+("fixed"===a?0:i())+"px",h.hasScrollbar()||(f=e.getBoundingClientRect(),!n.SYSTEM_RELOAD&&f.bottom+5>r()&&(n.SYSTEM_RELOAD=!0,setTimeout(function(){h.position(t,e,n)},50))))},h.options=function(t,e){if(e="object"==typeof e?e:{attr:e},t===l)return{};var t=h(t),n=e.attr||"lay-options",t=t.attr(n);try{return new Function("return "+(t||"{}"))()}catch(i){return layui.hint().error(e.errorText||[n+'="'+t+'"',"\n parseerror: "+i].join("\n"),"error"),{}}},h.isTopElem=function(n){var t=[l,h("body")[0]],i=!1;return h.each(t,function(t,e){if(e===n)return i=!0}),i},r.addStr=function(n,t){return n=n.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),h.each(t,function(t,e){new RegExp("\\b"+e+"\\b").test(n)||(n=n+" "+e)}),n.replace(/^\s|\s$/,"")},r.removeStr=function(n,t){return n=n.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),h.each(t,function(t,e){e=new RegExp("\\b"+e+"\\b");e.test(n)&&(n=n.replace(e,""))}),n.replace(/\s+/," ").replace(/^\s|\s$/,"")},r.fn.find=function(n){var i=[],r="object"==typeof n;return this.each(function(t,e){e=r&&e.contains(n)?n:e.querySelectorAll(n||null);h.each(e,function(t,e){i.push(e)})}),h(i)},r.fn.each=function(t){return h.each.call(this,this,t)},r.fn.addClass=function(n,i){return this.each(function(t,e){e.className=r[i?"removeStr":"addStr"](e.className,n)})},r.fn.removeClass=function(t){return this.addClass(t,!0)},r.fn.hasClass=function(n){var i=!1;return this.each(function(t,e){new RegExp("\\b"+n+"\\b").test(e.className)&&(i=!0)}),i},r.fn.css=function(e,i){var t=this,r=function(t){return isNaN(t)?t:t+"px"};return"string"!=typeof e||i!==undefined?t.each(function(t,n){"object"==typeof e?h.each(e,function(t,e){n.style[t]=r(e)}):n.style[e]=r(i)}):0]|&(?=#[a-zA-Z0-9]+)/g.test(e+="")?e.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,"""):e}},i=function(e){return new RegExp(e,"g")},u=function(e,r){var n="Laytpl Error: ";return"object"==typeof console&&console.error(n+e+"\n"+(r||"")),n+e},n=function(e,r){var n=this,e=(n.config=n.config||{},n.template=e,function(e){for(var r in e)n.config[r]=e[r]});e(c),e(r)},r=(n.prototype.tagExp=function(e,r,n){var c=this.config;return i((r||"")+c.open+["#([\\s\\S])+?","([^{#}])*?"][e||0]+c.close+(n||""))},n.prototype.parse=function(e,r){var n=this,c=n.config,t=e,o=i("^"+c.open+"#",""),p=i(c.close+"$","");if("string"!=typeof e)return e;e='"use strict";var view = "'+(e=e.replace(/\s+|\r|\t|\n/g," ").replace(i(c.open+"#"),c.open+"# ").replace(i(c.close+"}"),"} "+c.close).replace(/\\/g,"\\\\").replace(i(c.open+"!(.+?)!"+c.close),function(e){return e=e.replace(i("^"+c.open+"!"),"").replace(i("!"+c.close),"").replace(i(c.open+"|"+c.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(n.tagExp(),function(e){return'";'+(e=e.replace(o,"").replace(p,"")).replace(/\\(.)/g,"$1")+';view+="'}).replace(n.tagExp(1),function(e){var r='"+laytpl.escape(';return e.replace(/\s/g,"")===c.open+c.close?"":(e=e.replace(i(c.open+"|"+c.close),""),/^=/.test(e)?e=e.replace(/^=/,""):/^-/.test(e)&&(e=e.replace(/^-/,""),r='"+('),r+e.replace(/\\(.)/g,"$1")+')+"')}))+'";return view;';try{return n.cache=e=new Function("d, laytpl",e),e(r,l)}catch(a){return delete n.cache,u(a,t)}},n.prototype.render=function(e,r){e=e||{};var n=this,e=n.cache?n.cache(e,l):n.parse(n.template,e);return"function"==typeof r&&r(e),e},function(e,r){return new n(e,r)});r.config=function(e){for(var r in e=e||{})c[r]=e[r]},r.v="2.0.0",e("laytpl",r)});layui.define(function(e){"use strict";var r=document,u="getElementById",c="getElementsByTagName",a="layui-disabled",t=function(e){var a=this;a.config=e||{},a.config.index=++o.index,a.render(!0)},o=(t.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return e.elem.length===undefined?2:3},t.prototype.view=function(){var t,i,n=this.config,r=n.groups="groups"in n?Number(n.groups)||0:5,u=(n.layout="object"==typeof n.layout?n.layout:["prev","page","next"],n.count=Number(n.count)||0,n.curr=Number(n.curr)||1,n.limits="object"==typeof n.limits?n.limits:[10,20,30,40,50],n.limit=Number(n.limit)||10,n.pages=Math.ceil(n.count/n.limit)||1,n.curr>n.pages?n.curr=n.pages:n.curr<1&&(n.curr=1),r<0?r=1:r>n.pages&&(r=n.pages),n.prev="prev"in n?n.prev:"上一页",n.next="next"in n?n.next:"下一页",n.pages>r?Math.ceil((n.curr+(1'+n.prev+"":"",page:function(){var e=[];if(n.count<1)return"";1'+(n.first||1)+"");var a=Math.floor((r-1)/2),t=1n.pages?n.pages:a:r;for(i-t…');t<=i;t++)t===n.curr?e.push('"+t+""):e.push(''+t+"");return n.pages>r&&n.pages>i&&!1!==n.last&&(i+1…'),0!==r&&e.push(''+(n.last||n.pages)+"")),e.join("")}(),next:n.next?''+n.next+"":"",count:'\u5171 '+n.count+" \u6761",limit:(t=['"),refresh:['','',""].join(""),skip:['到第','','页',""].join("")};return['
',(i=[],layui.each(n.layout,function(e,a){l[a]&&i.push(l[a])}),i.join("")),"
"].join("")},t.prototype.jump=function(e,a){if(e){var t=this,i=t.config,n=e.children,r=e[c]("button")[0],u=e[c]("input")[0],e=e[c]("select")[0],l=function(){var e=Number(u.value.replace(/\s|\D/g,""));e&&(i.curr=e,t.render())};if(a)return l();for(var s=0,p=n.length;si.pages||(i.curr=e,t.render())});e&&o.on(e,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),r&&o.on(r,"click",function(){l()})}},t.prototype.skip=function(t){var i,e;t&&(i=this,(e=t[c]("input")[0])&&o.on(e,"keyup",function(e){var a=this.value,e=e.keyCode;/^(37|38|39|40)$/.test(e)||(/\D/.test(a)&&(this.value=a.replace(/\D/,"")),13===e&&i.jump(t,!0))}))},t.prototype.render=function(e){var a=this,t=a.config,i=a.type(),n=a.view(),i=(2===i?t.elem&&(t.elem.innerHTML=n):3===i?t.elem.html(n):r[u](t.elem)&&(r[u](t.elem).innerHTML=n),t.jump&&t.jump(t,e),r[u]("layui-laypage-"+t.index));a.jump(i),t.hash&&!e&&(location.hash="!"+t.hash+"="+t.curr),a.skip(i)},{render:function(e){return new t(e).index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(a,e,t){return a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1),this}});e("laypage",o)});!function(i,v){"use strict";var n=i.layui&&layui.define,l={getPath:i.lay&&lay.getPath?lay.getPath:"",link:function(e,t,a){D.path&&i.lay&&lay.layui&&lay.layui.link(D.path+e,t,a)}},e=i.LAYUI_GLOBAL||{},d="layui-laydate-id",D={v:"5.5.0",config:{weekStart:0},index:i.laydate&&i.laydate.v?1e5:0,path:e.laydate_dir||l.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var t="laydate",a=(n?"modules/":"")+"laydate.css?v="+D.v;return n?layui["layui.all"]?"function"==typeof e&&e():layui.addcss(a,e,t):l.link(a,e,t),this}},s=function(){var t=this,e=t.config.id;return(s.that[e]=t).inst={hint:function(e){t.hint.call(t,e)},reload:function(e){t.reload.call(t,e)},config:t.config}},a="laydate",x="layui-this",k="laydate-disabled",h=[100,2e5],T="layui-laydate-static",w="layui-laydate-list",o="laydate-selected",r="layui-laydate-hint",y="laydate-day-prev",m="laydate-day-next",C=".laydate-btns-confirm",M="laydate-time-text",L="laydate-btns-time",E="layui-laydate-preview",S="layui-laydate-shade",I=function(e){var t,a=this,n=(a.index=++D.index,a.config=lay.extend({},a.config,D.config,e),lay(e.elem||a.config.elem));return 1\u8bf7\u91cd\u65b0\u9009\u62e9",invalidDate:"\u4e0d\u5728\u6709\u6548\u65e5\u671f\u6216\u65f6\u95f4\u8303\u56f4\u5185",formatError:["\u65e5\u671f\u683c\u5f0f\u4e0d\u5408\u6cd5
\u5fc5\u987b\u9075\u5faa\u4e0b\u8ff0\u683c\u5f0f\uff1a
","
\u5df2\u4e3a\u4f60\u91cd\u7f6e"],preview:"\u5f53\u524d\u9009\u4e2d\u7684\u7ed3\u679c"},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
Please re-select",invalidDate:"Invalid date",formatError:["The date format error
Must be followed\uff1a
","
It has been reset"],preview:"The selected result"}};return e[this.config.lang]||e.cn},I.prototype.reload=function(e){this.config=lay.extend({},this.config,e),this.init()},I.prototype.init=function(){var r=this,o=r.config,e="static"===o.position,t={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};o.elem=lay(o.elem),o.eventElem=lay(o.eventElem),o.elem[0]&&("array"!==layui.type(o.theme)&&(o.theme=[o.theme]),o.fullPanel&&("datetime"!==o.type||o.range)&&delete o.fullPanel,r.rangeStr=o.range?"string"==typeof o.range?o.range:"-":"",r.rangeLinked=!(!o.range||!o.rangeLinked||"date"!==o.type&&"datetime"!==o.type),r.autoCalendarModel=function(){var e=r.rangeLinked;return r.rangeLinked=o.range&&("date"===o.type||"datetime"===o.type)&&(!r.startDate||!r.endDate||r.startDate&&r.endDate&&r.startDate.year===r.endDate.year&&r.startDate.month===r.endDate.month),lay(r.elem)[r.rangeLinked?"addClass":"removeClass"]("layui-laydate-linkage"),r.rangeLinked!=e},r.autoCalendarModel.auto=r.rangeLinked&&"auto"===o.rangeLinked,"array"===layui.type(o.range)&&(r.rangeElem=[lay(o.range[0]),lay(o.range[1])]),t[o.type]||(i.console&&console.error&&console.error("laydate type error:'"+o.type+"' is not supported"),o.type="date"),o.format===t.date&&(o.format=t[o.type]||t.date),r.format=s.formatArr(o.format),o.weekStart&&!/^[0-6]$/.test(o.weekStart)&&(t=r.lang(),o.weekStart=t.weeks.indexOf(o.weekStart),-1===o.weekStart&&(o.weekStart=0)),r.EXP_IF="",r.EXP_SPLIT="",lay.each(r.format,function(e,t){e=new RegExp(c).test(t)?"\\d{"+(new RegExp(c).test(r.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(t)?4:t.length:/^yyyy$/.test(t)?"1,4":/^y$/.test(t)?"1,308":"1,2")+"}":"\\"+t;r.EXP_IF=r.EXP_IF+e,r.EXP_SPLIT=r.EXP_SPLIT+"("+e+")"}),r.EXP_IF_ONE=new RegExp("^"+r.EXP_IF+"$"),r.EXP_IF=new RegExp("^"+(o.range?r.EXP_IF+"\\s\\"+r.rangeStr+"\\s"+r.EXP_IF:r.EXP_IF)+"$"),r.EXP_SPLIT=new RegExp("^"+r.EXP_SPLIT+"$",""),r.isInput(o.elem[0])||"focus"===o.trigger&&(o.trigger="click"),o.elem.attr("lay-key",r.index),o.eventElem.attr("lay-key",r.index),o.elem.attr(d,o.id),o.mark=lay.extend({},o.calendar&&"cn"===o.lang?{"0-1-1":"\u5143\u65e6","0-2-14":"\u60c5\u4eba","0-3-8":"\u5987\u5973","0-3-12":"\u690d\u6811","0-4-1":"\u611a\u4eba","0-5-1":"\u52b3\u52a8","0-5-4":"\u9752\u5e74","0-6-1":"\u513f\u7ae5","0-9-10":"\u6559\u5e08","0-10-1":"\u56fd\u5e86","0-12-25":"\u5723\u8bde"}:{},o.mark),lay.each(["min","max"],function(e,t){var a=[],n=[];if("number"==typeof o[t])var i=o[t],l=new Date,l=r.newDate({year:l.getFullYear(),month:l.getMonth(),date:l.getDate(),hours:e?23:0,minutes:e?59:0,seconds:e?59:0}).getTime(),e=new Date(i?i<864e5?l+864e5*i:i:l),a=[e.getFullYear(),e.getMonth()+1,e.getDate()],n=[e.getHours(),e.getMinutes(),e.getSeconds()];else if("string"==typeof o[t])a=(o[t].match(/\d+-\d+-\d+/)||[""])[0].split("-"),n=(o[t].match(/\d+:\d+:\d+/)||[""])[0].split(":");else if("object"==typeof o[t])return o[t];o[t]={year:0|a[0]||(new Date).getFullYear(),month:a[1]?(0|a[1])-1:(new Date).getMonth(),date:0|a[2]||(new Date).getDate(),hours:0|n[0],minutes:0|n[1],seconds:0|n[2]}}),r.elemID="layui-laydate"+o.elem.attr("lay-key"),(o.show||e)&&r.render(),e||r.events(),o.value&&o.isInitValue&&("date"===layui.type(o.value)?r.setValue(r.parse(0,r.systemDate(o.value))):r.setValue(o.value)))},I.prototype.render=function(){var a,n,i,l,r=this,o=r.config,d=r.lang(),s="static"===o.position,y=r.elem=lay.elem("div",{id:r.elemID,"class":["layui-laydate",o.range?" layui-laydate-range":"",r.rangeLinked?" layui-laydate-linkage":"",s?" "+T:"",o.fullPanel?" laydate-theme-fullpanel":"",(a="",lay.each(o.theme,function(e,t){"default"===t||/^#/.test(t)||(a+=" laydate-theme-"+t)}),a)].join("")}),m=r.elemMain=[],c=r.elemHeader=[],u=r.elemCont=[],h=r.table=[],e=r.footer=lay.elem("div",{"class":"layui-laydate-footer"}),t=r.shortcut=lay.elem("ul",{"class":"layui-laydate-shortcut"}),f=(o.zIndex&&(y.style.zIndex=o.zIndex),lay.each(new Array(2),function(e){if(!o.range&&0'+d.timeTips+""),(o.range||"datetime"!==o.type||o.fullPanel)&&f.push(''),lay.each(o.btns,function(e,t){var a=d.tools[t]||"btn";o.range&&"now"===t||(s&&"clear"===t&&(a="cn"===o.lang?"\u91cd\u7f6e":"Reset"),n.push(''+a+""))}),f.push('"),f.join(""))),o.shortcuts&&(y.appendChild(t),lay(t).html((i=[],lay.each(o.shortcuts,function(e,t){i.push('
  • '+t.text+"
  • ")}),i.join(""))).find("li").on("click",function(e){var t=(o.shortcuts[this.dataset.index]||{}).value||[],n=(layui.isArray(t)||(t=[t]),o.type),t=(lay.each(t,function(e,t){var a=[o.dateTime,r.endDate][e];"time"===n&&"date"!==layui.type(t)?r.EXP_IF.test(t)&&(t=(t.match(r.EXP_SPLIT)||[]).slice(1),lay.extend(a,{hours:0|t[0],minutes:0|t[2],seconds:0|t[4]})):lay.extend(a,r.systemDate("date"===layui.type(t)?t:new Date(t))),"time"!==n&&"datetime"!==n||(r[["startTime","endTime"][e]]={hours:a.hours,minutes:a.minutes,seconds:a.seconds}),0===e?r.startDate=lay.extend({},a):r.endState=!0,"year"===n||"month"===n||"time"===n?r.listYM[e]=[a.year,a.month+1]:e&&r.autoCalendarModel.auto&&r.autoCalendarModel()}),r.checkDate("limit").calendar(null,null,"init"),lay(r.footer).find("."+L).removeClass(k));t&&"date"===t.attr("lay-type")&&t[0].click(),r.done(null,"change"),lay(this).addClass(x),"static"!==o.position&&r.setValue(r.parse()).done().remove()})),lay.each(m,function(e,t){y.appendChild(t)}),o.showBottom&&y.appendChild(e),lay.elem("style")),p=[],g=!0,t=(lay.each(o.theme,function(e,t){if(g&&/^#/.test(t))return g=!(l=!0),void p.push(["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} li.layui-this,#{{id}} td.layui-this>div{background-color:{{theme}} !important;}",-1!==o.theme.indexOf("circle")?"":"#{{id}} .layui-this{background-color:{{theme}} !important;}","#{{id}} .laydate-day-now{color:{{theme}} !important;}","#{{id}} .laydate-day-now:after{border-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,r.elemID).replace(/{{theme}}/g,t));!g&&/^#/.test(t)&&p.push(["#{{id}} .laydate-selected>div{background-color:{{theme}} !important;}","#{{id}} .laydate-selected:hover>div{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,r.elemID).replace(/{{theme}}/g,t))}),o.shortcuts&&o.range&&p.push("#{{id}}.layui-laydate-range{width: 628px;}".replace(/{{id}}/g,r.elemID)),p.length&&(p=p.join(""),"styleSheet"in f?(f.setAttribute("type","text/css"),f.styleSheet.cssText=p):f.innerHTML=p,l&&lay(y).addClass("laydate-theme-molv"),y.appendChild(f)),r.remove(I.thisElemDate),D.thisId=o.id,s?o.elem.append(y):(v.body.appendChild(y),r.position()),o.shade?'
    ':"");y.insertAdjacentHTML("beforebegin",t),r.checkDate().calendar(null,0,"init"),r.changeEvent(),I.thisElemDate=r.elemID,r.renderAdditional(),"function"==typeof o.ready&&o.ready(lay.extend({},o.dateTime,{month:o.dateTime.month+1})),r.preview()},I.prototype.remove=function(e){var t=this,a=t.config,n=lay("#"+(e||t.elemID));return n[0]&&(n.hasClass(T)||t.checkDate(function(){n.remove(),delete t.startDate,delete t.endDate,delete t.endState,delete t.startTime,delete t.endTime,delete D.thisId,"function"==typeof a.close&&a.close(t)}),lay("."+S).remove()),t},I.prototype.position=function(){var e=this.config;return lay.position(e.elem[0],this.elem,{position:e.position}),this},I.prototype.hint=function(e){var t=this,a=(t.config,lay.elem("div",{"class":r}));t.elem&&(a.innerHTML=(e="object"==typeof e?e||{}:{content:e}).content||"",lay(t.elem).find("."+r).remove(),t.elem.appendChild(a),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+r).remove()},"ms"in e?e.ms:3e3))},I.prototype.getAsYM=function(e,t,a){return a?t--:t++,t<0&&(t=11,e--),11h[1]&&(e.year=h[1],o=!0),11t&&(e.date=t,o=!0))},r=function(n,i,l){var r=["startTime","endTime"];i=(i.match(d.EXP_SPLIT)||[]).slice(1),l=l||0,s.range&&(d[r[l]]=d[r[l]]||{}),lay.each(d.format,function(e,t){var a=parseFloat(i[e]);i[e].lengthd.getDateTime(s.max)?(n=s.dateTime=lay.extend({},s.max),c=!0):d.getDateTime(n)d.getDateTime(s.max))&&(d.endDate=lay.extend({},s.max),c=!0),d.startTime={hours:s.dateTime.hours,minutes:s.dateTime.minutes,seconds:s.dateTime.seconds},d.endTime={hours:d.endDate.hours,minutes:d.endDate.minutes,seconds:d.endDate.seconds},"month"===s.type&&(s.dateTime.date=1,d.endDate.date=1)),c&&l&&(d.setValue(d.parse()),d.hint("value "+a.invalidDate+a.formatError[1])),d.startDate=d.startDate||l&&lay.extend({},s.dateTime),d.autoCalendarModel.auto&&d.autoCalendarModel(),d.endState=!s.range||!d.rangeLinked||!(!d.startDate||!d.endDate),e&&e(),d},I.prototype.mark=function(e,a){var n,t=this.config;return lay.each(t.mark,function(e,t){e=e.split("-");e[0]!=a[0]&&0!=e[0]||e[1]!=a[1]&&0!=e[1]||e[2]!=a[2]||(n=t||a[2])}),n&&e.find("div").html(''+n+""),this},I.prototype.holidays=function(n,i){var e=this.config,l=["","work"];return"array"!==layui.type(e.holidays)||lay.each(e.holidays,function(a,e){lay.each(e,function(e,t){t===n.attr("lay-ymd")&&n.find("div").html('"+i[2]+"")})}),this},I.prototype.limit=function(t){t=t||{};var i=this,e=i.config,l={},a=t.index>(t.time?0:41)?i.endDate:e.dateTime;return lay.each({now:lay.extend({},a,t.date||{}),min:e.min,max:e.max},function(e,a){var n;l[e]=i.newDate(lay.extend({year:a.year,month:"year"===t.type?0:a.month,date:"year"===t.type||"month"===t.type?1:a.date},(n={},lay.each(t.time,function(e,t){n[t]=a[t]}),n))).getTime()}),a=l.nowl.max,t.elem&&t.elem[a?"addClass":"removeClass"](k),a},I.prototype.thisDateTime=function(e){var t=this.config;return e?this.endDate:t.dateTime},I.prototype.calendar=function(e,t,a){var i,l,r,o=this,n=o.config,t=t?1:0,d=e||o.thisDateTime(t),s=new Date,y=o.lang(),m="date"!==n.type&&"datetime"!==n.type,c=lay(o.table[t]).find("td"),u=lay(o.elemHeader[t][2]).find("span");return d.yearh[1]&&(d.year=h[1],o.hint(y.invalidDate)),o.firstDate||(o.firstDate=lay.extend({},d)),s.setFullYear(d.year,d.month,1),i=(s.getDay()+(7-n.weekStart))%7,l=D.getEndDate(d.month||12,d.year),r=D.getEndDate(d.month+1,d.year),lay.each(c,function(e,t){var a=[d.year,d.month],n=0;(t=lay(t)).removeAttr("class"),e"+a[2]+""),o.mark(t,a).holidays(t,a).limit({elem:t,date:{year:a[0],month:a[1]-1,date:a[2]},index:e})}),lay(u[0]).attr("lay-ym",d.year+"-"+(d.month+1)),lay(u[1]).attr("lay-ym",d.year+"-"+(d.month+1)),"cn"===n.lang?(lay(u[0]).attr("lay-type","year").html(d.year+" \u5e74"),lay(u[1]).attr("lay-type","month").html(d.month+1+" \u6708")):(lay(u[0]).attr("lay-type","month").html(y.month[d.month]),lay(u[1]).attr("lay-type","year").html(d.year)),m&&(n.range?!e&&"init"===a||(o.listYM=[[(o.startDate||n.dateTime).year,(o.startDate||n.dateTime).month+1],[o.endDate.year,o.endDate.month+1]],o.list(n.type,0).list(n.type,1),"time"===n.type?o.setBtnStatus("\u65f6\u95f4",lay.extend({},o.systemDate(),o.startTime),lay.extend({},o.systemDate(),o.endTime)):o.setBtnStatus(!0)):(o.listYM=[[d.year,d.month+1]],o.list(n.type,0))),n.range&&"init"===a&&(o.rangeLinked?(s=o.getAsYM(d.year,d.month,t?"sub":null),o.calendar(lay.extend({},d,{year:s[0],month:s[1]}),1-t)):o.calendar(null,1-t)),n.range||(c=["hours","minutes","seconds"],o.limit({elem:lay(o.footer).find(".laydate-btns-now"),date:o.systemDate(),index:0,time:c}),o.limit({elem:lay(o.footer).find(C),index:0,time:c})),o.setBtnStatus(),lay(o.shortcut).find("li."+x).removeClass(x),n.range&&!m&&"init"!==a&&o.stampRange(),o},I.prototype.list=function(n,i){var l,r,e,o,d=this,s=d.config,y=d.rangeLinked?s.dateTime:[s.dateTime,d.endDate][i],m=d.lang(),t=s.range&&"date"!==s.type&&"datetime"!==s.type,c=lay.elem("ul",{"class":w+" "+{year:"laydate-year-list",month:"laydate-month-list",time:"laydate-time-list"}[n]}),a=d.elemHeader[i],u=lay(a[2]).find("span"),h=d.elemCont[i||0],f=lay(h).find("."+w)[0],p="cn"===s.lang,g=p?"\u5e74":"",v=d.listYM[i]||{},D=["hours","minutes","seconds"],T=["startTime","endTime"][i];return v[0]<1&&(v[0]=1),"year"===n?(e=l=v[0]-7,l<1&&(e=l=1),lay.each(new Array(15),function(e){var t=lay.elem("li",{"lay-ym":l}),a={year:l,month:0,date:1};l==v[0]&&lay(t).addClass(x),t.innerHTML=l+g,c.appendChild(t),d.limit({elem:lay(t),date:a,index:i,type:n}),l++}),lay(u[p?0:1]).attr("lay-ym",l-8+"-"+v[1]).html(e+g+" - "+(l-1)+g)):"month"===n?(lay.each(new Array(12),function(e){var t=lay.elem("li",{"lay-ym":e}),a={year:v[0],month:e,date:1};e+1==v[1]&&lay(t).addClass(x),t.innerHTML=m.month[e]+(p?"\u6708":""),c.appendChild(t),d.limit({elem:lay(t),date:a,index:i,type:n})}),lay(u[p?0:1]).attr("lay-ym",v[0]+"-"+v[1]).html(v[0]+g)):"time"===n&&(r=function(){lay(c).find("ol").each(function(a,e){lay(e).find("li").each(function(e,t){d.limit({elem:lay(t),date:[{hours:e},{hours:d[T].hours,minutes:e},{hours:d[T].hours,minutes:d[T].minutes,seconds:e}][a],index:i,time:[["hours"],["hours","minutes"],["hours","minutes","seconds"]][a]})})}),s.range||d.limit({elem:lay(d.footer).find(C),date:d[T],inedx:0,time:["hours","minutes","seconds"]})},s.range?d[T]||(d[T]="startTime"===T?y:d.endDate):d[T]=y,lay.each([24,60,60],function(t,e){var a=lay.elem("li"),n=["

    "+m.time[t]+"

      "];lay.each(new Array(e),function(e){n.push(""+lay.digit(e,2)+"")}),a.innerHTML=n.join("")+"
    ",c.appendChild(a)}),r()),f&&h.removeChild(f),h.appendChild(c),"year"===n||"month"===n?(lay(d.elemMain[i]).addClass("laydate-ym-show"),lay(c).find("li").on("click",function(){var e=0|lay(this).attr("lay-ym");lay(this).hasClass(k)||(d.rangeLinked?lay.extend(y,{year:"year"===n?e:v[0],month:"year"===n?v[1]-1:e}):y[n]=e,"year"===s.type||"month"===s.type?(lay(c).find("."+x).removeClass(x),lay(this).addClass(x),"month"===s.type&&"year"===n&&(d.listYM[i][0]=e,t&&((i?d.endDate:y).year=e),d.list("month",i))):(d.checkDate("limit").calendar(y,i,"init"),d.closeList()),d.setBtnStatus(),!s.range&&s.autoConfirm&&("month"===s.type&&"month"===n||"year"===s.type&&"year"===n)&&d.setValue(d.parse()).done().remove(),d.autoCalendarModel.auto&&!d.rangeLinked?d.choose(lay(h).find("td.layui-this"),i):d.endState&&d.done(null,"change"),lay(d.footer).find("."+L).removeClass(k))})):(e=lay.elem("span",{"class":M}),o=function(){lay(c).find("ol").each(function(e){var a=this,t=lay(a).find("li");a.scrollTop=30*(d[T][D[e]]-2),a.scrollTop<=0&&t.each(function(e,t){if(!lay(this).hasClass(k))return a.scrollTop=30*(e-2),!0})})},u=lay(a[2]).find("."+M),o(),e.innerHTML=s.range?[m.startTime,m.endTime][i]:m.timeTips,lay(d.elemMain[i]).addClass("laydate-time-show"),u[0]&&u.remove(),a[2].appendChild(e),lay(c).find("ol").each(function(t){var a=this;lay(a).find("li").on("click",function(){var e=0|this.innerHTML;lay(this).hasClass(k)||(s.range?d[T][D[t]]=e:y[D[t]]=e,lay(a).find("."+x).removeClass(x),lay(this).addClass(x),r(),o(),(d.endDate||"time"===s.type||"datetime"===s.type&&s.fullPanel)&&d.done(null,"change"),d.setBtnStatus())})})),d},I.prototype.listYM=[],I.prototype.closeList=function(){var a=this;a.config;lay.each(a.elemCont,function(e,t){lay(this).find("."+w).remove(),lay(a.elemMain[e]).removeClass("laydate-ym-show laydate-time-show")}),lay(a.elem).find("."+M).remove()},I.prototype.setBtnStatus=function(e,t,a){var n=this,i=n.config,l=n.lang(),r=lay(n.footer).find(C);i.range&&"time"!==i.type&&(t=t||(n.rangeLinked?n.startDate:i.dateTime),a=a||n.endDate,i=!n.endState||n.newDate(t).getTime()>n.newDate(a).getTime(),n.limit({date:t})||n.limit({date:a})?r.addClass(k):r[i?"addClass":"removeClass"](k),e&&i&&n.hint("string"==typeof e?l.timeout.replace(/\u65e5\u671f/g,e):l.timeout))},I.prototype.parse=function(e,t){var a=this,n=a.config,t=t||("end"==e?lay.extend({},a.endDate,a.endTime):n.range?lay.extend({},a.rangeLinked?a.startDate:n.dateTime,a.startTime):n.dateTime),t=D.parse(t,a.format,1);return n.range&&e===undefined?t+" "+a.rangeStr+" "+a.parse("end"):t},I.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},I.prototype.getDateTime=function(e){return this.newDate(e).getTime()},I.prototype.setValue=function(e){var t=this,a=t.config,n=a.elem[0];return"static"===a.position||(e=e||"",t.isInput(n)?lay(n).val(e):(a=t.rangeElem)?("array"!==layui.type(e)&&(e=e.split(" "+t.rangeStr+" ")),a[0].val(e[0]||""),a[1].val(e[1]||"")):(0===lay(n).find("*").length&&lay(n).html(e),lay(n).attr("lay-date",e))),t},I.prototype.preview=function(){var e,t=this,a=t.config;a.isPreview&&(e=lay(t.elem).find("."+E),a=!a.range||(t.rangeLinked?t.endState:t.endDate)?t.parse():"",e.html(a),e.html()&&(e.css({color:"#16b777"}),setTimeout(function(){e.css({color:"#777"})},300)))},I.prototype.renderAdditional=function(){this.config.fullPanel&&this.list("time",0)},I.prototype.stampRange=function(){var n,i=this,l=i.config,r=i.rangeLinked?i.startDate:l.dateTime,e=lay(i.elem).find("td");l.range&&!i.endState&&lay(i.footer).find(C).addClass(k),r=r&&i.newDate({year:r.year,month:r.month,date:r.date}).getTime(),n=i.endState&&i.endDate&&i.newDate({year:i.endDate.year,month:i.endDate.month,date:i.endDate.date}).getTime(),lay.each(e,function(e,t){var a=lay(t).attr("lay-ymd").split("-"),a=i.newDate({year:a[0],month:a[1]-1,date:a[2]}).getTime();l.rangeLinked&&!i.startDate&&a===i.newDate(i.systemDate()).getTime()&&lay(t).addClass(lay(t).hasClass(y)||lay(t).hasClass(m)?"":"laydate-day-now"),lay(t).removeClass(o+" "+x),a!==r&&a!==n||(i.rangeLinked||!i.rangeLinked&&(e<42?a===r:a===n))&&lay(t).addClass(lay(t).hasClass(y)||lay(t).hasClass(m)?o:x),rn.getDateTime(i.max)&&(n[t]={hours:i.max.hours,minutes:i.max.minutes,seconds:i.max.seconds},lay.extend(l,n[t])))}),a||(n.startDate=lay.extend({},l)),n.endState&&!n.limit({date:n.thisDateTime(1-a)})&&(((r=n.endState&&n.autoCalendarModel.auto?n.autoCalendarModel():r)||n.rangeLinked&&n.endState)&&n.newDate(n.startDate)>n.newDate(n.endDate)&&(e=n.startDate.year===n.endDate.year&&n.startDate.month===n.endDate.month&&n.startDate.date===n.endDate.date,o=n.startDate,n.startDate=lay.extend({},n.endDate,e?{}:n.startTime),i.dateTime=lay.extend({},n.startDate),n.endDate=lay.extend({},o,e?{}:n.endTime),e&&(o=n.startTime,n.startTime=n.endTime,n.endTime=o)),r&&(i.dateTime=lay.extend({},n.startDate))),n.rangeLinked?(e=lay.extend({},l),!t||a||r||(o=n.getAsYM(l.year,l.month,"sub"),lay.extend(i.dateTime,{year:o[0],month:o[1]})),n.calendar(e,t,r?"init":null)):n.calendar(null,a,r?"init":null),n.endState&&n.done(null,"change")):"static"===i.position?n.calendar().done().done(null,"change"):"date"===i.type?i.autoConfirm?n.setValue(n.parse()).done().remove():n.calendar().done(null,"change"):"datetime"===i.type&&n.calendar().done(null,"change"))},I.prototype.tool=function(t,e){var a=this,n=a.config,i=a.lang(),l=n.dateTime,r="static"===n.position,o={datetime:function(){lay(t).hasClass(k)||(a.list("time",0),n.range&&a.list("time",1),lay(t).attr("lay-type","date").html(a.lang().dateTips))},date:function(){a.closeList(),lay(t).attr("lay-type","datetime").html(a.lang().timeTips)},clear:function(){r&&(lay.extend(l,a.firstDate),a.calendar()),n.range&&(delete n.dateTime,delete a.endDate,delete a.startTime,delete a.endTime),a.setValue(""),a.done(null,"onClear").done(["",{},{}]).remove()},now:function(){var e=new Date;if(lay(t).hasClass(k))return a.hint(i.tools.now+", "+i.invalidDate);lay.extend(l,a.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),a.setValue(a.parse()),r&&a.calendar(),a.done(null,"onNow").done().remove()},confirm:function(){if(n.range){if(lay(t).hasClass(k))return a.hint("time"===n.type?i.timeout.replace(/\u65e5\u671f/g,"\u65f6\u95f4"):i.timeout)}else if(lay(t).hasClass(k))return a.hint(i.invalidDate);a.setValue(a.parse()),a.done(null,"onConfirm").done().remove()}};o[e]&&o[e]()},I.prototype.change=function(n){var i=this,l=i.config,r=i.thisDateTime(n),o=l.range&&("year"===l.type||"month"===l.type),d=i.elemCont[n||0],s=i.listYM[n],e=function(e){var t=lay(d).find(".laydate-year-list")[0],a=lay(d).find(".laydate-month-list")[0];return t&&(s[0]=e?s[0]-15:s[0]+15,i.list("year",n)),a&&(e?s[0]--:s[0]++,i.list("month",n)),(t||a)&&(lay.extend(r,{year:s[0]}),o&&(r.year=s[0]),l.range||i.done(null,"change"),l.range||i.limit({elem:lay(i.footer).find(C),date:{year:s[0]}})),i.setBtnStatus(),t||a};return{prevYear:function(){e("sub")||(i.rangeLinked?(l.dateTime.year--,i.checkDate("limit").calendar(null,null,"init")):(r.year--,i.checkDate("limit").calendar(null,n),i.autoCalendarModel.auto?i.choose(lay(d).find("td.layui-this"),n):i.done(null,"change")))},prevMonth:function(){i.rangeLinked&&(r=l.dateTime);var e=i.getAsYM(r.year,r.month,"sub");lay.extend(r,{year:e[0],month:e[1]}),i.checkDate("limit").calendar(null,null,"init"),i.rangeLinked||(i.autoCalendarModel.auto?i.choose(lay(d).find("td.layui-this"),n):i.done(null,"change"))},nextMonth:function(){i.rangeLinked&&(r=l.dateTime);var e=i.getAsYM(r.year,r.month);lay.extend(r,{year:e[0],month:e[1]}),i.checkDate("limit").calendar(null,null,"init"),i.rangeLinked||(i.autoCalendarModel.auto?i.choose(lay(d).find("td.layui-this"),n):i.done(null,"change"))},nextYear:function(){e()||(i.rangeLinked?(l.dateTime.year++,i.checkDate("limit").calendar(null,0,"init")):(r.year++,i.checkDate("limit").calendar(null,n),i.autoCalendarModel.auto?i.choose(lay(d).find("td.layui-this"),n):i.done(null,"change")))}}},I.prototype.changeEvent=function(){var i=this;i.config;lay(i.elem).on("click",function(e){lay.stope(e)}).on("mousedown",function(e){lay.stope(e)}),lay.each(i.elemHeader,function(n,e){lay(e[0]).on("click",function(e){i.change(n).prevYear()}),lay(e[1]).on("click",function(e){i.change(n).prevMonth()}),lay(e[2]).find("span").on("click",function(e){var t=lay(this),a=t.attr("lay-ym"),t=t.attr("lay-type");a&&(a=a.split("-"),i.listYM[n]=[0|a[0],0|a[1]],i.list(t,n),lay(i.footer).find("."+L).addClass(k))}),lay(e[3]).on("click",function(e){i.change(n).nextMonth()}),lay(e[4]).on("click",function(e){i.change(n).nextYear()})}),lay.each(i.table,function(e,t){lay(t).find("td").on("click",function(){i.choose(lay(this),e)})}),lay(i.footer).find("span").on("click",function(){var e=lay(this).attr("lay-type");i.tool(this,e)})},I.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())||/INPUT|TEXTAREA/.test(e.tagName)},I.prototype.events=function(){var e,t=this,a=t.config;a.elem[0]&&!a.elem[0].eventHandler&&(a.elem.on(a.trigger,e=function(){D.thisId!==a.id&&t.render()}),a.elem[0].eventHandler=!0,a.eventElem.on(a.trigger,e),t.unbind=function(){t.remove(),a.elem.off(a.trigger,e),a.elem.removeAttr("lay-key"),a.elem.removeAttr(d),a.elem[0].eventHandler=!1,a.eventElem.off(a.trigger,e),a.eventElem.removeAttr("lay-key"),delete s.that[a.id]})},s.that={},s.getThis=function(e){var t=s.that[e];return!t&&n&&layui.hint().error(e?a+" instance with ID '"+e+"' not found":"ID argument required"),t},l.run=function(n){n(v).on("mousedown",function(e){var t,a;!D.thisId||(t=s.getThis(D.thisId))&&(a=t.config,e.target!==a.elem[0]&&e.target!==a.eventElem[0]&&e.target!==n(a.closeStop)[0]&&t.remove())}).on("keydown",function(e){var t;!D.thisId||(t=s.getThis(D.thisId))&&"static"!==t.config.position&&13===e.keyCode&&n("#"+t.elemID)[0]&&t.elemID===I.thisElemDate&&(e.preventDefault(),n(t.footer).find(C)[0].click())}),n(i).on("resize",function(){if(D.thisId){var e=s.getThis(D.thisId);if(e)return!(!e.elem||!n(".layui-laydate")[0])&&void e.position()}})},D.render=function(e){e=new I(e);return s.call(e)},D.reload=function(e,t){e=s.getThis(e);if(e)return e.reload(t)},D.getInst=function(e){e=s.getThis(e);if(e)return e.inst},D.hint=function(e,t){e=s.getThis(e);if(e)return e.hint(t)},D.unbind=function(e){e=s.getThis(e);if(e)return e.unbind()},D.close=function(e){e=s.getThis(e||D.thisId);if(e)return e.remove()},D.parse=function(a,n,i){return a=a||{},n=((n="string"==typeof n?s.formatArr(n):n)||[]).concat(),lay.each(n,function(e,t){/yyyy|y/.test(t)?n[e]=lay.digit(a.year,t.length):/MM|M/.test(t)?n[e]=lay.digit(a.month+(i||0),t.length):/dd|d/.test(t)?n[e]=lay.digit(a.date,t.length):/HH|H/.test(t)?n[e]=lay.digit(a.hours,t.length):/mm|m/.test(t)?n[e]=lay.digit(a.minutes,t.length):/ss|s/.test(t)&&(n[e]=lay.digit(a.seconds,t.length))}),n.join("")},D.getEndDate=function(e,t){var a=new Date;return a.setFullYear(t||a.getFullYear(),e||a.getMonth()+1,1),new Date(a.getTime()-864e5).getDate()},n?(D.ready(),layui.define("lay",function(e){D.path=layui.cache.dir,l.run(lay),e(a,D)})):"function"==typeof define&&define.amd?define(function(){return l.run(lay),D}):(D.ready(),l.run(i.lay),i.laydate=D)}(window,window.document);!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e):function(e){if(e.document)return t(e);throw new Error("jQuery requires a window with a document")}:t(e)}("undefined"!=typeof window?window:this,function(T,M){var f=[],g=T.document,c=f.slice,O=f.concat,R=f.push,P=f.indexOf,B={},W=B.toString,m=B.hasOwnProperty,y={},e="1.12.4",C=function(e,t){return new C.fn.init(e,t)},I=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,$=/^-ms-/,z=/-([\da-z])/gi,X=function(e,t){return t.toUpperCase()};function U(e){var t=!!e&&"length"in e&&e.length,n=C.type(e);return"function"!==n&&!C.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+a+")"+a+"*"),ee=new RegExp("="+a+"*([^\\]'\"]*?)"+a+"*\\]","g"),te=new RegExp(G),ne=new RegExp("^"+s+"$"),f={ID:new RegExp("^#("+s+")"),CLASS:new RegExp("^\\.("+s+")"),TAG:new RegExp("^("+s+"|[*])"),ATTR:new RegExp("^"+J),PSEUDO:new RegExp("^"+G),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+a+"*(even|odd|(([+-]|)(\\d*)n|)"+a+"*(?:([+-]|)"+a+"*(\\d+)|))"+a+"*\\)|)","i"),bool:new RegExp("^(?:"+Y+")$","i"),needsContext:new RegExp("^"+a+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+a+"*((?:-\\d)?\\d*)"+a+"*\\)|)(?=[^-]|$)","i")},re=/^(?:input|select|textarea|button)$/i,ie=/^h\d$/i,c=/^[^{]+\{\s*\[native \w/,oe=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ae=/[+~]/,se=/'|\\/g,d=new RegExp("\\\\([\\da-f]{1,6}"+a+"?|("+a+")|.)","ig"),p=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(65536+r):String.fromCharCode(r>>10|55296,1023&r|56320)},ue=function(){C()};try{D.apply(n=V.call(v.childNodes),v.childNodes),n[v.childNodes.length].nodeType}catch(F){D={apply:n.length?function(e,t){U.apply(e,V.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function H(e,t,n,r){var i,o,a,s,u,l,c,f,d=t&&t.ownerDocument,p=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==p&&9!==p&&11!==p)return n;if(!r&&((t?t.ownerDocument||t:v)!==E&&C(t),t=t||E,N)){if(11!==p&&(l=oe.exec(e)))if(i=l[1]){if(9===p){if(!(a=t.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(d&&(a=d.getElementById(i))&&y(t,a)&&a.id===i)return n.push(a),n}else{if(l[2])return D.apply(n,t.getElementsByTagName(e)),n;if((i=l[3])&&g.getElementsByClassName&&t.getElementsByClassName)return D.apply(n,t.getElementsByClassName(i)),n}if(g.qsa&&!A[e+" "]&&(!m||!m.test(e))){if(1!==p)d=t,f=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(se,"\\$&"):t.setAttribute("id",s=k),o=(c=w(e)).length,u=ne.test(s)?"#"+s:"[id='"+s+"']";o--;)c[o]=u+" "+_(c[o]);f=c.join(","),d=ae.test(e)&&de(t.parentNode)||t}if(f)try{return D.apply(n,d.querySelectorAll(f)),n}catch(h){}finally{s===k&&t.removeAttribute("id")}}}return P(e.replace(L,"$1"),t,n,r)}function le(){var n=[];function r(e,t){return n.push(e+" ")>b.cacheLength&&delete r[n.shift()],r[e+" "]=t}return r}function q(e){return e[k]=!0,e}function h(e){var t=E.createElement("div");try{return!!e(t)}catch(F){return!1}finally{t.parentNode&&t.parentNode.removeChild(t)}}function ce(e,t){for(var n=e.split("|"),r=n.length;r--;)b.attrHandle[n[r]]=t}function fe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||1<<31)-(~e.sourceIndex||1<<31);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function x(a){return q(function(o){return o=+o,q(function(e,t){for(var n,r=a([],e.length,o),i=r.length;i--;)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function de(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in g=H.support={},O=H.isXML=function(e){e=e&&(e.ownerDocument||e).documentElement;return!!e&&"HTML"!==e.nodeName},C=H.setDocument=function(e){var e=e?e.ownerDocument||e:v;return e!==E&&9===e.nodeType&&e.documentElement&&(t=(E=e).documentElement,N=!O(E),(e=E.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",ue,!1):e.attachEvent&&e.attachEvent("onunload",ue)),g.attributes=h(function(e){return e.className="i",!e.getAttribute("className")}),g.getElementsByTagName=h(function(e){return e.appendChild(E.createComment("")),!e.getElementsByTagName("*").length}),g.getElementsByClassName=c.test(E.getElementsByClassName),g.getById=h(function(e){return t.appendChild(e).id=k,!E.getElementsByName||!E.getElementsByName(k).length}),g.getById?(b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&N)return(e=t.getElementById(e))?[e]:[]},b.filter.ID=function(e){var t=e.replace(d,p);return function(e){return e.getAttribute("id")===t}}):(delete b.find.ID,b.filter.ID=function(e){var t=e.replace(d,p);return function(e){e="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return e&&e.value===t}}),b.find.TAG=g.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):g.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"!==e)return o;for(;n=o[i++];)1===n.nodeType&&r.push(n);return r},b.find.CLASS=g.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&N)return t.getElementsByClassName(e)},r=[],m=[],(g.qsa=c.test(E.querySelectorAll))&&(h(function(e){t.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+a+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+a+"*(?:value|"+Y+")"),e.querySelectorAll("[id~="+k+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||m.push(".#.+[+~]")}),h(function(e){var t=E.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+a+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")})),(g.matchesSelector=c.test(i=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.msMatchesSelector))&&h(function(e){g.disconnectedMatch=i.call(e,"div"),i.call(e,"[s!='']:x"),r.push("!=",G)}),m=m.length&&new RegExp(m.join("|")),r=r.length&&new RegExp(r.join("|")),e=c.test(t.compareDocumentPosition),y=e||c.test(t.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,t=t&&t.parentNode;return e===t||!(!t||1!==t.nodeType||!(n.contains?n.contains(t):e.compareDocumentPosition&&16&e.compareDocumentPosition(t)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},$=e?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!g.sortDetached&&t.compareDocumentPosition(e)===n?e===E||e.ownerDocument===v&&y(v,e)?-1:t===E||t.ownerDocument===v&&y(v,t)?1:u?j(u,e)-j(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===E?-1:t===E?1:i?-1:o?1:u?j(u,e)-j(u,t):0;if(i===o)return fe(e,t);for(n=e;n=n.parentNode;)a.unshift(n);for(n=t;n=n.parentNode;)s.unshift(n);for(;a[r]===s[r];)r++;return r?fe(a[r],s[r]):a[r]===v?-1:s[r]===v?1:0}),E},H.matches=function(e,t){return H(e,null,null,t)},H.matchesSelector=function(e,t){if((e.ownerDocument||e)!==E&&C(e),t=t.replace(ee,"='$1']"),g.matchesSelector&&N&&!A[t+" "]&&(!r||!r.test(t))&&(!m||!m.test(t)))try{var n=i.call(e,t);if(n||g.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(F){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(d,p),e[3]=(e[3]||e[4]||e[5]||"").replace(d,p),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||H.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&H.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return f.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&te.test(n)&&(t=w(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(d,p).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=W[e+" "];return t||(t=new RegExp("(^|"+a+")"+e+"("+a+"|$)"))&&W(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(t,n,r){return function(e){e=H.attr(e,t);return null==e?"!="===n:!n||(e+="","="===n?e===r:"!="===n?e!==r:"^="===n?r&&0===e.indexOf(r):"*="===n?r&&-1(?:<\/\1>|)$/,G=/^.[^:#\[\.,]*$/;function K(e,n,r){if(C.isFunction(n))return C.grep(e,function(e,t){return!!n.call(e,t,e)!==r});if(n.nodeType)return C.grep(e,function(e){return e===n!==r});if("string"==typeof n){if(G.test(n))return C.filter(n,e,r);n=C.filter(n,e)}return C.grep(e,function(e){return-1)[^>]*|#([\w-]*))$/,ee=((C.fn.init=function(e,t,n){if(!e)return this;if(n=n||Q,"string"!=typeof e)return e.nodeType?(this.context=this[0]=e,this.length=1,this):C.isFunction(e)?"undefined"!=typeof n.ready?n.ready(e):e(C):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),C.makeArray(e,this));if(!(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&3<=e.length?[null,e,null]:Z.exec(e))||!r[1]&&t)return(!t||t.jquery?t||n:this.constructor(t)).find(e);if(r[1]){if(t=t instanceof C?t[0]:t,C.merge(this,C.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:g,!0)),J.test(r[1])&&C.isPlainObject(t))for(var r in t)C.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}if((n=g.getElementById(r[2]))&&n.parentNode){if(n.id!==r[2])return Q.find(e);this.length=1,this[0]=n}return this.context=g,this.selector=e,this}).prototype=C.fn,Q=C(g),/^(?:parents|prev(?:Until|All))/),te={children:!0,contents:!0,next:!0,prev:!0};function ne(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}C.fn.extend({has:function(e){var t,n=C(e,this),r=n.length;return this.filter(function(){for(t=0;t
    a",y.leadingWhitespace=3===S.firstChild.nodeType,y.tbody=!S.getElementsByTagName("tbody").length,y.htmlSerialize=!!S.getElementsByTagName("link").length,y.html5Clone="<:nav>"!==g.createElement("nav").cloneNode(!0).outerHTML,q.type="checkbox",q.checked=!0,k.appendChild(q),y.appendChecked=q.checked,S.innerHTML="",y.noCloneChecked=!!S.cloneNode(!0).lastChild.defaultValue,k.appendChild(S),(q=g.createElement("input")).setAttribute("type","radio"),q.setAttribute("checked","checked"),q.setAttribute("name","t"),S.appendChild(q),y.checkClone=S.cloneNode(!0).cloneNode(!0).lastChild.checked,y.noCloneEvent=!!S.addEventListener,S[C.expando]=1,y.attributes=!S.getAttribute(C.expando);var x={option:[1,""],legend:[1,"
    ","
    "],area:[1,"",""],param:[1,"",""],thead:[1,"","
    "],tr:[2,"","
    "],col:[2,"","
    "],td:[3,"","
    "],_default:y.htmlSerialize?[0,"",""]:[1,"X
    ","
    "]};function b(e,t){var n,r,i=0,o="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):undefined;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||C.nodeName(r,t)?o.push(r):C.merge(o,b(r,t));return t===undefined||t&&C.nodeName(e,t)?C.merge([e],o):o}function we(e,t){for(var n,r=0;null!=(n=e[r]);r++)C._data(n,"globalEval",!t||C._data(t[r],"globalEval"))}x.optgroup=x.option,x.tbody=x.tfoot=x.colgroup=x.caption=x.thead,x.th=x.td;var Te=/<|&#?\w+;/,Ce=/"!==f[1]||Ce.test(a)?0:u:u.firstChild)&&a.childNodes.length;o--;)C.nodeName(c=a.childNodes[o],"tbody")&&!c.childNodes.length&&a.removeChild(c);for(C.merge(h,u.childNodes),u.textContent="";u.firstChild;)u.removeChild(u.firstChild);u=p.lastChild}else h.push(t.createTextNode(a));for(u&&p.removeChild(u),y.appendChecked||C.grep(b(h,"input"),Ee),g=0;a=h[g++];)if(r&&-1]","i"),Pe=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,Be=/\s*$/g,ze=be(g).appendChild(g.createElement("div"));function Xe(e,t){return C.nodeName(e,"table")&&C.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ue(e){return e.type=(null!==C.find.attr(e,"type"))+"/"+e.type,e}function Ve(e){var t=Ie.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Ye(e,t){if(1===t.nodeType&&C.hasData(e)){var n,r,i,e=C._data(e),o=C._data(t,e),a=e.events;if(a)for(n in delete o.handle,o.events={},a)for(r=0,i=a[n].length;r")},clone:function(e,t,n){var r,i,o,a,s,u=C.contains(e.ownerDocument,e);if(y.html5Clone||C.isXMLDoc(e)||!Re.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(ze.innerHTML=e.outerHTML,ze.removeChild(o=ze.firstChild)),!(y.noCloneEvent&&y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||C.isXMLDoc(e)))for(r=b(o),s=b(e),a=0;null!=(i=s[a]);++a)if(r[a]){f=c=l=p=d=void 0;var l,c,f,d=i,p=r[a];if(1===p.nodeType){if(l=p.nodeName.toLowerCase(),!y.noCloneEvent&&p[C.expando]){for(c in(f=C._data(p)).events)C.removeEvent(p,c,f.handle);p.removeAttribute(C.expando)}"script"===l&&p.text!==d.text?(Ue(p).text=d.text,Ve(p)):"object"===l?(p.parentNode&&(p.outerHTML=d.outerHTML),y.html5Clone&&d.innerHTML&&!C.trim(p.innerHTML)&&(p.innerHTML=d.innerHTML)):"input"===l&&ge.test(d.type)?(p.defaultChecked=p.checked=d.checked,p.value!==d.value&&(p.value=d.value)):"option"===l?p.defaultSelected=p.selected=d.defaultSelected:"input"!==l&&"textarea"!==l||(p.defaultValue=d.defaultValue)}}if(t)if(n)for(s=s||b(e),r=r||b(o),a=0;null!=(i=s[a]);a++)Ye(i,r[a]);else Ye(e,o);return 0<(r=b(o,"script")).length&&we(r,!u&&b(e,"script")),r=s=i=null,o},cleanData:function(e,t){for(var n,r,i,o,a=0,s=C.expando,u=C.cache,l=y.attributes,c=C.event.special;null!=(n=e[a]);a++)if((t||v(n))&&(o=(i=n[s])&&u[i])){if(o.events)for(r in o.events)c[r]?C.event.remove(n,r):C.removeEvent(n,r,o.handle);u[i]&&(delete u[i],l||"undefined"==typeof n.removeAttribute?n[s]=undefined:n.removeAttribute(s),f.push(i))}}}),C.fn.extend({domManip:w,detach:function(e){return Je(this,e,!0)},remove:function(e){return Je(this,e)},text:function(e){return d(this,function(e){return e===undefined?C.text(this):this.empty().append((this[0]&&this[0].ownerDocument||g).createTextNode(e))},null,e,arguments.length)},append:function(){return w(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Xe(this,e).appendChild(e)})},prepend:function(){return w(this,arguments,function(e){var t;1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(t=Xe(this,e)).insertBefore(e,t.firstChild)})},before:function(){return w(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return w(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&C.cleanData(b(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&C.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return C.clone(this,e,t)})},html:function(e){return d(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined)return 1===t.nodeType?t.innerHTML.replace(Oe,""):undefined;if("string"==typeof e&&!Be.test(e)&&(y.htmlSerialize||!Re.test(e))&&(y.leadingWhitespace||!ve.test(e))&&!x[(me.exec(e)||["",""])[1].toLowerCase()]){e=C.htmlPrefilter(e);try{for(;n")).appendTo(t.documentElement))[0].contentWindow||Ge[0].contentDocument).document).write(),t.close(),n=Qe(e,t),Ge.detach()),Ke[e]=n),n}var n,et,tt,nt,rt,it,ot,a,at=/^margin/,st=new RegExp("^("+e+")(?!px)[a-z%]+$","i"),ut=function(e,t,n,r){var i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.apply(e,r||[]),t)e.style[i]=o[i];return r},lt=g.documentElement;function t(){var e,t=g.documentElement;t.appendChild(ot),a.style.cssText="-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",n=tt=it=!1,et=rt=!0,T.getComputedStyle&&(e=T.getComputedStyle(a),n="1%"!==(e||{}).top,it="2px"===(e||{}).marginLeft,tt="4px"===(e||{width:"4px"}).width,a.style.marginRight="50%",et="4px"===(e||{marginRight:"4px"}).marginRight,(e=a.appendChild(g.createElement("div"))).style.cssText=a.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",e.style.marginRight=e.style.width="0",a.style.width="1px",rt=!parseFloat((T.getComputedStyle(e)||{}).marginRight),a.removeChild(e)),a.style.display="none",(nt=0===a.getClientRects().length)&&(a.style.display="",a.innerHTML="
    t
    ",a.childNodes[0].style.borderCollapse="separate",(e=a.getElementsByTagName("td"))[0].style.cssText="margin:0;border:0;padding:0;display:none",(nt=0===e[0].offsetHeight)&&(e[0].style.display="",e[1].style.display="none",nt=0===e[0].offsetHeight)),t.removeChild(ot)}ot=g.createElement("div"),(a=g.createElement("div")).style&&(a.style.cssText="float:left;opacity:.5",y.opacity="0.5"===a.style.opacity,y.cssFloat=!!a.style.cssFloat,a.style.backgroundClip="content-box",a.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle="content-box"===a.style.backgroundClip,(ot=g.createElement("div")).style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",a.innerHTML="",ot.appendChild(a),y.boxSizing=""===a.style.boxSizing||""===a.style.MozBoxSizing||""===a.style.WebkitBoxSizing,C.extend(y,{reliableHiddenOffsets:function(){return null==n&&t(),nt},boxSizingReliable:function(){return null==n&&t(),tt},pixelMarginRight:function(){return null==n&&t(),et},pixelPosition:function(){return null==n&&t(),n},reliableMarginRight:function(){return null==n&&t(),rt},reliableMarginLeft:function(){return null==n&&t(),it}}));var l,p,ct=/^(top|right|bottom|left)$/;function ft(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}T.getComputedStyle?(l=function(e){var t=e.ownerDocument.defaultView;return(t=t&&t.opener?t:T).getComputedStyle(e)},p=function(e,t,n){var r,i,o=e.style;return""!==(i=(n=n||l(e))?n.getPropertyValue(t)||n[t]:undefined)&&i!==undefined||C.contains(e.ownerDocument,e)||(i=C.style(e,t)),n&&!y.pixelMarginRight()&&st.test(i)&&at.test(t)&&(e=o.width,t=o.minWidth,r=o.maxWidth,o.minWidth=o.maxWidth=o.width=i,i=n.width,o.width=e,o.minWidth=t,o.maxWidth=r),i===undefined?i:i+""}):lt.currentStyle&&(l=function(e){return e.currentStyle},p=function(e,t,n){var r,i,o,a=e.style;return null==(n=(n=n||l(e))?n[t]:undefined)&&a&&a[t]&&(n=a[t]),st.test(n)&&!ct.test(t)&&(r=a.left,(o=(i=e.runtimeStyle)&&i.left)&&(i.left=e.currentStyle.left),a.left="fontSize"===t?"1em":n,n=a.pixelLeft+"px",a.left=r,o&&(i.left=o)),n===undefined?n:n+""||"auto"});var dt=/alpha\([^)]*\)/i,pt=/opacity\s*=\s*([^)]*)/i,ht=/^(none|table(?!-c[ea]).+)/,gt=new RegExp("^("+e+")(.*)$","i"),mt={position:"absolute",visibility:"hidden",display:"block"},yt={letterSpacing:"0",fontWeight:"400"},vt=["Webkit","O","Moz","ms"],xt=g.createElement("div").style;function bt(e){if(e in xt)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=vt.length;n--;)if((e=vt[n]+t)in xt)return e}function wt(e,t){for(var n,r,i,o=[],a=0,s=e.length;a
    a",F=q.getElementsByTagName("a")[0],k.setAttribute("type","checkbox"),q.appendChild(k),(F=q.getElementsByTagName("a")[0]).style.cssText="top:1px",y.getSetAttribute="t"!==q.className,y.style=/top/.test(F.getAttribute("style")),y.hrefNormalized="/a"===F.getAttribute("href"),y.checkOn=!!k.value,y.optSelected=e.selected,y.enctype=!!g.createElement("form").enctype,S.disabled=!0,y.optDisabled=!e.disabled,(k=g.createElement("input")).setAttribute("value",""),y.input=""===k.getAttribute("value"),k.value="t",k.setAttribute("type","radio"),y.radioValue="t"===k.value;var Lt=/\r/g,Ht=/[\x20\t\r\n\f]+/g;C.fn.extend({val:function(t){var n,e,r,i=this[0];return arguments.length?(r=C.isFunction(t),this.each(function(e){1===this.nodeType&&(null==(e=r?t.call(this,e,C(this).val()):t)?e="":"number"==typeof e?e+="":C.isArray(e)&&(e=C.map(e,function(e){return null==e?"":e+""})),(n=C.valHooks[this.type]||C.valHooks[this.nodeName.toLowerCase()])&&"set"in n&&n.set(this,e,"value")!==undefined||(this.value=e))})):i?(n=C.valHooks[i.type]||C.valHooks[i.nodeName.toLowerCase()])&&"get"in n&&(e=n.get(i,"value"))!==undefined?e:"string"==typeof(e=i.value)?e.replace(Lt,""):null==e?"":e:void 0}}),C.extend({valHooks:{option:{get:function(e){var t=C.find.attr(e,"value");return null!=t?t:C.trim(C.text(e)).replace(Ht," ")}},select:{get:function(e){for(var t,n=e.options,r=e.selectedIndex,i="select-one"===e.type||r<0,o=i?null:[],a=i?r+1:n.length,s=r<0?a:i?r:0;s").append(C.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},C.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){C.fn[t]=function(e){return this.on(t,e)}}),C.expr.filters.animated=function(t){return C.grep(C.timers,function(e){return t===e.elem}).length},C.offset={setOffset:function(e,t,n){var r,i,o,a,s=C.css(e,"position"),u=C(e),l={};"static"===s&&(e.style.position="relative"),o=u.offset(),r=C.css(e,"top"),a=C.css(e,"left"),s=("absolute"===s||"fixed"===s)&&-1'+(s?a.title[0]:a.title)+"":"";return a.zIndex=o,t([a.shade?'
    ':"",'
    '+(e&&2!=a.type?"":s)+"'+(n=["layui-icon-tips","layui-icon-success","layui-icon-error","layui-icon-question","layui-icon-lock","layui-icon-face-cry","layui-icon-face-smile"],o="layui-anim layui-anim-rotate layui-anim-loop",0==a.type&&-1!==a.icon?'':3==a.type?(i=["layui-icon-loading","layui-icon-loading-1"],2==a.icon?'
    ':''):"")+((1!=a.type||!e)&&a.content||"")+'
    '+(n=[],l&&(n.push(''),n.push('')),a.closeBtn&&n.push(''),n.join(""))+"
    "+(a.btn?function(){var e="";"string"==typeof a.btn&&(a.btn=[a.btn]);for(var t=0,i=a.btn.length;t'+a.btn[t]+"";return'
    '+e+"
    "}():"")+(a.resize?'':"")+""],s,m('
    ')),this},t.pt.creat=function(){var e,t,i,n,a,o=this,s=o.config,l=o.index,r="object"==typeof(f=s.content),c=m("body");if(s.id&&m("."+y[0]).find("#"+s.id)[0])return e=m("#"+s.id).closest("."+y[0]),t=e.attr("times"),i=e.data("config"),n=m("#"+y.SHADE+t),void("min"===(e.data("maxminStatus")||{})?h.restore(t):i.hideOnClose&&(n.show(),e.show()));switch(s.removeFocus&&document.activeElement.blur(),"string"==typeof s.area&&(s.area="auto"===s.area?["",""]:[s.area,""]),s.shift&&(s.anim=s.shift),6==h.ie&&(s.fixed=!1),s.type){case 0:s.btn="btn"in s?s.btn:u.btn[0],h.closeAll("dialog");break;case 2:var f=s.content=r?s.content:[s.content||"","auto"];s.content='';break;case 3:delete s.title,delete s.closeBtn,-1===s.icon&&s.icon,h.closeAll("loading");break;case 4:r||(s.content=[s.content,"body"]),s.follow=s.content[1],s.content=s.content[0]+'',delete s.title,s.tips="object"==typeof s.tips?s.tips:[s.tips,!0],s.tipsMore||h.closeAll("tips")}o.vessel(r,function(e,t,i){c.append(e[0]),r?2==s.type||4==s.type?m("body").append(e[1]):f.parents("."+y[0])[0]||(f.data("display",f.css("display")).show().addClass("layui-layer-wrap").wrap(e[1]),m("#"+y[0]+l).find("."+y[5]).before(t)):c.append(e[1]),m("#"+y.MOVE)[0]||c.append(u.moveElem=i),o.layero=m("#"+y[0]+l),o.shadeo=m("#"+y.SHADE+l),s.scrollbar||y.html.css("overflow","hidden").attr("layer-full",l)}).auto(l),o.shadeo.css({"background-color":s.shade[1]||"#000",opacity:s.shade[0]||s.shade}),2==s.type&&6==h.ie&&o.layero.find("iframe").attr("src",f[0]),4==s.type?o.tips():(o.offset(),parseInt(u.getStyle(document.getElementById(y.MOVE),"z-index"))||(o.layero.css("visibility","hidden"),h.ready(function(){o.offset(),o.layero.css("visibility","visible")}))),s.fixed&&!u.events.resize[o.index]&&(u.events.resize[o.index]=function(){o.resize()},d.on("resize",u.events.resize[o.index])),s.time<=0||setTimeout(function(){h.close(o.index)},s.time),o.move().callback(),y.anim[s.anim]&&(a="layer-anim "+y.anim[s.anim],o.layero.addClass(a).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){m(this).removeClass(a)})),o.layero.data("config",s)},t.pt.resize=function(){var e=this,t=e.config;e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(e.index),4==t.type&&e.tips()},t.pt.auto=function(e){var t=this.config,i=m("#"+y[0]+e),n=(""===t.area[0]&&0t.maxWidth&&i.width(t.maxWidth)),[i.innerWidth(),i.innerHeight()]),a=i.find(y[1]).outerHeight()||0,o=i.find("."+y[6]).outerHeight()||0,e=function(e){(e=i.find(e)).height(n[1]-a-o-2*(0|parseFloat(e.css("padding-top"))))};return 2===t.type?e("iframe"):""===t.area[1]?0t.maxHeight?(n[1]=t.maxHeight,e("."+y[5])):t.fixed&&n[1]>=d.height()&&(n[1]=d.height(),e("."+y[5])):e("."+y[5]),this},t.pt.offset=function(){var e=this,t=e.config,i=e.layero,n=[i.outerWidth(),i.outerHeight()],a="object"==typeof t.offset;e.offsetTop=(d.height()-n[1])/2,e.offsetLeft=(d.width()-n[0])/2,a?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=d.width()-n[0]:"b"===t.offset?e.offsetTop=d.height()-n[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=d.height()-n[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=d.width()-n[0]):"rb"===t.offset?(e.offsetTop=d.height()-n[1],e.offsetLeft=d.width()-n[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?d.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?d.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=d.scrollTop(),e.offsetLeft+=d.scrollLeft()),"min"===i.data("maxminStatus")&&(e.offsetTop=d.height()-(i.find(y[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},t.pt.tips=function(){var e=this.config,t=this.layero,i=[t.outerWidth(),t.outerHeight()],n=m(e.follow),a={width:(n=n[0]?n:m("body")).outerWidth(),height:n.outerHeight(),top:n.offset().top,left:n.offset().left},o=t.find(".layui-layer-TipsG"),n=e.tips[0];e.tips[1]||o.remove(),a.autoLeft=function(){0d.width()&&(o=d.width()-180-(u.minStackArr.edgeIndex=u.minStackArr.edgeIndex||0,u.minStackArr.edgeIndex+=3))<0&&(o=0),t.minStack&&(l.left=o,l.top=d.height()-n,a||u.minStackIndex++,r.attr("minLeft",o)),r.attr("position",s),h.style(e,l,!0),i.hide(),"page"===r.attr("type")&&r.find(y[4]).hide(),u.rescollbar(e),c.hide())},h.restore=function(e){var t=m("#"+y[0]+e),i=m("#"+y.SHADE+e),n=t.attr("area").split(","),a=t.attr("type");t.removeData("maxminStatus"),h.style(e,{width:n[0],height:n[1],top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===a&&t.find(y[4]).show(),u.rescollbar(e),i.show()},h.full=function(t){var i=m("#"+y[0]+t),e=i.data("maxminStatus");"max"!==e&&("min"===e&&h.restore(t),i.data("maxminStatus","max"),u.record(i),y.html.attr("layer-full")||y.html.css("overflow","hidden").attr("layer-full",t),setTimeout(function(){var e="fixed"===i.css("position");h.style(t,{top:e?0:d.scrollTop(),left:e?0:d.scrollLeft(),width:"100%",height:"100%"},!0),i.find(".layui-layer-min").hide()},100))},h.title=function(e,t){m("#"+y[0]+(t||h.index)).find(y[1]).html(e)},h.close=function(o,s){var l,e,r=(t=m("."+y[0]).find("#"+o).closest("."+y[0]))[0]?(o=t.attr("times"),t):m("#"+y[0]+o),c=r.attr("type"),t=r.data("config")||{},f=t.id&&t.hideOnClose;r[0]&&(l={slideDown:"layer-anim-slide-down-out",slideLeft:"layer-anim-slide-left-out",slideUp:"layer-anim-slide-up-out",slideRight:"layer-anim-slide-right-out"}[t.anim]||"layer-anim-close",e=function(){var e="layui-layer-wrap";if(f)return r.removeClass("layer-anim "+l),r.hide();if(c===u.type[1]&&"object"===r.attr("conType")){r.children(":not(."+y[5]+")").remove();for(var t=r.find("."+e),i=0;i<2;i++)t.unwrap();t.css("display",t.data("display")).removeClass(e)}else{if(c===u.type[2])try{var n=m("#"+y[4]+o)[0];n.contentWindow.document.write(""),n.contentWindow.close(),r.find("."+y[5])[0].removeChild(n)}catch(a){}r[0].innerHTML="",r.remove()}"function"==typeof u.end[o]&&u.end[o](),delete u.end[o],"function"==typeof s&&s(),u.events.resize[o]&&(d.off("resize",u.events.resize[o]),delete u.events.resize[o])},m("#"+y.SHADE+o)[f?"hide":"remove"](),t.isOutAnim&&r.addClass("layer-anim "+l),6==h.ie&&u.reselect(),u.rescollbar(o),"string"==typeof r.attr("minLeft")&&(u.minStackIndex--,u.minStackArr.push(r.attr("minLeft"))),h.ie&&h.ie<10||!t.isOutAnim?e():setTimeout(function(){e()},200))},h.closeAll=function(n,a){"function"==typeof n&&(a=n,n=null);var o=m("."+y[0]);m.each(o,function(e){var t=m(this),i=n?t.attr("type")===n:1;i&&h.close(t.attr("times"),e===o.length-1?a:null)}),0===o.length&&"function"==typeof a&&a()},h.closeLast=function(e){h.close(m(".layui-layer-"+(e=e||"page")+":last").attr("times"))},h.cache||{}),g=function(e){return i.skin?" "+i.skin+" "+i.skin+"-"+e:""};h.prompt=function(i,n){var e="",t="";"function"==typeof(i=i||{})&&(n=i),i.area&&(e='style="width: '+(o=i.area)[0]+"; height: "+o[1]+';"',delete i.area),i.placeholder&&(t=' placeholder="'+i.placeholder+'"');var a,o=2==i.formType?'":'",s=i.success;return delete i.success,h.open(m.extend({type:1,btn:["确定","取消"],content:o,skin:"layui-layer-prompt"+g("prompt"),maxWidth:d.width(),success:function(e){(a=e.find(".layui-layer-input")).val(i.value||"").focus(),"function"==typeof s&&s(e)},resize:!1,yes:function(e){var t=a.val();t.length>(i.maxlength||500)?h.tips("最多输入"+(i.maxlength||500)+"个字数",a,{tips:1}):n&&n(t,e,a)}},i))},h.tab=function(n){var a=(n=n||{}).tab||{},o="layui-this",s=n.success;return delete n.success,h.open(m.extend({type:1,skin:"layui-layer-tab"+g("tab"),resize:!1,title:function(){var e=a.length,t=1,i="";if(0'+a[0].title+"";t"+a[t].title+"";return i}(),content:'
      '+function(){var e=a.length,t=1,i="";if(0'+(a[0].content||"no content")+"";t'+(a[t].content||"no content")+"";return i}()+"
    ",success:function(e){var t=e.find(".layui-layer-title").children(),i=e.find(".layui-layer-tabmain").children();t.on("mousedown",function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0;var e=m(this),t=e.index();e.addClass(o).siblings().removeClass(o),i.eq(t).show().siblings().hide(),"function"==typeof n.change&&n.change(t)}),"function"==typeof s&&s(e)}},n))},h.photos=function(n,e,a){var o={};if((n=n||{}).photos){var t=!("string"==typeof n.photos||n.photos instanceof m),i=t?n.photos:{},s=i.data||[],l=i.start||0,r=(o.imgIndex=1+(0|l),n.img=n.img||"img",n.success);if(delete n.success,t){if(0===s.length)return h.msg("没有图片")}else{var c=m(n.photos),f=function(){s=[],c.find(n.img).each(function(e){var t=m(this);t.attr("layer-index",e),s.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("lay-src")||t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(f(),0===s.length)return;if(e||c.on("click",n.img,function(){f();var e=m(this).attr("layer-index");h.photos(m.extend(n,{photos:{start:e,data:s,tab:n.tab},full:n.full}),!0)}),!e)return}o.imgprev=function(e){o.imgIndex--,o.imgIndex<1&&(o.imgIndex=s.length),o.tabimg(e)},o.imgnext=function(e,t){o.imgIndex++,o.imgIndex>s.length&&(o.imgIndex=1,t)||o.tabimg(e)},o.keyup=function(e){var t;o.end||(t=e.keyCode,e.preventDefault(),37===t?o.imgprev(!0):39===t?o.imgnext(!0):27===t&&h.close(o.index))},o.tabimg=function(e){if(!(s.length<=1))return i.start=o.imgIndex-1,h.close(o.index),h.photos(n,!0,e)},o.event=function(){o.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),o.imgprev(!0)}),o.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),o.imgnext(!0)}),m(document).on("keyup",o.keyup)},o.loadi=h.load(1,{shade:!("shade"in n)&&.9,scrollbar:!1});var t=s[l].src,d=function(e){h.close(o.loadi);var t,i=s[l].alt||"";a&&(n.anim=-1),o.index=h.open(m.extend({type:1,id:"layui-layer-photos",area:(e=[e.width,e.height],t=[m(p).width()-100,m(p).height()-100],!n.full&&(e[0]>t[0]||e[1]>t[1])&&((t=[e[0]/t[0],e[1]/t[1]])[1]'+i+''+(t=['
    '],1','','',"
    "].join("")),n.hideFooter||t.push(['
    ','
    ',"

    "+i+"

    ",""+o.imgIndex+" / "+s.length+"",'\u67e5\u770b\u539f\u56fe',"
    ","
    "].join("")),t.push(""),t.join(""))+"",success:function(e,t){o.bigimg=e.find(".layui-layer-phimg"),o.imgsee=e.find(".layui-layer-imgbar"),o.event(e),n.tab&&n.tab(s[l],e),"function"==typeof r&&r(e)},end:function(){o.end=!0,m(document).off("keyup",o.keyup)}},n))},u=function(){h.close(o.loadi),h.msg("当前图片地址异常
    是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){1").addClass(a));layui.each(i.bars,function(e,t){var n=s('
  • ');n.addClass(t.icon).attr({"lay-type":t.type,style:t.style||(i.bgcolor?"background-color: "+i.bgcolor:"")}).html(t.content),n.on("click",function(){var e=s(this).attr("lay-type");"top"===e&&("body"===i.target?s("html,body"):c).animate({scrollTop:0},i.duration),"function"==typeof i.click&&i.click.call(this,e)}),"object"===layui.type(i.on)&&layui.each(i.on,function(e,t){n.on(e,function(){var e=s(this).attr("lay-type");"function"==typeof t&&t.call(this,e)})}),"top"===t.type&&(n.addClass("layui-fixbar-top"),o=n),u.append(n)}),l.find("."+a).remove(),"object"==typeof i.css&&u.css(i.css),l.append(u),o&&(t=function t(){return c.scrollTop()>=i.margin?e||(o.show(),e=1):e&&(o.hide(),e=0),t}()),c.on("scroll",function(){t&&(clearTimeout(n),n=setTimeout(function(){t()},100))})},countdown:function(e,t,n){var i=this,o="function"==typeof t,a=new Date(e).getTime(),r=new Date(!t||o?(new Date).getTime():t).getTime(),a=a-r,l=[Math.floor(a/864e5),Math.floor(a/36e5)%24,Math.floor(a/6e4)%60,Math.floor(a/1e3)%60],o=(o&&(n=t),setTimeout(function(){i.countdown(e,r+1e3,n)},1e3));return n&&n(0]|&(?=#[a-zA-Z0-9]+)/g.test(e+="")?e.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,"""):e},unescape:function(e){return e!==undefined&&null!==e||(e=""),(e+="").replace(/\&/g,"&").replace(/\</g,"<").replace(/\>/g,">").replace(/\'/g,"'").replace(/\"/g,'"')},openWin:function(e){var t=(e=e||{}).window||window.open(e.url||"",e.target,e.specs);e.url||(t.document.open("text/html","replace"),t.document.write(e.content||""),t.document.close())},toVisibleArea:function(e){var t,n,i,o,a,r,l,c;(e=s.extend({margin:160,duration:200,type:"y"},e)).scrollElem[0]&&e.thisElem[0]&&(t=e.scrollElem,l=e.thisElem,i=(a="y"===e.type)?"top":"left",o=t[n=a?"scrollTop":"scrollLeft"](),a=t[a?"height":"width"](),r=t.offset()[i],c={},((l=l.offset()[i]-r)>a-e.margin||l."+h,k=function(e){var i=this;i.index=++p.index,i.config=s.extend({},i.config,p.config,e),i.init()};k.prototype.config={trigger:"click",content:"",className:"",style:"",show:!1,isAllowSpread:!0,isSpreadItem:!0,data:[],delay:300,shade:0},k.prototype.reload=function(e,i){var t=this;t.config=s.extend({},t.config,e),t.init(!0,i)},k.prototype.init=function(e,i){var t,n=this,a=n.config,l=s(a.elem);return 1');return 0No data
  • '),e},u=function(r,e){return layui.each(e,function(e,i){var t,n=i.child&&0",(t="href"in i?''+l+"":l,n?'
    '+t+("parent"===o?'':"group"===o&&d.isAllowSpread?'':"")+"
    ":'
    '+t+"
    "),""].join(""))).data("item",i),n&&(a=s('
    '),t=s("
      "),"parent"===o?(a.append(u(t,i.child)),l.append(a)):l.append(u(t,i.child))),r.append(l))}),r},a=['
      ',"
      "].join("");!(e="contextmenu"!==d.trigger&&!lay.isTopElem(d.elem[0])?e:!0)&&d.elem.data(m+"_opened")||(l.elemView=s("."+f+'[lay-id="'+d.id+'"]'),"reloadData"===i&&l.elemView.length?l.elemView.html(d.content||n()):(l.elemView=s(a),l.elemView.append(d.content||n()),d.className&&l.elemView.addClass(d.className),d.style&&l.elemView.attr("style",d.style),p.thisId=d.id,l.remove(),t.append(l.elemView),d.elem.data(m+"_opened",!0),e=d.shade?'
      ':"",l.elemView.before(e),"mouseenter"===d.trigger&&l.elemView.on("mouseenter",function(){clearTimeout(y.timer)}).on("mouseleave",function(){l.delayRemove()})),l.position(),(y.prevElem=l.elemView).data("prevElem",d.elem),l.elemView.find(".layui-menu").on(o,function(e){layui.stope(e)}),l.elemView.find(".layui-menu li").on("click",function(e){var i=s(this),t=i.data("item")||{},n=t.child&&0n.width()&&(t.addClass(V),(i=t[0].getBoundingClientRect()).left<0&&t.removeClass(V)),i.bottom>n.height()&&t.eq(0).css("margin-top",-(i.bottom-n.height()+5)))}).on("mouseleave",t,function(e){var i=s(this).children("."+C);i.removeClass(V),i.css("margin-top",0)}),p.close=function(e){e=y.getThis(e);return e?(e.remove(),y.call(e)):this},p.reload=function(e,i,t){e=y.getThis(e);return e?(e.reload(i,t),y.call(e)):this},p.reloadData=function(){var t=s.extend([],arguments),n=(t[2]="reloadData",new RegExp("^("+["data","templet","content"].join("|")+")$"));return layui.each(t[1],function(e,i){n.test(e)||delete t[1][e]}),p.reload.apply(null,t)},p.render=function(e){e=new k(e);return y.call(e)},e(r,p)});layui.define(["jquery","lay"],function(e){"use strict";var g=layui.$,c=layui.lay,m={config:{},index:layui.slider?layui.slider.index+1e4:0,set:function(e){var i=this;return i.config=g.extend({},i.config,e),i},on:function(e,i){return layui.onevent.call(this,t,e,i)}},t="slider",v="layui-disabled",x="layui-slider-bar",b="layui-slider-wrap",T="layui-slider-wrap-btn",w="layui-slider-tips",M="layui-slider-input-txt",L="layui-slider-hover",i=function(e){var i=this;i.index=++m.index,i.config=g.extend({},i.config,m.config,e),i.render()};i.prototype.config={type:"default",min:0,max:100,value:0,step:1,showstep:!1,tips:!0,input:!1,range:!1,height:200,disabled:!1,theme:"#16baaa"},i.prototype.render=function(){var a=this,n=a.config,e=g(n.elem);if(1n.min?e:n.min,n.value[1]=i>n.min?i:n.min,n.value[0]=n.value[0]>n.max?n.max:n.value[0],n.value[1]=n.value[1]>n.max?n.max:n.value[1],i=Math.floor((n.value[0]-n.min)/(n.max-n.min)*100),t=(s=Math.floor((n.value[1]-n.min)/(n.max-n.min)*100))-i+"%",i+="%",s+="%"):("object"==typeof n.value&&(n.value=Math.min.apply(null,n.value)),n.valuen.max&&(n.value=n.max),t=Math.floor((n.value-n.min)/(n.max-n.min)*100)+"%");var l,e=n.disabled?"#c2c2c2":n.theme,i='
      '+(n.tips?'
      ':"")+'
      '+(n.range?'
      ':"")+"
      ",t=g(n.elem),s=t.next(".layui-slider");if(s[0]&&s.remove(),a.elemTemp=g(i),n.range?(a.elemTemp.find("."+b).eq(0).data("value",n.value[0]),a.elemTemp.find("."+b).eq(1).data("value",n.value[1])):a.elemTemp.find("."+b).data("value",n.value),t.html(a.elemTemp),"vertical"===n.type&&a.elemTemp.height(n.height+"px"),n.showstep){for(var o=(n.max-n.min)/n.step,r="",u=1;u<1+o;u++){var d=100*u/o;d<100&&(r+='
      ')}a.elemTemp.append(r)}n.input&&!n.range&&(e=g('
      '),t.css("position","relative"),t.append(e),t.find("."+M).children("input").val(n.value),"vertical"===n.type?e.css({left:0,top:-48}):a.elemTemp.css("margin-right",e.outerWidth()+15)),n.disabled?(a.elemTemp.addClass(v),a.elemTemp.find("."+T).addClass(v)):a.slide(),a.elemTemp.find("."+T).on("mouseover",function(){var e="vertical"===n.type?n.height:a.elemTemp[0].offsetWidth,i=a.elemTemp.find("."+b),t=("vertical"===n.type?e-g(this).parent()[0].offsetTop-i.height():g(this).parent()[0].offsetLeft)/e*100,i=g(this).parent().data("value"),e=n.setTips?n.setTips(i):i;a.elemTemp.find("."+w).html(e),clearTimeout(l),l=setTimeout(function(){"vertical"===n.type?a.elemTemp.find("."+w).css({bottom:t+"%","margin-bottom":"20px",display:"inline-block"}):a.elemTemp.find("."+w).css({left:t+"%",display:"inline-block"})},300)}).on("mouseout",function(){clearTimeout(l),a.elemTemp.find("."+w).css("display","none")})},i.prototype.slide=function(e,i,t){var o=this,r=o.config,u=o.elemTemp,d=function(){return"vertical"===r.type?r.height:u[0].offsetWidth},c=u.find("."+b),m=u.next(".layui-slider-input"),v=m.children("."+M).children("input").val(),p=100/((r.max-r.min)/Math.ceil(r.step)),f=function(e,i,t){e=(e=100<(e=100a[1]&&a.reverse(),o.value=r.range?a:l,r.change&&r.change(o.value),"done"===t&&r.done&&r.done(o.value)},h=function(e){var i=e/d()*100/p,t=Math.round(i)*p;return t=e==d()?Math.ceil(i)*p:t},y=g(['
      d()?d():i)/d()*100/p;f(i,l),s.addClass(L),u.find("."+w).show(),e.preventDefault()},i=function(){s.removeClass(L),u.find("."+w).hide()},t=function(){i&&i(),y.remove(),r.done&&r.done(o.value)},g("#LAY-slider-moving")[0]||g("body").append(y),y.on("mousemove",e),y.on("mouseup",t).on("mouseleave",t)})}),u.on("click",function(e){var i=g("."+T),t=g(this);!i.is(event.target)&&0===i.has(event.target).length&&i.length&&(t=(i=(i=(i="vertical"===r.type?d()-e.clientY+t.offset().top-g(window).scrollTop():e.clientX-t.offset().left-g(window).scrollLeft())<0?0:i)>d()?d():i)/d()*100/p,i=r.range?"vertical"===r.type?Math.abs(i-parseInt(g(c[0]).css("bottom")))>Math.abs(i-parseInt(g(c[1]).css("bottom")))?1:0:Math.abs(i-c[0].offsetLeft)>Math.abs(i-c[1].offsetLeft)?1:0:0,f(t,i,"done"),e.preventDefault())}),m.children(".layui-slider-input-btn").children("i").each(function(i){g(this).on("click",function(){v=m.children("."+M).children("input").val();var e=((v=1==i?v-r.stepr.max?r.max:Number(v)+r.step)-r.min)/(r.max-r.min)*100/p;f(e,0,"done")})});var a=function(){var e=this.value,e=(e=(e=(e=isNaN(e)?0:e)r.max?r.max:e,((this.value=e)-r.min)/(r.max-r.min)*100/p);f(e,0,"done")};m.children("."+M).children("input").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),a.call(this))}).on("change",a)},i.prototype.events=function(){this.config},m.render=function(e){e=new i(e);return function(){var t=this,a=t.config;return{setValue:function(e,i){return e=(e=e>a.max?a.max:e)',"",'','',"","","
      "].join("")),r=i.elem=m(i.elem);i.size&&o.addClass("layui-colorpicker-"+i.size),r.addClass("layui-inline").html(e.elemColorBox=o),i.id="id"in i?i.id:r.attr("id")||e.index,e.color=e.elemColorBox.find("."+C)[0].style.background,e.events()},d.prototype.renderPicker=function(){var o,e=this,i=e.config,r=e.elemColorBox[0],t=e.elemPicker=m(['
      ','
      ','
      ','
      ','
      ','
      ',"
      ",'
      ','
      ',"
      ","
      ",'
      ','
      ','
      ',"
      ","
      ",i.predefine?(o=['
      '],layui.each(i.colors,function(e,i){o.push(['
      ','
      ',"
      "].join(""))}),o.push("
      "),o.join("")):"",'
      ','
      ','',"
      ",'
      ','','',"","
      "].join(""));e.elemColorBox.find("."+C)[0];m(a)[0]&&m(a).data("index")==e.index?e.removePicker(d.thisElemInd):(e.removePicker(d.thisElemInd),m("body").append(t)),n.thisId=i.id,d.thisElemInd=e.index,d.thisColor=r.style.background,e.position(),e.pickerEvents()},d.prototype.removePicker=function(e){var i=this.config,e=m("#layui-colorpicker"+(e||this.index));return e[0]&&(e.remove(),delete n.thisId,"function"==typeof i.close&&i.close(this.color)),this},d.prototype.position=function(){var e=this,i=e.config;return t.position(e.bindElem||e.elemColorBox[0],e.elemPicker[0],{position:i.position,align:"center"}),e},d.prototype.val=function(){var e,i=this,o=(i.config,i.elemColorBox.find("."+C)),r=i.elemPicker.find("."+M),t=o[0].style.backgroundColor;t?(e=Y(L(t)),o=o.attr("lay-type"),i.select(e.h,e.s,e.b),"torgb"===o?r.find("input").val(t):"rgba"===o?(o=L(t),3===(t.match(/[0-9]{1,3}/g)||[]).length?(r.find("input").val("rgba("+o.r+", "+o.g+", "+o.b+", 1)"),i.elemPicker.find("."+T).css("left",280)):(r.find("input").val(t),t=280*t.slice(t.lastIndexOf(",")+1,t.length-1),i.elemPicker.find("."+T).css("left",t)),i.elemPicker.find("."+D)[0].style.background="linear-gradient(to right, rgba("+o.r+", "+o.g+", "+o.b+", 0), rgb("+o.r+", "+o.g+", "+o.b+"))"):r.find("input").val("#"+F(e))):(i.select(0,100,100),r.find("input").val(""),i.elemPicker.find("."+D)[0].style.background="",i.elemPicker.find("."+T).css("left",280))},d.prototype.side=function(){var n=this,l=n.config,c=n.elemColorBox.find("."+C),a=c.attr("lay-type"),s=n.elemPicker.find(".layui-colorpicker-side"),e=n.elemPicker.find("."+B),d=n.elemPicker.find("."+I),r=n.elemPicker.find("."+E),f=n.elemPicker.find("."+D),u=n.elemPicker.find("."+T),g=e[0].offsetTop/180*360,p=100-(r[0].offsetTop+3)/180*100,h=(r[0].offsetLeft+3)/260*100,v=Math.round(u[0].offsetLeft/280*100)/100,b=n.elemColorBox.find("."+w),i=n.elemPicker.find(".layui-colorpicker-pre").children("div"),y=function(e,i,o,r){n.select(e,i,o);var t=j({h:e,s:i,b:o}),e=F({h:e,s:i,b:o}),i=n.elemPicker.find("."+M).find("input");b.addClass(x).removeClass(P),c[0].style.background="rgb("+t.r+", "+t.g+", "+t.b+")","torgb"===a?i.val("rgb("+t.r+", "+t.g+", "+t.b+")"):"rgba"===a?(u.css("left",280*r),i.val("rgba("+t.r+", "+t.g+", "+t.b+", "+r+")"),c[0].style.background="rgba("+t.r+", "+t.g+", "+t.b+", "+r+")",f[0].style.background="linear-gradient(to right, rgba("+t.r+", "+t.g+", "+t.b+", 0), rgb("+t.r+", "+t.g+", "+t.b+"))"):i.val("#"+e),l.change&&l.change(n.elemPicker.find("."+M).find("input").val())},o=m(['
      '].join("")),k=function(e){m("#LAY-colorpicker-moving")[0]||m("body").append(o),o.on("mousemove",e),o.on("mouseup",function(){o.remove()}).on("mouseleave",function(){o.remove()})};e.on("mousedown",function(e){var r=this.offsetTop,t=e.clientY;k(function(e){var i=r+(e.clientY-t),o=s[0].offsetHeight,o=(i=o<(i=i<0?0:i)?o:i)/180*360;y(g=o,h,p,v),e.preventDefault()}),e.preventDefault()}),s.on("click",function(e){var i=e.clientY-m(this).offset().top+H.scrollTop(),i=(i=(i=i<0?0:i)>this.offsetHeight?this.offsetHeight:i)/180*360;y(g=i,h,p,v),e.preventDefault()}),r.on("mousedown",function(e){var n=this.offsetTop,l=this.offsetLeft,c=e.clientY,a=e.clientX;layui.stope(e),k(function(e){var i=n+(e.clientY-c),o=l+(e.clientX-a),r=d[0].offsetHeight-3,t=d[0].offsetWidth-3,t=((o=t<(o=o<-3?-3:o)?t:o)+3)/260*100,o=100-((i=r<(i=i<-3?-3:i)?r:i)+3)/180*100;y(g,h=t,p=o,v),e.preventDefault()}),e.preventDefault()}),d.on("mousedown",function(e){var i=e.clientY-m(this).offset().top-3+H.scrollTop(),o=e.clientX-m(this).offset().left-3+H.scrollLeft(),o=((i=i<-3?-3:i)>this.offsetHeight-3&&(i=this.offsetHeight-3),((o=(o=o<-3?-3:o)>this.offsetWidth-3?this.offsetWidth-3:o)+3)/260*100),i=100-(i+3)/180*100;y(g,h=o,p=i,v),layui.stope(e),e.preventDefault(),r.trigger(e,"mousedown")}),u.on("mousedown",function(e){var r=this.offsetLeft,t=e.clientX;k(function(e){var i=r+(e.clientX-t),o=f[0].offsetWidth,o=(o<(i=i<0?0:i)&&(i=o),Math.round(i/280*100)/100);y(g,h,p,v=o),e.preventDefault()}),e.preventDefault()}),f.on("click",function(e){var i=e.clientX-m(this).offset().left,i=((i=i<0?0:i)>this.offsetWidth&&(i=this.offsetWidth),Math.round(i/280*100)/100);y(g,h,p,v=i),e.preventDefault()}),i.each(function(){m(this).on("click",function(){m(this).parent(".layui-colorpicker-pre").addClass("selected").siblings().removeClass("selected");var e=this.style.backgroundColor,i=Y(L(e)),o=e.slice(e.lastIndexOf(",")+1,e.length-1);g=i.h,h=i.s,p=i.b,3===(e.match(/[0-9]{1,3}/g)||[]).length&&(o=1),v=o,y(i.h,i.s,i.b,o)})})},d.prototype.select=function(e,i,o,r){this.config;var t=F({h:e,s:100,b:100}),e=(F({h:e,s:i,b:o}),e/360*180),o=180-o/100*180-3,i=i/100*260-3;this.elemPicker.find("."+B).css("top",e),this.elemPicker.find("."+I)[0].style.background="#"+t,this.elemPicker.find("."+E).css({top:o,left:i})},d.prototype.pickerEvents=function(){var c=this,a=c.config,s=c.elemColorBox.find("."+C),d=c.elemPicker.find("."+M+" input"),o={clear:function(e){s[0].style.background="",c.elemColorBox.find("."+w).removeClass(x).addClass(P),c.color="",a.done&&a.done(""),c.removePicker()},confirm:function(e,i){var o,r,t,n,l=d.val();if(-1>16,g:(65280&t)>>8,b:255&t},r=Y(n),s[0].style.background=o="#"+F(r),c.elemColorBox.find("."+w).removeClass(P).addClass(x)),"change"===i)return c.select(r.h,r.s,r.b,i),void(a.change&&a.change(o));c.color=l,a.done&&a.done(l),c.removePicker()}};c.elemPicker.on("click","*[colorpicker-events]",function(){var e=m(this),i=e.attr("colorpicker-events");o[i]&&o[i].call(this,e)}),d.on("keyup",function(e){var i=m(this);o.confirm.call(this,i,13===e.keyCode?null:"change")})},d.prototype.events=function(){var e=this;e.config;e.elemColorBox.on("click",function(){e.renderPicker(),m(a)[0]&&(e.val(),e.side())})},s.on(i,function(e){var i,o,r;!n.thisId||(i=l.getThis(n.thisId))&&(o=i.config,r=i.elemColorBox.find("."+C),m(e.target).hasClass(c)||m(e.target).parents("."+c)[0]||m(e.target).hasClass(a.replace(/\./g,""))||m(e.target).parents(a)[0]||i.elemPicker&&(i.color?(e=Y(L(i.color)),i.select(e.h,e.s,e.b)):i.elemColorBox.find("."+w).removeClass(x).addClass(P),r[0].style.background=i.color||"","function"==typeof o.cancel&&o.cancel(i.color),i.removePicker()))}),H.on("resize",function(){if(n.thisId){var e=l.getThis(n.thisId);if(e)return!(!e.elemPicker||!m(a)[0])&&void e.position()}}),l.that={},l.getThis=function(e){var i=l.that[e];return i||o.error(e?r+" instance with ID '"+e+"' not found":"ID argument required"),i},n.render=function(e){e=new d(e);return l.call(e)},e(r,n)});layui.define("jquery",function(t){"use strict";var u=layui.$,d=(layui.hint(),layui.device()),o="element",c="layui-this",h="layui-show",r=".layui-tab-title",i=function(){this.config={}},y=(i.prototype.set=function(t){return u.extend(!0,this.config,t),this},i.prototype.on=function(t,i){return layui.onevent.call(this,o,t,i)},i.prototype.tabAdd=function(t,i){var a,e=u(".layui-tab[lay-filter="+t+"]"),l=e.children(r),n=l.children(".layui-tab-bar"),e=e.children(".layui-tab-content"),s=""+(i.title||"unnaming")+"";return n[0]?n.before(s):l.append(s),e.append('
      '+(i.content||"")+"
      "),i.change&&this.tabChange(t,i.id),l.data("LAY_TAB_CHANGE",i.change),g.tabAuto(i.change?"change":null),this},i.prototype.tabDelete=function(t,i){t=u(".layui-tab[lay-filter="+t+"]").children(r).find('>li[lay-id="'+i+'"]');return g.tabDelete(null,t),this},i.prototype.tabChange=function(t,i){t=u(".layui-tab[lay-filter="+t+"]").children(r).find('>li[lay-id="'+i+'"]');return g.tabClick.call(t[0],{liElem:t}),this},i.prototype.tab=function(a){a=a||{},e.on("click",a.headerElem,function(t){var i=u(this).index();g.tabClick.call(this,{index:i,options:a})})},i.prototype.progress=function(t,i){var a="layui-progress",t=u("."+a+"[lay-filter="+t+"]").find("."+a+"-bar"),a=t.find("."+a+"-text");return t.css("width",function(){return/^.+\/.+$/.test(i)?100*new Function("return "+i)()+"%":i}).attr("lay-percent",i),a.text(i),this},".layui-nav"),f="layui-nav-item",l="layui-nav-bar",p="layui-nav-tree",b="layui-nav-child",v="layui-nav-more",m="layui-anim layui-anim-upbit",g={tabClick:function(t){var i=(t=t||{}).options||{},a=t.liElem||u(this),e=i.headerElem?a.parent():a.parents(".layui-tab").eq(0),i=i.bodyElem?u(i.bodyElem):e.children(".layui-tab-content").children(".layui-tab-item"),l=a.find("a"),l="javascript:;"!==l.attr("href")&&"_blank"===l.attr("target"),n="string"==typeof a.attr("lay-unselect"),s=e.attr("lay-filter"),t="index"in t?t.index:a.parent().children("li").index(a);l||n||(a.addClass(c).siblings().removeClass(c),i.eq(t).addClass(h).siblings().removeClass(h)),layui.event.call(this,o,"tab("+s+")",{elem:e,index:t})},tabDelete:function(t,i){var i=i||u(this).parent(),a=i.parent().children("li").index(i),e=i.closest(".layui-tab"),l=e.children(".layui-tab-content").children(".layui-tab-item"),n=e.attr("lay-filter");i.hasClass(c)&&(i.next()[0]&&i.next().is("li")?g.tabClick.call(i.next()[0],{index:a+1}):i.prev()[0]&&i.prev().is("li")&&g.tabClick.call(i.prev()[0],null,a-1)),i.remove(),l.eq(a).remove(),setTimeout(function(){g.tabAuto()},50),layui.event.call(this,o,"tabDelete("+n+")",{elem:e,index:a})},tabAuto:function(l){var n="layui-tab-more",s="layui-tab-bar",o="layui-tab-close",c=this;u(".layui-tab").each(function(){var t,i=u(this),a=i.children(".layui-tab-title"),e=(i.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),e=u('');c===window&&d.ie,i.attr("lay-allowclose")&&a.find("li").each(function(){var t,i=u(this);i.find("."+o)[0]||((t=u('')).on("click",g.tabDelete),i.append(t))}),"string"!=typeof i.attr("lay-unauto")&&(a.prop("scrollWidth")>a.outerWidth()+1||a.find("li").length&&a.height()>(t=a.find("li").eq(0).height())+t/2?("change"===l&&a.data("LAY_TAB_CHANGE")&&a.addClass(n),a.find("."+s)[0]||(a.append(e),i.attr("overflow",""),e.on("click",function(t){var i=a.hasClass(n);a[i?"removeClass":"addClass"](n)}))):(a.find("."+s).remove(),i.removeAttr("overflow")))})},hideTabMore:function(t){var i=u(".layui-tab-title");!0!==t&&"tabmore"===u(t.target).attr("lay-stope")||(i.removeClass("layui-tab-more"),i.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var t=u(this),i=t.parents(y),a=i.attr("lay-filter"),e=t.parent(),l=t.siblings("."+b),n="string"==typeof e.attr("lay-unselect");"javascript:;"!==t.attr("href")&&"_blank"===t.attr("target")||n||l[0]||(i.find("."+c).removeClass(c),e.addClass(c)),i.hasClass(p)&&(l.removeClass(m),l[0]&&(e["none"===l.css("display")?"addClass":"removeClass"](f+"ed"),"all"===i.attr("lay-shrink")&&e.siblings().removeClass(f+"ed"))),layui.event.call(this,o,"nav("+a+")",t)},collapse:function(){var t=u(this),i=t.find(".layui-colla-icon"),a=t.siblings(".layui-colla-content"),e=t.parents(".layui-collapse").eq(0),l=e.attr("lay-filter"),n="none"===a.css("display");"string"==typeof e.attr("lay-accordion")&&((e=e.children(".layui-colla-item").children("."+h)).siblings(".layui-colla-title").children(".layui-colla-icon").html(""),e.removeClass(h)),a[n?"addClass":"removeClass"](h),i.html(n?"":""),layui.event.call(this,o,"collapse("+l+")",{title:t,content:a,show:n})}},a=(i.prototype.render=i.prototype.init=function(t,i){var a=i?'[lay-filter="'+i+'"]':"",i={tab:function(){g.tabAuto.call({})},nav:function(){var s={},o={},c={},r="layui-nav-title";u(y+a).each(function(t){var i=u(this),a=u(''),e=i.find("."+f);i.find("."+l)[0]||(i.append(a),(i.hasClass(p)?e.find("dd,>."+r):e).on("mouseenter",function(){!function(t,i,a){var e,l=u(this),n=l.find("."+b);i.hasClass(p)?n[0]||(e=l.children("."+r),t.css({top:l.offset().top-i.offset().top,height:(e[0]?e:l).outerHeight(),opacity:1})):(n.addClass(m),n.hasClass("layui-nav-child-c")&&n.css({left:-(n.outerWidth()-l.width())/2}),n[0]?t.css({left:t.position().left+t.width()/2,width:0,opacity:0}):t.css({left:l.position().left+parseFloat(l.css("marginLeft")),top:l.position().top+l.height()-t.height()}),s[a]=setTimeout(function(){t.css({width:n[0]?0:l.width(),opacity:n[0]?0:1})},d.ie&&d.ie<10?0:200),clearTimeout(c[a]),"block"===n.css("display")&&clearTimeout(o[a]),o[a]=setTimeout(function(){n.addClass(h),l.find("."+v).addClass(v+"d")},300))}.call(this,a,i,t)}).on("mouseleave",function(){i.hasClass(p)?a.css({height:0,opacity:0}):(clearTimeout(o[t]),o[t]=setTimeout(function(){i.find("."+b).removeClass(h),i.find("."+v).removeClass(v+"d")},300))}),i.on("mouseleave",function(){clearTimeout(s[t]),c[t]=setTimeout(function(){i.hasClass(p)||a.css({width:0,left:a.position().left+a.width()/2,opacity:0})},200)})),e.find("a").each(function(){var t=u(this);t.parent();t.siblings("."+b)[0]&&!t.children("."+v)[0]&&t.append(''),t.off("click",g.clickThis).on("click",g.clickThis)})})},breadcrumb:function(){u(".layui-breadcrumb"+a).each(function(){var t=u(this),i="lay-separator",a=t.attr(i)||"/",e=t.find("a");e.next("span["+i+"]")[0]||(e.each(function(t){t!==e.length-1&&u(this).after(""+a+"")}),t.css("visibility","visible"))})},progress:function(){var e="layui-progress";u("."+e+a).each(function(){var t=u(this),i=t.find(".layui-progress-bar"),a=i.attr("lay-percent");i.css("width",function(){return/^.+\/.+$/.test(a)?100*new Function("return "+a)()+"%":a}),t.attr("lay-showpercent")&&setTimeout(function(){i.html(''+a+"")},350)})},collapse:function(){u(".layui-collapse"+a).each(function(){u(this).find(".layui-colla-item").each(function(){var t=u(this),i=t.find(".layui-colla-title"),t="none"===t.find(".layui-colla-content").css("display");i.find(".layui-colla-icon").remove(),i.append(''+(t?"":"")+""),i.off("click",g.collapse).on("click",g.collapse)})})}};return i[t]?i[t]():layui.each(i,function(t,i){i()})},new i),e=u(document);u(function(){a.render()}),e.on("click",".layui-tab-title li",g.tabClick),u(window).on("resize",g.tabAuto),t(o,a)});layui.define(["lay","layer"],function(e){"use strict";var y=layui.$,i=layui.layer,x=layui.device(),t={config:{},set:function(e){var i=this;return i.config=y.extend({},i.config,e),i},on:function(e,i){return layui.onevent.call(this,n,e,i)}},n="upload",a="layui-upload-file",o="layui-upload-form",F="layui-upload-iframe",b="layui-upload-choose",w=function(e){var i=this;i.config=y.extend({},i.config,t.config,e),i.render()};w.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",force:"",field:"file",acceptMime:"",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},w.prototype.render=function(e){var i=this;(e=i.config).elem=y(e.elem),e.bindAction=y(e.bindAction),i.file(),i.events()},w.prototype.file=function(){var e=this,i=e.config,t=e.elemFile=y(['"].join("")),n=i.elem.next();(n.hasClass(a)||n.hasClass(o))&&n.remove(),x.ie&&x.ie<10&&i.elem.wrap('
      '),e.isFile()?(e.elemFile=i.elem,i.field=i.elem[0].name):i.elem.after(t),x.ie&&x.ie<10&&e.initIE()},w.prototype.initIE=function(){var t,e=this.config,i=y(''),n=y(['
      ',"
      "].join(""));y("#"+F)[0]||y("body").append(i),e.elem.next().hasClass(o)||(this.elemFile.wrap(n),e.elem.next("."+o).append((t=[],layui.each(e.data,function(e,i){i="function"==typeof i?i():i,t.push('')}),t.join(""))))},w.prototype.msg=function(e){return i.msg(e,{icon:2,shift:6})},w.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},w.prototype.preview=function(n){window.FileReader&&layui.each(this.chooseFiles,function(e,i){var t=new FileReader;t.readAsDataURL(i),t.onload=function(){n&&n(e,i,this.result)}})},w.prototype.upload=function(e,i){var t,n,a,o,r=this,u=r.config,l=r.elemFile[0],c=function(){return e||r.files||r.chooseFiles||l.files},f=function(){var i=0,a=0,o=c(),l=function(){u.multiple&&i+a===r.fileLength&&"function"==typeof u.allDone&&u.allDone({total:r.fileLength,successful:i,failed:a})},t=function(t){var n=new FormData,e=(layui.each(u.data,function(e,i){i="function"==typeof i?i():i,n.append(e,i)}),t.unified?layui.each(o,function(e,i){n.append(u.field,i)}):n.append(u.field,t.file),{url:u.url,type:"post",data:n,contentType:!1,processData:!1,dataType:"json",headers:u.headers||{},success:function(e){u.unified?i+=r.fileLength:i++,p(t.index,e),l()},error:function(e){u.unified?a+=r.fileLength:a++,r.msg(["Upload failed, please try again.","status: "+(e.status||"")+" - "+(e.statusText||"error")].join("
      ")),d(t.index),l()}});"function"==typeof u.progress&&(e.xhr=function(){var e=y.ajaxSettings.xhr();return e.upload.addEventListener("progress",function(e){var i;e.lengthComputable&&(i=Math.floor(e.loaded/e.total*100),u.progress(i,(u.item||u.elem)[0],e,t.index))}),e}),y.ajax(e)};u.unified?t({unified:!0,index:0}):layui.each(o,function(e,i){t({index:e,file:i})})},s=function(){var n=y("#"+F);r.elemFile.parent().submit(),clearInterval(w.timer),w.timer=setInterval(function(){var e,i=n.contents().find("body");try{e=i.text()}catch(t){r.msg("Cross-domain requests are not supported"),clearInterval(w.timer),d()}e&&(clearInterval(w.timer),i.html(""),p(0,e))},30)},p=function(e,i){if(r.elemFile.next("."+b).remove(),l.value="","json"===u.force&&"object"!=typeof i)try{i=JSON.parse(i)}catch(t){return i={},r.msg("Please return JSON data format")}"function"==typeof u.done&&u.done(i,e||0,function(e){r.upload(e)})},d=function(e){u.auto&&(l.value=""),"function"==typeof u.error&&u.error(e||0,function(e){r.upload(e)})},m=u.exts,h=(n=[],layui.each(e||r.chooseFiles,function(e,i){n.push(i.name)}),n),g={preview:function(e){r.preview(e)},upload:function(e,i){var t={};t[e]=i,r.upload(t)},pushFile:function(){return r.files=r.files||{},layui.each(r.chooseFiles,function(e,i){r.files[e]=i}),r.files},resetFile:function(e,i,t){i=new File([i],t);r.files=r.files||{},r.files[e]=i}},v={file:"\u6587\u4ef6",images:"\u56fe\u7247",video:"\u89c6\u9891",audio:"\u97f3\u9891"}[u.accept]||"\u6587\u4ef6",h=0===h.length?l.value.match(/[^\/\\]+\..+/g)||[]||"":h;if(0!==h.length){switch(u.accept){case"file":layui.each(h,function(e,i){if(m&&!RegExp(".\\.("+m+")$","i").test(escape(i)))return t=!0});break;case"video":layui.each(h,function(e,i){if(!RegExp(".\\.("+(m||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(i)))return t=!0});break;case"audio":layui.each(h,function(e,i){if(!RegExp(".\\.("+(m||"mp3|wav|mid")+")$","i").test(escape(i)))return t=!0});break;default:layui.each(h,function(e,i){if(!RegExp(".\\.("+(m||"jpg|png|gif|bmp|jpeg|svg")+")$","i").test(escape(i)))return t=!0})}if(t)return r.msg("\u9009\u62e9\u7684"+v+"\u4e2d\u5305\u542b\u4e0d\u652f\u6301\u7684\u683c\u5f0f"),l.value="";if("choose"!==i&&!u.auto||(u.choose&&u.choose(g),"choose"!==i)){if(r.fileLength=(a=0,v=c(),layui.each(v,function(){a++}),a),u.number&&r.fileLength>u.number)return r.msg("\u540c\u65f6\u6700\u591a\u53ea\u80fd\u4e0a\u4f20: "+u.number+" \u4e2a\u6587\u4ef6
      \u60a8\u5f53\u524d\u5df2\u7ecf\u9009\u62e9\u4e86: "+r.fileLength+" \u4e2a\u6587\u4ef6");if(01024*u.size&&(i=1<=(i=u.size/1024)?i.toFixed(2)+"MB":u.size+"KB",l.value="",o=i)}),o)return r.msg("\u6587\u4ef6\u5927\u5c0f\u4e0d\u80fd\u8d85\u8fc7 "+o);if(!u.before||!1!==u.before(g))x.ie?(9'+e+"")},r=function(){var e=y(this);(e.attr("lay-data")||e.attr("lay-options"))&&(n.config=y.extend({},a,lay.options(this,{attr:e.attr("lay-data")?"lay-data":null})))};a.elem.off("upload.start").on("upload.start",function(){var e=y(this);r.call(this),n.config.item=e,n.elemFile[0].click()}),x.ie&&x.ie<10||a.elem.off("upload.over").on("upload.over",function(){y(this).attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){y(this).removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(e,i){var t=y(this),i=i.originalEvent.dataTransfer.files||[];t.removeAttr("lay-over"),r.call(this),o(i),a.auto?n.upload():l(i)}),n.elemFile.off("upload.change").on("upload.change",function(){var e=this.files||[];r.call(this),o(e),a.auto?n.upload():l(e)}),a.bindAction.off("upload.action").on("upload.action",function(){n.upload()}),a.elem.data("haveEvents")||(n.elemFile.on("change",function(){y(this).trigger("upload.change")}),a.elem.on("click",function(){n.isFile()||y(this).trigger("upload.start")}),a.drag&&a.elem.on("dragover",function(e){e.preventDefault(),y(this).trigger("upload.over")}).on("dragleave",function(e){y(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),y(this).trigger("upload.drop",e)}),a.bindAction.on("click",function(){y(this).trigger("upload.action")}),a.elem.data("haveEvents",!0))},t.render=function(e){e=new w(e);return function(){var i=this;return{upload:function(e){i.upload.call(i,e)},reload:function(e){i.reload.call(i,e)},config:i.config}}.call(e)},e(n,t)});layui.define(["lay","layer","util"],function(e){"use strict";var b=layui.$,y=layui.layer,d=layui.util,l=layui.hint(),w=(layui.device(),"form"),o=".layui-form",T="layui-this",$="layui-hide",q="layui-disabled",t=function(){this.config={verify:{required:[/[\S]+/,"\u5fc5\u586b\u9879\u4e0d\u80fd\u4e3a\u7a7a"],phone:[/^1\d{10}$/,"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u624b\u673a\u53f7"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"\u90ae\u7bb1\u683c\u5f0f\u4e0d\u6b63\u786e"],url:[/^(#|(http(s?)):\/\/|\/\/)[^\s]+\.[^\s]+$/,"\u94fe\u63a5\u683c\u5f0f\u4e0d\u6b63\u786e"],number:function(e){if(isNaN(e))return"\u53ea\u80fd\u586b\u5199\u6570\u5b57"},date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"\u65e5\u671f\u683c\u5f0f\u4e0d\u6b63\u786e"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u8eab\u4efd\u8bc1\u53f7"]},verIncludelRequired:!1,autocomplete:null}},i=(t.prototype.set=function(e){return b.extend(!0,this.config,e),this},t.prototype.verify=function(e){return b.extend(!0,this.config.verify,e),this},t.prototype.getFormElem=function(e){return b(o+(e?'[lay-filter="'+e+'"]':""))},t.prototype.on=function(e,t){return layui.onevent.call(this,w,e,t)},t.prototype.val=function(e,i){return this.getFormElem(e).each(function(e,t){var a=b(this);layui.each(i,function(e,t){var i,e=a.find('[name="'+e+'"]');e[0]&&("checkbox"===(i=e[0].type)?e[0].checked=t:"radio"===i?e.each(function(){this.checked=this.value==t}):e.val(t))})}),r.render(null,e),this.getValue(e)},t.prototype.getValue=function(e,t){t=t||this.getFormElem(e);var a={},n={},e=t.find("input,select,textarea");return layui.each(e,function(e,t){var i;b(this);t.name=(t.name||"").replace(/^\s*|\s*&/,""),t.name&&(/^.*\[\]$/.test(t.name)&&(i=t.name.match(/^(.*)\[\]$/g)[0],a[i]=0|a[i],i=t.name.replace(/^(.*)\[\]$/,"$1["+a[i]+++"]")),/^(checkbox|radio)$/.test(t.type)&&!t.checked||(n[i||t.name]=t.value))}),n},t.prototype.render=function(e,t){var i=this.config,a=b(o+(t?'[lay-filter="'+t+'"]':"")),n={input:function(e){e=e||a.find("input,textarea");i.autocomplete&&e.attr("autocomplete",i.autocomplete),a.find("input[lay-affix],textarea[lay-affix]").each(function(){var l=b(this),r=l.attr("lay-affix"),s="layui-input-suffix",o="layui-input-affix",e=l.is("[disabled]")||l.is("[readonly]"),c=function(e,t){(e=b(e))[0]&&e[b.trim(t)?"removeClass":"addClass"]($)},n=function(t){t=b.extend({},u[r]||{value:r},t,lay.options(l[0]));var i=b('
      '),e=b(''),a=(i.append(e),t.split&&i.addClass("layui-input-split"),l.next("."+o)),n=(a[0]&&a.remove(),l.next("."+s));n[0]?((a=n.find("."+o))[0]&&a.remove(),n.prepend(i),l.css("padding-right",function(){return(l.closest(".layui-input-group")[0]?0:n.outerWidth())+i.outerWidth()})):(i.addClass(s),l.after(i)),"auto"===t.show&&c(i,l.val()),l.on("input propertychange",function(){var e=this.value;"auto"===t.show&&c(i,e)}),e.on("click",function(){var e=l.attr("lay-filter");b(this).hasClass(q)||("function"==typeof t.click&&t.click.call(this,l,t),layui.event.call(this,w,"input-affix("+e+")",{elem:l[0],affix:r,options:t}))})},u={eye:{value:"eye-invisible",click:function(e,t){var i="LAY_FORM_INPUT_AFFIX_SHOW",a=e.data(i);e.attr("type",a?"password":"text").data(i,!a),n({value:a?"eye-invisible":"eye"})}},clear:{value:"clear",click:function(e){e.val("").focus(),c(b(this).parent(),null)},show:"auto",disabled:e}};n()})},select:function(e){var p,c="\u8bf7\u9009\u62e9",m="layui-form-select",g="layui-select-title",x="layui-select-none",k="",e=e||a.find("select"),C=function(e,t){b(e.target).parent().hasClass(g)&&!t||(b("."+m).removeClass(m+"ed "+m+"up"),p&&k&&p.val(k)),p=null},u=function(a,e,t){var s,r,i,n,o,l,c=b(this),u=a.find("."+g),d=u.find("input"),f=a.find("dl"),h=f.children("dd"),y=f.children("dt"),v=this.selectedIndex;e||(r=c.attr("lay-search"),i=function(){var e=a.offset().top+a.outerHeight()+5-F.scrollTop(),t=f.outerHeight();v=c[0].selectedIndex,a.addClass(m+"ed"),h.removeClass($),y.removeClass($),s=null,h.removeClass(T),0<=v&&h.eq(v).addClass(T),e+t>F.height()&&t<=e&&a.addClass(m+"up"),o()},n=function(e){a.removeClass(m+"ed "+m+"up"),d.blur(),s=null,e||l(d.val(),function(e){var t=c[0].selectedIndex;e&&(k=b(c[0].options[t]).html(),0===t&&k===d.attr("placeholder")&&(k=""),d.val(k||""))})},o=function(){var e,t,i=f.children("dd."+T);i[0]&&(e=i.position().top,t=f.height(),i=i.height(),t\u65e0\u5339\u914d\u9879

      '):f.find("."+x).remove()},"keyup"),""===t&&(c.val(""),f.find("."+T).removeClass(T),(c[0].options[0]||{}).value||f.children("dd:eq(0)").addClass(T),f.find("."+x).remove()),o()}).on("blur",function(e){var t=c[0].selectedIndex;p=d,k=b(c[0].options[t]).text(),0===t&&k===d.attr("placeholder")&&(k=""),setTimeout(function(){l(d.val(),function(e){k||d.val("")},"blur")},200)}),h.on("click",function(){var e=b(this),t=e.attr("lay-value"),i=c.attr("lay-filter");return e.hasClass(q)||(e.hasClass("layui-select-tips")?d.val(""):(d.val(e.text()),e.addClass(T)),e.siblings().removeClass(T),c.val(t).removeClass("layui-form-danger"),layui.event.call(this,w,"select("+i+")",{elem:c[0],value:t,othis:a}),n(!0)),!1}),a.find("dl>dt").on("click",function(e){return!1}),b(document).off("click",C).on("click",C))};e.each(function(e,t){var i=b(this),a=i.next("."+m),n=this.disabled,l=t.value,r=b(t.options[t.selectedIndex]),t=t.options[0];if("string"==typeof i.attr("lay-ignore"))return i.show();var s,o="string"==typeof i.attr("lay-search"),t=t&&!t.value&&t.innerHTML||c,r=b(['
      ','
      ','','
      ','
      ',(t=i.find("*"),s=[],layui.each(t,function(e,t){var i=t.tagName.toLowerCase();0!==e||t.value||"optgroup"===i?"optgroup"===i?s.push("
      "+t.label+"
      "):s.push('
      '+b.trim(t.innerHTML)+"
      "):s.push('
      '+b.trim(t.innerHTML||c)+"
      ")}),0===s.length&&s.push('
      \u6ca1\u6709\u9009\u9879
      '),s.join("")+"
      "),"
      "].join(""));a[0]&&a.remove(),i.after(r),u.call(this,r,n,o)})},checkbox:function(e){var o={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],"switch":["layui-form-switch","layui-form-onswitch","switch"],SUBTRA:"layui-icon-indeterminate"},e=e||a.find("input[type=checkbox]");e.each(function(e,t){var i=b(this),a=i.attr("lay-skin")||"primary",n=d.escape(b.trim(t.title||(t.title=i.attr("lay-text")||""))),l=this.disabled,r=o[a]||o.checkbox,s=i.next("."+r[0]);if(s[0]&&s.remove(),i.next("[lay-checkbox]")[0]&&(n=i.next().html()||""),n="switch"===a?n.split("|"):[n],"string"==typeof i.attr("lay-ignore"))return i.show();l=b(['
      ",(s={checkbox:[n[0]?"
      "+n[0]+"
      ":"primary"===a?"":"
      ",''].join(""),"switch":"
      "+((t.checked?n[0]:n[1])||"")+"
      "})[a]||s.checkbox,"
      "].join(""));i.after(l),function(a,n){var l=b(this);a.on("click",function(){var e=b(this),t=l.attr("lay-filter"),e=e.next("*[lay-checkbox]")[0]?e.next().html():l.attr("title")||"",i=l.attr("lay-skin")||"primary",e="switch"===i?e.split("|"):[e];l[0].disabled||(l[0].indeterminate&&(l[0].indeterminate=!1,a.find("."+o.SUBTRA).removeClass(o.SUBTRA).addClass("layui-icon-ok")),l[0].checked?(l[0].checked=!1,a.removeClass(n[1]),"switch"===i&&a.children("div").html(e[1])):(l[0].checked=!0,a.addClass(n[1]),"switch"===i&&a.children("div").html(e[0])),layui.event.call(l[0],w,n[2]+"("+t+")",{elem:l[0],value:l[0].value,othis:a}))})}.call(this,l,r)})},radio:function(e){var r="layui-form-radio",s=["layui-icon-radio","layui-icon-circle"],e=e||a.find("input[type=radio]");e.each(function(e,t){var i=b(this),a=i.next("."+r),n=this.disabled;if("string"==typeof i.attr("lay-ignore"))return i.show();a[0]&&a.remove();n=b(['
      ','',"
      "+(a=d.escape(t.title||""),a=i.next("[lay-radio]")[0]?i.next().html():a)+"
      ","
      "].join(""));i.after(n),function(a){var n=b(this),l="layui-anim-scaleSpring";a.on("click",function(){var e=n[0].name,t=n.parents(o),i=n.attr("lay-filter"),e=t.find("input[name="+e.replace(/(\.|#|\[|\])/g,"\\$1")+"]");n[0].disabled||(layui.each(e,function(){var e=b(this).next("."+r);this.checked=!1,e.removeClass(r+"ed"),e.find(".layui-icon").removeClass(l+" "+s[0]).addClass(s[1])}),n[0].checked=!0,a.addClass(r+"ed"),a.find(".layui-icon").addClass(l+" "+s[0]),layui.event.call(n[0],w,"radio("+i+")",{elem:n[0],value:n[0].value,othis:a}))})}.call(this,n)})}},t=function(){layui.each(n,function(e,t){t()})};return"object"===layui.type(e)?b(e).is(o)?(a=b(e),t()):e.each(function(e,t){var i=b(t);i.closest(o).length&&("SELECT"===t.tagName?n.select(i):"INPUT"===t.tagName&&("checkbox"===(t=t.type)||"radio"===t?n[t](i):n.input(i)))}):e?n[e]?n[e]():l.error('\u4e0d\u652f\u6301\u7684 "'+e+'" \u8868\u5355\u6e32\u67d3'):t(),this},t.prototype.validate=function(e){var u=null,d=this.config,f=d.verify,h="layui-form-danger";return!(e=b(e))[0]||(e.attr("lay-verify")!==undefined||!1!==this.validate(e.find("*[lay-verify]")))&&(layui.each(e,function(e,r){var s=b(this),t=(s.attr("lay-verify")||"").split("|"),o=s.attr("lay-vertype"),c=b.trim(s.val());if(s.removeClass(h),layui.each(t,function(e,t){var i="",a=f[t];if(a){var n="function"==typeof a?i=a(c,r):!a[0].test(c),l="select"===r.tagName.toLowerCase()||/^(checkbox|radio)$/.test(r.type),i=i||a[1];if("required"===t&&(i=s.attr("lay-reqtext")||i),n&&(d.verIncludelRequired||"required"===t||c&&"required"!==t))return"tips"===o?y.tips(i,"string"!=typeof s.attr("lay-ignore")&&l?s.next():s,{tips:1}):"alert"===o?y.alert(i,{title:"\u63d0\u793a",shadeClose:!0}):/\b(string|number)\b/.test(typeof i)&&y.msg(i,{icon:5,shift:6}),setTimeout(function(){(l?s.next().find("input"):r).focus()},7),s.addClass(h),u=!0}}),u)return u}),!u)},t.prototype.submit=function(e,t){var i=b(this),e="string"==typeof e?e:i.attr("lay-filter"),a=this.getFormElem?this.getFormElem(e):i.parents(o).eq(0),n=a.find("*[lay-verify]");if(!r.validate(n))return!1;n=r.getValue(null,a),a={elem:this.getFormElem?window.event&&window.event.target:this,form:(this.getFormElem?a:i.parents("form"))[0],field:n};return"function"==typeof t&&t(a),layui.event.call(this,w,"submit("+e+")",a)}),r=new t,t=b(document),F=b(window);b(function(){r.render()}),t.on("reset",o,function(){var e=b(this).attr("lay-filter");setTimeout(function(){r.render(null,e)},50)}),t.on("submit",o,i).on("click","*[lay-submit]",i),e(w,r)});layui.define(["lay","laytpl","laypage","form","util"],function(n){"use strict";var p=layui.$,r=layui.lay,m=layui.laytpl,z=layui.laypage,f=layui.layer,v=layui.form,g=layui.util,y=layui.hint(),b=layui.device(),x={config:{checkName:"LAY_CHECKED",indexName:"LAY_INDEX",numbersName:"LAY_NUM",disabledName:"LAY_DISABLED"},cache:{},index:layui.table?layui.table.index+1e4:0,set:function(e){var t=this;return t.config=p.extend({},t.config,e),t},on:function(e,t){return layui.onevent.call(this,T,e,t)}},k=function(){var a=this,e=a.config,i=e.id||e.index;return{config:e,reload:function(e,t){a.reload.call(a,e,t)},reloadData:function(e,t){x.reloadData(i,e,t)},setColsWidth:function(){a.setColsWidth.call(a)},resize:function(){a.resize.call(a)}}},C=function(e){var t=k.that[e];return t||y.error(e?"The table instance with ID '"+e+"' not found":"ID argument required"),t||null},l=function(e){var t=k.config[e];return t||y.error(e?"The table instance with ID '"+e+"' not found":"ID argument required"),t||null},w=function(e){var t=this.config||{},a=(e=e||{}).item3,i=e.content;"numbers"===a.type&&(i=e.tplData[x.config.numbersName]);("escape"in a?a:t).escape&&(i=g.escape(i));t=e.text&&a.exportTemplet||a.templet||a.toolbar;return t&&(i="function"==typeof t?t.call(a,e.tplData,e.obj):m(p(t).html()||String(i)).render(p.extend({LAY_COL:a},e.tplData))),e.text?p("
      "+i+"
      ").text():i},T="table",t=".layui-table",N="layui-hide",h="layui-hide-v",L="layui-none",R="layui-table-view",o=".layui-table-header",D=".layui-table-body",_=".layui-table-pageview",A=".layui-table-sort",E="layui-table-checked",W="layui-table-edit",j="layui-table-hover",H="laytable-cell-group",M="layui-table-col-special",S="layui-table-tool-panel",I="LAY_TABLE_MOVE_DICT",e=function(e){return['',"","{{# layui.each(d.data.cols, function(i1, item1){ }}","","{{# layui.each(item1, function(i2, item2){ }}",'{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}','{{# if(item2.fixed === "right"){ right = true; } }}',(e=e||{}).fixed&&"right"!==e.fixed?'{{# if(item2.fixed && item2.fixed !== "right"){ }}':"right"===e.fixed?'{{# if(item2.fixed === "right"){ }}':"","{{# var isSort = !(item2.colGroup) && item2.sort; }}",'",e.fixed?"{{# }; }}":"","{{# }); }}","","{{# }); }}","","
      ','
      ','{{# if(item2.type === "checkbox"){ }}','',"{{# } else { }}",'{{-item2.title||""}}',"{{# if(isSort){ }}",'',"{{# } }}","{{# } }}","
      ","
      "].join("")},a=['',"","
      "].join(""),c=[,"{{# if(d.data.toolbar){ }}",'
      ','
      ','
      ',"
      ","{{# } }}",'
      ',"{{# if(d.data.loading){ }}",'
      ','',"
      ","{{# } }}","{{# var left, right; }}",'
      ',e(),"
      ",'
      ',a,"
      ","{{# if(left){ }}",'
      ','
      ',e({fixed:!0}),"
      ",'
      ',a,"
      ","
      ","{{# }; }}","{{# if(right){ }}",'
      ','
      ',e({fixed:"right"}),'
      ',"
      ",'
      ',a,"
      ","
      ","{{# }; }}","
      ","{{# if(d.data.totalRow){ }}",'
      ','','',"
      ","
      ","{{# } }}",'
      ','
      ',"
      ",""].join(""),O=p(window),P=p(document),i=function(e){this.index=++x.index,this.config=p.extend({},this.config,x.config,e),this.render()},d=(i.prototype.config={limit:10,loading:!0,escape:!0,cellMinWidth:60,cellMaxWidth:Number.MAX_VALUE,editTrigger:"click",defaultToolbar:["filter","exports","print"],defaultContextmenu:!0,autoSort:!0,text:{none:"\u65e0\u6570\u636e"},cols:[]},i.prototype.render=function(e){var t=this,a=t.config,i=(a.elem=p(a.elem),a.where=a.where||{},a.id="id"in a?a.id:a.elem.attr("id")||t.index);if(k.that[i]=t,(k.config[i]=a).request=p.extend({pageName:"page",limitName:"limit"},a.request),a.response=p.extend({statusName:"code",statusCode:0,msgName:"msg",dataName:"data",totalRowName:"totalRow",countName:"count"},a.response),null!==a.page&&"object"==typeof a.page&&(a.limit=a.page.limit||a.limit,a.limits=a.page.limits||a.limits,t.page=a.page.curr=a.page.curr||1,delete a.page.elem,delete a.page.jump),!a.elem[0])return t;if(a.elem.attr("lay-filter")||a.elem.attr("lay-filter",a.id),"reloadData"===e)return t.pullData(t.page,{type:"reloadData"});a.index=t.index,t.key=a.id||a.index,t.setInit(),a.height&&/^full-\d+$/.test(a.height)?(t.fullHeightGap=a.height.split("-")[1],a.height=O.height()-t.fullHeightGap):a.height&&/^#\w+\S*-\d+$/.test(a.height)&&(i=a.height.split("-"),t.parentHeightGap=i.pop(),t.parentDiv=i.join("-"),a.height=p(t.parentDiv).height()-t.parentHeightGap);var l,e=a.elem,i=e.next("."+R),n=t.elem=p("
      ");n.addClass((l=[R,R+"-"+t.index,"layui-form","layui-border-box"],a.className&&l.push(a.className),l.join(" "))).attr({"lay-filter":"LAY-TABLE-FORM-DF-"+t.index,"lay-id":a.id,style:(l=[],a.width&&l.push("width:"+a.width+"px;"),l.join(""))}).html(m(c,{open:"{{",close:"}}"}).render({data:a,index:t.index})),i[0]&&i.remove(),e.after(n),t.layTool=n.find(".layui-table-tool"),t.layBox=n.find(".layui-table-box"),t.layHeader=n.find(o),t.layMain=n.find(".layui-table-main"),t.layBody=n.find(D),t.layFixed=n.find(".layui-table-fixed"),t.layFixLeft=n.find(".layui-table-fixed-l"),t.layFixRight=n.find(".layui-table-fixed-r"),t.layTotal=n.find(".layui-table-total"),t.layPage=n.find(".layui-table-page"),t.renderToolbar(),t.renderPagebar(),t.fullSize(),t.pullData(t.page),t.events()},i.prototype.initOpts=function(e){this.config;e.checkbox&&(e.type="checkbox"),e.space&&(e.type="space"),e.type||(e.type="normal"),"normal"!==e.type&&(e.unresize=!0,e.width=e.width||{checkbox:50,radio:50,space:30,numbers:60}[e.type])},i.prototype.setInit=function(e){var l,a,d=this,r=d.config;if(r.clientWidth=r.width||(l=function(e){var t,a=(e=e||r.elem.parent()).width();try{t="none"===e.css("display")}catch(i){}return!e[0]||a&&!t?a:l(e.parent())})(),"width"===e)return r.clientWidth;r.height=r.maxHeight||r.height,r.css&&-1===r.css.indexOf(R)&&(a=r.css.split("}"),layui.each(a,function(e,t){t&&(a[e]="."+R+"-"+d.index+" "+t)}),r.css=a.join("}"));var c=function(a,e,i,l){var n,o;l?(l.key=[r.index,a,i].join("-"),l.colspan=l.colspan||0,l.rowspan=l.rowspan||0,d.initOpts(l),(n=a+(parseInt(l.rowspan)||1))
      ','
      ','
      '].join(""),a=this.layTool.find(".layui-table-tool-temp"),i=("default"===e.toolbar?a.html(t):"string"==typeof e.toolbar&&(t=p(e.toolbar).html()||"")&&a.html(m(t).render(e)),{filter:{title:"\u7b5b\u9009\u5217",layEvent:"LAYTABLE_COLS",icon:"layui-icon-cols"},exports:{title:"\u5bfc\u51fa",layEvent:"LAYTABLE_EXPORT",icon:"layui-icon-export"},print:{title:"\u6253\u5370",layEvent:"LAYTABLE_PRINT",icon:"layui-icon-print"}}),l=[];"object"==typeof e.defaultToolbar&&layui.each(e.defaultToolbar,function(e,t){t="string"==typeof t?i[t]:t;t&&l.push('
      ')}),this.layTool.find(".layui-table-tool-self").html(l.join(""))},i.prototype.renderPagebar=function(){var e,t=this.config,a=this.layPagebar=p('
      ');t.pagebar&&((e=p(t.pagebar).html()||"")&&a.append(m(e).render(t)),this.layPage.append(a))},i.prototype.setParentCol=function(e,t){var a=this.config,i=this.layHeader.find('th[data-key="'+t+'"]'),l=parseInt(i.attr("colspan"))||0;i[0]&&(t=t.split("-"),t=a.cols[t[1]][t[2]],e?l--:l++,i.attr("colspan",l),i[l?"removeClass":"addClass"](N),t.colspan2=l,t.hide=l<1,(a=i.data("parentkey"))&&this.setParentCol(e,a))},i.prototype.setColsPatch=function(){var a=this,e=a.config;layui.each(e.cols,function(e,t){layui.each(t,function(e,t){t.hide&&a.setParentCol(t.hide,t.parentKey)})})},i.prototype.setGroupWidth=function(i){var e,l=this;l.config.cols.length<=1||((e=l.layHeader.find((i?"th[data-key="+i.data("parentkey")+"]>":"")+"."+H)).css("width",0),layui.each(e.get().reverse(),function(){var e=p(this),t=e.parent().data("key"),a=0;l.layHeader.eq(0).find("th[data-parentkey="+t+"]").width(function(e,t){p(this).hasClass(N)||0 tr:first-child > th:last-child")).data("field")&&e.prev()[0]?t(e.prev()):e})()).data("key"),n.getCssRule(e,function(e){var t=e.style.width||a.outerWidth();e.style.width=parseFloat(t)+l+"px",0'+(e||"Error")+"
      ");a[0]&&(t.layNone.remove(),a.remove()),t.layFixed.addClass(N),t.layMain.find("tbody").html(""),t.layMain.append(t.layNone=e),t.layTotal.addClass(h),t.layPage.find(_).addClass(h),x.cache[t.key]=[],t.syncCheckAll(),t.renderForm(),t.setColsWidth()},i.prototype.page=1,i.prototype.pullData=function(a,t){var e,i,l=this,n=l.config,o=(n.HAS_SET_COLS_PATCH||l.setColsPatch(),n.HAS_SET_COLS_PATCH=!0,n.request),d=n.response,r=function(){"object"==typeof n.initSort&&l.sort({field:n.initSort.field,type:n.initSort.type,reloadType:t.type})},c=function(e,t){l.setColsWidth(),"function"==typeof n.done&&n.done(e,a,e[d.countName],t)};t=t||{},"function"==typeof n.before&&n.before(n),l.startTime=(new Date).getTime(),t.renderData?((e={})[d.dataName]=x.cache[l.key],e[d.countName]=n.url?"object"===layui.type(n.page)?n.page.count:e[d.dataName].length:n.data.length,"object"==typeof n.totalRow&&(e[d.totalRowName]=p.extend({},l.totalRow)),l.renderData({res:e,curr:a,count:e[d.countName],type:t.type}),r(),c(e,"renderData")):n.url?(i={},n.page&&(i[o.pageName]=a,i[o.limitName]=n.limit),o=p.extend(i,n.where),n.contentType&&0==n.contentType.indexOf("application/json")&&(o=JSON.stringify(o)),l.loading(),p.ajax({type:n.method||"get",url:n.url,contentType:n.contentType,data:o,dataType:n.dataType||"json",jsonpCallback:n.jsonpCallback,headers:n.headers||{},success:function(e){(e="function"==typeof n.parseData?n.parseData(e)||e:e)[d.statusName]!=d.statusCode?l.errorView(e[d.msgName]||'\u8fd4\u56de\u7684\u6570\u636e\u4e0d\u7b26\u5408\u89c4\u8303\uff0c\u6b63\u786e\u7684\u6210\u529f\u72b6\u6001\u7801\u5e94\u4e3a\uff1a"'+d.statusName+'": '+d.statusCode):(l.totalRow=e[d.totalRowName],l.renderData({res:e,curr:a,count:e[d.countName],type:t.type}),r(),n.time=(new Date).getTime()-l.startTime+" ms"),c(e)},error:function(e,t){l.errorView("\u8bf7\u6c42\u5f02\u5e38\uff0c\u9519\u8bef\u63d0\u793a\uff1a"+t),"function"==typeof n.error&&n.error(e,t)}})):"array"===layui.type(n.data)&&(e={},i=a*n.limit-n.limit,o=n.data.concat(),e[d.dataName]=n.page?o.splice(i,n.limit):o,e[d.countName]=n.data.length,"object"==typeof n.totalRow&&(e[d.totalRowName]=p.extend({},n.totalRow)),l.totalRow=e[d.totalRowName],l.renderData({res:e,curr:a,count:e[d.countName],type:t.type}),r(),c(e))},i.prototype.eachCols=function(e){return x.eachCols(null,e,this.config.cols),this},i.prototype.col=function(e){try{return e=e.split("-"),this.config.cols[e[1]][e[2]]||{}}catch(t){return y.error(t),{}}},i.prototype.getTrHtml=function(a,l,n,e){var s=this,u=s.config,y=e&&e.trs||[],h=e&&e.trs_fixed||[],f=e&&e.trs_fixed_r||[];return n=n||1,layui.each(a,function(e,o){var i=[],d=[],r=[],c=e+u.limit*(n-1)+1;if("object"!=typeof o){a[e]=o={LAY_KEY:o};try{x.cache[s.key][e]=o}catch(t){}}"array"===layui.type(o)&&0===o.length||(o[x.config.numbersName]=c,l||(o[x.config.indexName]=e),s.eachCols(function(e,l){var t,e=l.field||e,a=l.key,n=o[e];n!==undefined&&null!==n||(n=""),l.colGroup||(t=['','
      "+function(){var e,t=p.extend(!0,{LAY_COL:l},o),a=x.config.checkName,i=x.config.disabledName;switch(l.type){case"checkbox":return'';case"radio":return'';case"numbers":return c}return l.toolbar?m(p(l.toolbar).html()||"").render(t):w.call(s,{item3:l,content:n,tplData:t})}(),"
      "].join(""),i.push(t),l.fixed&&"right"!==l.fixed&&d.push(t),"right"===l.fixed&&r.push(t))}),e=['data-index="'+e+'"'],o[x.config.checkName]&&e.push('class="'+E+'"'),e=e.join(" "),y.push(""+i.join("")+""),h.push(""+d.join("")+""),f.push(""+r.join("")+""))}),{trs:y,trs_fixed:h,trs_fixed_r:f}},x.getTrHtml=function(e,t){e=C(e);return e.getTrHtml(t,null,e.page)},i.prototype.renderData=function(e){var a=this,i=a.config,t=e.res,l=e.curr,n=a.count=e.count,o=e.sort,d=t[i.response.dataName]||[],t=t[i.response.totalRowName],r=[],c=[],s=[],u=function(){if(!o&&a.sortKey)return a.sort({field:a.sortKey.field,type:a.sortKey.sort,pull:!0,reloadType:e.type});a.getTrHtml(d,o,l,{trs:r,trs_fixed:c,trs_fixed_r:s}),"fixed"===i.scrollPos&&"reloadData"===e.type||a.layBody.scrollTop(0),"reset"===i.scrollPos&&a.layBody.scrollLeft(0),a.layMain.find("."+L).remove(),a.layMain.find("tbody").html(r.join("")),a.layFixLeft.find("tbody").html(c.join("")),a.layFixRight.find("tbody").html(s.join("")),a.syncCheckAll(),a.renderForm(),a.fullSize(),a.haveInit?a.scrollPatch():setTimeout(function(){a.scrollPatch()},50),a.haveInit=!0,f.close(a.tipsIndex)};return x.cache[a.key]=d,a.layTotal[0==d.length?"addClass":"removeClass"](h),a.layPage[i.page||i.pagebar?"removeClass":"addClass"](N),a.layPage.find(_)[!i.page||0==n||0===d.length&&1==l?"addClass":"removeClass"](h),0===d.length?a.errorView(i.text.none):(a.layFixLeft.removeClass(N),o?u():(u(),a.renderTotal(d,t),a.layTotal&&a.layTotal.removeClass(N),void(i.page&&(i.page=p.extend({elem:"layui-table-page"+i.index,count:n,limit:i.limit,limits:i.limits||[10,20,30,40,50,60,70,80,90],groups:3,layout:["prev","page","next","skip","count","limit"],prev:'',next:'',jump:function(e,t){t||(a.page=e.curr,i.limit=e.limit,a.pullData(e.curr))}},i.page),i.page.count=n,z.render(i.page)))))},x.renderData=function(e){e=C(e);e&&e.pullData(e.page,{renderData:!0,type:"reloadData"})},i.prototype.renderTotal=function(e,o){var d,r=this,c=r.config,s={};c.totalRow&&(layui.each(e,function(e,i){"array"===layui.type(i)&&0===i.length||r.eachCols(function(e,t){var e=t.field||e,a=i[e];t.totalRow&&(s[e]=(s[e]||0)+(parseFloat(a)||0))})}),r.dataTotal=[],d=[],r.eachCols(function(e,t){var a,e=t.field||e,i=o&&o[t.field],l="totalRowDecimals"in t?t.totalRowDecimals:2,l=s[e]?parseFloat(s[e]||0).toFixed(l):"",l=(a=t.totalRowText||"",(n={LAY_COL:t})[e]=l,n=t.totalRow&&w.call(r,{item3:t,content:l,tplData:n})||a,i||n),n=(t.field&&r.dataTotal.push({field:t.field,total:p("
      "+l+"
      ").text()}),['','
      "+("string"==typeof(a=t.totalRow||c.totalRow)?m(a).render(p.extend({TOTAL_NUMS:i||s[e],TOTAL_ROW:o||{},LAY_COL:t},t)):l),"
      "].join(""));d.push(n)}),e=r.layTotal.find(".layui-table-patch"),r.layTotal.find("tbody").html(""+d.join("")+(e.length?e.get(0).outerHTML:"")+""))},i.prototype.getColElem=function(e,t){this.config;return e.eq(0).find(".laytable-cell-"+t+":eq(0)")},i.prototype.renderForm=function(e){this.config;var t=this.elem.attr("lay-filter");v.render(e,t)},i.prototype.syncCheckAll=function(){var a,e=this,i=e.config,t=e.layHeader.find('input[name="layTableCheckbox"]'),l=x.checkStatus(e.key);t[0]&&(a=l.isAll,e.eachCols(function(e,t){"checkbox"===t.type&&(t[i.checkName]=a)}),t.prop({checked:l.isAll,indeterminate:!l.isAll&&l.data.length}),v.render(t))},i.prototype.setRowActive=function(e,t){this.config;this.layBody.find('tr[data-index="'+e+'"]').addClass(t=t||"layui-table-click").siblings("tr").removeClass(t)},i.prototype.setRowChecked=function(a){var e=this,i=e.config,l=e.layBody.find("tr"+("all"===a.index?"":'[data-index="'+a.index+'"]')),t=(a=p.extend({type:"checkbox"},a),x.cache[e.key]),n="checked"in a,o=function(e){return"radio"===a.type||(n?a.checked:!e)},t=(layui.each(t,function(e,t){"array"!==layui.type(t)&&(Number(a.index)===e||"all"===a.index?(e=t[i.checkName]=o(t[i.checkName]),l[e?"addClass":"removeClass"](E),"radio"===a.type&&l.siblings().removeClass(E)):"radio"===a.type&&delete t[i.checkName])}),l.find('input[lay-type="'+({radio:"layTableRadio",checkbox:"layTableCheckbox"}[a.type]||"checkbox")+'"]'));t.prop("checked",o(t.last().prop("checked"))),e.syncCheckAll(),e.renderForm(a.type)},i.prototype.sort=function(l){var e,t=this,a={},i=t.config,n=i.elem.attr("lay-filter"),o=x.cache[t.key];"string"==typeof(l=l||{}).field&&(d=l.field,t.layHeader.find("th").each(function(e,t){var a=p(this),i=a.data("field");if(i===l.field)return l.field=a,d=i,!1}));try{var d=d||l.field.data("field"),r=l.field.data("key");if(t.sortKey&&!l.pull&&d===t.sortKey.field&&l.type===t.sortKey.sort)return;var c=t.layHeader.find("th .laytable-cell-"+r).find(A);t.layHeader.find("th").find(A).removeAttr("lay-sort"),c.attr("lay-sort",l.type||null),t.layFixed.find("th")}catch(s){y.error("Table modules: sort field '"+d+"' not matched")}t.sortKey={field:d,sort:l.type},i.autoSort&&("asc"===l.type?e=layui.sort(o,d,null,!0):"desc"===l.type?e=layui.sort(o,d,!0,!0):(e=layui.sort(o,x.config.indexName,null,!0),delete t.sortKey,delete i.initSort)),a[i.response.dataName]=e||o,t.renderData({res:a,curr:t.page,count:t.count,sort:!0,type:l.reloadType}),l.fromEvent&&(i.initSort={field:d,type:l.type},layui.event.call(l.field,T,"sort("+n+")",p.extend({config:i},i.initSort)))},i.prototype.loading=function(e){var t=this;t.config.loading&&(e?(t.layInit&&t.layInit.remove(),delete t.layInit,t.layBox.find(".layui-table-init").remove()):(t.layInit=p(['
      ','',"
      "].join("")),t.layBox.append(t.layInit)))},i.prototype.getCssRule=function(a,i){var e=this.elem.find("style")[0],e=e.sheet||e.styleSheet||{},e=e.cssRules||e.rules;layui.each(e,function(e,t){if(t.selectorText===".laytable-cell-"+a)return i(t),!0})},i.prototype.fullSize=function(){var e,a,i=this,t=i.config,l=t.height;i.fullHeightGap?(l=O.height()-i.fullHeightGap)<135&&(l=135):i.parentDiv&&i.parentHeightGap&&(l=p(i.parentDiv).height()-i.parentHeightGap)<135&&(l=135),1
      ')).find("div").css({width:a}),e.find("tr").append(t)):e.find(".layui-table-patch").remove()};n(e.layHeader),n(e.layTotal);n=e.layMain.height()-i;e.layFixed.find(D).css("height",t.height()>=n?n:"auto"),e.layFixRight[x.cache[e.key]&&x.cache[e.key].length&&0');a.html(t),u.height&&a.css("max-height",u.height-(s.layTool.outerHeight()||50)),i.find("."+S)[0]||i.append(a),s.renderForm(),a.on("click",function(e){layui.stope(e)}),e.done&&e.done(a,t)};switch(layui.stope(e),P.trigger("table.tool.panel.remove"),f.close(s.tipsIndex),t){case"LAYTABLE_COLS":l({list:(a=[],s.eachCols(function(e,t){t.field&&"normal"==t.type&&a.push('
    • "+(t.fieldTitle||t.title||t.field)+"
    • ").text())+'" lay-filter="LAY_TABLE_TOOL_COLS">')}),a.join("")),done:function(){v.on("checkbox(LAY_TABLE_TOOL_COLS)",function(e){var e=p(e.elem),t=this.checked,a=e.data("key"),i=s.col(a),l=i.hide,e=e.data("parentkey");i.key&&(i.hide=!t,s.elem.find('*[data-key="'+a+'"]')[t?"removeClass":"addClass"](N),l!=i.hide&&s.setParentCol(!t,e),s.resize(),layui.event.call(this,T,"colToggled("+r+")",{col:i,config:u}))})}});break;case"LAYTABLE_EXPORT":b.ie?f.tips("\u5bfc\u51fa\u529f\u80fd\u4e0d\u652f\u6301 IE\uff0c\u8bf7\u7528 Chrome \u7b49\u9ad8\u7ea7\u6d4f\u89c8\u5668\u5bfc\u51fa",this,{tips:3}):l({list:['
    • \u5bfc\u51fa csv \u683c\u5f0f\u6587\u4ef6
    • ','
    • \u5bfc\u51fa xls \u683c\u5f0f\u6587\u4ef6
    • '].join(""),done:function(e,t){t.on("click",function(){var e=p(this).data("type");x.exportFile.call(s,u.id,null,e)})}});break;case"LAYTABLE_PRINT":var n=window.open("about:blank","_blank"),o=[""].join(""),d=p(s.layHeader.html());d.append(s.layMain.find("table").html()),d.append(s.layTotal.find("table").html()),d.find("th.layui-table-patch").remove(),d.find("thead>tr>th."+M).filter(function(e,t){return!p(t).children("."+H).length}).remove(),d.find("tbody>tr>td."+M).remove(),n.document.write(o+d.prop("outerHTML")),n.document.close(),layui.device("edg").edg?(n.onafterprint=n.close,n.print()):(n.print(),n.close())}layui.event.call(this,T,"toolbar("+r+")",p.extend({event:t,config:u},{}))}),s.layHeader.on("click","*[lay-event]",function(e){var t=p(this),a=t.attr("lay-event"),t=t.closest("th").data("key"),t=s.col(t);layui.event.call(this,T,"colTool("+r+")",p.extend({event:a,config:u,col:t},{}))}),s.layPagebar.on("click","*[lay-event]",function(e){var t=p(this).attr("lay-event");layui.event.call(this,T,"pagebar("+r+")",p.extend({event:t,config:u},{}))}),e.on("mousemove",function(e){var t=p(this),a=t.offset().left,e=e.clientX-a;t.data("unresize")||k.eventMoveElem||(d.allowResize=t.width()-e<=10,o.css("cursor",d.allowResize?"col-resize":""))}).on("mouseleave",function(){p(this);k.eventMoveElem||o.css("cursor","")}).on("mousedown",function(e){var t,a=p(this);d.allowResize&&(t=a.data("key"),e.preventDefault(),d.offset=[e.clientX,e.clientY],s.getCssRule(t,function(e){var t=e.style.width||a.outerWidth();d.rule=e,d.ruleWidth=parseFloat(t),d.minWidth=a.data("minwidth")||u.cellMinWidth,d.maxWidth=a.data("maxwidth")||u.cellMaxWidth}),a.data(I,d),k.eventMoveElem=a)}),k.docEvent||P.on("mousemove",function(e){var t,a;k.eventMoveElem&&(t=k.eventMoveElem.data(I)||{},k.eventMoveElem.data("resizing",1),e.preventDefault(),t.rule&&(e=t.ruleWidth+e.clientX-t.offset[0],a=k.eventMoveElem.closest("."+R).attr("lay-id"),(a=C(a))&&((e=et.maxWidth&&(e=t.maxWidth),t.rule.style.width=e+"px",a.setGroupWidth(k.eventMoveElem),f.close(s.tipsIndex))))}).on("mouseup",function(e){var t,a,i,l,n;k.eventMoveElem&&(i=(t=k.eventMoveElem).closest("."+R).attr("lay-id"),(a=C(i))&&(i=t.data("key"),l=a.col(i),n=a.config.elem.attr("lay-filter"),d={},o.css("cursor",""),a.scrollPatch(),t.removeData(I),delete k.eventMoveElem,a.getCssRule(i,function(e){l.width=parseFloat(e.style.width),layui.event.call(t[0],T,"colResized("+n+")",{col:l,config:a.config})})))}),k.docEvent=!0,e.on("click",function(e){var t=p(this),a=t.find(A),i=a.attr("lay-sort");if(!a[0]||1===t.data("resizing"))return t.removeData("resizing");s.sort({field:t,type:"asc"===i?"desc":"desc"===i?null:"asc",fromEvent:!0})}).find(A+" .layui-edge ").on("click",function(e){var t=p(this),a=t.index(),t=t.parents("th").eq(0).data("field");layui.stope(e),0===a?s.sort({field:t,type:"asc",fromEvent:!0}):s.sort({field:t,type:"desc",fromEvent:!0})}),s.commonMember=function(e){var t=p(this).parents("tr").eq(0).data("index"),r=s.layBody.find('tr[data-index="'+t+'"]'),c=(c=x.cache[s.key]||[])[t]||{},a={tr:r,config:u,data:x.clearCacheKey(c),dataCache:c,index:t,del:function(){x.cache[s.key][t]=[],r.remove(),s.scrollPatch()},update:function(e,d){e=e||{},layui.each(e,function(i,l){var n=r.children('td[data-field="'+i+'"]'),o=n.children(y);c[i]=a.data[i]=l,s.eachCols(function(e,t){var a;t.field==i?(o.html(w.call(s,{item3:t,content:l,tplData:p.extend({LAY_COL:t},c)})),n.data("content",l)):d&&(t.templet||t.toolbar)&&(e=r.children('td[data-field="'+(t.field||e)+'"]'),a=c[t.field],e.children(y).html(w.call(s,{item3:t,content:a,tplData:p.extend({LAY_COL:t},c)})),e.data("content",a))})}),s.renderForm()},setRowChecked:function(e){s.setRowChecked(p.extend({index:t},e))}};return p.extend(a,e)}),a=(s.elem.on("click",'input[name="layTableCheckbox"]+',function(e){var t=p(this),a=t.closest("td"),t=t.prev(),i=(s.layBody.find('input[name="layTableCheckbox"]'),t.parents("tr").eq(0).data("index")),l=t[0].checked,n="layTableAllChoose"===t.attr("lay-filter");t[0].disabled||(n?s.setRowChecked({index:"all",checked:l}):(s.setRowChecked({index:i,checked:l}),layui.stope(e)),layui.event.call(t[0],T,"checkbox("+r+")",c.call(t[0],{checked:l,type:n?"all":"one",getCol:function(){return s.col(a.data("key"))}})))}),s.elem.on("click",'input[lay-type="layTableRadio"]+',function(e){var t=p(this),a=t.closest("td"),t=t.prev(),i=t[0].checked,l=t.parents("tr").eq(0).data("index");if(layui.stope(e),t[0].disabled)return!1;s.setRowChecked({type:"radio",index:l}),layui.event.call(t[0],T,"radio("+r+")",c.call(t[0],{checked:i,getCol:function(){return s.col(a.data("key"))}}))}),s.layBody.on("mouseenter","tr",function(){var e=p(this),t=e.index();e.data("off")||s.layBody.find("tr:eq("+t+")").addClass(j)}).on("mouseleave","tr",function(){var e=p(this),t=e.index();e.data("off")||s.layBody.find("tr:eq("+t+")").removeClass(j)}).on("click","tr",function(e){var t=".layui-form-checkbox,.layui-form-switch,.layui-form-radio,[lay-unrow]";p(e.target).is(t)||p(e.target).closest(t)[0]||a.call(this,"row")}).on("dblclick","tr",function(){a.call(this,"rowDouble")}).on("contextmenu","tr",function(e){u.defaultContextmenu||e.preventDefault(),a.call(this,"rowContextmenu")}),function(e){var t=p(this);t.data("off")||layui.event.call(this,T,e+"("+r+")",c.call(t.children("td")[0]))}),n=function(e,t){var a,i,l,n;(e=p(e)).data("off")||(a=e.data("field"),n=e.data("key"),n=s.col(n),i=e.closest("tr").data("index"),i=x.cache[s.key][i],l=e.children(y),(n="function"==typeof n.edit?n.edit(i):n.edit)&&((n=p("textarea"===n?'':''))[0].value=e.data("content")||i[a]||l.text(),e.find("."+W)[0]||e.append(n),n.focus(),t&&layui.stope(t)))},i=(s.layBody.on("change","."+W,function(){var e=p(this),t=e.parent(),a=this.value,i=e.parent().data("field"),e=e.closest("tr").data("index"),e=x.cache[s.key][e],l=c.call(t[0],{value:a,field:i,oldValue:e[i],td:t,reedit:function(){setTimeout(function(){n(l.td);var e={};e[i]=l.oldValue,l.update(e)})},getCol:function(){return s.col(t.data("key"))}}),e={};e[i]=a,l.update(e),layui.event.call(t[0],T,"edit("+r+")",l)}).on("blur","."+W,function(){p(this).remove()}),s.layBody.on(u.editTrigger,"td",function(e){n(this,e)}).on("mouseenter","td",function(){t.call(this)}).on("mouseleave","td",function(){t.call(this,"hide")}),s.layTotal.on("mouseenter","td",function(){t.call(this)}).on("mouseleave","td",function(){t.call(this,"hide")}),"layui-table-grid-down"),t=function(e){var t=p(this),a=t.children(y);t.data("off")||(e?t.find(".layui-table-grid-down").remove():!(a.prop("scrollWidth")>a.outerWidth()||0'))},l=function(e){var t=p(this).parent().children(y);s.tipsIndex=f.tips(['
      ',t.html(),"
      ",''].join(""),t[0],{tips:[3,""],time:-1,anim:-1,maxWidth:b.ios||b.android?300:s.elem.width()/2,isOutAnim:!1,skin:"layui-table-tips",success:function(e,t){e.find(".layui-table-tips-c").on("click",function(){f.close(t)})}}),layui.stope(e)},h=(s.layBody.on("click","."+i,function(e){l.call(this,e)}),s.layTotal.on("click","."+i,function(e){l.call(this,e)}),function(e){var t=p(this),a=t.closest("td"),i=t.parents("tr").eq(0).data("index");s.setRowActive(i),layui.event.call(this,T,(e||"tool")+"("+r+")",c.call(this,{event:t.attr("lay-event"),getCol:function(){return s.col(a.data("key"))}}))});s.layBody.on("click","*[lay-event]",function(e){h.call(this),layui.stope(e)}).on("dblclick","*[lay-event]",function(e){h.call(this,"toolDouble"),layui.stope(e)}),s.layMain.on("scroll",function(){var e=p(this),t=e.scrollLeft(),e=e.scrollTop();s.layHeader.scrollLeft(t),s.layTotal.scrollLeft(t),s.layFixed.find(D).scrollTop(e),f.close(s.tipsIndex)}),O.on("resize",function(){s.resize()})},P.on("click",function(){P.trigger("table.remove.tool.panel")}),P.on("table.remove.tool.panel",function(){p("."+S).remove()}),x.init=function(i,o){o=o||{};var e="object"==typeof i?i:p("string"==typeof i?'table[lay-filter="'+i+'"]':t+"[lay-data], "+t+"[lay-options]"),d="Table element property lay-data configuration item has a syntax error: ";return e.each(function(){var l,e=p(this),t=e.attr("lay-data"),t=r.options(this,{attr:t?"lay-data":null,errorText:d+(t||e.attr("lay-options"))}),n=p.extend({elem:this,cols:[],data:[],skin:e.attr("lay-skin"),size:e.attr("lay-size"),even:"string"==typeof e.attr("lay-even")},x.config,o,t),a=(i&&e.hide(),e.find("thead>tr").each(function(i){n.cols[i]=[],p(this).children().each(function(e){var t=p(this),a=t.attr("lay-data"),a=r.options(this,{attr:a?"lay-data":null,errorText:d+(a||t.attr("lay-options"))}),t=p.extend({title:t.text(),colspan:parseInt(t.attr("colspan"))||0,rowspan:parseInt(t.attr("rowspan"))||0},a);n.cols[i].push(t)})}),e.find("tbody>tr")),t=x.render(n);!a.length||o.data||t.config.url||(l=0,x.eachCols(t.config.id,function(e,i){a.each(function(e){n.data[e]=n.data[e]||{};var t=p(this),a=i.field;n.data[e][a]=t.children("td").eq(l).html()}),l++}),t.reloadData({data:n.data}))}),this},k.that={},k.config={},function(a,i,e,l){var n,o;l.colGroup&&(n=0,a++,l.CHILD_COLS=[],o=e+(parseInt(l.rowspan)||1),layui.each(i[o],function(e,t){t.parentKey?t.parentKey===l.key&&(t.PARENT_COL_INDEX=a,l.CHILD_COLS.push(t),d(a,i,o,t)):t.PARENT_COL_INDEX||1<=n&&n==(l.colspan||1)||(t.PARENT_COL_INDEX=a,l.CHILD_COLS.push(t),n+=parseInt(1td').filter('[data-field="'+e+'"]')}}})).replace(/"/g,'""'),n.push(a='"'+a+'"')))}),d.push(n.join(","))}),c&&layui.each(c.dataTotal,function(e,t){r[t.field]||i.push(t.total)}),o.join(",")+"\r\n"+d.join("\r\n")+"\r\n"+i.join(","))),u.download=(a.title||n.title||"table_"+(n.index||""))+"."+l,document.body.appendChild(u),u.click(),document.body.removeChild(u)},x.getOptions=l,x.hideCol=function(e,l){var n=C(e);n&&("boolean"===layui.type(l)?n.eachCols(function(e,t){var a=t.key,i=n.col(a),t=t.parentKey;i.hide!=l&&(i=i.hide=l,n.elem.find('*[data-key="'+a+'"]')[i?"addClass":"removeClass"](N),n.setParentCol(i,t))}):(l=layui.isArray(l)?l:[l],layui.each(l,function(e,l){n.eachCols(function(e,t){var a,i;l.field===t.field&&(a=t.key,i=n.col(a),t=t.parentKey,"hide"in l&&i.hide!=l.hide&&(i=i.hide=!!l.hide,n.elem.find('*[data-key="'+a+'"]')[i?"addClass":"removeClass"](N),n.setParentCol(i,t)))})})),p("."+S).remove(),n.resize())},x.reload=function(e,t,a,i){if(l(e))return e=C(e),e.reload(t,a,i),k.call(e)},x.reloadData=function(){var a=p.extend([],arguments),i=(a[3]="reloadData",new RegExp("^("+["elem","id","cols","width","height","maxHeight","toolbar","defaultToolbar","className","css","totalRow","pagebar"].join("|")+")$"));return layui.each(a[1],function(e,t){i.test(e)&&delete a[1][e]}),x.reload.apply(null,a)},x.render=function(e){e=new i(e);return k.call(e)},x.clearCacheKey=function(e){return delete(e=p.extend({},e))[x.config.checkName],delete e[x.config.indexName],delete e[x.config.numbersName],delete e[x.config.disabledName],e},p(function(){x.init()}),n(T,x)});layui.define(["table"],function(e){"use strict";var B=layui.$,x=layui.form,j=layui.table,y=layui.hint(),P={config:{},on:j.on,eachCols:j.eachCols,index:j.index,set:function(e){var t=this;return t.config=B.extend({},t.config,e),t},resize:j.resize,getOptions:j.getOptions,hideCol:j.hideCol,renderData:j.renderData},i=function(){var a=this,e=a.config,n=e.id||e.index;return{config:e,reload:function(e,t){a.reload.call(a,e,t)},reloadData:function(e,t){P.reloadData(n,e,t)}}},F=function(e){var t=i.that[e];return t||y.error(e?"The treeTable instance with ID '"+e+"' not found":"ID argument required"),t||null},q="layui-hide",L=".layui-table-main",Y=".layui-table-fixed-l",R=".layui-table-fixed-r",h="layui-table-tree",H="LAY_DATA_INDEX",m="LAY_DATA_INDEX_HISTORY",f="LAY_PARENT_INDEX",b="LAY_CHECKBOX_HALF",X="LAY_EXPAND",z="LAY_HAS_EXPANDED",V="LAY_ASYNC_STATUS",t=function(e){var t=this;t.index=++P.index,t.config=B.extend(!0,{},t.config,P.config,e),t.init(),t.render()},u=function(n,i,e){var l=j.cache[n];layui.each(e||l,function(e,t){var a=t[H];-1!==a.indexOf("-")&&(l[a]=t),t[i]&&u(n,i,t[i])})},l=function(i,a,e){var l=F(i),t=("reloadData"!==e&&(l.status={expand:{}}),B.extend(!0,{},l.getOptions(),a)),n=t.tree,r=n.customName.children,d=n.customName.id,o=(delete a.hasNumberCol,delete a.hasChecboxCol,delete a.hasRadioCol,j.eachCols(null,function(e,t){"numbers"===t.type?a.hasNumberCol=!0:"checkbox"===t.type?a.hasChecboxCol=!0:"radio"===t.type&&(a.hasRadioCol=!0)},t.cols),a.parseData),c=a.done;t.url?e&&(!o||o.mod)||(a.parseData=function(){var e=this,t=arguments,a=t[0],t=("function"===layui.type(o)&&(a=o.apply(e,t)||t[0]),e.response.dataName);return n.data.isSimpleData&&!n["async"].enable&&(a[t]=l.flatToTree(a[t])),s(a[t],function(e){e[X]=X in e?e[X]:e[d]!==undefined&&l.status.expand[e[d]]},r),e.autoSort&&e.initSort&&e.initSort.type&&layui.sort(a[t],e.initSort.field,"desc"===e.initSort.type,!0),l.initData(a[t]),a},a.parseData.mod=!0):(a.data=a.data||[],n.data.isSimpleData&&(a.data=l.flatToTree(a.data)),l.initData(a.data)),e&&(!c||c.mod)||(a.done=function(){var e,t=arguments,a=(t[3]||delete l.isExpandAll,this.elem.next()),n=(l.updateStatus(null,{LAY_HAS_EXPANDED:!1}),u(i,r),a.find('[name="layTableCheckbox"][lay-filter="layTableAllChoose"]'));if(n.length&&(e=P.checkStatus(i),n.prop({checked:e.isAll&&e.data.length,indeterminate:!e.isAll&&e.data.length})),l.renderTreeTable(a),"function"===layui.type(c))return c.apply(this,t)},a.done.mod=!0)};t.prototype.init=function(){var e=this.config,t=j.render(B.extend({},e,{data:[],url:"",done:null})),a=t.config.id;(i.that[a]=this).tableIns=t,l(a,e)},t.prototype.config={tree:{customName:{children:"children",isParent:"isParent",name:"name",id:"id",pid:"parentId",icon:"icon"},view:{indent:14,flexIconClose:'',flexIconOpen:'',showIcon:!0,icon:"",iconClose:'',iconOpen:'',iconLeaf:'',showFlexIconIfNotParent:!1,dblClickExpand:!0,expandAllDefault:!1},data:{isSimpleData:!1,rootPid:null},"async":{enable:!1,url:"",type:null,contentType:null,headers:null,where:null,autoParam:[]},callback:{beforeExpand:null,onExpand:null}}},t.prototype.getOptions=function(){return this.tableIns?j.getOptions(this.tableIns.config.id):this.config},t.prototype.flatToTree=function(e){var a,n,i,t,l,r,d,o=this.getOptions(),c=o.tree,u=c.customName,o=o.id;return e=e||j.cache[o],o=e,a=u.id,n=u.pid,i=u.children,t=c.data.rootPid,a=a||"id",n=n||"parentId",i=i||"children",d={},layui.each(o,function(e,t){l=a+t[a],d[l]=B.extend({},t),d[l][i]=[]}),layui.each(d,function(e,t){(r=a+t[n])&&d[r]&&d[r][i].push(t)}),Object.values(d).filter(function(e){return t?e[n]===t:!e[n]})},t.prototype.treeToFlat=function(e,n,i){var l=this,r=l.getOptions().tree.customName,d=r.children,o=r.pid,c=[];return layui.each(e,function(e,t){var e=(i?i+"-":"")+e,a=B.extend({},t);a[d]=null,a[o]=t[o]||n,c.push(a),c=c.concat(l.treeToFlat(t[d],t[r.id],e))}),c},t.prototype.getTreeNode=function(e){var t=this;if(!e)return y.error("\u627e\u4e0d\u5230\u8282\u70b9\u6570\u636e");var a=t.getOptions(),n=a.tree;a.id,n.customName;return{data:e,dataIndex:e[H],getParentNode:function(){return t.getNodeByIndex(e[f])}}},t.prototype.getNodeByIndex=function(t){var e=this,a=e.getNodeDataByIndex(t);if(!a)return y.error("\u627e\u4e0d\u5230\u8282\u70b9\u6570\u636e");var n=e.getOptions(),i=(n.tree.customName.parent,n.id),n={data:a,dataIndex:a[H],getParentNode:function(){return e.getNodeByIndex(a[f])},update:function(e){return P.updateNode(i,t,e)},remove:function(){return P.removeNode(i,t)},expand:function(e){return P.expandNode(i,B.extend({},e,{index:t}))},setChecked:function(e){return P.setRowChecked(i,B.extend({},e,{index:t}))}};return n.dataIndex=t,n},t.prototype.getNodeById=function(a){var e=this.getOptions(),n=e.tree.customName.id,i="",e=P.getData(e.id,!0);if(layui.each(e,function(e,t){if(t[n]===a)return i=t[H],!0}),i)return this.getNodeByIndex(i)},t.prototype.getNodeDataByIndex=function(a,e,t){var n=this.getOptions(),i=n.tree,l=n.id,r=j.cache[l][a];if("delete"!==t&&r)return B.extend(r,t),e?B.extend({},r):r;for(var r=this.getTableData(),d=(a+="").split("-"),o=r,c=n.url||1');var D=function(e){y[V]="success",y[f.children]=e,c.initData(y[f.children],y[H]),J(t,!0,!p&&n,i,l)},T=b.format;if("function"===layui.type(T))return T(y,o,D),h;var _=B.extend({},b.where||o.where),T=b.autoParam,T=(layui.each(T,function(e,t){t=t.split("=");_[t[0].trim()]=y[(t[1]||t[0]).trim()]}),b.contentType||o.contentType),k=(T&&0==T.indexOf("application/json")&&(_=JSON.stringify(_)),b.method||o.method),O=b.dataType||o.dataType,w=b.jsonpCallback||o.jsonpCallback,S=b.headers||o.headers,A=b.parseData||o.parseData,E=b.response||o.response;return B.ajax({type:k||"get",url:C,contentType:T,data:_,dataType:O||"json",jsonpCallback:w,headers:S||{},success:function(e){(e="function"==typeof A?A.call(o,e)||e:e)[E.statusName]!=E.statusCode?(y[V]="error",g.html('')):D(e[E.dataName])},error:function(e,t){y[V]="error","function"==typeof o.error&&o.error(e,t)}}),h}m=y[z]=!0,v.length&&(!o.initSort||o.url&&!o.autoSort||((b=o.initSort).type?layui.sort(v,b.field,"desc"===b.type,!0):layui.sort(v,j.config.indexName,null,!0)),c.initData(y[f.children],y[H]),k=j.getTrHtml(d,v,null,null,e),N={trs:B(k.trs.join("")),trs_fixed:B(k.trs_fixed.join("")),trs_fixed_r:B(k.trs_fixed_r.join(""))},I=(e.split("-").length-1||0)+1,layui.each(v,function(e,t){N.trs.eq(e).attr({"data-index":t[H],"lay-data-index":t[H],"data-level":I}),N.trs_fixed.eq(e).attr({"data-index":t[H],"lay-data-index":t[H],"data-level":I}),N.trs_fixed_r.eq(e).attr({"data-index":t[H],"lay-data-index":t[H],"data-level":I})}),r.find(L).find('tbody tr[lay-data-index="'+e+'"]').after(N.trs),r.find(Y).find('tbody tr[lay-data-index="'+e+'"]').after(N.trs_fixed),r.find(R).find('tbody tr[lay-data-index="'+e+'"]').after(N.trs_fixed_r),c.renderTreeTable(N.trs,I),n&&!p&&layui.each(v,function(e,t){J({dataIndex:t[H],trElem:r.find('tr[lay-data-index="'+t[H]+'"]').first(),tableViewElem:r,tableId:d,options:o},a,n,i,l)}))}else c.isExpandAll=!1,n&&!p?(layui.each(v,function(e,t){J({dataIndex:t[H],trElem:r.find('tr[lay-data-index="'+t[H]+'"]').first(),tableViewElem:r,tableId:d,options:o},a,n,i,l)}),r.find(v.map(function(e,t,a){return'tr[lay-data-index="'+e[H]+'"]'}).join(",")).addClass(q)):(C=c.treeToFlat(v,y[f.id],e),r.find(C.map(function(e,t,a){return'tr[lay-data-index="'+e[H]+'"]'}).join(",")).addClass(q));return U("resize-"+d,function(){P.resize(d)},0)(),l&&"loading"!==y[V]&&(T=u.callback.onExpand,"function"===layui.type(T)&&T(d,y,x)),h},g=(P.expandNode=function(e,t){var a,n,i,e=F(e);if(e)return a=(t=t||{}).index,n=t.expandFlag,i=t.inherit,t=t.callbackFlag,e=e.getOptions().elem.next(),J({trElem:e.find('tr[lay-data-index="'+a+'"]').first()},n,i,null,t)},P.expandAll=function(a,e){if("boolean"!==layui.type(e))return y.error("expandAll \u7684\u5c55\u5f00\u72b6\u6001\u53c2\u6570\u53ea\u63a5\u6536true/false");var t=F(a);if(t){t.isExpandAll=e;var n=t.getOptions(),i=n.tree,l=n.elem.next(),r=i.customName.isParent,d=i.customName.id,o=i.view.showFlexIconIfNotParent;if(e){e=P.getData(a,!0);if(i["async"].enable){var c=!0;if(layui.each(e,function(e,t){if(t[r]&&!t[V])return!(c=!1)}),!c)return void layui.each(P.getData(a),function(e,t){P.expandNode(a,{index:t[H],expandFlag:!0,inherit:!0})})}var u=!0;if(layui.each(e,function(e,t){if(t[r]&&!t[z])return!(u=!1)}),u)t.updateStatus(null,function(e){(e[r]||o)&&(e[X]=!0,e[d]!==undefined&&(t.status.expand[e[d]]=!0))}),l.find('tbody tr[data-level!="0"]').removeClass(q),l.find(".layui-table-tree-flexIcon").html(i.view.flexIconOpen),i.view.showIcon&&l.find(".layui-table-tree-nodeIcon:not(.layui-table-tree-iconCustom,.layui-table-tree-iconLeaf)").html(i.view.iconOpen);else{if(t.updateStatus(null,function(e){(e[r]||o)&&(e[X]=!0,e[z]=!0,e[d]!==undefined&&(t.status.expand[e[d]]=!0))}),n.initSort&&n.initSort.type&&(!n.url||n.autoSort))return P.sort(a);var f,n=j.getTrHtml(a,e),s={trs:B(n.trs.join("")),trs_fixed:B(n.trs_fixed.join("")),trs_fixed_r:B(n.trs_fixed_r.join(""))};layui.each(e,function(e,t){var a=t[H].split("-").length-1;f={"data-index":t[H],"lay-data-index":t[H],"data-level":a},s.trs.eq(e).attr(f),s.trs_fixed.eq(e).attr(f),s.trs_fixed_r.eq(e).attr(f)}),layui.each(["main","fixed-l","fixed-r"],function(e,t){l.find(".layui-table-"+t+" tbody").html(s[["trs","trs_fixed","trs_fixed_r"][e]])}),t.renderTreeTable(l,0,!1)}}else t.updateStatus(null,function(e){(e[r]||o)&&(e[X]=!1,e[d]!==undefined&&(t.status.expand[e[d]]=!1))}),l.find('.layui-table-box tbody tr[data-level!="0"]').addClass(q),l.find(".layui-table-tree-flexIcon").html(i.view.flexIconClose),i.view.showIcon&&l.find(".layui-table-tree-nodeIcon:not(.layui-table-tree-iconCustom,.layui-table-tree-iconLeaf)").html(i.view.iconClose);P.resize(a)}},t.prototype.renderTreeTable=function(e,t,a){var n=this,i=n.getOptions(),l=i.elem.next(),r=(l.hasClass(h)||l.addClass(h),i.id),d=i.tree||{},o=(d.data,d.view||{}),c=d.customName||{},u=c.isParent,f=(l.attr("lay-filter"),n),s=((t=t||0)||(l.find(".layui-table-body tr:not([data-level])").attr("data-level",t),layui.each(j.cache[r],function(e,t){l.find('.layui-table-main tbody tr[data-level="0"]:eq('+e+")").attr("lay-data-index",t[H]),l.find('.layui-table-fixed-l tbody tr[data-level="0"]:eq('+e+")").attr("lay-data-index",t[H]),l.find('.layui-table-fixed-r tbody tr[data-level="0"]:eq('+e+")").attr("lay-data-index",t[H])})),null),y=c.name,p=o.indent||14;if(layui.each(e.find('td[data-field="'+y+'"]'),function(e,t){var a,n,i=(t=B(t)).closest("tr"),t=t.children(".layui-table-cell");t.hasClass("layui-table-tree-item")||(n=i.attr("lay-data-index"))&&(i=l.find('tr[lay-data-index="'+n+'"]'),(a=f.getNodeDataByIndex(n))[X]&&a[u]&&((s=s||{})[n]=!0),a[b]&&i.find('input[type="checkbox"][name="layTableCheckbox"]').prop("indeterminate",!0),n=t.html(),(t=i.find('td[data-field="'+y+'"]>div.layui-table-cell')).addClass("layui-table-tree-item"),t.html(['
      ',a[X]?o.flexIconOpen:o.flexIconClose,"
      ",o.showIcon?'
      '+(a[c.icon]||o.icon||(a[u]?a[X]?o.iconOpen:o.iconClose:o.iconLeaf)||"")+"
      ":"",n].join("")).find(".layui-table-tree-flexIcon").on("click",function(e){layui.stope(e),J({trElem:i},null,null,null,!0)}))}),!t&&d.view.expandAllDefault&&n.isExpandAll===undefined)return P.expandAll(r,!0);!1!==a&&s?layui.each(s,function(e,t){e=l.find('tr[lay-data-index="'+e+'"]');e.find(".layui-table-tree-flexIcon").html(o.flexIconOpen),J({trElem:e.first()},!0)}):U("renderTreeTable-"+r,function(){i.hasNumberCol&&g(n),x.render(B('.layui-table-tree[lay-id="'+r+'"]'))},0)()},function(a){var e=a.getOptions(),t=e.elem.next(),n=0,i=t.find(".layui-table-main tbody tr"),l=t.find(".layui-table-fixed-l tbody tr"),r=t.find(".layui-table-fixed-r tbody tr");layui.each(a.treeToFlat(j.cache[e.id]),function(e,t){a.getNodeDataByIndex(t[H]).LAY_NUM=++n,i.eq(e).find(".laytable-cell-numbers").html(n),l.eq(e).find(".laytable-cell-numbers").html(n),r.eq(e).find(".laytable-cell-numbers").html(n)})}),s=(t.prototype.render=function(e){var t=this;t.tableIns=j["reloadData"===e?"reloadData":"reload"](t.tableIns.config.id,B.extend(!0,{},t.config)),t.config=t.tableIns.config},t.prototype.reload=function(e,t,a){var n=this;e=e||{},delete n.haveInit,layui.each(e,function(e,t){"array"===layui.type(t)&&delete n.config[e]}),l(n.getOptions().id,e,a||!0),n.config=B.extend(t,{},n.config,e),n.render(a)},P.reloadData=function(){var e=B.extend(!0,[],arguments);return e[3]="reloadData",P.reload.apply(null,e)},function(e,a,n){var i=[];return layui.each(e,function(e,t){"function"===layui.type(a)?a(t):B.extend(t,a),i.push(B.extend({},t)),i=i.concat(s(t[n],a,n))}),i}),r=(t.prototype.updateStatus=function(e,t){var a=this.getOptions(),n=a.tree;return e=e||j.cache[a.id],s(e,t,n.customName.children)},t.prototype.getTableData=function(){var e=this.getOptions();return e.url?j.cache[e.id]:e.data},P.updateStatus=function(e,t,a){var e=F(e),n=e.getOptions();return a=a||(n.url?j.cache[n.id]:n.data),e.updateStatus(a,t)},P.sort=function(e){var t,a=F(e);!a||(t=a.getOptions()).url&&!t.autoSort||(a.initData(),P.renderData(e))},function(n){var t=n.config.id,i=F(t),a=n.data=P.getNodeDataByIndex(t,n.index),l=a[H],r=(n.dataIndex=l,n.update);n.update=function(){var e=arguments,t=(B.extend(i.getNodeDataByIndex(l),e[0]),r.apply(this,e)),a=n.config.tree.customName.name;return a in e[0]&&n.tr.find('td[data-field="'+a+'"]').children("div.layui-table-cell").removeClass("layui-table-tree-item"),i.renderTreeTable(n.tr,n.tr.attr("data-level"),!1),t},n.del=function(){P.removeNode(t,a)},n.setRowChecked=function(e){P.setRowChecked(t,{index:a,checked:e})}}),o=(P.updateNode=function(e,a,t){var n,i,l,r,d,o=F(e);o&&((r=o.getOptions()).tree,r=(n=r.elem.next()).find('tr[lay-data-index="'+a+'"]'),i=r.attr("data-index"),l=r.attr("data-level"),t&&(r=o.getNodeDataByIndex(a,!1,t),d=j.getTrHtml(e,[r]),layui.each(["main","fixed-l","fixed-r"],function(e,t){n.find(".layui-table-"+t+' tbody tr[lay-data-index="'+a+'"]').replaceWith(B(d[["trs","trs_fixed","trs_fixed_r"][e]].join("")).attr({"data-index":i,"lay-data-index":a,"data-level":l}))}),o.renderTreeTable(n.find('tr[lay-data-index="'+a+'"]'),l)))},P.removeNode=function(e,t){var a,n,i,l,r,d=F(e);d&&(r=(a=d.getOptions()).tree,n=a.elem.next(),i=[],t=d.getNodeDataByIndex("string"===layui.type(t)?t:t[H],!1,"delete"),l=d.getNodeDataByIndex(t[f]),d.updateCheckStatus(l),l=d.treeToFlat([t],t[r.customName.pid],t[f]),layui.each(l,function(e,t){i.push('tr[lay-data-index="'+t[H]+'"]')}),n.find(i.join(",")).remove(),r=d.initData(),layui.each(d.treeToFlat(r),function(e,t){t[m]&&t[m]!==t[H]&&n.find('tr[lay-data-index="'+t[m]+'"]').attr({"data-index":t[H],"lay-data-index":t[H]})}),layui.each(j.cache[e],function(e,t){n.find('tr[data-level="0"][lay-data-index="'+t[H]+'"]').attr("data-index",e)}),a.hasNumberCol&&g(d))},P.addNodes=function(e,t){var a=F(e);if(a){var n=a.getOptions(),i=n.tree,l=n.elem.next(),r=(t=t||{}).parentIndex,d=t.index,o=t.data,t=t.focus,c=(r="number"===layui.type(r)?r.toString():r)?a.getNodeDataByIndex(r):null,d="number"===layui.type(d)?d:-1,o=B.extend(!0,[],layui.isArray(o)?o:[o]);a.getTableData();if(c){var u=i.customName.isParent,f=i.customName.children;c[u]=!0;var s=(s=c[f])?(y=s.splice(-1===d?s.length:d),c[f]=s.concat(o,y)):c[f]=o,f=(a.updateStatus(s,function(e){(e[u]||i.view.showFlexIconIfNotParent)&&(e[z]=!1)}),a.treeToFlat(s));l.find(f.map(function(e){return'tr[lay-data-index="'+e[H]+'"]'}).join(",")).remove(),a.initData(),c[z]=!1,c[V]="local",J({trElem:l.find('tr[lay-data-index="'+r+'"]')},!0)}else{var y=j.cache[e].splice(-1===d?j.cache[e].length:d);if(j.cache[e]=j.cache[e].concat(o,y),n.url||(n.page?(s=n.page,n.data.splice.apply(n.data,[s.limit*(s.curr-1),s.limit].concat(j.cache[e]))):n.data=j.cache[e]),a.initData(),l.find(".layui-none").length)return j.renderData(e),o;var p,f=j.getTrHtml(e,o),x={trs:B(f.trs.join("")),trs_fixed:B(f.trs_fixed.join("")),trs_fixed_r:B(f.trs_fixed_r.join(""))},r=(layui.each(o,function(e,t){p={"data-index":t[H],"lay-data-index":t[H],"data-level":"0"},x.trs.eq(e).attr(p),x.trs_fixed.eq(e).attr(p),x.trs_fixed_r.eq(e).attr(p)}),parseInt(o[0][H])-1),s=l.find(L),n=l.find(Y),f=l.find(R);-1==r?(s.find('tr[data-level="0"][data-index="0"]').before(x.trs),n.find('tr[data-level="0"][data-index="0"]').before(x.trs_fixed),f.find('tr[data-level="0"][data-index="0"]').before(x.trs_fixed_r)):-1===d?(s.find("tbody").append(x.trs),n.find("tbody").append(x.trs_fixed),f.find("tbody").append(x.trs_fixed_r)):(r=y[0][m],s.find('tr[data-level="0"][data-index="'+r+'"]').before(x.trs),n.find('tr[data-level="0"][data-index="'+r+'"]').before(x.trs_fixed),f.find('tr[data-level="0"][data-index="'+r+'"]').before(x.trs_fixed_r)),layui.each(j.cache[e],function(e,t){l.find('tr[data-level="0"][lay-data-index="'+t[H]+'"]').attr("data-index",e)}),a.renderTreeTable(l.find(o.map(function(e,t,a){return'tr[lay-data-index="'+e[H]+'"]'}).join(",")))}return a.updateCheckStatus(c),P.resize(e),t&&l.find(L).find('tr[lay-data-index="'+o[0][H]+'"]').get(0).scrollIntoViewIfNeeded(),o}},P.checkStatus=function(e,n){var i,t,a;if(F(e))return i=j.config.checkName,t=P.getData(e,!0).filter(function(e,t,a){return e[i]||n&&e[b]}),a=!0,layui.each(j.cache[e],function(e,t){if(!t[i])return!(a=!1)}),{data:t,isAll:a}},P.on("sort",function(e){var e=e.config,t=e.elem.next(),e=e.id;t.hasClass(h)&&P.sort(e)}),P.on("row",function(e){e.config.elem.next().hasClass(h)&&r(e)}),P.on("rowDouble",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(h)&&(r(e),(t.tree||{}).view.dblClickExpand&&J({trElem:e.tr.first()},null,null,null,!0))}),P.on("rowContextmenu",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(h)&&r(e)}),P.on("tool",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(h)&&r(e)}),P.on("edit",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(h)&&(r(e),e.field===t.tree.customName.name&&((a={})[e.field]=e.value,e.update(a)))}),P.on("radio",function(e){var t=e.config,a=t.elem.next(),t=t.id;a.hasClass(h)&&(a=F(t),r(e),o.call(a,e.tr,e.checked))}),t.prototype.updateCheckStatus=function(e,t){var a=this.getOptions(),n=(a.tree,a.id),i=a.elem.next(),l=j.config.checkName,r=(e&&(a=this.updateParentCheckStatus(e,"boolean"===layui.type(t)?t:null),layui.each(a,function(e,t){x.render(i.find('tr[lay-data-index="'+t[H]+'"] input[name="layTableCheckbox"]:not(:disabled)').prop({checked:t[l],indeterminate:t[b]}))})),!0),d=!1;return layui.each(j.cache[n],function(e,t){(t[l]||t[b])&&(d=!0),t[l]||(r=!1)}),d=d&&!r,x.render(i.find('input[name="layTableCheckbox"][lay-filter="layTableAllChoose"]').prop({checked:r,indeterminate:d})),r},t.prototype.updateParentCheckStatus=function(a,n){var i,e=this.getOptions(),t=e.tree,e=e.id,l=j.config.checkName,t=t.customName.children,r=[];return!(a[b]=!1)===n?a[t].length?layui.each(a[t],function(e,t){if(!t[l])return n=!1,a[b]=!0}):n=!1:!1===n?layui.each(a[t],function(e,t){if(t[l]||t[b])return a[b]=!0}):(n=!1,i=0,layui.each(a[t],function(e,t){t[l]&&i++}),n=a[t].length?a[t].length===i:a[l],a[b]=!n&&0')),a=(e.tree(n),i.elem=u(i.elem));if(a[0]){if(e.key=i.id||e.index,e.elem=n,e.elemNone=u('
      '+i.text.none+"
      "),a.html(e.elem),0==e.elem.find(".layui-tree-set").length)return e.elem.append(e.elemNone);i.showCheckbox&&e.renderForm("checkbox"),e.elem.find(".layui-tree-set").each(function(){var e=u(this);e.parent(".layui-tree-pack")[0]||e.addClass("layui-tree-setHide"),!e.next()[0]&&e.parents(".layui-tree-pack").eq(1).hasClass("layui-tree-lineExtend")&&e.addClass(N),e.next()[0]||e.parents(".layui-tree-set").eq(0).next()[0]||e.addClass(N)}),e.events()}},l.prototype.renderForm=function(e){i.render(e,"LAY-tree-"+this.index)},l.prototype.tree=function(l,e){var r=this,c=r.config,e=e||c.data;layui.each(e,function(e,i){var n=i.children&&0"),t=u(['
      ','
      ','
      ',c.showLine?n?'':'':'',c.showCheckbox?'':"",c.isJump&&i.href?''+(i.title||i.label||c.text.defaultNodeName)+"":''+(i.title||i.label||c.text.defaultNodeName)+"","
      ",function(){if(!c.edit)return"";var n={add:'',update:'',del:''},a=['
      '];return!0===c.edit&&(c.edit=["update","del"]),"object"==typeof c.edit?(layui.each(c.edit,function(e,i){a.push(n[i]||"")}),a.join("")+"
      "):void 0}(),"
      "].join(""));n&&(t.append(a),r.tree(a,i.children)),l.append(t),t.prev("."+f)[0]&&t.prev().children(".layui-tree-pack").addClass("layui-tree-showLine"),n||t.parent(".layui-tree-pack").addClass("layui-tree-lineExtend"),r.spread(t,i),c.showCheckbox&&(i.checked&&r.checkids.push(i.id),r.checkClick(t,i)),c.edit&&r.operate(t,i)})},l.prototype.spread=function(a,e){var t=this.config,i=a.children("."+m),n=i.children("."+x),l=i.find("."+C),i=i.find("."+b),r=t.onlyIconControl?l:n,c="";r.on("click",function(e){var i=a.children("."+g),n=(r.children(".layui-icon")[0]?r:r.find(".layui-tree-icon")).children(".layui-icon");i[0]?a.hasClass(w)?(a.removeClass(w),i.slideUp(200),n.removeClass(v).addClass(k)):(a.addClass(w),i.slideDown(200),n.addClass(v).removeClass(k),t.accordion&&((i=a.siblings("."+f)).removeClass(w),i.children("."+g).slideUp(200),i.find(".layui-tree-icon").children(".layui-icon").removeClass(v).addClass(k))):c="normal"}),i.on("click",function(){u(this).hasClass(d)||(c=a.hasClass(w)?t.onlyIconControl?"open":"close":t.onlyIconControl?"close":"open",t.click&&t.click({elem:a,state:c,data:e}))})},l.prototype.setCheckbox=function(e,i,n){this.config;var t,l=n.prop("checked");n.prop("disabled")||("object"!=typeof i.children&&!e.find("."+g)[0]||e.find("."+g).find('input[same="layuiTreeCheck"]').each(function(){this.disabled||(this.checked=l)}),(t=function(e){var i,n,a;e.parents("."+f)[0]&&(n=(e=e.parent("."+g)).parent(),a=e.prev().find('input[same="layuiTreeCheck"]'),l?a.prop("checked",l):(e.find('input[same="layuiTreeCheck"]').each(function(){this.checked&&(i=!0)}),i||a.prop("checked",!1)),t(n))})(e),this.renderForm("checkbox"))},l.prototype.checkClick=function(n,a){var t=this,l=t.config;n.children("."+m).children("."+x).on("click",'input[same="layuiTreeCheck"]+',function(e){layui.stope(e);var e=u(this).prev(),i=e.prop("checked");e.prop("disabled")||(t.setCheckbox(n,a,e),l.oncheck&&l.oncheck({elem:n,checked:i,data:a}))})},l.prototype.operate=function(c,d){var s=this,o=s.config,e=c.children("."+m),h=e.children("."+x);e.children(".layui-tree-btnGroup").on("click",".layui-icon",function(e){layui.stope(e);var i,e=u(this).data("type"),a=c.children("."+g),t={data:d,type:e,elem:c};if("add"==e){a[0]||(o.showLine?(h.find("."+C).addClass("layui-tree-icon"),h.find("."+C).children(".layui-icon").addClass(k).removeClass("layui-icon-file")):h.find(".layui-tree-iconArrow").removeClass(y),c.append('
      '));var n,l=o.operate&&o.operate(t),r={};if(r.title=o.text.defaultNodeName,r.id=l,s.tree(c.children("."+g),[r]),o.showLine&&(a[0]?(a.hasClass(L)||a.addClass(L),c.find("."+g).each(function(){u(this).children("."+f).last().addClass(N)}),(a.children("."+f).last().prev().hasClass(N)?a.children("."+f).last().prev():a.children("."+f).last()).removeClass(N),!c.parent("."+g)[0]&&c.next()[0]&&a.children("."+f).last().removeClass(N)):(l=c.siblings("."+f),n=1,r=c.parent("."+g),layui.each(l,function(e,i){u(i).children("."+g)[0]||(n=0)}),1==n?(l.children("."+g).addClass(T),l.children("."+g).children("."+f).removeClass(N),c.children("."+g).addClass(T),r.removeClass(L),r.children("."+f).last().children("."+g).children("."+f).last().addClass(N)):c.children("."+g).children("."+f).addClass(N))),!o.showCheckbox)return;h.find('input[same="layuiTreeCheck"]')[0].checked&&(c.children("."+g).children("."+f).last().find('input[same="layuiTreeCheck"]')[0].checked=!0),s.renderForm("checkbox")}else"update"==e?(l=h.children("."+b).html(),h.children("."+b).html(""),h.append(''),h.children(".layui-tree-editInput").val(l).focus(),i=function(e){var i=(i=e.val().trim())||o.text.defaultNodeName;e.remove(),h.children("."+b).html(i),t.data.title=i,o.operate&&o.operate(t)},h.children(".layui-tree-editInput").blur(function(){i(u(this))}),h.children(".layui-tree-editInput").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),i(u(this)))})):p.confirm('\u786e\u8ba4\u5220\u9664\u8be5\u8282\u70b9 "'+(d.title||"")+'" \u5417\uff1f',function(e){if(o.operate&&o.operate(t),t.status="remove",p.close(e),!c.prev("."+f)[0]&&!c.next("."+f)[0]&&!c.parent("."+g)[0])return c.remove(),void s.elem.append(s.elemNone);var l,n,i;c.siblings("."+f).children("."+m)[0]?(o.showCheckbox&&(l=function(e){var i,n,a,t;e.parents("."+f)[0]&&(i=e.siblings("."+f).children("."+m),n=(e=e.parent("."+g).prev()).find('input[same="layuiTreeCheck"]')[0],a=1,(t=0)==n.checked&&(i.each(function(e,i){i=u(i).find('input[same="layuiTreeCheck"]')[0];0!=i.checked||i.disabled||(a=0),i.disabled||(t=1)}),1==a&&1==t&&(n.checked=!0,s.renderForm("checkbox"),l(e.parent("."+f)))))})(c),o.showLine&&(e=c.siblings("."+f),n=1,i=c.parent("."+g),layui.each(e,function(e,i){u(i).children("."+g)[0]||(n=0)}),1==n?(a[0]||(i.removeClass(L),e.children("."+g).addClass(T),e.children("."+g).children("."+f).removeClass(N)),(c.next()[0]?i.children("."+f).last():c.prev()).children("."+g).children("."+f).last().addClass(N),c.next()[0]||c.parents("."+f)[1]||c.parents("."+f).eq(0).next()[0]||c.prev("."+f).addClass(N)):!c.next()[0]&&c.hasClass(N)&&c.prev().addClass(N))):(e=c.parent("."+g).prev(),o.showLine?(e.find("."+C).removeClass("layui-tree-icon"),e.find("."+C).children(".layui-icon").removeClass(v).addClass("layui-icon-file"),(i=e.parents("."+g).eq(0)).addClass(L),i.children("."+f).each(function(){u(this).children("."+g).children("."+f).last().addClass(N)})):e.find(".layui-tree-iconArrow").addClass(y),c.parents("."+f).eq(0).removeClass(w),c.parent("."+g).remove()),c.remove()})})},l.prototype.events=function(){var i=this,t=i.config;i.elem.find(".layui-tree-checkedFirst");i.setChecked(i.checkids),i.elem.find(".layui-tree-search").on("keyup",function(){var e=u(this),n=e.val(),e=e.nextAll(),a=[];e.find("."+b).each(function(){var i,e=u(this).parents("."+m);-1!=u(this).html().indexOf(n)&&(a.push(u(this).parent()),(i=function(e){e.addClass("layui-tree-searchShow"),e.parent("."+g)[0]&&i(e.parent("."+g).parent("."+f))})(e.parent("."+f)))}),e.find("."+m).each(function(){var e=u(this).parent("."+f);e.hasClass("layui-tree-searchShow")||e.addClass(y)}),0==e.find(".layui-tree-searchShow").length&&i.elem.append(i.elemNone),t.onsearch&&t.onsearch({elem:a})}),i.elem.find(".layui-tree-search").on("keydown",function(){u(this).nextAll().find("."+m).each(function(){u(this).parent("."+f).removeClass("layui-tree-searchShow "+y)}),u(".layui-tree-emptyText")[0]&&u(".layui-tree-emptyText").remove()})},l.prototype.getChecked=function(){var e=this.config,i=[],n=[],t=(this.elem.find(".layui-form-checked").each(function(){i.push(u(this).prev()[0].value)}),function(e,a){layui.each(e,function(e,n){layui.each(i,function(e,i){if(n.id==i)return delete(i=u.extend({},n)).children,a.push(i),n.children&&(i.children=[],t(n.children,i.children)),!0})})});return t(u.extend({},e.data),n),n},l.prototype.setChecked=function(l){this.config;this.elem.find("."+f).each(function(e,i){var n=u(this).data("id"),a=u(i).children("."+m).find('input[same="layuiTreeCheck"]'),t=a.next();if("number"==typeof l){if(n.toString()==l.toString())return a[0].checked||t.click(),!1}else"object"==typeof l&&layui.each(l,function(e,i){if(i.toString()==n.toString()&&!a[0].checked)return t.click(),!0})})},t.that={},t.config={},a.reload=function(e,i){e=t.that[e];return e.reload(i),t.call(e)},a.getChecked=function(e){return t.that[e].getChecked()},a.setChecked=function(e,i){return t.that[e].setChecked(i)},a.render=function(e){e=new l(e);return t.call(e)},e(n,a)});layui.define(["laytpl","form"],function(e){"use strict";var s=layui.$,n=layui.laytpl,t=layui.form,a="transfer",i={config:{},index:layui[a]?layui[a].index+1e4:0,set:function(e){var t=this;return t.config=s.extend({},t.config,e),t},on:function(e,t){return layui.onevent.call(this,a,e,t)}},l=function(){var t=this,e=t.config,a=e.id||t.index;return l.that[a]=t,{config:l.config[a]=e,reload:function(e){t.reload.call(t,e)},getData:function(){return t.getData.call(t)}}},d="layui-hide",h="layui-btn-disabled",r="layui-none",c="layui-transfer-box",u="layui-transfer-header",o="layui-transfer-search",f="layui-transfer-data",y=function(e){return['
      ','
      ','","
      ","{{# if(d.data.showSearch){ }}",'","{{# } }}",'
        ',"
        "].join("")},p=['
        ',y({index:0,checkAllName:"layTransferLeftCheckAll"}),'
        ','",'","
        ",y({index:1,checkAllName:"layTransferRightCheckAll"}),"
        "].join(""),v=function(e){var t=this;t.index=++i.index,t.config=s.extend({},t.config,i.config,e),t.render()};v.prototype.config={title:["\u5217\u8868\u4e00","\u5217\u8868\u4e8c"],width:200,height:360,data:[],value:[],showSearch:!1,id:"",text:{none:"\u65e0\u6570\u636e",searchNone:"\u65e0\u5339\u914d\u6570\u636e"}},v.prototype.reload=function(e){var t=this;t.config=s.extend({},t.config,e),t.render()},v.prototype.render=function(){var e=this,t=e.config,a=e.elem=s(n(p,{open:"{{",close:"}}"}).render({data:t,index:e.index})),i=t.elem=s(t.elem);i[0]&&(t.data=t.data||[],t.value=t.value||[],t.id="id"in t?t.id:elem.attr("id")||e.index,e.key=t.id,i.html(e.elem),e.layBox=e.elem.find("."+c),e.layHeader=e.elem.find("."+u),e.laySearch=e.elem.find("."+o),e.layData=a.find("."+f),e.layBtn=a.find(".layui-transfer-active .layui-btn"),e.layBox.css({width:t.width,height:t.height}),e.layData.css({height:(i=t.height-e.layHeader.outerHeight(),t.showSearch&&(i-=e.laySearch.outerHeight()),i-2)}),e.renderData(),e.events())},v.prototype.renderData=function(){var e=this,t=e.config,l=[{checkName:"layTransferLeftCheck",views:[]},{checkName:"layTransferRightCheck",views:[]}];e.parseData(function(a){var i=a.selected?1:0,n=["
      • ",'',"
      • "].join("");i?layui.each(t.value,function(e,t){t==a.value&&a.selected&&(l[i].views[e]=n)}):l[i].views.push(n),delete a.selected}),e.layData.eq(0).html(l[0].views.join("")),e.layData.eq(1).html(l[1].views.join("")),e.renderCheckBtn()},v.prototype.renderForm=function(e){t.render(e,"LAY-transfer-"+this.index)},v.prototype.renderCheckBtn=function(r){var c=this,o=c.config;r=r||{},c.layBox.each(function(e){var t=s(this),a=t.find("."+f),t=t.find("."+u).find('input[type="checkbox"]'),i=a.find('input[type="checkbox"]'),n=0,l=!1;i.each(function(){var e=s(this).data("hide");(this.checked||this.disabled||e)&&n++,this.checked&&!e&&(l=!0)}),t.prop("checked",l&&n===i.length),c.layBtn.eq(e)[l?"removeClass":"addClass"](h),r.stopNone||(i=a.children("li:not(."+d+")").length,c.noneView(a,i?"":o.text.none))}),c.renderForm("checkbox")},v.prototype.noneView=function(e,t){var a=s('

        '+(t||"")+"

        ");e.find("."+r)[0]&&e.find("."+r).remove(),t.replace(/\s/g,"")&&e.append(a)},v.prototype.setValue=function(){var e=this.config,t=[];return this.layBox.eq(1).find("."+f+' input[type="checkbox"]').each(function(){s(this).data("hide")||t.push(this.value)}),e.value=t,this},v.prototype.parseData=function(t){var i=this.config,n=[];return layui.each(i.data,function(e,a){a=("function"==typeof i.parseData?i.parseData(a):a)||a,n.push(a=s.extend({},a)),layui.each(i.value,function(e,t){t==a.value&&(a.selected=!0)}),t&&t(a)}),i.data=n,this},v.prototype.getData=function(e){var t=this.config,i=[];return this.setValue(),layui.each(e||t.value,function(e,a){layui.each(t.data,function(e,t){delete t.selected,a==t.value&&i.push(t)})}),i},v.prototype.transfer=function(e,t){var a,i=this,n=i.config,l=i.layBox.eq(e),r=[],t=(t?((a=(t=t).find('input[type="checkbox"]'))[0].checked=!1,l.siblings("."+c).find("."+f).append(t.clone()),t.remove(),r.push(a[0].value),i.setValue()):l.each(function(e){s(this).find("."+f).children("li").each(function(){var e=s(this),t=e.find('input[type="checkbox"]'),a=t.data("hide");t[0].checked&&!a&&(t[0].checked=!1,l.siblings("."+c).find("."+f).append(e.clone()),e.remove(),r.push(t[0].value)),i.setValue()})}),i.renderCheckBtn(),l.siblings("."+c).find("."+o+" input"));""!==t.val()&&t.trigger("keyup"),n.onchange&&n.onchange(i.getData(r),e)},v.prototype.events=function(){var n=this,l=n.config;n.elem.on("click",'input[lay-filter="layTransferCheckbox"]+',function(){var e=s(this).prev(),t=e[0].checked,a=e.parents("."+c).eq(0).find("."+f);e[0].disabled||("all"===e.attr("lay-type")&&a.find('input[type="checkbox"]').each(function(){this.disabled||(this.checked=t)}),setTimeout(function(){n.renderCheckBtn({stopNone:!0})},0))}),n.elem.on("dblclick","."+f+">li",function(e){var t=s(this),a=t.children('input[type="checkbox"]'),i=t.parent().parent();a[0].disabled||n.transfer(i.data("index"),t)}),n.layBtn.on("click",function(){var e=s(this),t=e.data("index");e.hasClass(h)||n.transfer(t)}),n.laySearch.find("input").on("keyup",function(){var i=this.value,e=s(this).parents("."+o).eq(0).siblings("."+f),t=e.children("li"),t=(t.each(function(){var e=s(this),t=e.find('input[type="checkbox"]'),a=t[0].title,a=("cs"!==l.showSearch&&(a=a.toLowerCase(),i=i.toLowerCase()),-1!==a.indexOf(i));e[a?"removeClass":"addClass"](d),t.data("hide",!a)}),n.renderCheckBtn(),t.length===e.children("li."+d).length);n.noneView(e,t?l.text.searchNone:"")})},l.that={},l.config={},i.reload=function(e,t){e=l.that[e];return e.reload(t),l.call(e)},i.getData=function(e){return l.that[e].getData()},i.render=function(e){e=new v(e);return l.call(e)},e(a,i)});layui.define(["jquery","lay"],function(e){"use strict";var a=layui.$,t=layui.lay,o=(layui.hint(),layui.device(),{config:{},set:function(e){var i=this;return i.config=a.extend({},i.config,e),i},on:function(e,i){return layui.onevent.call(this,r,e,i)}}),r="carousel",d="layui-this",s="layui-carousel-left",u="layui-carousel-right",c="layui-carousel-prev",m="layui-carousel-next",l="layui-carousel-arrow",f="layui-carousel-ind",i=function(e){var i=this;i.config=a.extend({},i.config,o.config,e),i.render()};i.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},i.prototype.render=function(){var e=this,i=e.config,n=a(i.elem);if(1*[carousel-item]>*"),i.index<0&&(i.index=0),i.index>=e.elemItem.length&&(i.index=e.elemItem.length-1),i.interval<800&&(i.interval=800),i.full?i.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):i.elem.css({width:i.width,height:i.height}),i.elem.attr("lay-anim",i.anim),e.elemItem.eq(i.index).addClass(d),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},i.prototype.reload=function(e){var i=this;clearInterval(i.timer),i.config=a.extend({},i.config,e),i.render()},i.prototype.prevIndex=function(){var e=this.config.index-1;return e=e<0?this.elemItem.length-1:e},i.prototype.nextIndex=function(){var e=this.config.index+1;return e=e>=this.elemItem.length?0:e},i.prototype.addIndex=function(e){var i=this.config;i.index=i.index+(e=e||1),i.index>=this.elemItem.length&&(i.index=0)},i.prototype.subIndex=function(e){var i=this.config;i.index=i.index-(e=e||1),i.index<0&&(i.index=this.elemItem.length-1)},i.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(clearInterval(e.timer),e.timer=setInterval(function(){e.slide()},i.interval))},i.prototype.arrow=function(){var i=this,e=i.config,n=a(['",'"].join(""));e.elem.attr("lay-arrow",e.arrow),e.elem.find("."+l)[0]&&e.elem.find("."+l).remove(),e.elem.append(n),n.on("click",function(){var e=a(this).attr("lay-type");i.slide(e)})},i.prototype["goto"]=function(e){var i=this,n=i.config;e>n.index?i.slide("add",e-n.index):e
          ',(i=[],layui.each(e.elemItem,function(e){i.push("")}),i.join("")),"
        "].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+f)[0]&&n.elem.find("."+f).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-t.height()/2),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){e["goto"](a(this).index())})},i.prototype.slide=function(e,i){var n=this,t=n.elemItem,a=n.config,o=a.index,l=a.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),t.eq(a.index).addClass(c),setTimeout(function(){t.eq(o).addClass(u),t.eq(a.index).addClass(u)},50)):(n.addIndex(i),t.eq(a.index).addClass(m),setTimeout(function(){t.eq(o).addClass(s),t.eq(a.index).addClass(s)},50)),setTimeout(function(){t.removeClass(d+" "+c+" "+m+" "+s+" "+u),t.eq(a.index).addClass(d),n.haveSlide=!1},300),n.elemInd.find("li").eq(a.index).addClass(d).siblings().removeClass(d),n.haveSlide=!0,e={index:a.index,prevIndex:o,item:t.eq(a.index)},"function"==typeof a.change&&a.change(e),layui.event.call(this,r,"change("+l+")",e))},i.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){"always"!==e.config.autoplay&&clearInterval(e.timer)}).on("mouseleave",function(){"always"!==e.config.autoplay&&e.autoplay()}),i.elem.data("haveEvents",!0))},o.render=function(e){return new i(e)},e(r,o)});layui.define(["jquery","lay"],function(e){"use strict";var s=layui.jquery,r=layui.lay,c={config:{},index:layui.rate?layui.rate.index+1e4:0,set:function(e){var a=this;return a.config=s.extend({},a.config,e),a},on:function(e,a){return layui.onevent.call(this,l,e,a)}},l="rate",f="layui-icon-rate",h="layui-icon-rate-solid",o="layui-icon-rate-half",u="layui-icon-rate-solid layui-icon-rate-half",v="layui-icon-rate layui-icon-rate-half",a=function(e){var a=this;a.index=++c.index,a.config=s.extend({},a.config,c.config,e),a.render()};a.prototype.config={length:5,text:!1,readonly:!1,half:!1,value:0,theme:""},a.prototype.render=function(){var e=this,a=e.config,l=s(a.elem);if(1a.length&&(a.value=a.length),parseInt(a.value)===a.value||a.half||(a.value=Math.ceil(a.value)-a.value<.5?Math.ceil(a.value):Math.floor(a.value)),'
          "),t=1;t<=a.length;t++){var o='
        • ";a.half&&parseInt(a.value)!==a.value&&t==Math.ceil(a.value)?n=n+'
        • ":n+=o}n+="
        "+(a.text?''+a.value+"\u661f":"")+"";var l=a.elem,u=l.next(".layui-rate");u[0]&&u.remove(),e.elemTemp=s(n),a.span=e.elemTemp.next("span"),a.setText&&a.setText(a.value),l.html(e.elemTemp),l.addClass("layui-inline"),a.readonly||e.action()},a.prototype.setvalue=function(e){this.config.value=e,this.render()},a.prototype.action=function(){var i=this.config,n=this.elemTemp,t=n.find("i").width();n.children("li").each(function(e){var a=e+1,l=s(this);l.on("click",function(e){i.value=a,i.half&&e.pageX-s(this).offset().left<=t/2&&(i.value=i.value-.5),i.text&&n.next("span").text(i.value+"\u661f"),i.choose&&i.choose(i.value),i.setText&&i.setText(i.value)}),l.on("mousemove",function(e){n.find("i").each(function(){s(this).addClass(f).removeClass(u)}),n.find("i:lt("+a+")").each(function(){s(this).addClass(h).removeClass(v)}),i.half&&e.pageX-s(this).offset().left<=t/2&&l.children("i").addClass(o).removeClass(h)}),l.on("mouseleave",function(){n.find("i").each(function(){s(this).addClass(f).removeClass(u)}),n.find("i:lt("+Math.floor(i.value)+")").each(function(){s(this).addClass(h).removeClass(v)}),i.half&&parseInt(i.value)!==i.value&&n.children("li:eq("+Math.floor(i.value)+")").children("i").addClass(o).removeClass("layui-icon-rate-solid layui-icon-rate")})})},a.prototype.events=function(){this.config},c.render=function(e){e=new a(e);return function(){var a=this;return{setvalue:function(e){a.setvalue.call(a,e)},config:a.config}}.call(e)},e(l,c)});layui.define("jquery",function(l){"use strict";var g=layui.$,e=function(l){};e.prototype.load=function(l){var t,i,n,e,r,o,a,c,m,s,u,f,y,d=this,p=0,h=g((l=l||{}).elem);if(h[0])return e=g(l.scrollElem||document),r=l.mb||50,o=!("isAuto"in l)||l.isAuto,a=l.end||"\u6ca1\u6709\u66f4\u591a\u4e86",c=l.scrollElem&&l.scrollElem!==document,m="\u52a0\u8f7d\u66f4\u591a",s=g('"),h.find(".layui-flow-more")[0]||h.append(s),u=function(l,e){l=g(l),s.before(l),(e=0==e||null)?s.html(a):s.find("a").html(m),i=e,t=null,y&&y()},f=function(){t=!0,s.find("a").html(''),"function"==typeof l.done&&l.done(++p,u)},f(),s.find("a").on("click",function(){g(this);i||t||f()}),l.isLazyimg&&(y=d.lazyimg({elem:l.elem+" img",scrollElem:l.scrollElem})),o&&e.on("scroll",function(){var e=g(this),o=e.scrollTop();n&&clearTimeout(n),!i&&h.width()&&(n=setTimeout(function(){var l=(c?e:g(window)).height();(c?e.prop("scrollHeight"):document.documentElement.scrollHeight)-o-l<=r&&(t||f())},100))}),d},e.prototype.lazyimg=function(l){var e,c=this,m=0,s=g((l=l||{}).scrollElem||document),u=l.elem||"img",f=l.scrollElem&&l.scrollElem!==document,y=function(e,l){var o,t=s.scrollTop(),l=t+l,i=f?e.offset().top-s.offset().top+t:e.offset().top;t<=i&&i<=l&&e.attr("lay-src")&&(o=e.attr("lay-src"),layui.img(o,function(){var l=c.lazyimg.elem.eq(m);e.attr("src",o).removeAttr("lay-src"),l[0]&&n(l),m++},function(){c.lazyimg.elem.eq(m);e.removeAttr("lay-src")}))},n=function(l,e){var o=(f?e||s:g(window)).height(),t=s.scrollTop(),i=t+o;if(c.lazyimg.elem=g(u),l)y(l,o);else for(var n=0;n"),preview:"Preview"}},x=function(e){return _.trim(e).replace(/^\n|\n$/,"")};e("code",function(e){var M=e=_.extend(!0,{},a,e);e.elem=_(e.elem),e.elem[0]&&layui.each(e.elem.get().reverse(),function(e,a){var t,l,i,o,n,s,c,d,r,u,y=_(a),E=_.extend(!0,{},M,lay.options(a),(t={},layui.each(["title","height","encode","skin","about"],function(e,a){var i=y.attr("lay-"+a);"string"==typeof i&&(t[a]=i)}),t)),p=y.data("code")||(i=[],y.children("textarea").each(function(){i.push(x(this.value))}),0===i.length&&i.push(x(y.html())),i),f=(y.data("code",p),{copy:{className:"file-b",title:["\u590d\u5236\u4ee3\u7801"],event:function(e,a){if("function"==typeof E.onCopy)E.onCopy(l);else try{navigator.clipboard.writeText(C.unescape(l)).then(function(){g.msg("\u5df2\u590d\u5236",{icon:1})})}catch(i){g.msg("\u590d\u5236\u5931\u8d25",{icon:2})}}}}),v=(E.preview&&(a="LAY-CODE-DF-"+e,r=E.layout||["code","preview"],o="iframe"===E.preview,L=_('
        '),d=_('
        '),n=_('
        '),u=_('
        '),s=_('
        '),m=y.parent("."+T.ELEM_PREVIEW),v=y.prev("."+T.ELEM_TAB),h=y.next("."+T.ELEM_ITEM+"-preview"),E.id&&L.attr("id",E.id),L.addClass(E.className),d.attr("lay-filter",a),E.encode=!0,layui.each(r,function(e,a){var i=_('
      • ');0===e&&i.addClass("layui-this"),i.html(E.text[a]),n.append(i)}),_.extend(f,{full:{className:"screen-full",title:["\u6700\u5927\u5316\u663e\u793a","\u8fd8\u539f\u663e\u793a"],event:function(e,a){var i=e.closest("."+T.ELEM_PREVIEW),t="layui-icon-"+this.className,l="layui-icon-screen-restore",o=this.title,n=_("html,body"),s="layui-scollbar-hide";e.hasClass(t)?(i.addClass(T.ELEM_FULL),e.removeClass(t).addClass(l),e.attr("title",o[1]),n.addClass(s)):(i.removeClass(T.ELEM_FULL),e.removeClass(l).addClass(t),e.attr("title",o[0]),n.removeClass(s))}},window:{className:"release",title:["\u5728\u65b0\u7a97\u53e3\u9884\u89c8"],event:function(e,a){C.openWin({content:l})}}}),E.copy&&("array"===layui.type(E.tools)?-1===E.tools.indexOf("copy")&&E.tools.unshift("copy"):E.tools=["copy"]),s.on("click",">i",function(){var e=_(this),a=e.data("type");"function"==typeof f[a].event&&f[a].event(e,a),"function"==typeof E.toolsEvent&&E.toolsEvent(e,a)}),layui.each(E.tools,function(e,a){var i=f[a]&&f[a].className||a,t=f[a].title||[""];s.append('')}),v[0]&&v.remove(),h[0]&&h.remove(),m[0]&&y.unwrap(),d.append(n),E.tools&&d.append(s),y.wrap(L).addClass(T.ELEM_ITEM).before(d),o&&u.html(''),c=function(e){var a=e.children("iframe")[0],i=(o&&a?a.srcdoc=p.join(""):e.html(p.join("")),{container:e,render:function(){b.render(e.find(".layui-form")),w.render()}});setTimeout(function(){"function"==typeof E.done&&E.done(i)},3)},"preview"===r[0]?(u.addClass(T.ELEM_SHOW),y.before(u),c(u)):y.addClass(T.ELEM_SHOW).after(u),E.codeStyle=[E.style,E.codeStyle].join(""),E.previewStyle=[E.style,E.previewStyle].join(""),u.attr("style",E.previewStyle),w.on("tab("+a+")",function(e){var a=_(this),i=_(e.elem).closest("."+T.ELEM_PREVIEW).find("."+T.ELEM_ITEM),e=i.eq(e.index);i.removeClass(T.ELEM_SHOW),e.addClass(T.ELEM_SHOW),"preview"===a.attr("lay-id")&&c(e)})),E.ln?"ol":"ul"),h=_("<"+v+' class="layui-code-'+v+'">'),m=_('
        '),L=(y.addClass("layui-code-view layui-box"),E.skin&&("notepad"===E.skin&&(E.skin="dark"),y.removeClass("layui-code-dark layui-code-light"),y.addClass("layui-code-"+E.skin)),l=p.join(""));"function"==typeof E.codeParse&&(L=l=E.codeParse(L)),L=(L=E.encode?C.escape(L):L).replace(/[\r\t\n]+/g,"
      • "),y.html(h.html("
      • "+L+"
      • ")),E.header&&!y.children("."+T.ELEM_TITLE)[0]&&(m.html((E.title||E.text.code)+(E.about?'
        '+E.about+"
        ":"")),y.prepend(m)),E.elem.length===e+1&&"function"==typeof E.allDone&&E.allDone(),0<(d=Math.floor(h.find("li").length/100))&&h.css("margin-left",d+"px"),E.height&&h.css("max-height",E.height),h.attr("style",E.codeStyle),E.copy&&!E.preview&&(r=_(['','',""].join("")),u=y.children("."+T.ELEM_COPY),(h[0].style.height||h[0].style.maxHeight)&&r.addClass(T.ELEM_COPY+"-offset"),u[0]&&u.remove(),y.append(r),r.on("click",function(){f.copy.event()}))})})}),layui["layui.all"]||layui.addcss("modules/code.css?v=3","skincodecss"); \ No newline at end of file +/** v2.8.16 | MIT Licensed */;!function(d){"use strict";var t,h=d.document,m={modules:{},status:{},timeout:10,event:{}},o=function(){this.v="2.8.16"},e=d.LAYUI_GLOBAL||{},v=(t=h.currentScript?h.currentScript.src:function(){for(var t,e=h.scripts,n=e.length-1,o=n;01e3*m.timeout/4?g(u+" is not a valid module","error"):void(m.status[u]?c():setTimeout(o,4))}())}function c(){e.push(layui[u]),11e3*m.timeout/4?g(u+" is not a valid module","error"):void("string"==typeof m.modules[u]&&m.status[u]?c():setTimeout(f,4))}():((p=h.createElement("script"))["async"]=!0,p.charset="utf-8",p.src=y+((i=!0===m.version?m.v||(new Date).getTime():m.version||"")?"?v="+i:""),a.appendChild(p),!p.attachEvent||p.attachEvent.toString&&p.attachEvent.toString().indexOf("[native code")<0||b?p.addEventListener("load",function(t){s(t,y)},!1):p.attachEvent("onreadystatechange",function(t){s(t,y)}),m.modules[u]=y),r},o.prototype.disuse=function(t){var n=this;return t=n.isArray(t)?t:[t],n.each(t,function(t,e){m.status[e],delete n[e],delete N[e],delete n.modules[e],delete m.status[e],delete m.modules[e]}),n},o.prototype.getStyle=function(t,e){t=t.currentStyle||d.getComputedStyle(t,null);return t[t.getPropertyValue?"getPropertyValue":"getAttribute"](e)},o.prototype.link=function(n,o,t){var r=this,e=h.getElementsByTagName("head")[0],i=h.createElement("link"),a="layuicss-"+((t="string"==typeof o?o:t)||n).replace(/\.|\//g,""),u="creating",l=0;return i.href=n+(m.debug?"?v="+(new Date).getTime():""),i.rel="stylesheet",i.id=a,i.media="all",h.getElementById(a)||e.appendChild(i),"function"!=typeof o||function s(t){var e=h.getElementById(a);return++l>1e3*m.timeout/100?g(n+" timeout"):void(1989===parseInt(r.getStyle(e,"width"))?(t===u&&e.removeAttribute("lay-status"),e.getAttribute("lay-status")===u?setTimeout(s,100):o()):(e.setAttribute("lay-status",u),setTimeout(function(){s(u)},100)))}(),r},o.prototype.addcss=function(t,e,n){return layui.link(m.dir+"css/"+t,e,n)},m.callback={},o.prototype.factory=function(t){if(layui[t])return"function"==typeof m.callback[t]?m.callback[t]:null},o.prototype.img=function(t,e,n){var o=new Image;if(o.src=t,o.complete)return e(o);o.onload=function(){o.onload=null,"function"==typeof e&&e(o)},o.onerror=function(t){o.onerror=null,"function"==typeof n&&n(t)}},o.prototype.config=function(t){for(var e in t=t||{})m[e]=t[e];return this},o.prototype.modules=function(){var t,e={};for(t in N)e[t]=N[t];return e}(),o.prototype.extend=function(t){for(var e in t=t||{})this[e]||this.modules[e]?g(e+" Module already exists","error"):this.modules[e]=t[e];return this},o.prototype.router=o.prototype.hash=function(t){var n={path:[],search:{},hash:((t=t||location.hash).match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(t)&&(t=t.replace(/^#\//,""),n.href="/"+t,t=t.replace(/([^#])(#.*$)/,"$1").split("/")||[],this.each(t,function(t,e){/^\w+=/.test(e)?(e=e.split("="),n.search[e[0]]=e[1]):n.path.push(e)})),n},o.prototype.url=function(t){var r,e,n=this;return{pathname:(t?((t.match(/\.[^.]+?\/.+/)||[])[0]||"").replace(/^[^\/]+/,"").replace(/\?.+/,""):location.pathname).replace(/^\//,"").split("/"),search:(r={},e=(t?((t.match(/\?.+/)||[])[0]||"").replace(/\#.+/,""):location.search).replace(/^\?+/,"").split("&"),n.each(e,function(t,e){var n=e.indexOf("="),o=n<0?e.substr(0,e.length):0!==n&&e.substr(0,n);o&&(r[o]=0(l.innerHeight||h.documentElement.clientHeight)},d.getStyleRules=function(t,n){if(t)return t=t.sheet||t.styleSheet||{},t=t.cssRules||t.rules,"function"==typeof n&&layui.each(t,function(t,e){if(n(e))return!0}),t},d.style=function(t){t=t||{};var e=d.elem("style"),n=t.text||"",i=t.target;if(n)return"styleSheet"in e?(e.setAttribute("type","text/css"),e.styleSheet.cssText=n):e.innerHTML=n,e.id="LAY-STYLE-"+(t.id||(n=d.style.index||0,d.style.index++,"DF-"+n)),i&&((t=d(i).find("#"+e.id))[0]&&t.remove(),d(i).append(e)),e},d.position=function(t,e,n){var i,r,o,c,u,a,f,s;e&&(n=n||{},t!==h&&t!==d("body")[0]||(n.clickType="right"),i="right"===n.clickType?{left:(i=n.e||l.event||{}).clientX,top:i.clientY,right:i.clientX,bottom:i.clientY}:t.getBoundingClientRect(),f=e.offsetWidth,s=e.offsetHeight,r=function(t){return h.body[t=t?"scrollLeft":"scrollTop"]|h.documentElement[t]},o=function(t){return h.documentElement[t?"clientWidth":"clientHeight"]},c="margin"in n?n.margin:5,u=i.left,a=i.bottom,"center"===n.align?u-=(f-t.offsetWidth)/2:"right"===n.align&&(u=u-f+t.offsetWidth),(u=u+f+c>o("width")?o("width")-f-c:u)o()&&(i.top>s+c&&i.top<=o()?a=i.top-s-2*c:n.allowBottomOut||(a=o()-s-2*c)<0&&(a=0)),(f=n.position)&&(e.style.position=f),e.style.left=u+("fixed"===f?0:r(1))+"px",e.style.top=a+("fixed"===f?0:r())+"px",d.hasScrollbar()||(s=e.getBoundingClientRect(),!n.SYSTEM_RELOAD&&s.bottom+c>o()&&(n.SYSTEM_RELOAD=!0,setTimeout(function(){d.position(t,e,n)},50))))},d.options=function(t,e){if(e="object"==typeof e?e:{attr:e},t===h)return{};var t=d(t),n=e.attr||"lay-options",t=t.attr(n);try{return new Function("return "+(t||"{}"))()}catch(i){return layui.hint().error(e.errorText||[n+'="'+t+'"',"\n parseerror: "+i].join("\n"),"error"),{}}},d.isTopElem=function(n){var t=[h,d("body")[0]],i=!1;return d.each(t,function(t,e){if(e===n)return i=!0}),i},r.addStr=function(n,t){return n=n.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),d.each(t,function(t,e){new RegExp("\\b"+e+"\\b").test(n)||(n=n+" "+e)}),n.replace(/^\s|\s$/,"")},r.removeStr=function(n,t){return n=n.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),d.each(t,function(t,e){e=new RegExp("\\b"+e+"\\b");e.test(n)&&(n=n.replace(e,""))}),n.replace(/\s+/," ").replace(/^\s|\s$/,"")},r.fn.find=function(n){var i=[],r="object"==typeof n;return this.each(function(t,e){e=r&&e.contains(n)?n:e.querySelectorAll(n||null);d.each(e,function(t,e){i.push(e)})}),d(i)},r.fn.each=function(t){return d.each.call(this,this,t)},r.fn.addClass=function(n,i){return this.each(function(t,e){e.className=r[i?"removeStr":"addStr"](e.className,n)})},r.fn.removeClass=function(t){return this.addClass(t,!0)},r.fn.hasClass=function(n){var i=!1;return this.each(function(t,e){new RegExp("\\b"+n+"\\b").test(e.className)&&(i=!0)}),i},r.fn.css=function(e,i){var t=this,r=function(t){return isNaN(t)?t:t+"px"};return"string"!=typeof e||i!==undefined?t.each(function(t,n){"object"==typeof e?d.each(e,function(t,e){n.style[t]=r(e)}):n.style[e]=r(i)}):0]|&(?=#[a-zA-Z0-9]+)/g.test(e+="")?e.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,"""):e}},i=function(e){return new RegExp(e,"g")},u=function(e,r){var n="Laytpl Error: ";return"object"==typeof console&&console.error(n+e+"\n"+(r||"")),n+e},n=function(e,r){var n=this,e=(n.config=n.config||{},n.template=e,function(e){for(var r in e)n.config[r]=e[r]});e(c),e(r)},r=(n.prototype.tagExp=function(e,r,n){var c=this.config;return i((r||"")+c.open+["#([\\s\\S])+?","([^{#}])*?"][e||0]+c.close+(n||""))},n.prototype.parse=function(e,r){var n=this,c=n.config,t=e,o=i("^"+c.open+"#",""),p=i(c.close+"$","");if("string"!=typeof e)return e;e='"use strict";var view = "'+(e=e.replace(/\s+|\r|\t|\n/g," ").replace(i(c.open+"#"),c.open+"# ").replace(i(c.close+"}"),"} "+c.close).replace(/\\/g,"\\\\").replace(i(c.open+"!(.+?)!"+c.close),function(e){return e=e.replace(i("^"+c.open+"!"),"").replace(i("!"+c.close),"").replace(i(c.open+"|"+c.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(n.tagExp(),function(e){return'";'+(e=e.replace(o,"").replace(p,"")).replace(/\\(.)/g,"$1")+';view+="'}).replace(n.tagExp(1),function(e){var r='"+laytpl.escape(';return e.replace(/\s/g,"")===c.open+c.close?"":(e=e.replace(i(c.open+"|"+c.close),""),/^=/.test(e)?e=e.replace(/^=/,""):/^-/.test(e)&&(e=e.replace(/^-/,""),r='"+('),r+e.replace(/\\(.)/g,"$1")+')+"')}))+'";return view;';try{return n.cache=e=new Function("d, laytpl",e),e(r,l)}catch(a){return delete n.cache,u(a,t)}},n.prototype.render=function(e,r){e=e||{};var n=this,e=n.cache?n.cache(e,l):n.parse(n.template,e);return"function"==typeof r&&r(e),e},function(e,r){return new n(e,r)});r.config=function(e){for(var r in e=e||{})c[r]=e[r]},r.v="2.0.0",e("laytpl",r)});layui.define(function(e){"use strict";var r=document,u="getElementById",c="getElementsByTagName",a="layui-disabled",t=function(e){var a=this;a.config=e||{},a.config.index=++o.index,a.render(!0)},o=(t.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return e.elem.length===undefined?2:3},t.prototype.view=function(){var t,i,n=this.config,r=n.groups="groups"in n?Number(n.groups)||0:5,u=(n.layout="object"==typeof n.layout?n.layout:["prev","page","next"],n.count=Number(n.count)||0,n.curr=Number(n.curr)||1,n.limits="object"==typeof n.limits?n.limits:[10,20,30,40,50],n.limit=Number(n.limit)||10,n.pages=Math.ceil(n.count/n.limit)||1,n.curr>n.pages?n.curr=n.pages:n.curr<1&&(n.curr=1),r<0?r=1:r>n.pages&&(r=n.pages),n.prev="prev"in n?n.prev:"上一页",n.next="next"in n?n.next:"下一页",n.pages>r?Math.ceil((n.curr+(1'+n.prev+"":"",page:function(){var e=[];if(n.count<1)return"";1'+(n.first||1)+"");var a=Math.floor((r-1)/2),t=1n.pages?n.pages:a:r;for(i-t…');t<=i;t++)t===n.curr?e.push('"+t+""):e.push(''+t+"");return n.pages>r&&n.pages>i&&!1!==n.last&&(i+1…'),0!==r&&e.push(''+(n.last||n.pages)+"")),e.join("")}(),next:n.next?''+n.next+"":"",count:'\u5171 '+n.count+" \u6761",limit:(t=['"),refresh:['','',""].join(""),skip:['到第','','页',""].join("")};return['
        ',(i=[],layui.each(n.layout,function(e,a){l[a]&&i.push(l[a])}),i.join("")),"
        "].join("")},t.prototype.jump=function(e,a){if(e){var t=this,i=t.config,n=e.children,r=e[c]("button")[0],u=e[c]("input")[0],e=e[c]("select")[0],l=function(){var e=Number(u.value.replace(/\s|\D/g,""));e&&(i.curr=e,t.render())};if(a)return l();for(var s=0,p=n.length;si.pages||(i.curr=e,t.render())});e&&o.on(e,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),r&&o.on(r,"click",function(){l()})}},t.prototype.skip=function(t){var i,e;t&&(i=this,(e=t[c]("input")[0])&&o.on(e,"keyup",function(e){var a=this.value,e=e.keyCode;/^(37|38|39|40)$/.test(e)||(/\D/.test(a)&&(this.value=a.replace(/\D/,"")),13===e&&i.jump(t,!0))}))},t.prototype.render=function(e){var a=this,t=a.config,i=a.type(),n=a.view(),i=(2===i?t.elem&&(t.elem.innerHTML=n):3===i?t.elem.html(n):r[u](t.elem)&&(r[u](t.elem).innerHTML=n),t.jump&&t.jump(t,e),r[u]("layui-laypage-"+t.index));a.jump(i),t.hash&&!e&&(location.hash="!"+t.hash+"="+t.curr),a.skip(i)},{render:function(e){return new t(e).index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(a,e,t){return a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1),this}});e("laypage",o)});!function(i,v){"use strict";var n=i.layui&&layui.define,l={getPath:i.lay&&lay.getPath?lay.getPath:"",link:function(e,t,a){D.path&&i.lay&&lay.layui&&lay.layui.link(D.path+e,t,a)}},e=i.LAYUI_GLOBAL||{},d="layui-laydate-id",D={v:"5.5.0",config:{weekStart:0},index:i.laydate&&i.laydate.v?1e5:0,path:e.laydate_dir||l.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var t="laydate",a=(n?"modules/":"")+"laydate.css?v="+D.v;return n?layui["layui.all"]?"function"==typeof e&&e():layui.addcss(a,e,t):l.link(a,e,t),this}},s=function(){var t=this,e=t.config.id;return(s.that[e]=t).inst={hint:function(e){t.hint.call(t,e)},reload:function(e){t.reload.call(t,e)},config:t.config}},a="laydate",x="layui-this",k="laydate-disabled",h=[100,2e5],T="layui-laydate-static",w="layui-laydate-list",o="laydate-selected",r="layui-laydate-hint",y="laydate-day-prev",m="laydate-day-next",C=".laydate-btns-confirm",M="laydate-time-text",L="laydate-btns-time",E="layui-laydate-preview",S="layui-laydate-shade",I=function(e){var t,a=this,n=(a.index=++D.index,a.config=lay.extend({},a.config,D.config,e),lay(e.elem||a.config.elem));return 1\u8bf7\u91cd\u65b0\u9009\u62e9",invalidDate:"\u4e0d\u5728\u6709\u6548\u65e5\u671f\u6216\u65f6\u95f4\u8303\u56f4\u5185",formatError:["\u65e5\u671f\u683c\u5f0f\u4e0d\u5408\u6cd5
        \u5fc5\u987b\u9075\u5faa\u4e0b\u8ff0\u683c\u5f0f\uff1a
        ","
        \u5df2\u4e3a\u4f60\u91cd\u7f6e"],preview:"\u5f53\u524d\u9009\u4e2d\u7684\u7ed3\u679c"},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
        Please re-select",invalidDate:"Invalid date",formatError:["The date format error
        Must be followed\uff1a
        ","
        It has been reset"],preview:"The selected result"}};return e[this.config.lang]||e.cn},I.prototype.reload=function(e){this.config=lay.extend({},this.config,e),this.init()},I.prototype.init=function(){var r=this,o=r.config,e="static"===o.position,t={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};o.elem=lay(o.elem),o.eventElem=lay(o.eventElem),o.elem[0]&&("array"!==layui.type(o.theme)&&(o.theme=[o.theme]),o.fullPanel&&("datetime"!==o.type||o.range)&&delete o.fullPanel,r.rangeStr=o.range?"string"==typeof o.range?o.range:"-":"",r.rangeLinked=!(!o.range||!o.rangeLinked||"date"!==o.type&&"datetime"!==o.type),r.autoCalendarModel=function(){var e=r.rangeLinked;return r.rangeLinked=o.range&&("date"===o.type||"datetime"===o.type)&&(!r.startDate||!r.endDate||r.startDate&&r.endDate&&r.startDate.year===r.endDate.year&&r.startDate.month===r.endDate.month),lay(r.elem)[r.rangeLinked?"addClass":"removeClass"]("layui-laydate-linkage"),r.rangeLinked!=e},r.autoCalendarModel.auto=r.rangeLinked&&"auto"===o.rangeLinked,"array"===layui.type(o.range)&&(r.rangeElem=[lay(o.range[0]),lay(o.range[1])]),t[o.type]||(i.console&&console.error&&console.error("laydate type error:'"+o.type+"' is not supported"),o.type="date"),o.format===t.date&&(o.format=t[o.type]||t.date),r.format=s.formatArr(o.format),o.weekStart&&!/^[0-6]$/.test(o.weekStart)&&(t=r.lang(),o.weekStart=t.weeks.indexOf(o.weekStart),-1===o.weekStart&&(o.weekStart=0)),r.EXP_IF="",r.EXP_SPLIT="",lay.each(r.format,function(e,t){e=new RegExp(c).test(t)?"\\d{"+(new RegExp(c).test(r.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(t)?4:t.length:/^yyyy$/.test(t)?"1,4":/^y$/.test(t)?"1,308":"1,2")+"}":"\\"+t;r.EXP_IF=r.EXP_IF+e,r.EXP_SPLIT=r.EXP_SPLIT+"("+e+")"}),r.EXP_IF_ONE=new RegExp("^"+r.EXP_IF+"$"),r.EXP_IF=new RegExp("^"+(o.range?r.EXP_IF+"\\s\\"+r.rangeStr+"\\s"+r.EXP_IF:r.EXP_IF)+"$"),r.EXP_SPLIT=new RegExp("^"+r.EXP_SPLIT+"$",""),r.isInput(o.elem[0])||"focus"===o.trigger&&(o.trigger="click"),o.elem.attr("lay-key",r.index),o.eventElem.attr("lay-key",r.index),o.elem.attr(d,o.id),o.mark=lay.extend({},o.calendar&&"cn"===o.lang?{"0-1-1":"\u5143\u65e6","0-2-14":"\u60c5\u4eba","0-3-8":"\u5987\u5973","0-3-12":"\u690d\u6811","0-4-1":"\u611a\u4eba","0-5-1":"\u52b3\u52a8","0-5-4":"\u9752\u5e74","0-6-1":"\u513f\u7ae5","0-9-10":"\u6559\u5e08","0-10-1":"\u56fd\u5e86","0-12-25":"\u5723\u8bde"}:{},o.mark),lay.each(["min","max"],function(e,t){var a=[],n=[];if("number"==typeof o[t])var i=o[t],l=new Date,l=r.newDate({year:l.getFullYear(),month:l.getMonth(),date:l.getDate(),hours:e?23:0,minutes:e?59:0,seconds:e?59:0}).getTime(),e=new Date(i?i<864e5?l+864e5*i:i:l),a=[e.getFullYear(),e.getMonth()+1,e.getDate()],n=[e.getHours(),e.getMinutes(),e.getSeconds()];else if("string"==typeof o[t])a=(o[t].match(/\d+-\d+-\d+/)||[""])[0].split("-"),n=(o[t].match(/\d+:\d+:\d+/)||[""])[0].split(":");else if("object"==typeof o[t])return o[t];o[t]={year:0|a[0]||(new Date).getFullYear(),month:a[1]?(0|a[1])-1:(new Date).getMonth(),date:0|a[2]||(new Date).getDate(),hours:0|n[0],minutes:0|n[1],seconds:0|n[2]}}),r.elemID="layui-laydate"+o.elem.attr("lay-key"),(o.show||e)&&r.render(),e||r.events(),o.value&&o.isInitValue&&("date"===layui.type(o.value)?r.setValue(r.parse(0,r.systemDate(o.value))):r.setValue(o.value)))},I.prototype.render=function(){var a,n,i,l,r=this,o=r.config,d=r.lang(),s="static"===o.position,y=r.elem=lay.elem("div",{id:r.elemID,"class":["layui-laydate",o.range?" layui-laydate-range":"",r.rangeLinked?" layui-laydate-linkage":"",s?" "+T:"",o.fullPanel?" laydate-theme-fullpanel":"",(a="",lay.each(o.theme,function(e,t){"default"===t||/^#/.test(t)||(a+=" laydate-theme-"+t)}),a)].join("")}),m=r.elemMain=[],c=r.elemHeader=[],u=r.elemCont=[],h=r.table=[],e=r.footer=lay.elem("div",{"class":"layui-laydate-footer"}),t=r.shortcut=lay.elem("ul",{"class":"layui-laydate-shortcut"}),f=(o.zIndex&&(y.style.zIndex=o.zIndex),lay.each(new Array(2),function(e){if(!o.range&&0'+d.timeTips+""),(o.range||"datetime"!==o.type||o.fullPanel)&&f.push(''),lay.each(o.btns,function(e,t){var a=d.tools[t]||"btn";o.range&&"now"===t||(s&&"clear"===t&&(a="cn"===o.lang?"\u91cd\u7f6e":"Reset"),n.push(''+a+""))}),f.push('"),f.join(""))),o.shortcuts&&(y.appendChild(t),lay(t).html((i=[],lay.each(o.shortcuts,function(e,t){i.push('
      • '+t.text+"
      • ")}),i.join(""))).find("li").on("click",function(e){var t=o.shortcuts[this.dataset.index]||{},t=("function"==typeof t.value?t.value():t.value)||[],n=(layui.isArray(t)||(t=[t]),o.type),t=(lay.each(t,function(e,t){var a=[o.dateTime,r.endDate][e];"time"===n&&"date"!==layui.type(t)?r.EXP_IF.test(t)&&(t=(t.match(r.EXP_SPLIT)||[]).slice(1),lay.extend(a,{hours:0|t[0],minutes:0|t[2],seconds:0|t[4]})):lay.extend(a,r.systemDate("date"===layui.type(t)?t:new Date(t))),"time"!==n&&"datetime"!==n||(r[["startTime","endTime"][e]]={hours:a.hours,minutes:a.minutes,seconds:a.seconds}),0===e?r.startDate=lay.extend({},a):r.endState=!0,"year"===n||"month"===n||"time"===n?r.listYM[e]=[a.year,a.month+1]:e&&r.autoCalendarModel.auto&&r.autoCalendarModel()}),r.checkDate("limit").calendar(null,null,"init"),lay(r.footer).find("."+L).removeClass(k));t&&"date"===t.attr("lay-type")&&t[0].click(),r.done(null,"change"),lay(this).addClass(x),"static"!==o.position&&r.setValue(r.parse()).done().remove()})),lay.each(m,function(e,t){y.appendChild(t)}),o.showBottom&&y.appendChild(e),lay.elem("style")),p=[],g=!0,t=(lay.each(o.theme,function(e,t){if(g&&/^#/.test(t))return g=!(l=!0),void p.push(["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} li.layui-this,#{{id}} td.layui-this>div{background-color:{{theme}} !important;}",-1!==o.theme.indexOf("circle")?"":"#{{id}} .layui-this{background-color:{{theme}} !important;}","#{{id}} .laydate-day-now{color:{{theme}} !important;}","#{{id}} .laydate-day-now:after{border-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,r.elemID).replace(/{{theme}}/g,t));!g&&/^#/.test(t)&&p.push(["#{{id}} .laydate-selected>div{background-color:{{theme}} !important;}","#{{id}} .laydate-selected:hover>div{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,r.elemID).replace(/{{theme}}/g,t))}),o.shortcuts&&o.range&&p.push("#{{id}}.layui-laydate-range{width: 628px;}".replace(/{{id}}/g,r.elemID)),p.length&&(p=p.join(""),"styleSheet"in f?(f.setAttribute("type","text/css"),f.styleSheet.cssText=p):f.innerHTML=p,l&&lay(y).addClass("laydate-theme-molv"),y.appendChild(f)),r.remove(I.thisElemDate),D.thisId=o.id,s?o.elem.append(y):(v.body.appendChild(y),r.position()),o.shade?'
        ':"");y.insertAdjacentHTML("beforebegin",t),r.checkDate().calendar(null,0,"init"),r.changeEvent(),I.thisElemDate=r.elemID,r.renderAdditional(),"function"==typeof o.ready&&o.ready(lay.extend({},o.dateTime,{month:o.dateTime.month+1})),r.preview()},I.prototype.remove=function(e){var t=this,a=t.config,n=lay("#"+(e||t.elemID));return n[0]&&(n.hasClass(T)||t.checkDate(function(){n.remove(),delete t.startDate,delete t.endDate,delete t.endState,delete t.startTime,delete t.endTime,delete D.thisId,"function"==typeof a.close&&a.close(t)}),lay("."+S).remove()),t},I.prototype.position=function(){var e=this.config;return lay.position(e.elem[0],this.elem,{position:e.position}),this},I.prototype.hint=function(e){var t=this,a=(t.config,lay.elem("div",{"class":r}));t.elem&&(a.innerHTML=(e="object"==typeof e?e||{}:{content:e}).content||"",lay(t.elem).find("."+r).remove(),t.elem.appendChild(a),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+r).remove()},"ms"in e?e.ms:3e3))},I.prototype.getAsYM=function(e,t,a){return a?t--:t++,t<0&&(t=11,e--),11h[1]&&(e.year=h[1],o=!0),11t&&(e.date=t,o=!0))},r=function(n,i,l){var r=["startTime","endTime"];i=(i.match(d.EXP_SPLIT)||[]).slice(1),l=l||0,s.range&&(d[r[l]]=d[r[l]]||{}),lay.each(d.format,function(e,t){var a=parseFloat(i[e]);i[e].lengthd.getDateTime(s.max)?(n=s.dateTime=lay.extend({},s.max),c=!0):d.getDateTime(n)d.getDateTime(s.max))&&(d.endDate=lay.extend({},s.max),c=!0),d.startTime={hours:s.dateTime.hours,minutes:s.dateTime.minutes,seconds:s.dateTime.seconds},d.endTime={hours:d.endDate.hours,minutes:d.endDate.minutes,seconds:d.endDate.seconds},"month"===s.type&&(s.dateTime.date=1,d.endDate.date=1)),c&&l&&(d.setValue(d.parse()),d.hint("value "+a.invalidDate+a.formatError[1])),d.startDate=d.startDate||l&&lay.extend({},s.dateTime),d.autoCalendarModel.auto&&d.autoCalendarModel(),d.endState=!s.range||!d.rangeLinked||!(!d.startDate||!d.endDate),e&&e(),d},I.prototype.mark=function(e,a){var n,t=this.config;return lay.each(t.mark,function(e,t){e=e.split("-");e[0]!=a[0]&&0!=e[0]||e[1]!=a[1]&&0!=e[1]||e[2]!=a[2]||(n=t||a[2])}),n&&e.find("div").html(''+n+""),this},I.prototype.holidays=function(n,i){var e=this.config,l=["","work"];return"array"!==layui.type(e.holidays)||lay.each(e.holidays,function(a,e){lay.each(e,function(e,t){t===n.attr("lay-ymd")&&n.find("div").html('"+i[2]+"")})}),this},I.prototype.limit=function(t){t=t||{};var i=this,e=i.config,l={},a=t.index>(t.time?0:41)?i.endDate:e.dateTime;return lay.each({now:lay.extend({},a,t.date||{}),min:e.min,max:e.max},function(e,a){var n;l[e]=i.newDate(lay.extend({year:a.year,month:"year"===t.type?0:a.month,date:"year"===t.type||"month"===t.type?1:a.date},(n={},lay.each(t.time,function(e,t){n[t]=a[t]}),n))).getTime()}),a=l.nowl.max,t.elem&&t.elem[a?"addClass":"removeClass"](k),a},I.prototype.thisDateTime=function(e){var t=this.config;return e?this.endDate:t.dateTime},I.prototype.calendar=function(e,t,a){t=t?1:0;var i,l,r,o=this,n=o.config,d=e||o.thisDateTime(t),s=new Date,y=o.lang(),m="date"!==n.type&&"datetime"!==n.type,c=lay(o.table[t]).find("td"),u=lay(o.elemHeader[t][2]).find("span");return d.yearh[1]&&(d.year=h[1],o.hint(y.invalidDate)),o.firstDate||(o.firstDate=lay.extend({},d)),s.setFullYear(d.year,d.month,1),i=(s.getDay()+(7-n.weekStart))%7,l=D.getEndDate(d.month||12,d.year),r=D.getEndDate(d.month+1,d.year),lay.each(c,function(e,t){var a,n=[d.year,d.month];(t=lay(t)).removeAttr("class"),e"+n[2]+"
        "),o.mark(t,n).holidays(t,n).limit({elem:t,date:{year:n[0],month:n[1]-1,date:n[2]},index:e})}),lay(u[0]).attr("lay-ym",d.year+"-"+(d.month+1)),lay(u[1]).attr("lay-ym",d.year+"-"+(d.month+1)),"cn"===n.lang?(lay(u[0]).attr("lay-type","year").html(d.year+" \u5e74"),lay(u[1]).attr("lay-type","month").html(d.month+1+" \u6708")):(lay(u[0]).attr("lay-type","month").html(y.month[d.month]),lay(u[1]).attr("lay-type","year").html(d.year)),m&&(n.range?!e&&"init"===a||(o.listYM=[[(o.startDate||n.dateTime).year,(o.startDate||n.dateTime).month+1],[o.endDate.year,o.endDate.month+1]],o.list(n.type,0).list(n.type,1),"time"===n.type?o.setBtnStatus("\u65f6\u95f4",lay.extend({},o.systemDate(),o.startTime),lay.extend({},o.systemDate(),o.endTime)):o.setBtnStatus(!0)):(o.listYM=[[d.year,d.month+1]],o.list(n.type,0))),n.range&&"init"===a&&(o.rangeLinked?(s=o.getAsYM(d.year,d.month,t?"sub":null),o.calendar(lay.extend({},d,{year:s[0],month:s[1]}),1-t)):o.calendar(null,1-t)),n.range||(c=["hours","minutes","seconds"],o.limit({elem:lay(o.footer).find(".laydate-btns-now"),date:o.systemDate(),index:0,time:c}),o.limit({elem:lay(o.footer).find(C),index:0,time:c})),o.setBtnStatus(),lay(o.shortcut).find("li."+x).removeClass(x),n.range&&!m&&"init"!==a&&o.stampRange(),o},I.prototype.list=function(n,i){var l,r,e,o,d=this,s=d.config,y=d.rangeLinked?s.dateTime:[s.dateTime,d.endDate][i],m=d.lang(),t=s.range&&"date"!==s.type&&"datetime"!==s.type,c=lay.elem("ul",{"class":w+" "+{year:"laydate-year-list",month:"laydate-month-list",time:"laydate-time-list"}[n]}),a=d.elemHeader[i],u=lay(a[2]).find("span"),h=d.elemCont[i||0],f=lay(h).find("."+w)[0],p="cn"===s.lang,g=p?"\u5e74":"",v=d.listYM[i]||{},D=["hours","minutes","seconds"],T=["startTime","endTime"][i];return v[0]<1&&(v[0]=1),"year"===n?(e=l=v[0]-7,l<1&&(e=l=1),lay.each(new Array(15),function(e){var t=lay.elem("li",{"lay-ym":l}),a={year:l,month:0,date:1};l==v[0]&&lay(t).addClass(x),t.innerHTML=l+g,c.appendChild(t),d.limit({elem:lay(t),date:a,index:i,type:n}),l++}),lay(u[p?0:1]).attr("lay-ym",l-8+"-"+v[1]).html(e+g+" - "+(l-1)+g)):"month"===n?(lay.each(new Array(12),function(e){var t=lay.elem("li",{"lay-ym":e}),a={year:v[0],month:e,date:1};e+1==v[1]&&lay(t).addClass(x),t.innerHTML=m.month[e]+(p?"\u6708":""),c.appendChild(t),d.limit({elem:lay(t),date:a,index:i,type:n})}),lay(u[p?0:1]).attr("lay-ym",v[0]+"-"+v[1]).html(v[0]+g)):"time"===n&&(r=function(){lay(c).find("ol").each(function(a,e){lay(e).find("li").each(function(e,t){d.limit({elem:lay(t),date:[{hours:e},{hours:d[T].hours,minutes:e},{hours:d[T].hours,minutes:d[T].minutes,seconds:e}][a],index:i,time:[["hours"],["hours","minutes"],["hours","minutes","seconds"]][a]})})}),s.range||d.limit({elem:lay(d.footer).find(C),date:d[T],inedx:0,time:["hours","minutes","seconds"]})},s.range?d[T]||(d[T]="startTime"===T?y:d.endDate):d[T]=y,lay.each([24,60,60],function(t,e){var a=lay.elem("li"),n=["

        "+m.time[t]+"

          "];lay.each(new Array(e),function(e){n.push(""+lay.digit(e,2)+"")}),a.innerHTML=n.join("")+"
        ",c.appendChild(a)}),r()),f&&h.removeChild(f),h.appendChild(c),"year"===n||"month"===n?(lay(d.elemMain[i]).addClass("laydate-ym-show"),lay(c).find("li").on("click",function(){var e=0|lay(this).attr("lay-ym");lay(this).hasClass(k)||(d.rangeLinked?lay.extend(y,{year:"year"===n?e:v[0],month:"year"===n?v[1]-1:e}):y[n]=e,"year"===s.type||"month"===s.type?(lay(c).find("."+x).removeClass(x),lay(this).addClass(x),"month"===s.type&&"year"===n&&(d.listYM[i][0]=e,t&&((i?d.endDate:y).year=e),d.list("month",i))):(d.checkDate("limit").calendar(y,i,"init"),d.closeList()),d.setBtnStatus(),!s.range&&s.autoConfirm&&("month"===s.type&&"month"===n||"year"===s.type&&"year"===n)&&d.setValue(d.parse()).done().remove(),d.autoCalendarModel.auto&&!d.rangeLinked?d.choose(lay(h).find("td.layui-this"),i):d.endState&&d.done(null,"change"),lay(d.footer).find("."+L).removeClass(k))})):(e=lay.elem("span",{"class":M}),o=function(){lay(c).find("ol").each(function(e){var a=this,t=lay(a).find("li");a.scrollTop=30*(d[T][D[e]]-2),a.scrollTop<=0&&t.each(function(e,t){if(!lay(this).hasClass(k))return a.scrollTop=30*(e-2),!0})})},u=lay(a[2]).find("."+M),o(),e.innerHTML=s.range?[m.startTime,m.endTime][i]:m.timeTips,lay(d.elemMain[i]).addClass("laydate-time-show"),u[0]&&u.remove(),a[2].appendChild(e),lay(c).find("ol").each(function(t){var a=this;lay(a).find("li").on("click",function(){var e=0|this.innerHTML;lay(this).hasClass(k)||(s.range?d[T][D[t]]=e:y[D[t]]=e,lay(a).find("."+x).removeClass(x),lay(this).addClass(x),r(),o(),(d.endDate||"time"===s.type||"datetime"===s.type&&s.fullPanel)&&d.done(null,"change"),d.setBtnStatus())})})),d},I.prototype.listYM=[],I.prototype.closeList=function(){var a=this;a.config;lay.each(a.elemCont,function(e,t){lay(this).find("."+w).remove(),lay(a.elemMain[e]).removeClass("laydate-ym-show laydate-time-show")}),lay(a.elem).find("."+M).remove()},I.prototype.setBtnStatus=function(e,t,a){var n=this,i=n.config,l=n.lang(),r=lay(n.footer).find(C);i.range&&"time"!==i.type&&(t=t||(n.rangeLinked?n.startDate:i.dateTime),a=a||n.endDate,i=!n.endState||n.newDate(t).getTime()>n.newDate(a).getTime(),n.limit({date:t})||n.limit({date:a})?r.addClass(k):r[i?"addClass":"removeClass"](k),e&&i&&n.hint("string"==typeof e?l.timeout.replace(/\u65e5\u671f/g,e):l.timeout))},I.prototype.parse=function(e,t){var a=this,n=a.config,t=t||("end"==e?lay.extend({},a.endDate,a.endTime):n.range?lay.extend({},a.rangeLinked?a.startDate:n.dateTime,a.startTime):n.dateTime),t=D.parse(t,a.format,1);return n.range&&e===undefined?t+" "+a.rangeStr+" "+a.parse("end"):t},I.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},I.prototype.getDateTime=function(e){return this.newDate(e).getTime()},I.prototype.setValue=function(e){var t=this,a=t.config,n=a.elem[0];return"static"===a.position||(e=e||"",t.isInput(n)?lay(n).val(e):(a=t.rangeElem)?("array"!==layui.type(e)&&(e=e.split(" "+t.rangeStr+" ")),a[0].val(e[0]||""),a[1].val(e[1]||"")):(0===lay(n).find("*").length&&lay(n).html(e),lay(n).attr("lay-date",e))),t},I.prototype.preview=function(){var e,t=this,a=t.config;a.isPreview&&(e=lay(t.elem).find("."+E),a=!a.range||(t.rangeLinked?t.endState:t.endDate)?t.parse():"",e.html(a),e.html()&&(e.css({color:"#16b777"}),setTimeout(function(){e.css({color:"#777"})},300)))},I.prototype.renderAdditional=function(){this.config.fullPanel&&this.list("time",0)},I.prototype.stampRange=function(){var n,i=this,l=i.config,r=i.rangeLinked?i.startDate:l.dateTime,e=lay(i.elem).find("td");l.range&&!i.endState&&lay(i.footer).find(C).addClass(k),r=r&&i.newDate({year:r.year,month:r.month,date:r.date}).getTime(),n=i.endState&&i.endDate&&i.newDate({year:i.endDate.year,month:i.endDate.month,date:i.endDate.date}).getTime(),lay.each(e,function(e,t){var a=lay(t).attr("lay-ymd").split("-"),a=i.newDate({year:a[0],month:a[1]-1,date:a[2]}).getTime();l.rangeLinked&&!i.startDate&&a===i.newDate(i.systemDate()).getTime()&&lay(t).addClass(lay(t).hasClass(y)||lay(t).hasClass(m)?"":"laydate-day-now"),lay(t).removeClass(o+" "+x),a!==r&&a!==n||(i.rangeLinked||!i.rangeLinked&&(e<42?a===r:a===n))&&lay(t).addClass(lay(t).hasClass(y)||lay(t).hasClass(m)?o:x),rn.getDateTime(i.max)&&(n[t]={hours:i.max.hours,minutes:i.max.minutes,seconds:i.max.seconds},lay.extend(l,n[t])))}),a||(n.startDate=lay.extend({},l)),n.endState&&!n.limit({date:n.thisDateTime(1-a)})&&(((r=n.endState&&n.autoCalendarModel.auto?n.autoCalendarModel():r)||n.rangeLinked&&n.endState)&&n.newDate(n.startDate)>n.newDate(n.endDate)&&(e=n.startDate.year===n.endDate.year&&n.startDate.month===n.endDate.month&&n.startDate.date===n.endDate.date,o=n.startDate,n.startDate=lay.extend({},n.endDate,e?{}:n.startTime),i.dateTime=lay.extend({},n.startDate),n.endDate=lay.extend({},o,e?{}:n.endTime),e&&(o=n.startTime,n.startTime=n.endTime,n.endTime=o)),r&&(i.dateTime=lay.extend({},n.startDate))),n.rangeLinked?(e=lay.extend({},l),!t||a||r||(o=n.getAsYM(l.year,l.month,"sub"),lay.extend(i.dateTime,{year:o[0],month:o[1]})),n.calendar(e,t,r?"init":null)):n.calendar(null,a,r?"init":null),n.endState&&n.done(null,"change")):"static"===i.position?n.calendar().done().done(null,"change"):"date"===i.type?i.autoConfirm?n.setValue(n.parse()).done().remove():n.calendar().done(null,"change"):"datetime"===i.type&&n.calendar().done(null,"change"))},I.prototype.tool=function(t,e){var a=this,n=a.config,i=a.lang(),l=n.dateTime,r="static"===n.position,o={datetime:function(){lay(t).hasClass(k)||(a.list("time",0),n.range&&a.list("time",1),lay(t).attr("lay-type","date").html(a.lang().dateTips))},date:function(){a.closeList(),lay(t).attr("lay-type","datetime").html(a.lang().timeTips)},clear:function(){r&&(lay.extend(l,a.firstDate),a.calendar()),n.range&&(delete n.dateTime,delete a.endDate,delete a.startTime,delete a.endTime),a.setValue(""),a.done(null,"onClear").done(["",{},{}]).remove()},now:function(){var e=new Date;if(lay(t).hasClass(k))return a.hint(i.tools.now+", "+i.invalidDate);lay.extend(l,a.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),a.setValue(a.parse()),r&&a.calendar(),a.done(null,"onNow").done().remove()},confirm:function(){if(n.range){if(lay(t).hasClass(k))return a.hint("time"===n.type?i.timeout.replace(/\u65e5\u671f/g,"\u65f6\u95f4"):i.timeout)}else if(lay(t).hasClass(k))return a.hint(i.invalidDate);a.setValue(a.parse()),a.done(null,"onConfirm").done().remove()}};o[e]&&o[e]()},I.prototype.change=function(n){var i=this,l=i.config,r=i.thisDateTime(n),o=l.range&&("year"===l.type||"month"===l.type),d=i.elemCont[n||0],s=i.listYM[n],e=function(e){var t=lay(d).find(".laydate-year-list")[0],a=lay(d).find(".laydate-month-list")[0];return t&&(s[0]=e?s[0]-15:s[0]+15,i.list("year",n)),a&&(e?s[0]--:s[0]++,i.list("month",n)),(t||a)&&(lay.extend(r,{year:s[0]}),o&&(r.year=s[0]),l.range||i.done(null,"change"),l.range||i.limit({elem:lay(i.footer).find(C),date:{year:s[0]}})),i.setBtnStatus(),t||a};return{prevYear:function(){e("sub")||(i.rangeLinked?(l.dateTime.year--,i.checkDate("limit").calendar(null,null,"init")):(r.year--,i.checkDate("limit").calendar(null,n),i.autoCalendarModel.auto?i.choose(lay(d).find("td.layui-this"),n):i.done(null,"change")))},prevMonth:function(){i.rangeLinked&&(r=l.dateTime);var e=i.getAsYM(r.year,r.month,"sub");lay.extend(r,{year:e[0],month:e[1]}),i.checkDate("limit").calendar(null,null,"init"),i.rangeLinked||(i.autoCalendarModel.auto?i.choose(lay(d).find("td.layui-this"),n):i.done(null,"change"))},nextMonth:function(){i.rangeLinked&&(r=l.dateTime);var e=i.getAsYM(r.year,r.month);lay.extend(r,{year:e[0],month:e[1]}),i.checkDate("limit").calendar(null,null,"init"),i.rangeLinked||(i.autoCalendarModel.auto?i.choose(lay(d).find("td.layui-this"),n):i.done(null,"change"))},nextYear:function(){e()||(i.rangeLinked?(l.dateTime.year++,i.checkDate("limit").calendar(null,0,"init")):(r.year++,i.checkDate("limit").calendar(null,n),i.autoCalendarModel.auto?i.choose(lay(d).find("td.layui-this"),n):i.done(null,"change")))}}},I.prototype.changeEvent=function(){var i=this;i.config;lay(i.elem).on("click",function(e){lay.stope(e)}).on("mousedown",function(e){lay.stope(e)}),lay.each(i.elemHeader,function(n,e){lay(e[0]).on("click",function(e){i.change(n).prevYear()}),lay(e[1]).on("click",function(e){i.change(n).prevMonth()}),lay(e[2]).find("span").on("click",function(e){var t=lay(this),a=t.attr("lay-ym"),t=t.attr("lay-type");a&&(a=a.split("-"),i.listYM[n]=[0|a[0],0|a[1]],i.list(t,n),lay(i.footer).find("."+L).addClass(k))}),lay(e[3]).on("click",function(e){i.change(n).nextMonth()}),lay(e[4]).on("click",function(e){i.change(n).nextYear()})}),lay.each(i.table,function(e,t){lay(t).find("td").on("click",function(){i.choose(lay(this),e)})}),lay(i.footer).find("span").on("click",function(){var e=lay(this).attr("lay-type");i.tool(this,e)})},I.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())||/INPUT|TEXTAREA/.test(e.tagName)},I.prototype.events=function(){var e,t=this,a=t.config;a.elem[0]&&!a.elem[0].eventHandler&&(a.elem.on(a.trigger,e=function(){D.thisId!==a.id&&t.render()}),a.elem[0].eventHandler=!0,a.eventElem.on(a.trigger,e),t.unbind=function(){t.remove(),a.elem.off(a.trigger,e),a.elem.removeAttr("lay-key"),a.elem.removeAttr(d),a.elem[0].eventHandler=!1,a.eventElem.off(a.trigger,e),a.eventElem.removeAttr("lay-key"),delete s.that[a.id]})},s.that={},s.getThis=function(e){var t=s.that[e];return!t&&n&&layui.hint().error(e?a+" instance with ID '"+e+"' not found":"ID argument required"),t},l.run=function(n){n(v).on("mousedown",function(e){var t,a;!D.thisId||(t=s.getThis(D.thisId))&&(a=t.config,e.target!==a.elem[0]&&e.target!==a.eventElem[0]&&e.target!==n(a.closeStop)[0]&&t.remove())}).on("keydown",function(e){var t;!D.thisId||(t=s.getThis(D.thisId))&&"static"!==t.config.position&&13===e.keyCode&&n("#"+t.elemID)[0]&&t.elemID===I.thisElemDate&&(e.preventDefault(),n(t.footer).find(C)[0].click())}),n(i).on("resize",function(){if(D.thisId){var e=s.getThis(D.thisId);if(e)return!(!e.elem||!n(".layui-laydate")[0])&&void e.position()}})},D.render=function(e){e=new I(e);return s.call(e)},D.reload=function(e,t){e=s.getThis(e);if(e)return e.reload(t)},D.getInst=function(e){e=s.getThis(e);if(e)return e.inst},D.hint=function(e,t){e=s.getThis(e);if(e)return e.hint(t)},D.unbind=function(e){e=s.getThis(e);if(e)return e.unbind()},D.close=function(e){e=s.getThis(e||D.thisId);if(e)return e.remove()},D.parse=function(a,n,i){return a=a||{},n=((n="string"==typeof n?s.formatArr(n):n)||[]).concat(),lay.each(n,function(e,t){/yyyy|y/.test(t)?n[e]=lay.digit(a.year,t.length):/MM|M/.test(t)?n[e]=lay.digit(a.month+(i||0),t.length):/dd|d/.test(t)?n[e]=lay.digit(a.date,t.length):/HH|H/.test(t)?n[e]=lay.digit(a.hours,t.length):/mm|m/.test(t)?n[e]=lay.digit(a.minutes,t.length):/ss|s/.test(t)&&(n[e]=lay.digit(a.seconds,t.length))}),n.join("")},D.getEndDate=function(e,t){var a=new Date;return a.setFullYear(t||a.getFullYear(),e||a.getMonth()+1,1),new Date(a.getTime()-864e5).getDate()},n?(D.ready(),layui.define("lay",function(e){D.path=layui.cache.dir,l.run(lay),e(a,D)})):"function"==typeof define&&define.amd?define(function(){return l.run(lay),D}):(D.ready(),l.run(i.lay),i.laydate=D)}(window,window.document);!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e):function(e){if(e.document)return t(e);throw new Error("jQuery requires a window with a document")}:t(e)}("undefined"!=typeof window?window:this,function(T,M){var f=[],g=T.document,c=f.slice,O=f.concat,R=f.push,P=f.indexOf,B={},W=B.toString,m=B.hasOwnProperty,y={},e="1.12.4",C=function(e,t){return new C.fn.init(e,t)},I=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,$=/^-ms-/,z=/-([\da-z])/gi,X=function(e,t){return t.toUpperCase()};function U(e){var t=!!e&&"length"in e&&e.length,n=C.type(e);return"function"!==n&&!C.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+a+")"+a+"*"),ee=new RegExp("="+a+"*([^\\]'\"]*?)"+a+"*\\]","g"),te=new RegExp(G),ne=new RegExp("^"+s+"$"),f={ID:new RegExp("^#("+s+")"),CLASS:new RegExp("^\\.("+s+")"),TAG:new RegExp("^("+s+"|[*])"),ATTR:new RegExp("^"+J),PSEUDO:new RegExp("^"+G),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+a+"*(even|odd|(([+-]|)(\\d*)n|)"+a+"*(?:([+-]|)"+a+"*(\\d+)|))"+a+"*\\)|)","i"),bool:new RegExp("^(?:"+Y+")$","i"),needsContext:new RegExp("^"+a+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+a+"*((?:-\\d)?\\d*)"+a+"*\\)|)(?=[^-]|$)","i")},re=/^(?:input|select|textarea|button)$/i,ie=/^h\d$/i,c=/^[^{]+\{\s*\[native \w/,oe=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ae=/[+~]/,se=/'|\\/g,d=new RegExp("\\\\([\\da-f]{1,6}"+a+"?|("+a+")|.)","ig"),p=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(65536+r):String.fromCharCode(r>>10|55296,1023&r|56320)},ue=function(){C()};try{D.apply(n=V.call(v.childNodes),v.childNodes),n[v.childNodes.length].nodeType}catch(F){D={apply:n.length?function(e,t){U.apply(e,V.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function H(e,t,n,r){var i,o,a,s,u,l,c,f,d=t&&t.ownerDocument,p=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==p&&9!==p&&11!==p)return n;if(!r&&((t?t.ownerDocument||t:v)!==E&&C(t),t=t||E,N)){if(11!==p&&(l=oe.exec(e)))if(i=l[1]){if(9===p){if(!(a=t.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(d&&(a=d.getElementById(i))&&y(t,a)&&a.id===i)return n.push(a),n}else{if(l[2])return D.apply(n,t.getElementsByTagName(e)),n;if((i=l[3])&&g.getElementsByClassName&&t.getElementsByClassName)return D.apply(n,t.getElementsByClassName(i)),n}if(g.qsa&&!A[e+" "]&&(!m||!m.test(e))){if(1!==p)d=t,f=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(se,"\\$&"):t.setAttribute("id",s=k),o=(c=w(e)).length,u=ne.test(s)?"#"+s:"[id='"+s+"']";o--;)c[o]=u+" "+_(c[o]);f=c.join(","),d=ae.test(e)&&de(t.parentNode)||t}if(f)try{return D.apply(n,d.querySelectorAll(f)),n}catch(h){}finally{s===k&&t.removeAttribute("id")}}}return P(e.replace(L,"$1"),t,n,r)}function le(){var n=[];function r(e,t){return n.push(e+" ")>b.cacheLength&&delete r[n.shift()],r[e+" "]=t}return r}function q(e){return e[k]=!0,e}function h(e){var t=E.createElement("div");try{return!!e(t)}catch(F){return!1}finally{t.parentNode&&t.parentNode.removeChild(t)}}function ce(e,t){for(var n=e.split("|"),r=n.length;r--;)b.attrHandle[n[r]]=t}function fe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||1<<31)-(~e.sourceIndex||1<<31);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function x(a){return q(function(o){return o=+o,q(function(e,t){for(var n,r=a([],e.length,o),i=r.length;i--;)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function de(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in g=H.support={},O=H.isXML=function(e){e=e&&(e.ownerDocument||e).documentElement;return!!e&&"HTML"!==e.nodeName},C=H.setDocument=function(e){var e=e?e.ownerDocument||e:v;return e!==E&&9===e.nodeType&&e.documentElement&&(t=(E=e).documentElement,N=!O(E),(e=E.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",ue,!1):e.attachEvent&&e.attachEvent("onunload",ue)),g.attributes=h(function(e){return e.className="i",!e.getAttribute("className")}),g.getElementsByTagName=h(function(e){return e.appendChild(E.createComment("")),!e.getElementsByTagName("*").length}),g.getElementsByClassName=c.test(E.getElementsByClassName),g.getById=h(function(e){return t.appendChild(e).id=k,!E.getElementsByName||!E.getElementsByName(k).length}),g.getById?(b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&N)return(e=t.getElementById(e))?[e]:[]},b.filter.ID=function(e){var t=e.replace(d,p);return function(e){return e.getAttribute("id")===t}}):(delete b.find.ID,b.filter.ID=function(e){var t=e.replace(d,p);return function(e){e="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return e&&e.value===t}}),b.find.TAG=g.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):g.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"!==e)return o;for(;n=o[i++];)1===n.nodeType&&r.push(n);return r},b.find.CLASS=g.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&N)return t.getElementsByClassName(e)},r=[],m=[],(g.qsa=c.test(E.querySelectorAll))&&(h(function(e){t.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+a+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+a+"*(?:value|"+Y+")"),e.querySelectorAll("[id~="+k+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||m.push(".#.+[+~]")}),h(function(e){var t=E.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+a+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")})),(g.matchesSelector=c.test(i=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.msMatchesSelector))&&h(function(e){g.disconnectedMatch=i.call(e,"div"),i.call(e,"[s!='']:x"),r.push("!=",G)}),m=m.length&&new RegExp(m.join("|")),r=r.length&&new RegExp(r.join("|")),e=c.test(t.compareDocumentPosition),y=e||c.test(t.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,t=t&&t.parentNode;return e===t||!(!t||1!==t.nodeType||!(n.contains?n.contains(t):e.compareDocumentPosition&&16&e.compareDocumentPosition(t)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},$=e?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!g.sortDetached&&t.compareDocumentPosition(e)===n?e===E||e.ownerDocument===v&&y(v,e)?-1:t===E||t.ownerDocument===v&&y(v,t)?1:u?j(u,e)-j(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===E?-1:t===E?1:i?-1:o?1:u?j(u,e)-j(u,t):0;if(i===o)return fe(e,t);for(n=e;n=n.parentNode;)a.unshift(n);for(n=t;n=n.parentNode;)s.unshift(n);for(;a[r]===s[r];)r++;return r?fe(a[r],s[r]):a[r]===v?-1:s[r]===v?1:0}),E},H.matches=function(e,t){return H(e,null,null,t)},H.matchesSelector=function(e,t){if((e.ownerDocument||e)!==E&&C(e),t=t.replace(ee,"='$1']"),g.matchesSelector&&N&&!A[t+" "]&&(!r||!r.test(t))&&(!m||!m.test(t)))try{var n=i.call(e,t);if(n||g.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(F){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(d,p),e[3]=(e[3]||e[4]||e[5]||"").replace(d,p),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||H.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&H.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return f.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&te.test(n)&&(t=w(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(d,p).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=W[e+" "];return t||(t=new RegExp("(^|"+a+")"+e+"("+a+"|$)"))&&W(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(t,n,r){return function(e){e=H.attr(e,t);return null==e?"!="===n:!n||(e+="","="===n?e===r:"!="===n?e!==r:"^="===n?r&&0===e.indexOf(r):"*="===n?r&&-1(?:<\/\1>|)$/,G=/^.[^:#\[\.,]*$/;function K(e,n,r){if(C.isFunction(n))return C.grep(e,function(e,t){return!!n.call(e,t,e)!==r});if(n.nodeType)return C.grep(e,function(e){return e===n!==r});if("string"==typeof n){if(G.test(n))return C.filter(n,e,r);n=C.filter(n,e)}return C.grep(e,function(e){return-1)[^>]*|#([\w-]*))$/,ee=((C.fn.init=function(e,t,n){if(!e)return this;if(n=n||Q,"string"!=typeof e)return e.nodeType?(this.context=this[0]=e,this.length=1,this):C.isFunction(e)?"undefined"!=typeof n.ready?n.ready(e):e(C):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),C.makeArray(e,this));if(!(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&3<=e.length?[null,e,null]:Z.exec(e))||!r[1]&&t)return(!t||t.jquery?t||n:this.constructor(t)).find(e);if(r[1]){if(t=t instanceof C?t[0]:t,C.merge(this,C.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:g,!0)),J.test(r[1])&&C.isPlainObject(t))for(var r in t)C.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}if((n=g.getElementById(r[2]))&&n.parentNode){if(n.id!==r[2])return Q.find(e);this.length=1,this[0]=n}return this.context=g,this.selector=e,this}).prototype=C.fn,Q=C(g),/^(?:parents|prev(?:Until|All))/),te={children:!0,contents:!0,next:!0,prev:!0};function ne(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}C.fn.extend({has:function(e){var t,n=C(e,this),r=n.length;return this.filter(function(){for(t=0;t
        a",y.leadingWhitespace=3===S.firstChild.nodeType,y.tbody=!S.getElementsByTagName("tbody").length,y.htmlSerialize=!!S.getElementsByTagName("link").length,y.html5Clone="<:nav>"!==g.createElement("nav").cloneNode(!0).outerHTML,q.type="checkbox",q.checked=!0,k.appendChild(q),y.appendChecked=q.checked,S.innerHTML="",y.noCloneChecked=!!S.cloneNode(!0).lastChild.defaultValue,k.appendChild(S),(q=g.createElement("input")).setAttribute("type","radio"),q.setAttribute("checked","checked"),q.setAttribute("name","t"),S.appendChild(q),y.checkClone=S.cloneNode(!0).cloneNode(!0).lastChild.checked,y.noCloneEvent=!!S.addEventListener,S[C.expando]=1,y.attributes=!S.getAttribute(C.expando);var x={option:[1,""],legend:[1,"
        ","
        "],area:[1,"",""],param:[1,"",""],thead:[1,"","
        "],tr:[2,"","
        "],col:[2,"","
        "],td:[3,"","
        "],_default:y.htmlSerialize?[0,"",""]:[1,"X
        ","
        "]};function b(e,t){var n,r,i=0,o="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):undefined;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||C.nodeName(r,t)?o.push(r):C.merge(o,b(r,t));return t===undefined||t&&C.nodeName(e,t)?C.merge([e],o):o}function we(e,t){for(var n,r=0;null!=(n=e[r]);r++)C._data(n,"globalEval",!t||C._data(t[r],"globalEval"))}x.optgroup=x.option,x.tbody=x.tfoot=x.colgroup=x.caption=x.thead,x.th=x.td;var Te=/<|&#?\w+;/,Ce=/"!==f[1]||Ce.test(a)?0:u:u.firstChild)&&a.childNodes.length;o--;)C.nodeName(c=a.childNodes[o],"tbody")&&!c.childNodes.length&&a.removeChild(c);for(C.merge(h,u.childNodes),u.textContent="";u.firstChild;)u.removeChild(u.firstChild);u=p.lastChild}else h.push(t.createTextNode(a));for(u&&p.removeChild(u),y.appendChecked||C.grep(b(h,"input"),Ee),g=0;a=h[g++];)if(r&&-1]","i"),Pe=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,Be=/\s*$/g,ze=be(g).appendChild(g.createElement("div"));function Xe(e,t){return C.nodeName(e,"table")&&C.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ue(e){return e.type=(null!==C.find.attr(e,"type"))+"/"+e.type,e}function Ve(e){var t=Ie.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Ye(e,t){if(1===t.nodeType&&C.hasData(e)){var n,r,i,e=C._data(e),o=C._data(t,e),a=e.events;if(a)for(n in delete o.handle,o.events={},a)for(r=0,i=a[n].length;r")},clone:function(e,t,n){var r,i,o,a,s,u=C.contains(e.ownerDocument,e);if(y.html5Clone||C.isXMLDoc(e)||!Re.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(ze.innerHTML=e.outerHTML,ze.removeChild(o=ze.firstChild)),!(y.noCloneEvent&&y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||C.isXMLDoc(e)))for(r=b(o),s=b(e),a=0;null!=(i=s[a]);++a)if(r[a]){f=c=l=p=d=void 0;var l,c,f,d=i,p=r[a];if(1===p.nodeType){if(l=p.nodeName.toLowerCase(),!y.noCloneEvent&&p[C.expando]){for(c in(f=C._data(p)).events)C.removeEvent(p,c,f.handle);p.removeAttribute(C.expando)}"script"===l&&p.text!==d.text?(Ue(p).text=d.text,Ve(p)):"object"===l?(p.parentNode&&(p.outerHTML=d.outerHTML),y.html5Clone&&d.innerHTML&&!C.trim(p.innerHTML)&&(p.innerHTML=d.innerHTML)):"input"===l&&ge.test(d.type)?(p.defaultChecked=p.checked=d.checked,p.value!==d.value&&(p.value=d.value)):"option"===l?p.defaultSelected=p.selected=d.defaultSelected:"input"!==l&&"textarea"!==l||(p.defaultValue=d.defaultValue)}}if(t)if(n)for(s=s||b(e),r=r||b(o),a=0;null!=(i=s[a]);a++)Ye(i,r[a]);else Ye(e,o);return 0<(r=b(o,"script")).length&&we(r,!u&&b(e,"script")),r=s=i=null,o},cleanData:function(e,t){for(var n,r,i,o,a=0,s=C.expando,u=C.cache,l=y.attributes,c=C.event.special;null!=(n=e[a]);a++)if((t||v(n))&&(o=(i=n[s])&&u[i])){if(o.events)for(r in o.events)c[r]?C.event.remove(n,r):C.removeEvent(n,r,o.handle);u[i]&&(delete u[i],l||"undefined"==typeof n.removeAttribute?n[s]=undefined:n.removeAttribute(s),f.push(i))}}}),C.fn.extend({domManip:w,detach:function(e){return Je(this,e,!0)},remove:function(e){return Je(this,e)},text:function(e){return d(this,function(e){return e===undefined?C.text(this):this.empty().append((this[0]&&this[0].ownerDocument||g).createTextNode(e))},null,e,arguments.length)},append:function(){return w(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Xe(this,e).appendChild(e)})},prepend:function(){return w(this,arguments,function(e){var t;1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(t=Xe(this,e)).insertBefore(e,t.firstChild)})},before:function(){return w(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return w(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&C.cleanData(b(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&C.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return C.clone(this,e,t)})},html:function(e){return d(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined)return 1===t.nodeType?t.innerHTML.replace(Oe,""):undefined;if("string"==typeof e&&!Be.test(e)&&(y.htmlSerialize||!Re.test(e))&&(y.leadingWhitespace||!ve.test(e))&&!x[(me.exec(e)||["",""])[1].toLowerCase()]){e=C.htmlPrefilter(e);try{for(;n")).appendTo(t.documentElement))[0].contentWindow||Ge[0].contentDocument).document).write(),t.close(),n=Qe(e,t),Ge.detach()),Ke[e]=n),n}var n,et,tt,nt,rt,it,ot,a,at=/^margin/,st=new RegExp("^("+e+")(?!px)[a-z%]+$","i"),ut=function(e,t,n,r){var i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.apply(e,r||[]),t)e.style[i]=o[i];return r},lt=g.documentElement;function t(){var e,t=g.documentElement;t.appendChild(ot),a.style.cssText="-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",n=tt=it=!1,et=rt=!0,T.getComputedStyle&&(e=T.getComputedStyle(a),n="1%"!==(e||{}).top,it="2px"===(e||{}).marginLeft,tt="4px"===(e||{width:"4px"}).width,a.style.marginRight="50%",et="4px"===(e||{marginRight:"4px"}).marginRight,(e=a.appendChild(g.createElement("div"))).style.cssText=a.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",e.style.marginRight=e.style.width="0",a.style.width="1px",rt=!parseFloat((T.getComputedStyle(e)||{}).marginRight),a.removeChild(e)),a.style.display="none",(nt=0===a.getClientRects().length)&&(a.style.display="",a.innerHTML="
        t
        ",a.childNodes[0].style.borderCollapse="separate",(e=a.getElementsByTagName("td"))[0].style.cssText="margin:0;border:0;padding:0;display:none",(nt=0===e[0].offsetHeight)&&(e[0].style.display="",e[1].style.display="none",nt=0===e[0].offsetHeight)),t.removeChild(ot)}ot=g.createElement("div"),(a=g.createElement("div")).style&&(a.style.cssText="float:left;opacity:.5",y.opacity="0.5"===a.style.opacity,y.cssFloat=!!a.style.cssFloat,a.style.backgroundClip="content-box",a.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle="content-box"===a.style.backgroundClip,(ot=g.createElement("div")).style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",a.innerHTML="",ot.appendChild(a),y.boxSizing=""===a.style.boxSizing||""===a.style.MozBoxSizing||""===a.style.WebkitBoxSizing,C.extend(y,{reliableHiddenOffsets:function(){return null==n&&t(),nt},boxSizingReliable:function(){return null==n&&t(),tt},pixelMarginRight:function(){return null==n&&t(),et},pixelPosition:function(){return null==n&&t(),n},reliableMarginRight:function(){return null==n&&t(),rt},reliableMarginLeft:function(){return null==n&&t(),it}}));var l,p,ct=/^(top|right|bottom|left)$/;function ft(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}T.getComputedStyle?(l=function(e){var t=e.ownerDocument.defaultView;return(t=t&&t.opener?t:T).getComputedStyle(e)},p=function(e,t,n){var r,i,o=e.style;return""!==(i=(n=n||l(e))?n.getPropertyValue(t)||n[t]:undefined)&&i!==undefined||C.contains(e.ownerDocument,e)||(i=C.style(e,t)),n&&!y.pixelMarginRight()&&st.test(i)&&at.test(t)&&(e=o.width,t=o.minWidth,r=o.maxWidth,o.minWidth=o.maxWidth=o.width=i,i=n.width,o.width=e,o.minWidth=t,o.maxWidth=r),i===undefined?i:i+""}):lt.currentStyle&&(l=function(e){return e.currentStyle},p=function(e,t,n){var r,i,o,a=e.style;return null==(n=(n=n||l(e))?n[t]:undefined)&&a&&a[t]&&(n=a[t]),st.test(n)&&!ct.test(t)&&(r=a.left,(o=(i=e.runtimeStyle)&&i.left)&&(i.left=e.currentStyle.left),a.left="fontSize"===t?"1em":n,n=a.pixelLeft+"px",a.left=r,o&&(i.left=o)),n===undefined?n:n+""||"auto"});var dt=/alpha\([^)]*\)/i,pt=/opacity\s*=\s*([^)]*)/i,ht=/^(none|table(?!-c[ea]).+)/,gt=new RegExp("^("+e+")(.*)$","i"),mt={position:"absolute",visibility:"hidden",display:"block"},yt={letterSpacing:"0",fontWeight:"400"},vt=["Webkit","O","Moz","ms"],xt=g.createElement("div").style;function bt(e){if(e in xt)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=vt.length;n--;)if((e=vt[n]+t)in xt)return e}function wt(e,t){for(var n,r,i,o=[],a=0,s=e.length;a
        a",F=q.getElementsByTagName("a")[0],k.setAttribute("type","checkbox"),q.appendChild(k),(F=q.getElementsByTagName("a")[0]).style.cssText="top:1px",y.getSetAttribute="t"!==q.className,y.style=/top/.test(F.getAttribute("style")),y.hrefNormalized="/a"===F.getAttribute("href"),y.checkOn=!!k.value,y.optSelected=e.selected,y.enctype=!!g.createElement("form").enctype,S.disabled=!0,y.optDisabled=!e.disabled,(k=g.createElement("input")).setAttribute("value",""),y.input=""===k.getAttribute("value"),k.value="t",k.setAttribute("type","radio"),y.radioValue="t"===k.value;var Lt=/\r/g,Ht=/[\x20\t\r\n\f]+/g;C.fn.extend({val:function(t){var n,e,r,i=this[0];return arguments.length?(r=C.isFunction(t),this.each(function(e){1===this.nodeType&&(null==(e=r?t.call(this,e,C(this).val()):t)?e="":"number"==typeof e?e+="":C.isArray(e)&&(e=C.map(e,function(e){return null==e?"":e+""})),(n=C.valHooks[this.type]||C.valHooks[this.nodeName.toLowerCase()])&&"set"in n&&n.set(this,e,"value")!==undefined||(this.value=e))})):i?(n=C.valHooks[i.type]||C.valHooks[i.nodeName.toLowerCase()])&&"get"in n&&(e=n.get(i,"value"))!==undefined?e:"string"==typeof(e=i.value)?e.replace(Lt,""):null==e?"":e:void 0}}),C.extend({valHooks:{option:{get:function(e){var t=C.find.attr(e,"value");return null!=t?t:C.trim(C.text(e)).replace(Ht," ")}},select:{get:function(e){for(var t,n=e.options,r=e.selectedIndex,i="select-one"===e.type||r<0,o=i?null:[],a=i?r+1:n.length,s=r<0?a:i?r:0;s").append(C.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},C.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){C.fn[t]=function(e){return this.on(t,e)}}),C.expr.filters.animated=function(t){return C.grep(C.timers,function(e){return t===e.elem}).length},C.offset={setOffset:function(e,t,n){var r,i,o,a,s=C.css(e,"position"),u=C(e),l={};"static"===s&&(e.style.position="relative"),o=u.offset(),r=C.css(e,"top"),a=C.css(e,"left"),s=("absolute"===s||"fixed"===s)&&-1'+(s?a.title[0]:a.title)+"
        ":"";return a.zIndex=o,t([a.shade?'
        ':"",'
        '+(e&&2!=a.type?"":s)+"'+(n=["layui-icon-tips","layui-icon-success","layui-icon-error","layui-icon-question","layui-icon-lock","layui-icon-face-cry","layui-icon-face-smile"],o="layui-anim layui-anim-rotate layui-anim-loop",0==a.type&&-1!==a.icon?'':3==a.type?(i=["layui-icon-loading","layui-icon-loading-1"],2==a.icon?'
        ':''):"")+((1!=a.type||!e)&&a.content||"")+'
        '+(n=[],l&&(n.push(''),n.push('')),a.closeBtn&&n.push(''),n.join(""))+"
        "+(a.btn?function(){var e="";"string"==typeof a.btn&&(a.btn=[a.btn]);for(var t,i=0,n=a.btn.length;i'+a.btn[i]+"";return'
        '+e+"
        "}():"")+(a.resize?'':"")+"
        "],s,m('
        ')),this},t.pt.creat=function(){var e,t,i,n,a,o=this,s=o.config,l=o.index,r="object"==typeof(f=s.content),c=m("body");if(s.id&&m("."+y[0]).find("#"+s.id)[0])return e=m("#"+s.id).closest("."+y[0]),t=e.attr("times"),i=e.data("config"),n=m("#"+y.SHADE+t),void("min"===(e.data("maxminStatus")||{})?h.restore(t):i.hideOnClose&&(n.show(),e.show()));switch(s.removeFocus&&document.activeElement.blur(),"string"==typeof s.area&&(s.area="auto"===s.area?["",""]:[s.area,""]),s.shift&&(s.anim=s.shift),6==h.ie&&(s.fixed=!1),s.type){case 0:s.btn="btn"in s?s.btn:u.btn[0],h.closeAll("dialog");break;case 2:var f=s.content=r?s.content:[s.content||"","auto"];s.content='';break;case 3:delete s.title,delete s.closeBtn,-1===s.icon&&s.icon,h.closeAll("loading");break;case 4:r||(s.content=[s.content,"body"]),s.follow=s.content[1],s.content=s.content[0]+'',delete s.title,s.tips="object"==typeof s.tips?s.tips:[s.tips,!0],s.tipsMore||h.closeAll("tips")}o.vessel(r,function(e,t,i){c.append(e[0]),r?2==s.type||4==s.type?m("body").append(e[1]):f.parents("."+y[0])[0]||(f.data("display",f.css("display")).show().addClass("layui-layer-wrap").wrap(e[1]),m("#"+y[0]+l).find("."+y[5]).before(t)):c.append(e[1]),m("#"+y.MOVE)[0]||c.append(u.moveElem=i),o.layero=m("#"+y[0]+l),o.shadeo=m("#"+y.SHADE+l),s.scrollbar||u.setScrollbar(l)}).auto(l),o.shadeo.css({"background-color":s.shade[1]||"#000",opacity:s.shade[0]||s.shade}),2==s.type&&6==h.ie&&o.layero.find("iframe").attr("src",f[0]),4==s.type?o.tips():(o.offset(),parseInt(u.getStyle(document.getElementById(y.MOVE),"z-index"))||(o.layero.css("visibility","hidden"),h.ready(function(){o.offset(),o.layero.css("visibility","visible")}))),s.fixed&&!u.events.resize[o.index]&&(u.events.resize[o.index]=function(){o.resize()},d.on("resize",u.events.resize[o.index])),s.time<=0||setTimeout(function(){h.close(o.index)},s.time),o.move().callback(),y.anim[s.anim]&&(a="layer-anim "+y.anim[s.anim],o.layero.addClass(a).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){m(this).removeClass(a)})),o.layero.data("config",s)},t.pt.resize=function(){var e=this,t=e.config;e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(e.index),4==t.type&&e.tips()},t.pt.auto=function(e){var t=this.config,i=m("#"+y[0]+e),n=(""===t.area[0]&&0t.maxWidth&&i.width(t.maxWidth)),[i.innerWidth(),i.innerHeight()]),a=i.find(y[1]).outerHeight()||0,o=i.find("."+y[6]).outerHeight()||0,e=function(e){(e=i.find(e)).height(n[1]-a-o-2*(0|parseFloat(e.css("padding-top"))))};return 2===t.type?e("iframe"):""===t.area[1]?0t.maxHeight?(n[1]=t.maxHeight,e("."+y[5])):t.fixed&&n[1]>=d.height()&&(n[1]=d.height(),e("."+y[5])):e("."+y[5]),this},t.pt.offset=function(){var e=this,t=e.config,i=e.layero,n=[i.outerWidth(),i.outerHeight()],a="object"==typeof t.offset;e.offsetTop=(d.height()-n[1])/2,e.offsetLeft=(d.width()-n[0])/2,a?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=d.width()-n[0]:"b"===t.offset?e.offsetTop=d.height()-n[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=d.height()-n[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=d.width()-n[0]):"rb"===t.offset?(e.offsetTop=d.height()-n[1],e.offsetLeft=d.width()-n[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?d.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?d.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=d.scrollTop(),e.offsetLeft+=d.scrollLeft()),"min"===i.data("maxminStatus")&&(e.offsetTop=d.height()-(i.find(y[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},t.pt.tips=function(){var e=this.config,t=this.layero,i=[t.outerWidth(),t.outerHeight()],n=m(e.follow),a={width:(n=n[0]?n:m("body")).outerWidth(),height:n.outerHeight(),top:n.offset().top,left:n.offset().left},o=t.find(".layui-layer-TipsG"),n=e.tips[0];e.tips[1]||o.remove(),a.autoLeft=function(){0d.width()&&(o=d.width()-180-(u.minStackArr.edgeIndex=u.minStackArr.edgeIndex||0,u.minStackArr.edgeIndex+=3))<0&&(o=0),t.minStack&&(l.left=o,l.top=d.height()-n,a||u.minStackIndex++,r.attr("minLeft",o)),r.attr("position",s),h.style(e,l,!0),i.hide(),"page"===r.attr("type")&&r.find(y[4]).hide(),u.restScrollbar(e),c.hide())},h.restore=function(e){var t=m("#"+y[0]+e),i=m("#"+y.SHADE+e),n=t.attr("area").split(","),a=t.attr("type"),o=t.data("config")||{};t.removeData("maxminStatus"),h.style(e,{width:n[0],height:n[1],top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===a&&t.find(y[4]).show(),o.scrollbar?u.restScrollbar(e):u.setScrollbar(e),i.show()},h.full=function(t){var i=m("#"+y[0]+t),e=i.data("maxminStatus");"max"!==e&&("min"===e&&h.restore(t),i.data("maxminStatus","max"),u.record(i),y.html.attr("layer-full")||u.setScrollbar(t),setTimeout(function(){var e="fixed"===i.css("position");h.style(t,{top:e?0:d.scrollTop(),left:e?0:d.scrollLeft(),width:"100%",height:"100%"},!0),i.find(".layui-layer-min").hide()},100))},h.title=function(e,t){m("#"+y[0]+(t||h.index)).find(y[1]).html(e)},h.close=function(o,s){var l,e,r=(t=m("."+y[0]).children("#"+o).closest("."+y[0]))[0]?(o=t.attr("times"),t):m("#"+y[0]+o),c=r.attr("type"),t=r.data("config")||{},f=t.id&&t.hideOnClose;r[0]&&(l={slideDown:"layer-anim-slide-down-out",slideLeft:"layer-anim-slide-left-out",slideUp:"layer-anim-slide-up-out",slideRight:"layer-anim-slide-right-out"}[t.anim]||"layer-anim-close",e=function(){var e="layui-layer-wrap";if(f)return r.removeClass("layer-anim "+l),r.hide();if(c===u.type[1]&&"object"===r.attr("conType")){r.children(":not(."+y[5]+")").remove();for(var t=r.find("."+e),i=0;i<2;i++)t.unwrap();t.css("display",t.data("display")).removeClass(e)}else{if(c===u.type[2])try{var n=m("#"+y[4]+o)[0];n.contentWindow.document.write(""),n.contentWindow.close(),r.find("."+y[5])[0].removeChild(n)}catch(a){}r[0].innerHTML="",r.remove()}"function"==typeof u.end[o]&&u.end[o](),delete u.end[o],"function"==typeof s&&s(),u.events.resize[o]&&(d.off("resize",u.events.resize[o]),delete u.events.resize[o])},m("#"+y.SHADE+o)[f?"hide":"remove"](),t.isOutAnim&&r.addClass("layer-anim "+l),6==h.ie&&u.reselect(),u.restScrollbar(o),"string"==typeof r.attr("minLeft")&&(u.minStackIndex--,u.minStackArr.push(r.attr("minLeft"))),h.ie&&h.ie<10||!t.isOutAnim?e():setTimeout(function(){e()},200))},h.closeAll=function(n,a){"function"==typeof n&&(a=n,n=null);var o=m("."+y[0]);m.each(o,function(e){var t=m(this),i=n?t.attr("type")===n:1;i&&h.close(t.attr("times"),e===o.length-1?a:null)}),0===o.length&&"function"==typeof a&&a()},h.closeLast=function(e){h.close(m(".layui-layer-"+(e=e||"page")+":last").attr("times"))},h.cache||{}),g=function(e){return i.skin?" "+i.skin+" "+i.skin+"-"+e:""};h.prompt=function(i,n){var e="",t="";"function"==typeof(i=i||{})&&(n=i),i.area&&(e='style="width: '+(o=i.area)[0]+"; height: "+o[1]+';"',delete i.area),i.placeholder&&(t=' placeholder="'+i.placeholder+'"');var a,o=2==i.formType?'":'",s=i.success;return delete i.success,h.open(m.extend({type:1,btn:["确定","取消"],content:o,skin:"layui-layer-prompt"+g("prompt"),maxWidth:d.width(),success:function(e){(a=e.find(".layui-layer-input")).val(i.value||"").focus(),"function"==typeof s&&s(e)},resize:!1,yes:function(e){var t=a.val();t.length>(i.maxlength||500)?h.tips("最多输入"+(i.maxlength||500)+"个字数",a,{tips:1}):n&&n(t,e,a)}},i))},h.tab=function(n){var a=(n=n||{}).tab||{},o="layui-this",s=n.success;return delete n.success,h.open(m.extend({type:1,skin:"layui-layer-tab"+g("tab"),resize:!1,title:function(){var e=a.length,t=1,i="";if(0'+a[0].title+"";t"+a[t].title+"";return i}(),content:'
          '+function(){var e=a.length,t=1,i="";if(0'+(a[0].content||"no content")+"";t'+(a[t].content||"no content")+"";return i}()+"
        ",success:function(e){var t=e.find(".layui-layer-title").children(),i=e.find(".layui-layer-tabmain").children();t.on("mousedown",function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0;var e=m(this),t=e.index();e.addClass(o).siblings().removeClass(o),i.eq(t).show().siblings().hide(),"function"==typeof n.change&&n.change(t)}),"function"==typeof s&&s(e)}},n))},h.photos=function(n,e,a){var o={};if((n=m.extend(!0,{toolbar:!0,footer:!0},n)).photos){var t=!("string"==typeof n.photos||n.photos instanceof m),i=t?n.photos:{},s=i.data||[],l=i.start||0,r=n.success;if(o.imgIndex=1+(0|l),n.img=n.img||"img",delete n.success,t){if(0===s.length)return h.msg("没有图片")}else{var c=m(n.photos),f=function(){s=[],c.find(n.img).each(function(e){var t=m(this);t.attr("layer-index",e),s.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("lay-src")||t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(f(),0===s.length)return;if(e||c.on("click",n.img,function(){f();var e=m(this).attr("layer-index");h.photos(m.extend(n,{photos:{start:e,data:s,tab:n.tab},full:n.full}),!0)}),!e)return}o.imgprev=function(e){o.imgIndex--,o.imgIndex<1&&(o.imgIndex=s.length),o.tabimg(e)},o.imgnext=function(e,t){o.imgIndex++,o.imgIndex>s.length&&(o.imgIndex=1,t)||o.tabimg(e)},o.keyup=function(e){var t;o.end||(t=e.keyCode,e.preventDefault(),37===t?o.imgprev(!0):39===t?o.imgnext(!0):27===t&&h.close(o.index))},o.tabimg=function(e){if(!(s.length<=1))return i.start=o.imgIndex-1,h.close(o.index),h.photos(n,!0,e)},o.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},o.image={},o.getTransform=function(e){var t=[],i=e.rotate,n=e.scaleX,e=e.scale;return o.isNumber(i)&&0!==i&&t.push("rotate("+i+"deg)"),o.isNumber(n)&&1!==n&&t.push("scaleX("+n+")"),o.isNumber(e)&&t.push("scale("+e+")"),t.length?t.join(" "):"none"},o.event=function(e,i,n){o.main.find(".layui-layer-photos-prev").on("click",function(e){e.preventDefault(),o.imgprev(!0)}),o.main.find(".layui-layer-photos-next").on("click",function(e){e.preventDefault(),o.imgnext(!0)}),m(document).on("keyup",o.keyup),e.off("click").on("click","*[toolbar-event]",function(){var e=m(this);switch(e.attr("toolbar-event")){case"rotate":o.image.rotate=((o.image.rotate||0)+Number(e.attr("data-option")))%360,o.imgElem.css({transform:o.getTransform(o.image)});break;case"scalex":o.image.scaleX=-1===o.image.scaleX?1:-1,o.imgElem.css({transform:o.getTransform(o.image)});break;case"zoom":var t=Number(e.attr("data-option"));o.image.scale=(o.image.scale||1)+t,t<0&&o.image.scale<0-t&&(o.image.scale=0-t),o.imgElem.css({transform:o.getTransform(o.image)});break;case"reset":o.image.scaleX=1,o.image.scale=1,o.image.rotate=0,o.imgElem.css({transform:"none"});break;case"close":h.close(i)}n.offset(),n.auto(i)})},o.loadi=h.load(1,{shade:!("shade"in n)&&.9,scrollbar:!1});var t=s[l].src,d=function(e){h.close(o.loadi);var t,i=s[l].alt||"";a&&(n.anim=-1),o.index=h.open(m.extend({type:1,id:"layui-layer-photos",area:(e=[e.width,e.height],t=[m(p).width()-100,m(p).height()-100],!n.full&&(e[0]>t[0]||e[1]>t[1])&&((t=[e[0]/t[0],e[1]/t[1]])[1]'+i+''+(t=['
        '],1','','',"
        "].join("")),n.toolbar&&t.push(['
        ','','','','','','',"
        "].join("")),n.footer&&t.push(['"].join("")),t.push("
        "),t.join(""))+"",success:function(e,t,i){o.main=e.find(".layer-layer-photos-main"),o.footer=e.find(".layui-layer-photos-footer"),o.imgElem=o.main.children("img"),o.event(e,t,i),n.tab&&n.tab(s[l],e),"function"==typeof r&&r(e)},end:function(){o.end=!0,m(document).off("keyup",o.keyup)}},n))},u=function(){h.close(o.loadi),h.msg("当前图片地址异常
        是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){1").addClass(o));layui.each(i.bars,function(t,e){var n=s('
      • ');n.addClass(e.icon).attr({"lay-type":e.type,style:e.style||(i.bgcolor?"background-color: "+i.bgcolor:"")}).html(e.content),n.on("click",function(){var t=s(this).attr("lay-type");"top"===t&&("body"===i.target?s("html,body"):c).animate({scrollTop:0},i.duration),"function"==typeof i.click&&i.click.call(this,t)}),"object"===layui.type(i.on)&&layui.each(i.on,function(t,e){n.on(t,function(){var t=s(this).attr("lay-type");"function"==typeof e&&e.call(this,t)})}),"top"===e.type&&(n.addClass("layui-fixbar-top"),r=n),l.append(n)}),u.find("."+o).remove(),"object"==typeof i.css&&l.css(i.css),u.append(l),r&&(e=function e(){return c.scrollTop()>=i.margin?t||(r.show(),t=1):t&&(r.hide(),t=0),e}()),c.on("scroll",function(){e&&(clearTimeout(n),n=setTimeout(function(){e()},100))})},countdown:function(i){i=s.extend(!0,{date:new Date,now:new Date},i);var r=arguments,o=(1]|&(?=#[a-zA-Z0-9]+)/g.test(t+="")?t.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,"""):t},unescape:function(t){return t!==undefined&&null!==t||(t=""),(t+="").replace(/\&/g,"&").replace(/\</g,"<").replace(/\>/g,">").replace(/\'/g,"'").replace(/\"/g,'"')},openWin:function(t){var e=(t=t||{}).window||window.open(t.url||"",t.target,t.specs);t.url||(e.document.open("text/html","replace"),e.document.write(t.content||""),e.document.close())},toVisibleArea:function(t){var e,n,i,r,o,a,u,c;(t=s.extend({margin:160,duration:200,type:"y"},t)).scrollElem[0]&&t.thisElem[0]&&(e=t.scrollElem,u=t.thisElem,i=(o="y"===t.type)?"top":"left",r=e[n=o?"scrollTop":"scrollLeft"](),o=e[o?"height":"width"](),a=e.offset()[i],c={},((u=u.offset()[i]-a)>o-t.margin||u."+v,E=function(e){var i=this;i.index=++f.index,i.config=c.extend({},i.config,f.config,e),i.init()};E.prototype.config={trigger:"click",content:"",className:"",style:"",show:!1,isAllowSpread:!0,isSpreadItem:!0,data:[],delay:300,shade:0},E.prototype.reload=function(e,i){var t=this;t.config=c.extend({},t.config,e),t.init(!0,i)},E.prototype.init=function(e,i){var t,n=this,a=n.config,l=c(a.elem);return 1');return 0No data
      • '),e},s=function(r,e){return layui.each(e,function(e,i){var t,n=i[u.children]&&0",(t="href"in i?''+l+"":l,n?'
        '+t+("parent"===o?'':"group"===o&&d.isAllowSpread?'':"")+"
        ":'
        '+t+"
        "),""].join(""))).data("item",i),n&&(a=c('
        '),t=c("
          "),"parent"===o?(a.append(s(t,i[u.children])),l.append(a)):l.append(s(t,i[u.children]))),r.append(l))}),r},a=['
          ',"
          "].join("");!(e="contextmenu"!==d.trigger&&!lay.isTopElem(d.elem[0])?e:!0)&&d.elem.data(y+"_opened")||(l.elemView=c("."+g+'[lay-id="'+d.id+'"]'),"reloadData"===i&&l.elemView.length?l.elemView.html(d.content||n()):(l.elemView=c(a),l.elemView.append(d.content||n()),d.className&&l.elemView.addClass(d.className),d.style&&l.elemView.attr("style",d.style),f.thisId=d.id,l.remove(),t.append(l.elemView),d.elem.data(y+"_opened",!0),e=d.shade?'
          ':"",l.elemView.before(e),"mouseenter"===d.trigger&&l.elemView.on("mouseenter",function(){clearTimeout(h.timer)}).on("mouseleave",function(){l.delayRemove()})),l.position(),(h.prevElem=l.elemView).data("prevElem",d.elem),l.elemView.find(".layui-menu").on(o,function(e){layui.stope(e)}),l.elemView.find(".layui-menu li").on("click",function(e){var i=c(this),t=i.data("item")||{},n=t[u.children]&&0n.width()&&(t.addClass(x),(i=t[0].getBoundingClientRect()).left<0&&t.removeClass(x)),i.bottom>n.height()&&t.eq(0).css("margin-top",-(i.bottom-n.height()+5)))}).on("mouseleave",t,function(e){var i=c(this).children("."+V);i.removeClass(x),i.css("margin-top",0)}),f.close=function(e){e=h.getThis(e);return e?(e.remove(),h.call(e)):this},f.reload=function(e,i,t){e=h.getThis(e);return e?(e.reload(i,t),h.call(e)):this},f.reloadData=function(){var t=c.extend([],arguments),n=(t[2]="reloadData",new RegExp("^("+["data","templet","content"].join("|")+")$"));return layui.each(t[1],function(e,i){n.test(e)||delete t[1][e]}),f.reload.apply(null,t)},f.render=function(e){e=new E(e);return h.call(e)},e(r,f)});layui.define(["jquery","lay"],function(e){"use strict";var g=layui.$,c=layui.lay,m={config:{},index:layui.slider?layui.slider.index+1e4:0,set:function(e){var i=this;return i.config=g.extend({},i.config,e),i},on:function(e,i){return layui.onevent.call(this,t,e,i)}},t="slider",v="layui-disabled",x="layui-slider-bar",b="layui-slider-wrap",T="layui-slider-wrap-btn",w="layui-slider-tips",M="layui-slider-input-txt",L="layui-slider-hover",i=function(e){var i=this;i.index=++m.index,i.config=g.extend({},i.config,m.config,e),i.render()};i.prototype.config={type:"default",min:0,max:100,value:0,step:1,showstep:!1,tips:!0,input:!1,range:!1,height:200,disabled:!1,theme:"#16baaa"},i.prototype.render=function(){var a=this,n=a.config,e=g(n.elem);if(1n.min?e:n.min,n.value[1]=i>n.min?i:n.min,n.value[0]=n.value[0]>n.max?n.max:n.value[0],n.value[1]=n.value[1]>n.max?n.max:n.value[1],i=Math.floor((n.value[0]-n.min)/(n.max-n.min)*100),t=(s=Math.floor((n.value[1]-n.min)/(n.max-n.min)*100))-i+"%",i+="%",s+="%"):("object"==typeof n.value&&(n.value=Math.min.apply(null,n.value)),n.valuen.max&&(n.value=n.max),t=Math.floor((n.value-n.min)/(n.max-n.min)*100)+"%");var l,e=n.disabled?"#c2c2c2":n.theme,i='
          '+(n.tips?'
          ':"")+'
          '+(n.range?'
          ':"")+"
          ",t=g(n.elem),s=t.next(".layui-slider");if(s[0]&&s.remove(),a.elemTemp=g(i),n.range?(a.elemTemp.find("."+b).eq(0).data("value",n.value[0]),a.elemTemp.find("."+b).eq(1).data("value",n.value[1])):a.elemTemp.find("."+b).data("value",n.value),t.html(a.elemTemp),"vertical"===n.type&&a.elemTemp.height(n.height+"px"),n.showstep){for(var o=(n.max-n.min)/n.step,r="",u=1;u<1+o;u++){var d=100*u/o;d<100&&(r+='
          ')}a.elemTemp.append(r)}n.input&&!n.range&&(e=g('
          '),t.css("position","relative"),t.append(e),t.find("."+M).children("input").val(n.value),"vertical"===n.type?e.css({left:0,top:-48}):a.elemTemp.css("margin-right",e.outerWidth()+15)),n.disabled?(a.elemTemp.addClass(v),a.elemTemp.find("."+T).addClass(v)):a.slide(),a.elemTemp.find("."+T).on("mouseover",function(){var e="vertical"===n.type?n.height:a.elemTemp[0].offsetWidth,i=a.elemTemp.find("."+b),t=("vertical"===n.type?e-g(this).parent()[0].offsetTop-i.height():g(this).parent()[0].offsetLeft)/e*100,i=g(this).parent().data("value"),e=n.setTips?n.setTips(i):i;a.elemTemp.find("."+w).html(e),clearTimeout(l),l=setTimeout(function(){"vertical"===n.type?a.elemTemp.find("."+w).css({bottom:t+"%","margin-bottom":"20px",display:"inline-block"}):a.elemTemp.find("."+w).css({left:t+"%",display:"inline-block"})},300)}).on("mouseout",function(){clearTimeout(l),a.elemTemp.find("."+w).css("display","none")})},i.prototype.slide=function(e,i,t){var o=this,r=o.config,u=o.elemTemp,d=function(){return"vertical"===r.type?r.height:u[0].offsetWidth},c=u.find("."+b),m=u.next(".layui-slider-input"),v=m.children("."+M).children("input").val(),p=100/((r.max-r.min)/Math.ceil(r.step)),f=function(e,i,t){e=(e=100<(e=100a[1]&&a.reverse(),o.value=r.range?a:l,r.change&&r.change(o.value),"done"===t&&r.done&&r.done(o.value)},h=function(e){var i=e/d()*100/p,t=Math.round(i)*p;return t=e==d()?Math.ceil(i)*p:t},y=g(['
          d()?d():i)/d()*100/p;f(i,l),s.addClass(L),u.find("."+w).show(),e.preventDefault()},i=function(){s.removeClass(L),u.find("."+w).hide()},t=function(){i&&i(),y.remove(),r.done&&r.done(o.value)},g("#LAY-slider-moving")[0]||g("body").append(y),y.on("mousemove",e),y.on("mouseup",t).on("mouseleave",t)})}),u.on("click",function(e){var i=g("."+T),t=g(this);!i.is(event.target)&&0===i.has(event.target).length&&i.length&&(t=(i=(i=(i="vertical"===r.type?d()-e.clientY+t.offset().top-g(window).scrollTop():e.clientX-t.offset().left-g(window).scrollLeft())<0?0:i)>d()?d():i)/d()*100/p,i=r.range?"vertical"===r.type?Math.abs(i-parseInt(g(c[0]).css("bottom")))>Math.abs(i-parseInt(g(c[1]).css("bottom")))?1:0:Math.abs(i-c[0].offsetLeft)>Math.abs(i-c[1].offsetLeft)?1:0:0,f(t,i,"done"),e.preventDefault())}),m.children(".layui-slider-input-btn").children("i").each(function(i){g(this).on("click",function(){v=m.children("."+M).children("input").val();var e=((v=1==i?v-r.stepr.max?r.max:Number(v)+r.step)-r.min)/(r.max-r.min)*100/p;f(e,0,"done")})});var a=function(){var e=this.value,e=(e=(e=(e=isNaN(e)?0:e)r.max?r.max:e,((this.value=e)-r.min)/(r.max-r.min)*100/p);f(e,0,"done")};m.children("."+M).children("input").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),a.call(this))}).on("change",a)},i.prototype.events=function(){this.config},m.render=function(e){e=new i(e);return function(){var t=this,a=t.config;return{setValue:function(e,i){return e=(e=e>a.max?a.max:e)',"",'','',"","","
          "].join("")),r=i.elem=m(i.elem);i.size&&o.addClass("layui-colorpicker-"+i.size),r.addClass("layui-inline").html(e.elemColorBox=o),i.id="id"in i?i.id:r.attr("id")||e.index,e.color=e.elemColorBox.find("."+C)[0].style.background,e.events()},d.prototype.renderPicker=function(){var o,e=this,i=e.config,r=e.elemColorBox[0],t=e.elemPicker=m(['
          ','
          ','
          ','
          ','
          ','
          ',"
          ",'
          ','
          ',"
          ","
          ",'
          ','
          ','
          ',"
          ","
          ",i.predefine?(o=['
          '],layui.each(i.colors,function(e,i){o.push(['
          ','
          ',"
          "].join(""))}),o.push("
          "),o.join("")):"",'
          ','
          ','',"
          ",'
          ','','',"","
          "].join(""));e.elemColorBox.find("."+C)[0];m(a)[0]&&m(a).data("index")==e.index?e.removePicker(d.thisElemInd):(e.removePicker(d.thisElemInd),m("body").append(t)),n.thisId=i.id,d.thisElemInd=e.index,d.thisColor=r.style.background,e.position(),e.pickerEvents()},d.prototype.removePicker=function(e){var i=this.config,e=m("#layui-colorpicker"+(e||this.index));return e[0]&&(e.remove(),delete n.thisId,"function"==typeof i.close&&i.close(this.color)),this},d.prototype.position=function(){var e=this,i=e.config;return t.position(e.bindElem||e.elemColorBox[0],e.elemPicker[0],{position:i.position,align:"center"}),e},d.prototype.val=function(){var e,i=this,o=(i.config,i.elemColorBox.find("."+C)),r=i.elemPicker.find("."+M),t=o[0].style.backgroundColor;t?(e=Y(L(t)),o=o.attr("lay-type"),i.select(e.h,e.s,e.b),"torgb"===o?r.find("input").val(t):"rgba"===o?(o=L(t),3===(t.match(/[0-9]{1,3}/g)||[]).length?(r.find("input").val("rgba("+o.r+", "+o.g+", "+o.b+", 1)"),i.elemPicker.find("."+T).css("left",280)):(r.find("input").val(t),t=280*t.slice(t.lastIndexOf(",")+1,t.length-1),i.elemPicker.find("."+T).css("left",t)),i.elemPicker.find("."+D)[0].style.background="linear-gradient(to right, rgba("+o.r+", "+o.g+", "+o.b+", 0), rgb("+o.r+", "+o.g+", "+o.b+"))"):r.find("input").val("#"+F(e))):(i.select(0,100,100),r.find("input").val(""),i.elemPicker.find("."+D)[0].style.background="",i.elemPicker.find("."+T).css("left",280))},d.prototype.side=function(){var n=this,l=n.config,c=n.elemColorBox.find("."+C),a=c.attr("lay-type"),s=n.elemPicker.find(".layui-colorpicker-side"),e=n.elemPicker.find("."+B),d=n.elemPicker.find("."+I),r=n.elemPicker.find("."+E),f=n.elemPicker.find("."+D),u=n.elemPicker.find("."+T),g=e[0].offsetTop/180*360,p=100-(r[0].offsetTop+3)/180*100,h=(r[0].offsetLeft+3)/260*100,v=Math.round(u[0].offsetLeft/280*100)/100,b=n.elemColorBox.find("."+w),i=n.elemPicker.find(".layui-colorpicker-pre").children("div"),y=function(e,i,o,r){n.select(e,i,o);var t=j({h:e,s:i,b:o}),e=F({h:e,s:i,b:o}),i=n.elemPicker.find("."+M).find("input");b.addClass(x).removeClass(P),c[0].style.background="rgb("+t.r+", "+t.g+", "+t.b+")","torgb"===a?i.val("rgb("+t.r+", "+t.g+", "+t.b+")"):"rgba"===a?(u.css("left",280*r),i.val("rgba("+t.r+", "+t.g+", "+t.b+", "+r+")"),c[0].style.background="rgba("+t.r+", "+t.g+", "+t.b+", "+r+")",f[0].style.background="linear-gradient(to right, rgba("+t.r+", "+t.g+", "+t.b+", 0), rgb("+t.r+", "+t.g+", "+t.b+"))"):i.val("#"+e),l.change&&l.change(n.elemPicker.find("."+M).find("input").val())},o=m(['
          '].join("")),k=function(e){m("#LAY-colorpicker-moving")[0]||m("body").append(o),o.on("mousemove",e),o.on("mouseup",function(){o.remove()}).on("mouseleave",function(){o.remove()})};e.on("mousedown",function(e){var r=this.offsetTop,t=e.clientY;k(function(e){var i=r+(e.clientY-t),o=s[0].offsetHeight,o=(i=o<(i=i<0?0:i)?o:i)/180*360;y(g=o,h,p,v),e.preventDefault()}),e.preventDefault()}),s.on("click",function(e){var i=e.clientY-m(this).offset().top+H.scrollTop(),i=(i=(i=i<0?0:i)>this.offsetHeight?this.offsetHeight:i)/180*360;y(g=i,h,p,v),e.preventDefault()}),r.on("mousedown",function(e){var n=this.offsetTop,l=this.offsetLeft,c=e.clientY,a=e.clientX;layui.stope(e),k(function(e){var i=n+(e.clientY-c),o=l+(e.clientX-a),r=d[0].offsetHeight-3,t=d[0].offsetWidth-3,t=((o=t<(o=o<-3?-3:o)?t:o)+3)/260*100,o=100-((i=r<(i=i<-3?-3:i)?r:i)+3)/180*100;y(g,h=t,p=o,v),e.preventDefault()}),e.preventDefault()}),d.on("mousedown",function(e){var i=e.clientY-m(this).offset().top-3+H.scrollTop(),o=e.clientX-m(this).offset().left-3+H.scrollLeft(),o=((i=i<-3?-3:i)>this.offsetHeight-3&&(i=this.offsetHeight-3),((o=(o=o<-3?-3:o)>this.offsetWidth-3?this.offsetWidth-3:o)+3)/260*100),i=100-(i+3)/180*100;y(g,h=o,p=i,v),layui.stope(e),e.preventDefault(),r.trigger(e,"mousedown")}),u.on("mousedown",function(e){var r=this.offsetLeft,t=e.clientX;k(function(e){var i=r+(e.clientX-t),o=f[0].offsetWidth,o=(o<(i=i<0?0:i)&&(i=o),Math.round(i/280*100)/100);y(g,h,p,v=o),e.preventDefault()}),e.preventDefault()}),f.on("click",function(e){var i=e.clientX-m(this).offset().left,i=((i=i<0?0:i)>this.offsetWidth&&(i=this.offsetWidth),Math.round(i/280*100)/100);y(g,h,p,v=i),e.preventDefault()}),i.each(function(){m(this).on("click",function(){m(this).parent(".layui-colorpicker-pre").addClass("selected").siblings().removeClass("selected");var e=this.style.backgroundColor,i=Y(L(e)),o=e.slice(e.lastIndexOf(",")+1,e.length-1);g=i.h,h=i.s,p=i.b,3===(e.match(/[0-9]{1,3}/g)||[]).length&&(o=1),v=o,y(i.h,i.s,i.b,o)})})},d.prototype.select=function(e,i,o,r){this.config;var t=F({h:e,s:100,b:100}),e=(F({h:e,s:i,b:o}),e/360*180),o=180-o/100*180-3,i=i/100*260-3;this.elemPicker.find("."+B).css("top",e),this.elemPicker.find("."+I)[0].style.background="#"+t,this.elemPicker.find("."+E).css({top:o,left:i})},d.prototype.pickerEvents=function(){var c=this,a=c.config,s=c.elemColorBox.find("."+C),d=c.elemPicker.find("."+M+" input"),o={clear:function(e){s[0].style.background="",c.elemColorBox.find("."+w).removeClass(x).addClass(P),c.color="",a.done&&a.done(""),c.removePicker()},confirm:function(e,i){var o,r,t,n,l=d.val();if(-1>16,g:(65280&t)>>8,b:255&t},r=Y(n),s[0].style.background=o="#"+F(r),c.elemColorBox.find("."+w).removeClass(P).addClass(x)),"change"===i)return c.select(r.h,r.s,r.b,i),void(a.change&&a.change(o));c.color=l,a.done&&a.done(l),c.removePicker()}};c.elemPicker.on("click","*[colorpicker-events]",function(){var e=m(this),i=e.attr("colorpicker-events");o[i]&&o[i].call(this,e)}),d.on("keyup",function(e){var i=m(this);o.confirm.call(this,i,13===e.keyCode?null:"change")})},d.prototype.events=function(){var e=this;e.config;e.elemColorBox.on("click",function(){e.renderPicker(),m(a)[0]&&(e.val(),e.side())})},s.on(i,function(e){var i,o,r;!n.thisId||(i=l.getThis(n.thisId))&&(o=i.config,r=i.elemColorBox.find("."+C),m(e.target).hasClass(c)||m(e.target).parents("."+c)[0]||m(e.target).hasClass(a.replace(/\./g,""))||m(e.target).parents(a)[0]||i.elemPicker&&(i.color?(e=Y(L(i.color)),i.select(e.h,e.s,e.b)):i.elemColorBox.find("."+w).removeClass(x).addClass(P),r[0].style.background=i.color||"","function"==typeof o.cancel&&o.cancel(i.color),i.removePicker()))}),H.on("resize",function(){if(n.thisId){var e=l.getThis(n.thisId);if(e)return!(!e.elemPicker||!m(a)[0])&&void e.position()}}),l.that={},l.getThis=function(e){var i=l.that[e];return i||o.error(e?r+" instance with ID '"+e+"' not found":"ID argument required"),i},n.render=function(e){e=new d(e);return l.call(e)},e(r,n)});layui.define("jquery",function(t){"use strict";var u=layui.$,d=(layui.hint(),layui.device()),o="element",c="layui-this",h="layui-show",r=".layui-tab-title",i=function(){this.config={}},y=(i.prototype.set=function(t){return u.extend(!0,this.config,t),this},i.prototype.on=function(t,i){return layui.onevent.call(this,o,t,i)},i.prototype.tabAdd=function(t,i){var a,e=u(".layui-tab[lay-filter="+t+"]"),l=e.children(r),n=l.children(".layui-tab-bar"),e=e.children(".layui-tab-content"),s=""+(i.title||"unnaming")+"";return n[0]?n.before(s):l.append(s),e.append('
          '+(i.content||"")+"
          "),i.change&&this.tabChange(t,i.id),l.data("LAY_TAB_CHANGE",i.change),g.tabAuto(i.change?"change":null),this},i.prototype.tabDelete=function(t,i){t=u(".layui-tab[lay-filter="+t+"]").children(r).find('>li[lay-id="'+i+'"]');return g.tabDelete(null,t),this},i.prototype.tabChange=function(t,i){t=u(".layui-tab[lay-filter="+t+"]").children(r).find('>li[lay-id="'+i+'"]');return g.tabClick.call(t[0],{liElem:t}),this},i.prototype.tab=function(a){a=a||{},e.on("click",a.headerElem,function(t){var i=u(this).index();g.tabClick.call(this,{index:i,options:a})})},i.prototype.progress=function(t,i){var a="layui-progress",t=u("."+a+"[lay-filter="+t+"]").find("."+a+"-bar"),a=t.find("."+a+"-text");return t.css("width",function(){return/^.+\/.+$/.test(i)?100*new Function("return "+i)()+"%":i}).attr("lay-percent",i),a.text(i),this},".layui-nav"),f="layui-nav-item",l="layui-nav-bar",p="layui-nav-tree",b="layui-nav-child",v="layui-nav-more",m="layui-anim layui-anim-upbit",g={tabClick:function(t){var i=(t=t||{}).options||{},a=t.liElem||u(this),e=i.headerElem?a.parent():a.parents(".layui-tab").eq(0),i=i.bodyElem?u(i.bodyElem):e.children(".layui-tab-content").children(".layui-tab-item"),l=a.find("a"),l="javascript:;"!==l.attr("href")&&"_blank"===l.attr("target"),n="string"==typeof a.attr("lay-unselect"),s=e.attr("lay-filter"),t="index"in t?t.index:a.parent().children("li").index(a);l||n||(a.addClass(c).siblings().removeClass(c),i.eq(t).addClass(h).siblings().removeClass(h)),layui.event.call(this,o,"tab("+s+")",{elem:e,index:t})},tabDelete:function(t,i){var i=i||u(this).parent(),a=i.parent().children("li").index(i),e=i.closest(".layui-tab"),l=e.children(".layui-tab-content").children(".layui-tab-item"),n=e.attr("lay-filter");i.hasClass(c)&&(i.next()[0]&&i.next().is("li")?g.tabClick.call(i.next()[0],{index:a+1}):i.prev()[0]&&i.prev().is("li")&&g.tabClick.call(i.prev()[0],null,a-1)),i.remove(),l.eq(a).remove(),setTimeout(function(){g.tabAuto()},50),layui.event.call(this,o,"tabDelete("+n+")",{elem:e,index:a})},tabAuto:function(l){var n="layui-tab-more",s="layui-tab-bar",o="layui-tab-close",c=this;u(".layui-tab").each(function(){var t,i=u(this),a=i.children(".layui-tab-title"),e=(i.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),e=u('');c===window&&d.ie,i.attr("lay-allowclose")&&a.find("li").each(function(){var t,i=u(this);i.find("."+o)[0]||((t=u('')).on("click",g.tabDelete),i.append(t))}),"string"!=typeof i.attr("lay-unauto")&&(a.prop("scrollWidth")>a.outerWidth()+1||a.find("li").length&&a.height()>(t=a.find("li").eq(0).height())+t/2?("change"===l&&a.data("LAY_TAB_CHANGE")&&a.addClass(n),a.find("."+s)[0]||(a.append(e),i.attr("overflow",""),e.on("click",function(t){var i=a.hasClass(n);a[i?"removeClass":"addClass"](n)}))):(a.find("."+s).remove(),i.removeAttr("overflow")))})},hideTabMore:function(t){var i=u(".layui-tab-title");!0!==t&&"tabmore"===u(t.target).attr("lay-stope")||(i.removeClass("layui-tab-more"),i.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var t=u(this),i=t.parents(y),a=i.attr("lay-filter"),e=t.parent(),l=t.siblings("."+b),n="string"==typeof e.attr("lay-unselect");"javascript:;"!==t.attr("href")&&"_blank"===t.attr("target")||n||l[0]||(i.find("."+c).removeClass(c),e.addClass(c)),i.hasClass(p)&&(l.removeClass(m),l[0]&&(e["none"===l.css("display")?"addClass":"removeClass"](f+"ed"),"all"===i.attr("lay-shrink")&&e.siblings().removeClass(f+"ed"))),layui.event.call(this,o,"nav("+a+")",t)},collapse:function(){var t=u(this),i=t.find(".layui-colla-icon"),a=t.siblings(".layui-colla-content"),e=t.parents(".layui-collapse").eq(0),l=e.attr("lay-filter"),n="none"===a.css("display");"string"==typeof e.attr("lay-accordion")&&((e=e.children(".layui-colla-item").children("."+h)).siblings(".layui-colla-title").children(".layui-colla-icon").html(""),e.removeClass(h)),a[n?"addClass":"removeClass"](h),i.html(n?"":""),layui.event.call(this,o,"collapse("+l+")",{title:t,content:a,show:n})}},a=(i.prototype.render=i.prototype.init=function(t,i){var a=i?'[lay-filter="'+i+'"]':"",i={tab:function(){g.tabAuto.call({})},nav:function(){var s={},o={},c={},r="layui-nav-title";u(y+a).each(function(t){var i=u(this),a=u(''),e=i.find("."+f);i.find("."+l)[0]||(i.append(a),(i.hasClass(p)?e.find("dd,>."+r):e).on("mouseenter",function(){!function(t,i,a){var e,l=u(this),n=l.find("."+b);i.hasClass(p)?n[0]||(e=l.children("."+r),t.css({top:l.offset().top-i.offset().top,height:(e[0]?e:l).outerHeight(),opacity:1})):(n.addClass(m),n.hasClass("layui-nav-child-c")&&n.css({left:-(n.outerWidth()-l.width())/2}),n[0]?t.css({left:t.position().left+t.width()/2,width:0,opacity:0}):t.css({left:l.position().left+parseFloat(l.css("marginLeft")),top:l.position().top+l.height()-t.height()}),s[a]=setTimeout(function(){t.css({width:n[0]?0:l.width(),opacity:n[0]?0:1})},d.ie&&d.ie<10?0:200),clearTimeout(c[a]),"block"===n.css("display")&&clearTimeout(o[a]),o[a]=setTimeout(function(){n.addClass(h),l.find("."+v).addClass(v+"d")},300))}.call(this,a,i,t)}).on("mouseleave",function(){i.hasClass(p)?a.css({height:0,opacity:0}):(clearTimeout(o[t]),o[t]=setTimeout(function(){i.find("."+b).removeClass(h),i.find("."+v).removeClass(v+"d")},300))}),i.on("mouseleave",function(){clearTimeout(s[t]),c[t]=setTimeout(function(){i.hasClass(p)||a.css({width:0,left:a.position().left+a.width()/2,opacity:0})},200)})),e.find("a").each(function(){var t=u(this);t.parent();t.siblings("."+b)[0]&&!t.children("."+v)[0]&&t.append(''),t.off("click",g.clickThis).on("click",g.clickThis)})})},breadcrumb:function(){u(".layui-breadcrumb"+a).each(function(){var t=u(this),i="lay-separator",a=t.attr(i)||"/",e=t.find("a");e.next("span["+i+"]")[0]||(e.each(function(t){t!==e.length-1&&u(this).after(""+a+"")}),t.css("visibility","visible"))})},progress:function(){var e="layui-progress";u("."+e+a).each(function(){var t=u(this),i=t.find(".layui-progress-bar"),a=i.attr("lay-percent");i.css("width",function(){return/^.+\/.+$/.test(a)?100*new Function("return "+a)()+"%":a}),t.attr("lay-showpercent")&&setTimeout(function(){i.html(''+a+"")},350)})},collapse:function(){u(".layui-collapse"+a).each(function(){u(this).find(".layui-colla-item").each(function(){var t=u(this),i=t.find(".layui-colla-title"),t="none"===t.find(".layui-colla-content").css("display");i.find(".layui-colla-icon").remove(),i.append(''+(t?"":"")+""),i.off("click",g.collapse).on("click",g.collapse)})})}};return i[t]?i[t]():layui.each(i,function(t,i){i()})},new i),e=u(document);u(function(){a.render()}),e.on("click",".layui-tab-title li",g.tabClick),u(window).on("resize",g.tabAuto),t(o,a)});layui.define(["lay","layer"],function(e){"use strict";var x=layui.$,i=layui.layer,b=layui.device(),t={config:{},set:function(e){var i=this;return i.config=x.extend({},i.config,e),i},on:function(e,i){return layui.onevent.call(this,n,e,i)}},n="upload",a="layui-upload-file",o="layui-upload-form",F="layui-upload-iframe",w="layui-upload-choose",L=function(e){var i=this;i.config=x.extend({},i.config,t.config,e),i.render()};L.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",force:"",field:"file",acceptMime:"",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1,text:{"cross-domain":"Cross-domain requests are not supported","data-format-error":"Please return JSON data format","check-error":"",error:"","limit-number":null,"limit-size":null}},L.prototype.render=function(e){var i=this;(e=i.config).elem=x(e.elem),e.bindAction=x(e.bindAction),i.file(),i.events()},L.prototype.file=function(){var e=this,i=e.config,t=e.elemFile=x(['"].join("")),n=i.elem.next();(n.hasClass(a)||n.hasClass(o))&&n.remove(),b.ie&&b.ie<10&&i.elem.wrap('
          '),e.isFile()?(e.elemFile=i.elem,i.field=i.elem[0].name):i.elem.after(t),b.ie&&b.ie<10&&e.initIE()},L.prototype.initIE=function(){var t,e=this.config,i=x(''),n=x(['
          ',"
          "].join(""));x("#"+F)[0]||x("body").append(i),e.elem.next().hasClass(o)||(this.elemFile.wrap(n),e.elem.next("."+o).append((t=[],layui.each(e.data,function(e,i){i="function"==typeof i?i():i,t.push('')}),t.join(""))))},L.prototype.msg=function(e){return i.msg(e,{icon:2,shift:6})},L.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},L.prototype.preview=function(n){window.FileReader&&layui.each(this.chooseFiles,function(e,i){var t=new FileReader;t.readAsDataURL(i),t.onload=function(){n&&n(e,i,this.result)}})},L.prototype.upload=function(e,i){var t,n,a,o,r=this,u=r.config,c=u.text||{},l=r.elemFile[0],f=function(){return e||r.files||r.chooseFiles||l.files},s=function(){var i=0,a=0,o=f(),l=function(){u.multiple&&i+a===r.fileLength&&"function"==typeof u.allDone&&u.allDone({total:r.fileLength,successful:i,failed:a})},t=function(t){var n=new FormData,e=(layui.each(u.data,function(e,i){i="function"==typeof i?i():i,n.append(e,i)}),t.unified?layui.each(o,function(e,i){n.append(u.field,i)}):n.append(u.field,t.file),{url:u.url,type:"post",data:n,contentType:!1,processData:!1,headers:u.headers||{},success:function(e){u.unified?i+=r.fileLength:i++,d(t.index,e),l()},error:function(e){u.unified?a+=r.fileLength:a++,r.msg(c.error||["Upload failed, please try again.","status: "+(e.status||"")+" - "+(e.statusText||"error")].join("
          ")),m(t.index),l()}});"function"==typeof u.progress&&(e.xhr=function(){var e=x.ajaxSettings.xhr();return e.upload.addEventListener("progress",function(e){var i;e.lengthComputable&&(i=Math.floor(e.loaded/e.total*100),u.progress(i,(u.item||u.elem)[0],e,t.index))}),e}),x.ajax(e)};u.unified?t({unified:!0,index:0}):layui.each(o,function(e,i){t({index:e,file:i})})},p=function(){var n=x("#"+F);r.elemFile.parent().submit(),clearInterval(L.timer),L.timer=setInterval(function(){var e,i=n.contents().find("body");try{e=i.text()}catch(t){r.msg(c["cross-domain"]),clearInterval(L.timer),m()}e&&(clearInterval(L.timer),i.html(""),d(0,e))},30)},d=function(e,i){if(r.elemFile.next("."+w).remove(),l.value="","json"===u.force&&"object"!=typeof i)try{i=JSON.parse(i)}catch(t){return i={},r.msg(c["data-format-error"])}"function"==typeof u.done&&u.done(i,e||0,function(e){r.upload(e)})},m=function(e){u.auto&&(l.value=""),"function"==typeof u.error&&u.error(e||0,function(e){r.upload(e)})},h=u.exts,g=(n=[],layui.each(e||r.chooseFiles,function(e,i){n.push(i.name)}),n),v={preview:function(e){r.preview(e)},upload:function(e,i){var t={};t[e]=i,r.upload(t)},pushFile:function(){return r.files=r.files||{},layui.each(r.chooseFiles,function(e,i){r.files[e]=i}),r.files},resetFile:function(e,i,t){i=new File([i],t);r.files=r.files||{},r.files[e]=i}},y={file:"\u6587\u4ef6",images:"\u56fe\u7247",video:"\u89c6\u9891",audio:"\u97f3\u9891"}[u.accept]||"\u6587\u4ef6",g=0===g.length?l.value.match(/[^\/\\]+\..+/g)||[]||"":g;if(0!==g.length){switch(u.accept){case"file":layui.each(g,function(e,i){if(h&&!RegExp(".\\.("+h+")$","i").test(escape(i)))return t=!0});break;case"video":layui.each(g,function(e,i){if(!RegExp(".\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(i)))return t=!0});break;case"audio":layui.each(g,function(e,i){if(!RegExp(".\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(i)))return t=!0});break;default:layui.each(g,function(e,i){if(!RegExp(".\\.("+(h||"jpg|png|gif|bmp|jpeg|svg")+")$","i").test(escape(i)))return t=!0})}if(t)return r.msg(c["check-error"]||"\u9009\u62e9\u7684"+y+"\u4e2d\u5305\u542b\u4e0d\u652f\u6301\u7684\u683c\u5f0f"),l.value="";if("choose"!==i&&!u.auto||(u.choose&&u.choose(v),"choose"!==i)){if(r.fileLength=(a=0,y=f(),layui.each(y,function(){a++}),a),u.number&&r.fileLength>u.number)return r.msg("function"==typeof c["limit-number"]?c["limit-number"](u,r.fileLength):"\u540c\u65f6\u6700\u591a\u53ea\u80fd\u4e0a\u4f20: "+u.number+" \u4e2a\u6587\u4ef6
          \u60a8\u5f53\u524d\u5df2\u7ecf\u9009\u62e9\u4e86: "+r.fileLength+" \u4e2a\u6587\u4ef6");if(01024*u.size&&(i=1<=(i=u.size/1024)?i.toFixed(2)+"MB":u.size+"KB",l.value="",o=i)}),o)return r.msg("function"==typeof c["limit-size"]?c["limit-size"](u,o):"\u6587\u4ef6\u5927\u5c0f\u4e0d\u80fd\u8d85\u8fc7 "+o);if(!u.before||!1!==u.before(v))b.ie?(9'+e+"")},r=function(){var e=x(this);(e.attr("lay-data")||e.attr("lay-options"))&&(n.config=x.extend({},a,lay.options(this,{attr:e.attr("lay-data")?"lay-data":null})))};a.elem.off("upload.start").on("upload.start",function(){var e=x(this);r.call(this),n.config.item=e,n.elemFile[0].click()}),b.ie&&b.ie<10||a.elem.off("upload.over").on("upload.over",function(){x(this).attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){x(this).removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(e,i){var t=x(this),i=i.originalEvent.dataTransfer.files||[];t.removeAttr("lay-over"),r.call(this),o(i),a.auto?n.upload():l(i)}),n.elemFile.off("upload.change").on("upload.change",function(){var e=this.files||[];0!==e.length&&(r.call(this),o(e),a.auto?n.upload():l(e))}),a.bindAction.off("upload.action").on("upload.action",function(){n.upload()}),a.elem.data("haveEvents")||(n.elemFile.on("change",function(){x(this).trigger("upload.change")}),a.elem.on("click",function(){n.isFile()||x(this).trigger("upload.start")}),a.drag&&a.elem.on("dragover",function(e){e.preventDefault(),x(this).trigger("upload.over")}).on("dragleave",function(e){x(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),x(this).trigger("upload.drop",e)}),a.bindAction.on("click",function(){x(this).trigger("upload.action")}),a.elem.data("haveEvents",!0))},t.render=function(e){e=new L(e);return function(){var i=this;return{upload:function(e){i.upload.call(i,e)},reload:function(e){i.reload.call(i,e)},config:i.config}}.call(e)},e(n,t)});layui.define(["lay","layer","util"],function(e){"use strict";var C=layui.$,y=layui.layer,d=layui.util,n=layui.hint(),w=(layui.device(),"form"),o=".layui-form",T="layui-this",N="layui-hide",$="layui-disabled",t=function(){this.config={verify:{required:[/[\S]+/,"\u5fc5\u586b\u9879\u4e0d\u80fd\u4e3a\u7a7a"],phone:[/^1\d{10}$/,"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u624b\u673a\u53f7"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"\u90ae\u7bb1\u683c\u5f0f\u4e0d\u6b63\u786e"],url:[/^(#|(http(s?)):\/\/|\/\/)[^\s]+\.[^\s]+$/,"\u94fe\u63a5\u683c\u5f0f\u4e0d\u6b63\u786e"],number:function(e){if(isNaN(e))return"\u53ea\u80fd\u586b\u5199\u6570\u5b57"},date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"\u65e5\u671f\u683c\u5f0f\u4e0d\u6b63\u786e"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u8eab\u4efd\u8bc1\u53f7"]},verIncludeRequired:!1,autocomplete:null}},i=(t.prototype.set=function(e){return C.extend(!0,this.config,e),this},t.prototype.verify=function(e){return C.extend(!0,this.config.verify,e),this},t.prototype.getFormElem=function(e){return C(o+(e?'[lay-filter="'+e+'"]':""))},t.prototype.on=function(e,t){return layui.onevent.call(this,w,e,t)},t.prototype.val=function(e,i){return this.getFormElem(e).each(function(e,t){var a=C(this);layui.each(i,function(e,t){var i,e=a.find('[name="'+e+'"]');e[0]&&("checkbox"===(i=e[0].type)?e[0].checked=t:"radio"===i?e.each(function(){this.checked=this.value==t}):e.val(t))})}),r.render(null,e),this.getValue(e)},t.prototype.getValue=function(e,t){t=t||this.getFormElem(e);var a={},l={},e=t.find("input,select,textarea");return layui.each(e,function(e,t){var i;C(this);t.name=(t.name||"").replace(/^\s*|\s*&/,""),t.name&&(/^.*\[\]$/.test(t.name)&&(i=t.name.match(/^(.*)\[\]$/g)[0],a[i]=0|a[i],i=t.name.replace(/^(.*)\[\]$/,"$1["+a[i]+++"]")),/^(checkbox|radio)$/.test(t.type)&&!t.checked||(l[i||t.name]=t.value))}),l},t.prototype.render=function(e,t){var i=this.config,a=C(o+(t?'[lay-filter="'+t+'"]':"")),l={input:function(e){e=e||a.find("input,textarea");i.autocomplete&&e.attr("autocomplete",i.autocomplete),a.find("input[lay-affix],textarea[lay-affix]").each(function(){var r=C(this),s=r.attr("lay-affix"),o="layui-input-wrap",c="layui-input-suffix",u="layui-input-affix",e=r.is("[disabled]")||r.is("[readonly]"),d=function(e,t){(e=C(e))[0]&&e[C.trim(t)?"removeClass":"addClass"](N)},l=function(i){i=C.extend({},f[s]||{value:s},i,lay.options(r[0]));var a,t=C('
          '),e=layui.isArray(i.value)?i.value:[i.value],e=C((a=[],layui.each(e,function(e,t){a.push('')}),a.join(""))),l=(t.append(e),i.split&&t.addClass("layui-input-split"),i.className&&t.addClass(i.className),r.next("."+u)),n=(l[0]&&l.remove(),r.parent().hasClass(o)||r.wrap('
          '),r.next("."+c));n[0]?((l=n.find("."+u))[0]&&l.remove(),n.prepend(t),r.css("padding-right",function(){return(r.closest(".layui-input-group")[0]?0:n.outerWidth())+t.outerWidth()})):(t.addClass(c),r.after(t)),"auto"===i.show&&d(t,r.val()),r.on("input propertychange",function(){var e=this.value;"auto"===i.show&&d(t,e)}),e.on("click",function(){var e=r.attr("lay-filter");C(this).hasClass($)||("function"==typeof i.click&&i.click.call(this,r,i),layui.event.call(this,w,"input-affix("+e+")",{elem:r[0],affix:s,options:i}))})},f={eye:{value:"eye-invisible",click:function(e,t){var i="LAY_FORM_INPUT_AFFIX_SHOW",a=e.data(i);e.attr("type",a?"password":"text").data(i,!a),l({value:a?"eye-invisible":"eye"})}},clear:{value:"clear",click:function(e){e.val("").focus(),d(C(this).parent(),null)},show:"auto",disabled:e},number:{value:["up","down"],split:!0,className:"layui-input-number",disabled:r.is("[disabled]"),click:function(e){var t=C(this).index(),i=e.val(),a=i,l=Number(e.attr("step"))||1,n=Number(e.attr("min")),r=Number(e.attr("max"));isNaN(i)||(i=Number(i),r<(i=(i=t?i-l:i+l)q.height()&&t<=e&&a.addClass(m+"up"),o()},l=function(e){a.removeClass(m+"ed "+m+"up"),d.blur(),s=null,e||n(d.val(),function(e){var t=c[0].selectedIndex;e&&(k=C(c[0].options[t]).html(),0===t&&k===d.attr("placeholder")&&(k=""),d.val(k||""))})},o=function(){var e,t,i=f.children("dd."+T);i[0]&&(e=i.position().top,t=f.height(),i=i.height(),t\u65e0\u5339\u914d\u9879

          '):f.find("."+x).remove()},"keyup"),""===t&&(c.val(""),f.find("."+T).removeClass(T),(c[0].options[0]||{}).value||f.children("dd:eq(0)").addClass(T),f.find("."+x).remove()),o()}).on("blur",function(e){var t=c[0].selectedIndex;p=d,k=C(c[0].options[t]).text(),0===t&&k===d.attr("placeholder")&&(k=""),setTimeout(function(){n(d.val(),function(e){k||d.val("")},"blur")},200)}),h.on("click",function(){var e=C(this),t=e.attr("lay-value"),i=c.attr("lay-filter");return e.hasClass($)||(e.hasClass("layui-select-tips")?d.val(""):(d.val(e.text()),e.addClass(T)),e.siblings().removeClass(T),c.val(t).removeClass("layui-form-danger"),layui.event.call(this,w,"select("+i+")",{elem:c[0],value:t,othis:a}),l(!0)),!1}),a.find("dl>dt").on("click",function(e){return!1}),C(document).off("click",b).on("click",b))};e.each(function(e,t){var i=C(this),a=i.next("."+m),l=this.disabled,n=t.value,r=C(t.options[t.selectedIndex]),t=t.options[0];if("string"==typeof i.attr("lay-ignore"))return i.show();var s,o="string"==typeof i.attr("lay-search"),t=t&&!t.value&&t.innerHTML||c,r=C(['
          ','
          ','','
          ','
          ',(t=i.find("*"),s=[],layui.each(t,function(e,t){var i=t.tagName.toLowerCase();0!==e||t.value||"optgroup"===i?"optgroup"===i?s.push("
          "+t.label+"
          "):s.push('
          '+C.trim(t.innerHTML)+"
          "):s.push('
          '+C.trim(t.innerHTML||c)+"
          ")}),0===s.length&&s.push('
          \u6ca1\u6709\u9009\u9879
          '),s.join("")+"
          "),"
          "].join(""));a[0]&&a.remove(),i.after(r),u.call(this,r,l,o)})},checkbox:function(e){var o={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],"switch":["layui-form-switch","layui-form-onswitch","switch"],SUBTRA:"layui-icon-indeterminate"},e=e||a.find("input[type=checkbox]");e.each(function(e,t){var i=C(this),a=i.attr("lay-skin")||"primary",l=d.escape(C.trim(t.title||(t.title=i.attr("lay-text")||""))),n=this.disabled,r=o[a]||o.checkbox,s=i.next("."+r[0]);if(s[0]&&s.remove(),i.next("[lay-checkbox]")[0]&&(l=i.next().html()||""),l="switch"===a?l.split("|"):[l],"string"==typeof i.attr("lay-ignore"))return i.show();n=C(['
          ",(s={checkbox:[l[0]?"
          "+l[0]+"
          ":"primary"===a?"":"
          ",''].join(""),"switch":"
          "+((t.checked?l[0]:l[1])||"")+"
          "})[a]||s.checkbox,"
          "].join(""));i.after(n),function(a,l){var n=C(this);a.on("click",function(){var e=C(this),t=n.attr("lay-filter"),e=e.next("*[lay-checkbox]")[0]?e.next().html():n.attr("title")||"",i=n.attr("lay-skin")||"primary",e="switch"===i?e.split("|"):[e];n[0].disabled||(n[0].indeterminate&&(n[0].indeterminate=!1,a.find("."+o.SUBTRA).removeClass(o.SUBTRA).addClass("layui-icon-ok")),n[0].checked?(n[0].checked=!1,a.removeClass(l[1]),"switch"===i&&a.children("div").html(e[1])):(n[0].checked=!0,a.addClass(l[1]),"switch"===i&&a.children("div").html(e[0])),layui.event.call(n[0],w,l[2]+"("+t+")",{elem:n[0],value:n[0].value,othis:a}))})}.call(this,n,r)})},radio:function(e){var r="layui-form-radio",s=["layui-icon-radio","layui-icon-circle"],e=e||a.find("input[type=radio]");e.each(function(e,t){var i=C(this),a=i.next("."+r),l=this.disabled;if("string"==typeof i.attr("lay-ignore"))return i.show();a[0]&&a.remove();l=C(['
          ','',"
          "+(a=d.escape(t.title||""),a=i.next("[lay-radio]")[0]?i.next().html():a)+"
          ","
          "].join(""));i.after(l),function(a){var l=C(this),n="layui-anim-scaleSpring";a.on("click",function(){var e=l[0].name,t=l.parents(o),i=l.attr("lay-filter"),e=t.find("input[name="+e.replace(/(\.|#|\[|\])/g,"\\$1")+"]");l[0].disabled||(layui.each(e,function(){var e=C(this).next("."+r);this.checked=!1,e.removeClass(r+"ed"),e.children(".layui-icon").removeClass(n+" "+s[0]).addClass(s[1])}),l[0].checked=!0,a.addClass(r+"ed"),a.children(".layui-icon").addClass(n+" "+s[0]),layui.event.call(l[0],w,"radio("+i+")",{elem:l[0],value:l[0].value,othis:a}))})}.call(this,l)})}},t=function(){layui.each(l,function(e,t){t()})};return"object"===layui.type(e)?C(e).is(o)?(a=C(e),t()):e.each(function(e,t){var i=C(t);i.closest(o).length&&("SELECT"===t.tagName?l.select(i):"INPUT"===t.tagName&&("checkbox"===(t=t.type)||"radio"===t?l[t](i):l.input(i)))}):e?l[e]?l[e]():n.error('\u4e0d\u652f\u6301\u7684 "'+e+'" \u8868\u5355\u6e32\u67d3'):t(),this},t.prototype.validate=function(e){var u=null,d=this.config,f=d.verify,h="layui-form-danger";return!(e=C(e))[0]||(e.attr("lay-verify")!==undefined||!1!==this.validate(e.find("*[lay-verify]")))&&(layui.each(e,function(e,r){var s=C(this),t=(s.attr("lay-verify")||"").split("|"),o=s.attr("lay-vertype"),c=C.trim(s.val());if(s.removeClass(h),layui.each(t,function(e,t){var i="",a=f[t];if(a){var l="function"==typeof a?i=a(c,r):!a[0].test(c),n="select"===r.tagName.toLowerCase()||/^(checkbox|radio)$/.test(r.type),i=i||a[1];if("required"===t&&(i=s.attr("lay-reqtext")||i),l&&(d.verIncludeRequired||"required"===t||c&&"required"!==t))return"tips"===o?y.tips(i,"string"!=typeof s.attr("lay-ignore")&&n?s.next():s,{tips:1}):"alert"===o?y.alert(i,{title:"\u63d0\u793a",shadeClose:!0}):/\b(string|number)\b/.test(typeof i)&&y.msg(i,{icon:5,shift:6}),setTimeout(function(){(n?s.next().find("input"):r).focus()},7),s.addClass(h),u=!0}}),u)return u}),!u)},t.prototype.submit=function(e,t){var i=C(this),e="string"==typeof e?e:i.attr("lay-filter"),a=this.getFormElem?this.getFormElem(e):i.parents(o).eq(0),l=a.find("*[lay-verify]");if(!r.validate(l))return!1;l=r.getValue(null,a),a={elem:this.getFormElem?window.event&&window.event.target:this,form:(this.getFormElem?a:i.parents("form"))[0],field:l};return"function"==typeof t&&t(a),layui.event.call(this,w,"submit("+e+")",a)}),r=new t,t=C(document),q=C(window);C(function(){r.render()}),t.on("reset",o,function(){var e=C(this).attr("lay-filter");setTimeout(function(){r.render(null,e)},50)}),t.on("submit",o,i).on("click","*[lay-submit]",i),e(w,r)});layui.define(["lay","laytpl","laypage","form","util"],function(n){"use strict";var p=layui.$,r=layui.lay,m=layui.laytpl,O=layui.laypage,f=layui.layer,v=layui.form,g=layui.util,y=layui.hint(),b=layui.device(),x={config:{checkName:"LAY_CHECKED",indexName:"LAY_INDEX",numbersName:"LAY_NUM",disabledName:"LAY_DISABLED"},cache:{},index:layui.table?layui.table.index+1e4:0,set:function(e){var t=this;return t.config=p.extend({},t.config,e),t},on:function(e,t){return layui.onevent.call(this,T,e,t)}},k=function(){var a=this,e=a.config,i=e.id||e.index;return{config:e,reload:function(e,t){a.reload.call(a,e,t)},reloadData:function(e,t){x.reloadData(i,e,t)},setColsWidth:function(){a.setColsWidth.call(a)},resize:function(){a.resize.call(a)}}},w=function(e){var t=k.that[e];return t||y.error(e?"The table instance with ID '"+e+"' not found":"ID argument required"),t||null},l=function(e){var t=k.config[e];return t||y.error(e?"The table instance with ID '"+e+"' not found":"ID argument required"),t||null},C=function(e){var t=this.config||{},a=(e=e||{}).item3,i=e.content;"numbers"===a.type&&(i=e.tplData[x.config.numbersName]);("escape"in a?a:t).escape&&(i=g.escape(i));t=e.text&&a.exportTemplet||a.templet||a.toolbar;return t&&(i="function"==typeof t?t.call(a,e.tplData,e.obj):m(p(t).html()||String(i)).render(p.extend({LAY_COL:a},e.tplData))),e.text?p("
          "+i+"
          ").text():i},T="table",t=".layui-table",N="layui-hide",h="layui-hide-v",R="layui-none",L="layui-table-view",o=".layui-table-header",D=".layui-table-body",A=".layui-table-pageview",_=".layui-table-sort",E="layui-table-checked",j="layui-table-edit",W="layui-table-hover",z="laytable-cell-group",H="layui-table-col-special",M="layui-table-tool-panel",S="layui-table-expanded",F="LAY_TABLE_MOVE_DICT",e=function(e){return['',"","{{# layui.each(d.data.cols, function(i1, item1){ }}","","{{# layui.each(item1, function(i2, item2){ }}",'{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}','{{# if(item2.fixed === "right"){ right = true; } }}',(e=e||{}).fixed&&"right"!==e.fixed?'{{# if(item2.fixed && item2.fixed !== "right"){ }}':"right"===e.fixed?'{{# if(item2.fixed === "right"){ }}':"","{{# var isSort = !(item2.colGroup) && item2.sort; }}",'",e.fixed?"{{# }; }}":"","{{# }); }}","","{{# }); }}","","
          ','
          ','{{# if(item2.type === "checkbox"){ }}','',"{{# } else { }}",'{{-item2.title||""}}',"{{# if(isSort){ }}",'',"{{# } }}","{{# } }}","
          ","
          "].join("")},a=['',"","
          "].join(""),s=[,"{{# if(d.data.toolbar){ }}",'
          ','
          ','
          ',"
          ","{{# } }}",'
          ',"{{# if(d.data.loading){ }}",'
          ','',"
          ","{{# } }}","{{# var left, right; }}",'
          ',e(),"
          ",'
          ',a,"
          ","{{# if(left){ }}",'
          ','
          ',e({fixed:!0}),"
          ",'
          ',a,"
          ","
          ","{{# }; }}","{{# if(right){ }}",'
          ','
          ',e({fixed:"right"}),'
          ',"
          ",'
          ',a,"
          ","
          ","{{# }; }}","
          ","{{# if(d.data.totalRow){ }}",'
          ','','',"
          ","
          ","{{# } }}",'
          ','
          ',"
          "].join(""),d=p(window),P=p(document),i=function(e){this.index=++x.index,this.config=p.extend({},this.config,x.config,e),this.render()},c=(i.prototype.config={limit:10,loading:!0,escape:!0,cellMinWidth:60,cellMaxWidth:Number.MAX_VALUE,editTrigger:"click",defaultToolbar:["filter","exports","print"],defaultContextmenu:!0,autoSort:!0,text:{none:"\u65e0\u6570\u636e"},cols:[]},i.prototype.render=function(e){var t=this,a=t.config,i=(a.elem=p(a.elem),a.where=a.where||{},a.id="id"in a?a.id:a.elem.attr("id")||t.index);if(k.that[i]=t,(k.config[i]=a).request=p.extend({pageName:"page",limitName:"limit"},a.request),a.response=p.extend({statusName:"code",statusCode:0,msgName:"msg",dataName:"data",totalRowName:"totalRow",countName:"count"},a.response),null!==a.page&&"object"==typeof a.page&&(a.limit=a.page.limit||a.limit,a.limits=a.page.limits||a.limits,t.page=a.page.curr=a.page.curr||1,delete a.page.elem,delete a.page.jump),!a.elem[0])return t;if(a.elem.attr("lay-filter")||a.elem.attr("lay-filter",a.id),"reloadData"===e)return t.pullData(t.page,{type:"reloadData"});a.index=t.index,t.key=a.id||a.index,t.setInit(),a.height&&/^full-\d+$/.test(a.height)?(t.fullHeightGap=a.height.split("-")[1],a.height=d.height()-t.fullHeightGap):a.height&&/^#\w+\S*-\d+$/.test(a.height)&&(i=a.height.split("-"),t.parentHeightGap=i.pop(),t.parentDiv=i.join("-"),a.height=p(t.parentDiv).height()-t.parentHeightGap);var l,e=a.elem,i=e.next("."+L),n=t.elem=p("
          ");n.addClass((l=[L,L+"-"+t.index,"layui-form","layui-border-box"],a.className&&l.push(a.className),l.join(" "))).attr({"lay-filter":"LAY-TABLE-FORM-DF-"+t.index,"lay-id":a.id,style:(l=[],a.width&&l.push("width:"+a.width+"px;"),l.join(""))}).html(m(s,{open:"{{",close:"}}"}).render({data:a,index:t.index})),t.renderStyle(),i[0]&&i.remove(),e.after(n),t.layTool=n.find(".layui-table-tool"),t.layBox=n.find(".layui-table-box"),t.layHeader=n.find(o),t.layMain=n.find(".layui-table-main"),t.layBody=n.find(D),t.layFixed=n.find(".layui-table-fixed"),t.layFixLeft=n.find(".layui-table-fixed-l"),t.layFixRight=n.find(".layui-table-fixed-r"),t.layTotal=n.find(".layui-table-total"),t.layPage=n.find(".layui-table-page"),t.renderToolbar(),t.renderPagebar(),t.fullSize(),t.pullData(t.page),t.events()},i.prototype.initOpts=function(e){this.config;e.checkbox&&(e.type="checkbox"),e.space&&(e.type="space"),e.type||(e.type="normal"),"normal"!==e.type&&(e.unresize=!0,e.width=e.width||{checkbox:50,radio:50,space:30,numbers:60}[e.type])},i.prototype.setInit=function(e){var l,a,d=this,r=d.config;if(r.clientWidth=r.width||(l=function(e){var t,a=(e=e||r.elem.parent()).width();try{t="none"===e.css("display")}catch(i){}return!e[0]||a&&!t?a:l(e.parent())})(),"width"===e)return r.clientWidth;r.height=r.maxHeight||r.height,r.css&&-1===r.css.indexOf(L)&&(a=r.css.split("}"),layui.each(a,function(e,t){t&&(a[e]="."+L+"-"+d.index+" "+t)}),r.css=a.join("}"));var c=function(a,e,i,l){var n,o;l?(l.key=[r.index,a,i].join("-"),l.colspan=l.colspan||0,l.rowspan=l.rowspan||0,d.initOpts(l),(n=a+(parseInt(l.rowspan)||1)) td:hover > .layui-table-cell{overflow: auto;}"],function(e,t){o.push(a+" "+t)})),l.css&&o.push(l.css),r.style({target:this.elem[0],text:o.join(""),id:"DF-"+n})},i.prototype.renderToolbar=function(){var e=this.config,t=['
          ','
          ','
          '].join(""),a=this.layTool.find(".layui-table-tool-temp"),i=("default"===e.toolbar?a.html(t):"string"==typeof e.toolbar&&(t=p(e.toolbar).html()||"")&&a.html(m(t).render(e)),{filter:{title:"\u7b5b\u9009\u5217",layEvent:"LAYTABLE_COLS",icon:"layui-icon-cols"},exports:{title:"\u5bfc\u51fa",layEvent:"LAYTABLE_EXPORT",icon:"layui-icon-export"},print:{title:"\u6253\u5370",layEvent:"LAYTABLE_PRINT",icon:"layui-icon-print"}}),l=[];"object"==typeof e.defaultToolbar&&layui.each(e.defaultToolbar,function(e,t){t="string"==typeof t?i[t]:t;t&&l.push('
          ')}),this.layTool.find(".layui-table-tool-self").html(l.join(""))},i.prototype.renderPagebar=function(){var e,t=this.config,a=this.layPagebar=p('
          ');t.pagebar&&((e=p(t.pagebar).html()||"")&&a.append(m(e).render(t)),this.layPage.append(a))},i.prototype.setParentCol=function(e,t){var a=this.config,i=this.layHeader.find('th[data-key="'+t+'"]'),l=parseInt(i.attr("colspan"))||0;i[0]&&(t=t.split("-"),t=a.cols[t[1]][t[2]],e?l--:l++,i.attr("colspan",l),i[l?"removeClass":"addClass"](N),t.colspan2=l,t.hide=l<1,(a=i.data("parentkey"))&&this.setParentCol(e,a))},i.prototype.setColsPatch=function(){var a=this,e=a.config;layui.each(e.cols,function(e,t){layui.each(t,function(e,t){t.hide&&a.setParentCol(t.hide,t.parentKey)})})},i.prototype.setGroupWidth=function(i){var e,l=this;l.config.cols.length<=1||((e=l.layHeader.find((i?"th[data-key="+i.data("parentkey")+"]>":"")+"."+z)).css("width",0),layui.each(e.get().reverse(),function(){var e=p(this),t=e.parent().data("key"),a=0;l.layHeader.eq(0).find("th[data-parentkey="+t+"]").width(function(e,t){p(this).hasClass(N)||0 tr:first-child > th:last-child")).data("field")&&e.prev()[0]?t(e.prev()):e})()).data("key"),n.cssRules(e,function(e){var t=e.style.width||a.outerWidth();e.style.width=parseFloat(t)+l+"px",0'+(e||"Error")+"
          ");a[0]&&(t.layNone.remove(),a.remove()),t.layFixed.addClass(N),t.layMain.find("tbody").html(""),t.layMain.append(t.layNone=e),t.layTotal.addClass(h),t.layPage.find(A).addClass(h),x.cache[t.key]=[],t.syncCheckAll(),t.renderForm(),t.setColsWidth()},i.prototype.page=1,i.prototype.pullData=function(a,t){var e,i,l=this,n=l.config,o=(n.HAS_SET_COLS_PATCH||l.setColsPatch(),n.HAS_SET_COLS_PATCH=!0,n.request),d=n.response,r=function(){"object"==typeof n.initSort&&l.sort({field:n.initSort.field,type:n.initSort.type,reloadType:t.type})},c=function(e,t){l.setColsWidth(),"function"==typeof n.done&&n.done(e,a,e[d.countName],t)};t=t||{},"function"==typeof n.before&&n.before(n),l.startTime=(new Date).getTime(),t.renderData?((e={})[d.dataName]=x.cache[l.key],e[d.countName]=n.url?"object"===layui.type(n.page)?n.page.count:e[d.dataName].length:n.data.length,"object"==typeof n.totalRow&&(e[d.totalRowName]=p.extend({},l.totalRow)),l.renderData({res:e,curr:a,count:e[d.countName],type:t.type,sort:!0}),c(e,"renderData")):n.url?(i={},n.page&&(i[o.pageName]=a,i[o.limitName]=n.limit),o=p.extend(i,n.where),n.contentType&&0==n.contentType.indexOf("application/json")&&(o=JSON.stringify(o)),l.loading(),p.ajax({type:n.method||"get",url:n.url,contentType:n.contentType,data:o,dataType:n.dataType||"json",jsonpCallback:n.jsonpCallback,headers:n.headers||{},success:function(e){(e="function"==typeof n.parseData?n.parseData(e)||e:e)[d.statusName]!=d.statusCode?l.errorView(e[d.msgName]||'\u8fd4\u56de\u7684\u6570\u636e\u4e0d\u7b26\u5408\u89c4\u8303\uff0c\u6b63\u786e\u7684\u6210\u529f\u72b6\u6001\u7801\u5e94\u4e3a\uff1a"'+d.statusName+'": '+d.statusCode):(l.totalRow=e[d.totalRowName],l.renderData({res:e,curr:a,count:e[d.countName],type:t.type}),r(),n.time=(new Date).getTime()-l.startTime+" ms"),c(e)},error:function(e,t){l.errorView("\u8bf7\u6c42\u5f02\u5e38\uff0c\u9519\u8bef\u63d0\u793a\uff1a"+t),"function"==typeof n.error&&n.error(e,t)}})):"array"===layui.type(n.data)&&(e={},i=a*n.limit-n.limit,o=n.data.concat(),e[d.dataName]=n.page?o.splice(i,n.limit):o,e[d.countName]=n.data.length,"object"==typeof n.totalRow&&(e[d.totalRowName]=p.extend({},n.totalRow)),l.totalRow=e[d.totalRowName],l.renderData({res:e,curr:a,count:e[d.countName],type:t.type}),r(),c(e))},i.prototype.eachCols=function(e){return x.eachCols(null,e,this.config.cols),this},i.prototype.col=function(e){try{return e=e.split("-"),this.config.cols[e[1]][e[2]]||{}}catch(t){return y.error(t),{}}},i.prototype.getTrHtml=function(a,l,n,e){var s=this,u=s.config,y=e&&e.trs||[],h=e&&e.trs_fixed||[],f=e&&e.trs_fixed_r||[];return n=n||1,layui.each(a,function(e,o){var i=[],d=[],r=[],c=e+u.limit*(n-1)+1;if("object"!=typeof o){a[e]=o={LAY_KEY:o};try{x.cache[s.key][e]=o}catch(t){}}"array"===layui.type(o)&&0===o.length||(o[x.config.numbersName]=c,l||(o[x.config.indexName]=e),s.eachCols(function(e,l){var t,e=l.field||e,a=l.key,n=o[e];n!==undefined&&null!==n||(n=""),l.colGroup||(t=['','
          "+function(){var e,t=p.extend(!0,{LAY_COL:l},o),a=x.config.checkName,i=x.config.disabledName;switch(l.type){case"checkbox":return'';case"radio":return'';case"numbers":return c}return l.toolbar?m(p(l.toolbar).html()||"").render(t):C.call(s,{item3:l,content:n,tplData:t})}(),"
          "].join(""),i.push(t),l.fixed&&"right"!==l.fixed&&d.push(t),"right"===l.fixed&&r.push(t))}),e=['data-index="'+e+'"'],o[x.config.checkName]&&e.push('class="'+E+'"'),e=e.join(" "),y.push(""+i.join("")+""),h.push(""+d.join("")+""),f.push(""+r.join("")+""))}),{trs:y,trs_fixed:h,trs_fixed_r:f}},x.getTrHtml=function(e,t){e=w(e);return e.getTrHtml(t,null,e.page)},i.prototype.renderData=function(e){var a=this,i=a.config,t=e.res,l=e.curr,n=a.count=e.count,o=e.sort,d=t[i.response.dataName]||[],t=t[i.response.totalRowName],r=[],c=[],s=[],u=function(){if(!o&&a.sortKey)return a.sort({field:a.sortKey.field,type:a.sortKey.sort,pull:!0,reloadType:e.type});a.getTrHtml(d,o,l,{trs:r,trs_fixed:c,trs_fixed_r:s}),"fixed"===i.scrollPos&&"reloadData"===e.type||a.layBody.scrollTop(0),"reset"===i.scrollPos&&a.layBody.scrollLeft(0),a.layMain.find("."+R).remove(),a.layMain.find("tbody").html(r.join("")),a.layFixLeft.find("tbody").html(c.join("")),a.layFixRight.find("tbody").html(s.join("")),a.syncCheckAll(),a.renderForm(),a.fullSize(),a.haveInit?a.scrollPatch():setTimeout(function(){a.scrollPatch()},50),a.haveInit=!0};return x.cache[a.key]=d,a.layTotal[0==d.length?"addClass":"removeClass"](h),a.layPage[i.page||i.pagebar?"removeClass":"addClass"](N),a.layPage.find(A)[!i.page||0==n||0===d.length&&1==l?"addClass":"removeClass"](h),0===d.length?a.errorView(i.text.none):(a.layFixLeft.removeClass(N),o?u():(u(),a.renderTotal(d,t),a.layTotal&&a.layTotal.removeClass(N),void(i.page&&(i.page=p.extend({elem:"layui-table-page"+i.index,count:n,limit:i.limit,limits:i.limits||[10,20,30,40,50,60,70,80,90],groups:3,layout:["prev","page","next","skip","count","limit"],prev:'',next:'',jump:function(e,t){t||(a.page=e.curr,i.limit=e.limit,a.pullData(e.curr))}},i.page),i.page.count=n,O.render(i.page)))))},x.renderData=function(e){e=w(e);e&&e.pullData(e.page,{renderData:!0,type:"reloadData"})},i.prototype.renderTotal=function(e,o){var d,r=this,c=r.config,s={};c.totalRow&&(layui.each(e,function(e,i){"array"===layui.type(i)&&0===i.length||r.eachCols(function(e,t){var e=t.field||e,a=i[e];t.totalRow&&(s[e]=(s[e]||0)+(parseFloat(a)||0))})}),r.dataTotal=[],d=[],r.eachCols(function(e,t){var a,e=t.field||e,i=o&&o[t.field],l="totalRowDecimals"in t?t.totalRowDecimals:2,l=s[e]?parseFloat(s[e]||0).toFixed(l):"",l=(a=t.totalRowText||"",(n={LAY_COL:t})[e]=l,n=t.totalRow&&C.call(r,{item3:t,content:l,tplData:n})||a,i||n),n=(t.field&&r.dataTotal.push({field:t.field,total:p("
          "+l+"
          ").text()}),['','
          "+("string"==typeof(a=t.totalRow||c.totalRow)?m(a).render(p.extend({TOTAL_NUMS:i||s[e],TOTAL_ROW:o||{},LAY_COL:t},t)):l),"
          "].join(""));d.push(n)}),e=r.layTotal.find(".layui-table-patch"),r.layTotal.find("tbody").html(""+d.join("")+(e.length?e.get(0).outerHTML:"")+""))},i.prototype.getColElem=function(e,t){return e.eq(0).find(".laytable-cell-"+t+":eq(0)")},i.prototype.renderForm=function(e){this.config;var t=this.elem.attr("lay-filter");v.render(e,t)},i.prototype.syncCheckAll=function(){var a,e=this,i=e.config,t=e.layHeader.find('input[name="layTableCheckbox"]'),l=x.checkStatus(e.key);t[0]&&(a=l.isAll,e.eachCols(function(e,t){"checkbox"===t.type&&(t[i.checkName]=a)}),t.prop({checked:l.isAll,indeterminate:!l.isAll&&l.data.length}),v.render(t))},i.prototype.setRowActive=function(e,t,a){this.config;e=this.layBody.find('tr[data-index="'+e+'"]');if(t=t||"layui-table-click",a)return e.removeClass(t);e.addClass(t),e.siblings("tr").removeClass(t)},i.prototype.setRowChecked=function(a){var e=this,i=e.config,l=e.layBody.find("tr"+("all"===a.index?"":'[data-index="'+a.index+'"]')),t=(a=p.extend({type:"checkbox"},a),x.cache[e.key]),n="checked"in a,o=function(e){return"radio"===a.type||(n?a.checked:!e)},t=(layui.each(t,function(e,t){"array"===layui.type(t)||t[i.disabledName]||(Number(a.index)===e||"all"===a.index?(e=t[i.checkName]=o(t[i.checkName]),l[e?"addClass":"removeClass"](E),"radio"===a.type&&l.siblings().removeClass(E)):"radio"===a.type&&delete t[i.checkName])}),l.find('input[lay-type="'+({radio:"layTableRadio",checkbox:"layTableCheckbox"}[a.type]||"checkbox")+'"]:not(:disabled)'));t.prop("checked",o(t.last().prop("checked"))),e.syncCheckAll(),e.renderForm(a.type)},i.prototype.sort=function(l){var e,t=this,a={},i=t.config,n=i.elem.attr("lay-filter"),o=x.cache[t.key];"string"==typeof(l=l||{}).field&&(d=l.field,t.layHeader.find("th").each(function(e,t){var a=p(this),i=a.data("field");if(i===l.field)return l.field=a,d=i,!1}));try{var d=d||l.field.data("field"),r=l.field.data("key");if(t.sortKey&&!l.pull&&d===t.sortKey.field&&l.type===t.sortKey.sort)return;var c=t.layHeader.find("th .laytable-cell-"+r).find(_);t.layHeader.find("th").find(_).removeAttr("lay-sort"),c.attr("lay-sort",l.type||null),t.layFixed.find("th")}catch(s){y.error("Table modules: sort field '"+d+"' not matched")}t.sortKey={field:d,sort:l.type},i.autoSort&&("asc"===l.type?e=layui.sort(o,d,null,!0):"desc"===l.type?e=layui.sort(o,d,!0,!0):(e=layui.sort(o,x.config.indexName,null,!0),delete t.sortKey,delete i.initSort)),a[i.response.dataName]=e||o,t.renderData({res:a,curr:t.page,count:t.count,sort:!0,type:l.reloadType}),l.fromEvent&&(i.initSort={field:d,type:l.type},layui.event.call(l.field,T,"sort("+n+")",p.extend({config:i},i.initSort)))},i.prototype.loading=function(e){var t=this;t.config.loading&&(e?(t.layInit&&t.layInit.remove(),delete t.layInit,t.layBox.find(".layui-table-init").remove()):(t.layInit=p(['
          ','',"
          "].join("")),t.layBox.append(t.layInit)))},i.prototype.cssRules=function(t,a){var e=this.elem.children("style")[0];r.getStyleRules(e,function(e){if(e.selectorText===".laytable-cell-"+t)return a(e),!0})},i.prototype.fullSize=function(){var e,a,i=this,t=i.config,l=t.height;i.fullHeightGap?(l=d.height()-i.fullHeightGap)<135&&(l=135):i.parentDiv&&i.parentHeightGap&&(l=p(i.parentDiv).height()-i.parentHeightGap)<135&&(l=135),1
          ')).find("div").css({width:a}),e.find("tr").append(t)):e.find(".layui-table-patch").remove()};n(e.layHeader),n(e.layTotal);n=e.layMain.height()-i;e.layFixed.find(D).css("height",t.height()>=n?n:"auto").scrollTop(e.layMain.scrollTop()),e.layFixRight[x.cache[e.key]&&x.cache[e.key].length&&0');a.html(t),u.height&&a.css("max-height",u.height-(s.layTool.outerHeight()||50)),i.find("."+M)[0]||i.append(a),s.renderForm(),a.on("click",function(e){layui.stope(e)}),e.done&&e.done(a,t)};switch(layui.stope(e),P.trigger("table.tool.panel.remove"),t){case"LAYTABLE_COLS":n({list:(a=[],s.eachCols(function(e,t){t.field&&"normal"==t.type&&a.push('
        • "+(t.fieldTitle||t.title||t.field)+"
        • ").text())+'" lay-filter="LAY_TABLE_TOOL_COLS">')}),a.join("")),done:function(){v.on("checkbox(LAY_TABLE_TOOL_COLS)",function(e){var e=p(e.elem),t=this.checked,a=e.data("key"),i=s.col(a),l=i.hide,e=e.data("parentkey");i.key&&(i.hide=!t,s.elem.find('*[data-key="'+a+'"]')[t?"removeClass":"addClass"](N),l!=i.hide&&s.setParentCol(!t,e),s.resize(),layui.event.call(this,T,"colToggled("+c+")",{col:i,config:u}))})}});break;case"LAYTABLE_EXPORT":if(!l.length)return f.tips("\u5f53\u524d\u8868\u683c\u65e0\u6570\u636e",this,{tips:3});b.ie?f.tips("\u5bfc\u51fa\u529f\u80fd\u4e0d\u652f\u6301 IE\uff0c\u8bf7\u7528 Chrome \u7b49\u9ad8\u7ea7\u6d4f\u89c8\u5668\u5bfc\u51fa",this,{tips:3}):n({list:['
        • \u5bfc\u51fa csv \u683c\u5f0f\u6587\u4ef6
        • ','
        • \u5bfc\u51fa xls \u683c\u5f0f\u6587\u4ef6
        • '].join(""),done:function(e,t){t.on("click",function(){var e=p(this).data("type");x.exportFile.call(s,u.id,null,e)})}});break;case"LAYTABLE_PRINT":if(!l.length)return f.tips("\u5f53\u524d\u8868\u683c\u65e0\u6570\u636e",this,{tips:3});var o=window.open("about:blank","_blank"),d=[""].join(""),r=p(s.layHeader.html());r.append(s.layMain.find("table").html()),r.append(s.layTotal.find("table").html()),r.find("th.layui-table-patch").remove(),r.find("thead>tr>th."+H).filter(function(e,t){return!p(t).children("."+z).length}).remove(),r.find("tbody>tr>td."+H).remove(),o.document.write(d+r.prop("outerHTML")),o.document.close(),layui.device("edg").edg?(o.onafterprint=o.close,o.print()):(o.print(),o.close())}layui.event.call(this,T,"toolbar("+c+")",p.extend({event:t,config:u},{}))}),s.layHeader.on("click","*[lay-event]",function(e){var t=p(this),a=t.attr("lay-event"),t=t.closest("th").data("key"),t=s.col(t);layui.event.call(this,T,"colTool("+c+")",p.extend({event:a,config:u,col:t},{}))}),s.layPagebar.on("click","*[lay-event]",function(e){var t=p(this).attr("lay-event");layui.event.call(this,T,"pagebar("+c+")",p.extend({event:t,config:u},{}))}),e.on("mousemove",function(e){var t=p(this),a=t.offset().left,e=e.clientX-a;t.data("unresize")||k.eventMoveElem||(d.allowResize=t.width()-e<=10,o.css("cursor",d.allowResize?"col-resize":""))}).on("mouseleave",function(){p(this);k.eventMoveElem||o.css("cursor","")}).on("mousedown",function(e){var t,a=p(this);d.allowResize&&(t=a.data("key"),e.preventDefault(),d.offset=[e.clientX,e.clientY],s.cssRules(t,function(e){var t=e.style.width||a.outerWidth();d.rule=e,d.ruleWidth=parseFloat(t),d.minWidth=a.data("minwidth")||u.cellMinWidth,d.maxWidth=a.data("maxwidth")||u.cellMaxWidth}),a.data(F,d),k.eventMoveElem=a)}),k.docEvent||P.on("mousemove",function(e){var t,a;k.eventMoveElem&&(t=k.eventMoveElem.data(F)||{},k.eventMoveElem.data("resizing",1),e.preventDefault(),t.rule&&(e=t.ruleWidth+e.clientX-t.offset[0],a=k.eventMoveElem.closest("."+L).attr("lay-id"),(a=w(a))&&((e=et.maxWidth&&(e=t.maxWidth),t.rule.style.width=e+"px",a.setGroupWidth(k.eventMoveElem))))}).on("mouseup",function(e){var t,a,i,l,n;k.eventMoveElem&&(i=(t=k.eventMoveElem).closest("."+L).attr("lay-id"),(a=w(i))&&(i=t.data("key"),l=a.col(i),n=a.config.elem.attr("lay-filter"),d={},o.css("cursor",""),a.scrollPatch(),t.removeData(F),delete k.eventMoveElem,a.cssRules(i,function(e){l.width=parseFloat(e.style.width),layui.event.call(t[0],T,"colResized("+n+")",{col:l,config:a.config})})))}),k.docEvent=!0,e.on("click",function(e){var t=p(this),a=t.find(_),i=a.attr("lay-sort");if(!a[0]||1===t.data("resizing"))return t.removeData("resizing");s.sort({field:t,type:"asc"===i?"desc":"desc"===i?null:"asc",fromEvent:!0})}).find(_+" .layui-edge ").on("click",function(e){var t=p(this),a=t.index(),t=t.parents("th").eq(0).data("field");layui.stope(e),0===a?s.sort({field:t,type:"asc",fromEvent:!0}):s.sort({field:t,type:"desc",fromEvent:!0})}),s.commonMember=function(e){var t=p(this).parents("tr").eq(0).data("index"),r=s.layBody.find('tr[data-index="'+t+'"]'),c=(c=x.cache[s.key]||[])[t]||{},a={tr:r,config:u,data:x.clearCacheKey(c),dataCache:c,index:t,del:function(){x.cache[s.key][t]=[],r.remove(),s.scrollPatch()},update:function(e,d){e=e||{},layui.each(e,function(i,l){var n=r.children('td[data-field="'+i+'"]'),o=n.children(y);c[i]=a.data[i]=l,s.eachCols(function(e,t){var a;t.field==i?(o.html(C.call(s,{item3:t,content:l,tplData:p.extend({LAY_COL:t},c)})),n.data("content",l)):d&&(t.templet||t.toolbar)&&(e=r.children('td[data-field="'+(t.field||e)+'"]'),a=c[t.field],e.children(y).html(C.call(s,{item3:t,content:a,tplData:p.extend({LAY_COL:t},c)})),e.data("content",a))})}),s.renderForm()},setRowChecked:function(e){s.setRowChecked(p.extend({index:t},e))}};return p.extend(a,e)}),a=(s.elem.on("click",'input[name="layTableCheckbox"]+',function(e){var t=p(this),a=t.closest("td"),t=t.prev(),i=(s.layBody.find('input[name="layTableCheckbox"]'),t.parents("tr").eq(0).data("index")),l=t[0].checked,n="layTableAllChoose"===t.attr("lay-filter");t[0].disabled||(n?s.setRowChecked({index:"all",checked:l}):(s.setRowChecked({index:i,checked:l}),layui.stope(e)),layui.event.call(t[0],T,"checkbox("+c+")",r.call(t[0],{checked:l,type:n?"all":"one",getCol:function(){return s.col(a.data("key"))}})))}),s.elem.on("click",'input[lay-type="layTableRadio"]+',function(e){var t=p(this),a=t.closest("td"),t=t.prev(),i=t[0].checked,l=t.parents("tr").eq(0).data("index");if(layui.stope(e),t[0].disabled)return!1;s.setRowChecked({type:"radio",index:l}),layui.event.call(t[0],T,"radio("+c+")",r.call(t[0],{checked:i,getCol:function(){return s.col(a.data("key"))}}))}),s.layBody.on("mouseenter","tr",function(){var e=p(this),t=e.index();e.data("off")||s.layBody.find("tr:eq("+t+")").addClass(W)}).on("mouseleave","tr",function(){var e=p(this),t=e.index();e.data("off")||s.layBody.find("tr:eq("+t+")").removeClass(W)}).on("click","tr",function(e){var t=[".layui-form-checkbox",".layui-form-switch",".layui-form-radio","[lay-unrow]"].join(",");p(e.target).is(t)||p(e.target).closest(t)[0]||a.call(this,"row")}).on("dblclick","tr",function(){a.call(this,"rowDouble")}).on("contextmenu","tr",function(e){u.defaultContextmenu||e.preventDefault(),a.call(this,"rowContextmenu")}),function(e){var t=p(this);t.data("off")||layui.event.call(this,T,e+"("+c+")",r.call(t.children("td")[0]))}),n=function(e,t){var a,i,l,n;(e=p(e)).data("off")||(a=e.data("field"),n=e.data("key"),n=s.col(n),i=e.closest("tr").data("index"),i=x.cache[s.key][i],l=e.children(y),(n="function"==typeof n.edit?n.edit(i):n.edit)&&((n=p("textarea"===n?'':''))[0].value=e.data("content")||i[a]||l.text(),e.find("."+j)[0]||e.append(n),n.focus(),t&&layui.stope(t)))},i=(s.layBody.on("change","."+j,function(){var e=p(this),t=e.parent(),a=this.value,i=e.parent().data("field"),e=e.closest("tr").data("index"),e=x.cache[s.key][e],l=r.call(t[0],{value:a,field:i,oldValue:e[i],td:t,reedit:function(){setTimeout(function(){n(l.td);var e={};e[i]=l.oldValue,l.update(e)})},getCol:function(){return s.col(t.data("key"))}}),e={};e[i]=a,l.update(e),layui.event.call(t[0],T,"edit("+c+")",l)}).on("blur","."+j,function(){p(this).remove()}),s.layBody.on(u.editTrigger,"td",function(e){n(this,e)}).on("mouseenter","td",function(){t.call(this)}).on("mouseleave","td",function(){t.call(this,"hide")}),s.layTotal.on("mouseenter","td",function(){t.call(this)}).on("mouseleave","td",function(){t.call(this,"hide")}),"layui-table-grid-down"),t=function(e){var t=p(this),a=t.children(y);t.data("off")||t.parent().hasClass(S)||(e?t.find(".layui-table-grid-down").remove():!(a.prop("scrollWidth")>a.outerWidth()||0
          '))},l=function(e){var t=p(this),a=t.parent(),i=a.data("key"),l=s.col(i),n=a.parent().data("index"),a=a.children(y),o="layui-table-cell-c",d=p('');s.elem.find("."+o).trigger("click"),s.cssRules(i,function(e){var t=e.style.width,a=l.expandedWidth||s.elem.width()/3;atr").each(function(i){n.cols[i]=[],p(this).children().each(function(e){var t=p(this),a=t.attr("lay-data"),a=r.options(this,{attr:a?"lay-data":null,errorText:d+(a||t.attr("lay-options"))}),t=p.extend({title:t.text(),colspan:parseInt(t.attr("colspan"))||1,rowspan:parseInt(t.attr("rowspan"))||1},a);n.cols[i].push(t)})}),e.find("tbody>tr")),t=x.render(n);!a.length||o.data||t.config.url||(l=0,x.eachCols(t.config.id,function(e,i){a.each(function(e){n.data[e]=n.data[e]||{};var t=p(this),a=i.field;n.data[e][a]=t.children("td").eq(l).html()}),l++}),t.reloadData({data:n.data}))}),this},k.that={},k.config={},function(a,i,e,l){var n,o;l.colGroup&&(n=0,a++,l.CHILD_COLS=[],o=e+(parseInt(l.rowspan)||1),layui.each(i[o],function(e,t){t.parentKey?t.parentKey===l.key&&(t.PARENT_COL_INDEX=a,l.CHILD_COLS.push(t),c(a,i,o,t)):t.PARENT_COL_INDEX||1<=n&&n==(l.colspan||1)||(t.PARENT_COL_INDEX=a,l.CHILD_COLS.push(t),n+=parseInt(1td').filter('[data-field="'+e+'"]')}}})).replace(/"/g,'""'),n.push(a='"'+a+'"')))}),d.push(n.join(","))}),c&&layui.each(c.dataTotal,function(e,t){r[t.field]||i.push('"'+(t.total||"")+'"')}),o.join(",")+"\r\n"+d.join("\r\n")+"\r\n"+i.join(","))),u.download=(a.title||n.title||"table_"+(n.index||""))+"."+l,document.body.appendChild(u),u.click(),document.body.removeChild(u)},x.getOptions=l,x.hideCol=function(e,l){var n=w(e);n&&("boolean"===layui.type(l)?n.eachCols(function(e,t){var a=t.key,i=n.col(a),t=t.parentKey;i.hide!=l&&(i=i.hide=l,n.elem.find('*[data-key="'+a+'"]')[i?"addClass":"removeClass"](N),n.setParentCol(i,t))}):(l=layui.isArray(l)?l:[l],layui.each(l,function(e,l){n.eachCols(function(e,t){var a,i;l.field===t.field&&(a=t.key,i=n.col(a),t=t.parentKey,"hide"in l&&i.hide!=l.hide&&(i=i.hide=!!l.hide,n.elem.find('*[data-key="'+a+'"]')[i?"addClass":"removeClass"](N),n.setParentCol(i,t)))})})),p("."+M).remove(),n.resize())},x.reload=function(e,t,a,i){if(l(e))return e=w(e),e.reload(t,a,i),k.call(e)},x.reloadData=function(){var a=p.extend([],arguments),i=(a[3]="reloadData",new RegExp("^("+["elem","id","cols","width","height","maxHeight","toolbar","defaultToolbar","className","css","pagebar"].join("|")+")$"));return layui.each(a[1],function(e,t){i.test(e)&&delete a[1][e]}),x.reload.apply(null,a)},x.render=function(e){e=new i(e);return k.call(e)},x.clearCacheKey=function(e){return delete(e=p.extend({},e))[x.config.checkName],delete e[x.config.indexName],delete e[x.config.numbersName],delete e[x.config.disabledName],e},p(function(){x.init()}),n(T,x)});layui.define(["table"],function(e){"use strict";var B=layui.$,x=layui.form,j=layui.table,y=layui.hint(),P={config:{},on:j.on,eachCols:j.eachCols,index:j.index,set:function(e){var t=this;return t.config=B.extend({},t.config,e),t},resize:j.resize,getOptions:j.getOptions,hideCol:j.hideCol,renderData:j.renderData},i=function(){var a=this,e=a.config,n=e.id||e.index;return{config:e,reload:function(e,t){a.reload.call(a,e,t)},reloadData:function(e,t){P.reloadData(n,e,t)}}},F=function(e){var t=i.that[e];return t||y.error(e?"The treeTable instance with ID '"+e+"' not found":"ID argument required"),t||null},L="layui-hide",q=".layui-table-main",R=".layui-table-fixed-l",Y=".layui-table-fixed-r",l="layui-table-checked",h="layui-table-tree",H="LAY_DATA_INDEX",m="LAY_DATA_INDEX_HISTORY",s="LAY_PARENT_INDEX",b="LAY_CHECKBOX_HALF",z="LAY_EXPAND",X="LAY_HAS_EXPANDED",V="LAY_ASYNC_STATUS",n=["all","parent","children","none"],t=function(e){var t=this;t.index=++P.index,t.config=B.extend(!0,{},t.config,P.config,e),t.init(),t.render()},f=function(n,i,e){var l=j.cache[n];layui.each(e||l,function(e,t){var a=t[H];-1!==a.indexOf("-")&&(l[a]=t),t[i]&&f(n,i,t[i])})},r=function(l,a,e){var r=F(l),d=("reloadData"!==e&&(r.status={expand:{}}),B.extend(!0,{},r.getOptions(),a)),n=d.tree,o=n.customName.children,i=n.customName.id,c=(delete a.hasNumberCol,delete a.hasChecboxCol,delete a.hasRadioCol,j.eachCols(null,function(e,t){"numbers"===t.type?a.hasNumberCol=!0:"checkbox"===t.type?a.hasChecboxCol=!0:"radio"===t.type&&(a.hasRadioCol=!0)},d.cols),a.parseData),u=a.done;d.url?e&&(!c||c.mod)||(a.parseData=function(){var e=this,t=arguments,a=t[0],t=("function"===layui.type(c)&&(a=c.apply(e,t)||t[0]),e.response.dataName);return n.data.isSimpleData&&!n["async"].enable&&(a[t]=r.flatToTree(a[t])),p(a[t],function(e){e[z]=z in e?e[z]:e[i]!==undefined&&r.status.expand[e[i]]},o),e.autoSort&&e.initSort&&e.initSort.type&&layui.sort(a[t],e.initSort.field,"desc"===e.initSort.type,!0),r.initData(a[t]),a},a.parseData.mod=!0):(a.data=a.data||[],n.data.isSimpleData&&(a.data=r.flatToTree(a.data)),r.initData(a.data)),e&&(!u||u.mod)||(a.done=function(){var e,t=arguments,a=t[3],n=(a||delete r.isExpandAll,this.elem.next()),i=(r.updateStatus(null,{LAY_HAS_EXPANDED:!1}),f(l,o),n.find('[name="layTableCheckbox"][lay-filter="layTableAllChoose"]'));if(i.length&&(e=P.checkStatus(l),i.prop({checked:e.isAll&&e.data.length,indeterminate:!e.isAll&&e.data.length})),!a&&d.autoSort&&d.initSort&&d.initSort.type&&P.sort(l),r.renderTreeTable(n),"function"===layui.type(u))return u.apply(this,t)},a.done.mod=!0)};t.prototype.init=function(){var e=this.config,t=e.tree.data.cascade,t=(-1===n.indexOf(t)&&(e.tree.data.cascade="all"),j.render(B.extend({},e,{data:[],url:"",done:null}))),a=t.config.id;(i.that[a]=this).tableIns=t,r(a,e)},t.prototype.config={tree:{customName:{children:"children",isParent:"isParent",name:"name",id:"id",pid:"parentId",icon:"icon"},view:{indent:14,flexIconClose:'',flexIconOpen:'',showIcon:!0,icon:"",iconClose:'',iconOpen:'',iconLeaf:'',showFlexIconIfNotParent:!1,dblClickExpand:!0,expandAllDefault:!1},data:{isSimpleData:!1,rootPid:null,cascade:"all"},"async":{enable:!1,url:"",type:null,contentType:null,headers:null,where:null,autoParam:[]},callback:{beforeExpand:null,onExpand:null}}},t.prototype.getOptions=function(){return this.tableIns?j.getOptions(this.tableIns.config.id):this.config},t.prototype.flatToTree=function(e){var a,n,i,t,l,r,d,o=this.getOptions(),c=o.tree,u=c.customName,o=o.id;return e=e||j.cache[o],o=e,a=u.id,n=u.pid,i=u.children,t=c.data.rootPid,a=a||"id",n=n||"parentId",i=i||"children",d={},layui.each(o,function(e,t){l=a+t[a],d[l]=B.extend({},t),d[l][i]=[]}),layui.each(d,function(e,t){(r=a+t[n])&&d[r]&&d[r][i].push(t)}),Object.values(d).filter(function(e){return t?e[n]===t:!e[n]})},t.prototype.treeToFlat=function(e,n,i){var l=this,r=l.getOptions().tree.customName,d=r.children,o=r.pid,c=[];return layui.each(e,function(e,t){var e=(i?i+"-":"")+e,a=B.extend({},t);a[o]=t[o]||n,c.push(a),c=c.concat(l.treeToFlat(t[d],t[r.id],e))}),c},t.prototype.getTreeNode=function(e){var t=this;if(!e)return y.error("\u627e\u4e0d\u5230\u8282\u70b9\u6570\u636e");var a=t.getOptions(),n=a.tree;a.id,n.customName;return{data:e,dataIndex:e[H],getParentNode:function(){return t.getNodeByIndex(e[s])}}},t.prototype.getNodeByIndex=function(t){var e=this,a=e.getNodeDataByIndex(t);if(!a)return y.error("\u627e\u4e0d\u5230\u8282\u70b9\u6570\u636e");var n=e.getOptions(),i=(n.tree.customName.parent,n.id),n={data:a,dataIndex:a[H],getParentNode:function(){return e.getNodeByIndex(a[s])},update:function(e){return P.updateNode(i,t,e)},remove:function(){return P.removeNode(i,t)},expand:function(e){return P.expandNode(i,B.extend({},e,{index:t}))},setChecked:function(e){return P.setRowChecked(i,B.extend({},e,{index:t}))}};return n.dataIndex=t,n},t.prototype.getNodeById=function(a){var e=this.getOptions(),n=e.tree.customName.id,i="",e=P.getData(e.id,!0);if(layui.each(e,function(e,t){if(t[n]===a)return i=t[H],!0}),i)return this.getNodeByIndex(i)},t.prototype.getNodeDataByIndex=function(a,e,t){var n=this.getOptions(),i=n.tree,l=n.id,r=j.cache[l][a];if("delete"!==t&&r)return B.extend(r,t),e?B.extend({},r):r;for(var r=this.getTableData(),d=(a+="").split("-"),o=r,c=n.url||1');var D=function(e){y[V]="success",y[s.children]=e,c.initData(y[s.children],y[H]),J(t,!0,!p&&n,i,l)},T=b.format;if("function"===layui.type(T))return T(y,o,D),h;var k=B.extend({},b.where||o.where),T=b.autoParam,T=(layui.each(T,function(e,t){t=t.split("=");k[t[0].trim()]=y[(t[1]||t[0]).trim()]}),b.contentType||o.contentType),_=(T&&0==T.indexOf("application/json")&&(k=JSON.stringify(k)),b.method||o.method),O=b.dataType||o.dataType,w=b.jsonpCallback||o.jsonpCallback,S=b.headers||o.headers,A=b.parseData||o.parseData,E=b.response||o.response;return B.ajax({type:_||"get",url:I,contentType:T,data:k,dataType:O||"json",jsonpCallback:w,headers:S||{},success:function(e){(e="function"==typeof A?A.call(o,e)||e:e)[E.statusName]!=E.statusCode?(y[V]="error",g.html('')):D(e[E.dataName])},error:function(e,t){y[V]="error","function"==typeof o.error&&o.error(e,t)}}),h}m=y[X]=!0,v.length&&(!o.initSort||o.url&&!o.autoSort||((b=o.initSort).type?layui.sort(v,b.field,"desc"===b.type,!0):layui.sort(v,j.config.indexName,null,!0)),c.initData(y[s.children],y[H]),_=j.getTrHtml(d,v,null,null,e),N={trs:B(_.trs.join("")),trs_fixed:B(_.trs_fixed.join("")),trs_fixed_r:B(_.trs_fixed_r.join(""))},C=(e.split("-").length-1||0)+1,layui.each(v,function(e,t){N.trs.eq(e).attr({"data-index":t[H],"lay-data-index":t[H],"data-level":C}),N.trs_fixed.eq(e).attr({"data-index":t[H],"lay-data-index":t[H],"data-level":C}),N.trs_fixed_r.eq(e).attr({"data-index":t[H],"lay-data-index":t[H],"data-level":C})}),r.find(q).find('tbody tr[lay-data-index="'+e+'"]').after(N.trs),r.find(R).find('tbody tr[lay-data-index="'+e+'"]').after(N.trs_fixed),r.find(Y).find('tbody tr[lay-data-index="'+e+'"]').after(N.trs_fixed_r),c.renderTreeTable(N.trs,C),n&&!p&&layui.each(v,function(e,t){J({dataIndex:t[H],trElem:r.find('tr[lay-data-index="'+t[H]+'"]').first(),tableViewElem:r,tableId:d,options:o},a,n,i,l)}))}else c.isExpandAll=!1,n&&!p?(layui.each(v,function(e,t){J({dataIndex:t[H],trElem:r.find('tr[lay-data-index="'+t[H]+'"]').first(),tableViewElem:r,tableId:d,options:o},a,n,i,l)}),r.find(v.map(function(e,t,a){return'tr[lay-data-index="'+e[H]+'"]'}).join(",")).addClass(L)):(I=c.treeToFlat(v,y[s.id],e),r.find(I.map(function(e,t,a){return'tr[lay-data-index="'+e[H]+'"]'}).join(",")).addClass(L));return U("resize-"+d,function(){P.resize(d)},0)(),l&&"loading"!==y[V]&&(T=u.callback.onExpand,"function"===layui.type(T)&&T(d,y,x)),h},g=(P.expandNode=function(e,t){var a,n,i,e=F(e);if(e)return a=(t=t||{}).index,n=t.expandFlag,i=t.inherit,t=t.callbackFlag,e=e.getOptions().elem.next(),J({trElem:e.find('tr[lay-data-index="'+a+'"]').first()},n,i,null,t)},P.expandAll=function(a,e){if("boolean"!==layui.type(e))return y.error("expandAll \u7684\u5c55\u5f00\u72b6\u6001\u53c2\u6570\u53ea\u63a5\u6536true/false");var t=F(a);if(t){t.isExpandAll=e;var n=t.getOptions(),i=n.tree,l=n.elem.next(),r=i.customName.isParent,d=i.customName.id,o=i.view.showFlexIconIfNotParent;if(e){e=P.getData(a,!0);if(i["async"].enable){var c=!0;if(layui.each(e,function(e,t){if(t[r]&&!t[V])return!(c=!1)}),!c)return void layui.each(P.getData(a),function(e,t){P.expandNode(a,{index:t[H],expandFlag:!0,inherit:!0})})}var u=!0;if(layui.each(e,function(e,t){if(t[r]&&!t[X])return!(u=!1)}),u)t.updateStatus(null,function(e){(e[r]||o)&&(e[z]=!0,e[d]!==undefined&&(t.status.expand[e[d]]=!0))}),l.find('tbody tr[data-level!="0"]').removeClass(L),l.find(".layui-table-tree-flexIcon").html(i.view.flexIconOpen),i.view.showIcon&&l.find(".layui-table-tree-nodeIcon:not(.layui-table-tree-iconCustom,.layui-table-tree-iconLeaf)").html(i.view.iconOpen);else{if(t.updateStatus(null,function(e){(e[r]||o)&&(e[z]=!0,e[X]=!0,e[d]!==undefined&&(t.status.expand[e[d]]=!0))}),n.initSort&&n.initSort.type&&n.autoSort)return P.sort(a);var s,n=j.getTrHtml(a,e),f={trs:B(n.trs.join("")),trs_fixed:B(n.trs_fixed.join("")),trs_fixed_r:B(n.trs_fixed_r.join(""))};layui.each(e,function(e,t){var a=t[H].split("-").length-1;s={"data-index":t[H],"lay-data-index":t[H],"data-level":a},f.trs.eq(e).attr(s),f.trs_fixed.eq(e).attr(s),f.trs_fixed_r.eq(e).attr(s)}),layui.each(["main","fixed-l","fixed-r"],function(e,t){l.find(".layui-table-"+t+" tbody").html(f[["trs","trs_fixed","trs_fixed_r"][e]])}),t.renderTreeTable(l,0,!1)}}else t.updateStatus(null,function(e){(e[r]||o)&&(e[z]=!1,e[d]!==undefined&&(t.status.expand[e[d]]=!1))}),l.find('.layui-table-box tbody tr[data-level!="0"]').addClass(L),l.find(".layui-table-tree-flexIcon").html(i.view.flexIconClose),i.view.showIcon&&l.find(".layui-table-tree-nodeIcon:not(.layui-table-tree-iconCustom,.layui-table-tree-iconLeaf)").html(i.view.iconClose);P.resize(a)}},t.prototype.renderTreeTable=function(e,t,a){var n=this,i=n.getOptions(),l=i.elem.next(),r=(l.hasClass(h)||l.addClass(h),i.id),d=i.tree||{},o=(d.data,d.view||{}),c=d.customName||{},u=c.isParent,s=(l.attr("lay-filter"),n),f=((t=t||0)||(l.find(".layui-table-body tr:not([data-level])").attr("data-level",t),layui.each(j.cache[r],function(e,t){l.find('.layui-table-main tbody tr[data-level="0"]:eq('+e+")").attr("lay-data-index",t[H]),l.find('.layui-table-fixed-l tbody tr[data-level="0"]:eq('+e+")").attr("lay-data-index",t[H]),l.find('.layui-table-fixed-r tbody tr[data-level="0"]:eq('+e+")").attr("lay-data-index",t[H])})),null),y=c.name,p=o.indent||14;if(layui.each(e.find('td[data-field="'+y+'"]'),function(e,t){var a,n,i=(t=B(t)).closest("tr"),t=t.children(".layui-table-cell");t.hasClass("layui-table-tree-item")||(n=i.attr("lay-data-index"))&&(i=l.find('tr[lay-data-index="'+n+'"]'),(a=s.getNodeDataByIndex(n))[z]&&a[u]&&((f=f||{})[n]=!0),a[b]&&i.find('input[type="checkbox"][name="layTableCheckbox"]').prop("indeterminate",!0),n=t.html(),(t=i.find('td[data-field="'+y+'"]>div.layui-table-cell')).addClass("layui-table-tree-item"),t.html(['
          ',a[z]?o.flexIconOpen:o.flexIconClose,"
          ",o.showIcon?'
          '+(a[c.icon]||o.icon||(a[u]?a[z]?o.iconOpen:o.iconClose:o.iconLeaf)||"")+"
          ":"",n].join("")).find(".layui-table-tree-flexIcon").on("click",function(e){layui.stope(e),J({trElem:i},null,null,null,!0)}))}),!t&&d.view.expandAllDefault&&n.isExpandAll===undefined)return P.expandAll(r,!0);!1!==a&&f?layui.each(f,function(e,t){e=l.find('tr[lay-data-index="'+e+'"]');e.find(".layui-table-tree-flexIcon").html(o.flexIconOpen),J({trElem:e.first()},!0)}):U("renderTreeTable-"+r,function(){i.hasNumberCol&&g(n),x.render(B('.layui-table-tree[lay-id="'+r+'"]'))},0)()},function(a){var e=a.getOptions(),t=e.elem.next(),n=0,i=t.find(".layui-table-main tbody tr"),l=t.find(".layui-table-fixed-l tbody tr"),r=t.find(".layui-table-fixed-r tbody tr");layui.each(a.treeToFlat(j.cache[e.id]),function(e,t){t.LAY_HIDE||(a.getNodeDataByIndex(t[H]).LAY_NUM=++n,i.eq(e).find(".laytable-cell-numbers").html(n),l.eq(e).find(".laytable-cell-numbers").html(n),r.eq(e).find(".laytable-cell-numbers").html(n))})}),p=(t.prototype.render=function(e){var t=this;t.tableIns=j["reloadData"===e?"reloadData":"reload"](t.tableIns.config.id,B.extend(!0,{},t.config)),t.config=t.tableIns.config},t.prototype.reload=function(e,t,a){var n=this;e=e||{},delete n.haveInit,layui.each(e,function(e,t){"array"===layui.type(t)&&delete n.config[e]}),r(n.getOptions().id,e,a||!0),n.config=B.extend(t,{},n.config,e),n.render(a)},P.reloadData=function(){var e=B.extend(!0,[],arguments);return e[3]="reloadData",P.reload.apply(null,e)},function(e,a,n,i){var l=[];return layui.each(e,function(e,t){"function"===layui.type(a)?a(t):B.extend(t,a),l.push(B.extend({},t)),i||(l=l.concat(p(t[n],a,n,i)))}),l}),o=(t.prototype.updateStatus=function(e,t,a){var n=this.getOptions(),i=n.tree;return e=e||j.cache[n.id],p(e,t,i.customName.children,a)},t.prototype.getTableData=function(){var e=this.getOptions();return j.cache[e.id]},P.updateStatus=function(e,t,a){var e=F(e),n=e.getOptions();return a=a||(n.url?j.cache[n.id]:n.data),e.updateStatus(a,t)},P.sort=function(e){var t=F(e);t&&t.getOptions().autoSort&&(t.initData(),P.renderData(e))},function(n){var t=n.config.id,i=F(t),a=n.data=P.getNodeDataByIndex(t,n.index),l=a[H],r=(n.dataIndex=l,n.update);n.update=function(){var e=arguments,t=(B.extend(i.getNodeDataByIndex(l),e[0]),r.apply(this,e)),a=n.config.tree.customName.name;return a in e[0]&&n.tr.find('td[data-field="'+a+'"]').children("div.layui-table-cell").removeClass("layui-table-tree-item"),i.renderTreeTable(n.tr,n.tr.attr("data-level"),!1),t},n.del=function(){P.removeNode(t,a)},n.setRowChecked=function(e){P.setRowChecked(t,{index:a,checked:e})}}),c=(P.updateNode=function(e,a,t){var n,i,l,r,d,o=F(e);o&&((r=o.getOptions()).tree,r=(n=r.elem.next()).find('tr[lay-data-index="'+a+'"]'),i=r.attr("data-index"),l=r.attr("data-level"),t&&(r=o.getNodeDataByIndex(a,!1,t),d=j.getTrHtml(e,[r]),layui.each(["main","fixed-l","fixed-r"],function(e,t){n.find(".layui-table-"+t+' tbody tr[lay-data-index="'+a+'"]').replaceWith(B(d[["trs","trs_fixed","trs_fixed_r"][e]].join("")).attr({"data-index":i,"lay-data-index":a,"data-level":l}))}),o.renderTreeTable(n.find('tr[lay-data-index="'+a+'"]'),l)))},P.removeNode=function(e,t){var a,n,i,l,r,d=F(e);d&&(r=(a=d.getOptions()).tree,n=a.elem.next(),i=[],t=d.getNodeDataByIndex("string"===layui.type(t)?t:t[H],!1,"delete"),l=d.getNodeDataByIndex(t[s]),d.updateCheckStatus(l),l=d.treeToFlat([t],t[r.customName.pid],t[s]),layui.each(l,function(e,t){i.push('tr[lay-data-index="'+t[H]+'"]')}),n.find(i.join(",")).remove(),r=d.initData(),layui.each(d.treeToFlat(r),function(e,t){t[m]&&t[m]!==t[H]&&n.find('tr[lay-data-index="'+t[m]+'"]').attr({"data-index":t[H],"lay-data-index":t[H]})}),layui.each(j.cache[e],function(e,t){n.find('tr[data-level="0"][lay-data-index="'+t[H]+'"]').attr("data-index",e)}),a.hasNumberCol&&g(d),P.resize(e))},P.addNodes=function(e,t){var a=F(e);if(a){var n=a.getOptions(),i=n.tree,l=n.elem.next(),r=j.config.checkName,d=(t=t||{}).parentIndex,o=t.index,c=t.data,t=t.focus,u=(d="number"===layui.type(d)?d.toString():d)?a.getNodeDataByIndex(d):null,o="number"===layui.type(o)?o:-1,c=B.extend(!0,[],layui.isArray(c)?c:[c]);layui.each(c,function(e,t){r in t||(t[r]=u[r])}),a.getTableData();if(u){var s=i.customName.isParent,f=i.customName.children;u[s]=!0;var y=(y=u[f])?(p=y.splice(-1===o?y.length:o),u[f]=y.concat(c,p)):u[f]=c,f=(a.updateStatus(y,function(e){(e[s]||i.view.showFlexIconIfNotParent)&&(e[X]=!1)}),a.treeToFlat(y));l.find(f.map(function(e){return'tr[lay-data-index="'+e[H]+'"]'}).join(",")).remove(),a.initData(),u[X]=!1,u[V]="local",J({trElem:l.find('tr[lay-data-index="'+d+'"]')},!0)}else{var p=j.cache[e].splice(-1===o?j.cache[e].length:o);if(j.cache[e]=j.cache[e].concat(c,p),n.url||(n.page?(y=n.page,n.data.splice.apply(n.data,[y.limit*(y.curr-1),y.limit].concat(j.cache[e]))):n.data=j.cache[e]),a.initData(),l.find(".layui-none").length)return j.renderData(e),c;var x,f=j.getTrHtml(e,c),h={trs:B(f.trs.join("")),trs_fixed:B(f.trs_fixed.join("")),trs_fixed_r:B(f.trs_fixed_r.join(""))},d=(layui.each(c,function(e,t){x={"data-index":t[H],"lay-data-index":t[H],"data-level":"0"},h.trs.eq(e).attr(x),h.trs_fixed.eq(e).attr(x),h.trs_fixed_r.eq(e).attr(x)}),parseInt(c[0][H])-1),y=l.find(q),n=l.find(R),f=l.find(Y);-1==d?(y.find('tr[data-level="0"][data-index="0"]').before(h.trs),n.find('tr[data-level="0"][data-index="0"]').before(h.trs_fixed),f.find('tr[data-level="0"][data-index="0"]').before(h.trs_fixed_r)):-1===o?(y.find("tbody").append(h.trs),n.find("tbody").append(h.trs_fixed),f.find("tbody").append(h.trs_fixed_r)):(d=p[0][m],y.find('tr[data-level="0"][data-index="'+d+'"]').before(h.trs),n.find('tr[data-level="0"][data-index="'+d+'"]').before(h.trs_fixed),f.find('tr[data-level="0"][data-index="'+d+'"]').before(h.trs_fixed_r)),layui.each(j.cache[e],function(e,t){l.find('tr[data-level="0"][lay-data-index="'+t[H]+'"]').attr("data-index",e)}),a.renderTreeTable(l.find(c.map(function(e,t,a){return'tr[lay-data-index="'+e[H]+'"]'}).join(",")))}return a.updateCheckStatus(u),P.resize(e),t&&l.find(q).find('tr[lay-data-index="'+c[0][H]+'"]').get(0).scrollIntoViewIfNeeded(),c}},P.checkStatus=function(e,n){var i,t,a,l=F(e);if(l)return l=l.getOptions().tree,i=j.config.checkName,t=P.getData(e,!0).filter(function(e,t,a){return e[i]||n&&e[b]}),a=!0,layui.each("all"===l.data.cascade?j.cache[e]:P.getData(e,!0),function(e,t){if(!t[i])return!(a=!1)}),{data:t,isAll:a}},P.on("sort",function(e){var e=e.config,t=e.elem.next(),e=e.id;t.hasClass(h)&&P.sort(e)}),P.on("row",function(e){e.config.elem.next().hasClass(h)&&o(e)}),P.on("rowDouble",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(h)&&(o(e),(t.tree||{}).view.dblClickExpand&&J({trElem:e.tr.first()},null,null,null,!0))}),P.on("rowContextmenu",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(h)&&o(e)}),P.on("tool",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(h)&&o(e)}),P.on("edit",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(h)&&(o(e),e.field===t.tree.customName.name&&((a={})[e.field]=e.value,e.update(a)))}),P.on("radio",function(e){var t=e.config,a=t.elem.next(),t=t.id;a.hasClass(h)&&(a=F(t),o(e),c.call(a,e.tr,e.checked))}),t.prototype.setRowCheckedClass=function(e,t){var a=this.getOptions(),n=(e.data("index"),a.elem.next());e[t?"addClass":"removeClass"](l),e.each(function(){var e=B(this).data("index");n.find('.layui-table-fixed-r tbody tr[data-index="'+e+'"]')[t?"addClass":"removeClass"](l)})},t.prototype.updateCheckStatus=function(e,t){var i=this,a=i.getOptions();if(!a.hasChecboxCol)return!1;var n=a.tree,l=a.id,r=a.elem.next(),d=j.config.checkName,o=n.data.cascade,c=(("all"===o||"parent"===o)&&e&&(o=i.updateParentCheckStatus(e,"boolean"===layui.type(t)?t:null),layui.each(o,function(e,t){var a=r.find('tr[lay-data-index="'+t[H]+'"] input[name="layTableCheckbox"]:not(:disabled)'),n=t[d];i.setRowCheckedClass(a.closest("tr"),n),x.render(a.prop({checked:n,indeterminate:t[b]}))})),!0),u=!1,e=(e="all"===n.data.cascade?j.cache[l]:P.getData(l,!0)).filter(function(e){return!e[a.disabledName]});return layui.each(e,function(e,t){if((t[d]||t[b])&&(u=!0),t[d]||(c=!1),u&&!c)return!0}),u=u&&!c,x.render(r.find('input[name="layTableCheckbox"][lay-filter="layTableAllChoose"]').prop({checked:c,indeterminate:u})),c},t.prototype.updateParentCheckStatus=function(a,n){var i,e=this.getOptions(),t=e.tree,e=e.id,l=j.config.checkName,t=t.customName.children,r=[];return!(a[b]=!1)===n?a[t].length?layui.each(a[t],function(e,t){if(!t[l])return n=!1,a[b]=!0}):n=!1:!1===n?layui.each(a[t],function(e,t){if(t[l]||t[b])return a[b]=!0}):(n=!1,i=0,layui.each(a[t],function(e,t){t[l]&&i++}),n=a[t].length?a[t].length===i:a[l],a[b]=!n&&0')),n=(e.tree(a),i.elem=p(i.elem));if(n[0]){if(e.key=i.id||e.index,e.elem=a,e.elemNone=p('
          '+i.text.none+"
          "),n.html(e.elem),0==e.elem.find(".layui-tree-set").length)return e.elem.append(e.elemNone);i.showCheckbox&&e.renderForm("checkbox"),e.elem.find(".layui-tree-set").each(function(){var e=p(this);e.parent(".layui-tree-pack")[0]||e.addClass("layui-tree-setHide"),!e.next()[0]&&e.parents(".layui-tree-pack").eq(1).hasClass("layui-tree-lineExtend")&&e.addClass(F),e.next()[0]||e.parents(".layui-tree-set").eq(0).next()[0]||e.addClass(F)}),e.events()}},l.prototype.renderForm=function(e){i.render(e,"LAY-tree-"+this.index)},l.prototype.tree=function(l,e){var c=this,r=c.config,d=r.customName,e=e||r.data;layui.each(e,function(e,i){var a=i[d.children]&&0"),t=p(['
          ','
          ','
          ',r.showLine?a?'':'':'',r.showCheckbox?'':"",r.isJump&&i.href?''+(i[d.title]||i.label||r.text.defaultNodeName)+"":''+(i[d.title]||i.label||r.text.defaultNodeName)+"","
          ",function(){if(!r.edit)return"";var a={add:'',update:'',del:''},n=['
          '];return!0===r.edit&&(r.edit=["update","del"]),"object"==typeof r.edit?(layui.each(r.edit,function(e,i){n.push(a[i]||"")}),n.join("")+"
          "):void 0}(),"
          "].join(""));a&&(t.append(n),c.tree(n,i[d.children])),l.append(t),t.prev("."+m)[0]&&t.prev().children(".layui-tree-pack").addClass("layui-tree-showLine"),a||t.parent(".layui-tree-pack").addClass("layui-tree-lineExtend"),c.spread(t,i),r.showCheckbox&&(i.checked&&c.checkids.push(i[d.id]),c.checkClick(t,i)),r.edit&&c.operate(t,i)})},l.prototype.spread=function(n,t){var l=this,c=l.config,e=n.children("."+x),i=e.children("."+b),a=i.find('input[same="layuiTreeCheck"]'),r=e.find("."+k),e=e.find("."+g),d=c.onlyIconControl?r:i,s="";d.on("click",function(e){var i=n.children("."+w),a=(d.children(".layui-icon")[0]?d:d.find(".layui-tree-icon")).children(".layui-icon");i[0]?n.hasClass(N)?(n.removeClass(N),i.slideUp(200),a.removeClass(v).addClass(C),l.updateFieldValue(t,"spread",!1)):(n.addClass(N),i.slideDown(200),a.addClass(v).removeClass(C),l.updateFieldValue(t,"spread",!0),c.accordion&&((i=n.siblings("."+m)).removeClass(N),i.children("."+w).slideUp(200),i.find(".layui-tree-icon").children(".layui-icon").removeClass(v).addClass(C))):s="normal"}),e.on("click",function(){p(this).hasClass(o)||(s=n.hasClass(N)?c.onlyIconControl?"open":"close":c.onlyIconControl?"close":"open",a[0]&&l.updateFieldValue(t,"checked",a.prop("checked")),c.click&&c.click({elem:n,state:s,data:t}))})},l.prototype.updateFieldValue=function(e,i,a){i in e&&(e[i]=a)},l.prototype.setCheckbox=function(e,i,a){var t,n=this,l=n.config.customName,c=a.prop("checked");a.prop("disabled")||("object"!=typeof i[l.children]&&!e.find("."+w)[0]||e.find("."+w).find('input[same="layuiTreeCheck"]').each(function(e){this.disabled||((e=i[l.children][e])&&n.updateFieldValue(e,"checked",c),n.updateFieldValue(this,"checked",c))}),(t=function(e){var i,a,n;e.parents("."+m)[0]&&(a=(e=e.parent("."+w)).parent(),n=e.prev().find('input[same="layuiTreeCheck"]'),c?n.prop("checked",c):(e.find('input[same="layuiTreeCheck"]').each(function(){this.checked&&(i=!0)}),i||n.prop("checked",!1)),t(a))})(e),n.renderForm("checkbox"))},l.prototype.checkClick=function(a,n){var t=this,l=t.config;a.children("."+x).children("."+b).on("click",'input[same="layuiTreeCheck"]+',function(e){layui.stope(e);var e=p(this).prev(),i=e.prop("checked");e.prop("disabled")||(t.setCheckbox(a,n,e),t.updateFieldValue(n,"checked",i),l.oncheck&&l.oncheck({elem:a,checked:i,data:n}))})},l.prototype.operate=function(r,d){var s=this,o=s.config,u=o.customName,e=r.children("."+x),h=e.children("."+b);e.children(".layui-tree-btnGroup").on("click",".layui-icon",function(e){layui.stope(e);var i,e=p(this).data("type"),n=r.children("."+w),t={data:d,type:e,elem:r};if("add"==e){n[0]||(o.showLine?(h.find("."+k).addClass("layui-tree-icon"),h.find("."+k).children(".layui-icon").addClass(C).removeClass("layui-icon-file")):h.find(".layui-tree-iconArrow").removeClass(f),r.append('
          '));var a,l=o.operate&&o.operate(t),c={};if(c[u.title]=o.text.defaultNodeName,c[u.id]=l,s.tree(r.children("."+w),[c]),o.showLine&&(n[0]?(n.hasClass(L)||n.addClass(L),r.find("."+w).each(function(){p(this).children("."+m).last().addClass(F)}),(n.children("."+m).last().prev().hasClass(F)?n.children("."+m).last().prev():n.children("."+m).last()).removeClass(F),!r.parent("."+w)[0]&&r.next()[0]&&n.children("."+m).last().removeClass(F)):(l=r.siblings("."+m),a=1,c=r.parent("."+w),layui.each(l,function(e,i){p(i).children("."+w)[0]||(a=0)}),1==a?(l.children("."+w).addClass(T),l.children("."+w).children("."+m).removeClass(F),r.children("."+w).addClass(T),c.removeClass(L),c.children("."+m).last().children("."+w).children("."+m).last().addClass(F)):r.children("."+w).children("."+m).addClass(F))),!o.showCheckbox)return;h.find('input[same="layuiTreeCheck"]')[0].checked&&(r.children("."+w).children("."+m).last().find('input[same="layuiTreeCheck"]')[0].checked=!0),s.renderForm("checkbox")}else"update"==e?(l=h.children("."+g).html(),h.children("."+g).html(""),h.append(''),h.children(".layui-tree-editInput").val(l).focus(),i=function(e){var i=(i=e.val().trim())||o.text.defaultNodeName;e.remove(),h.children("."+g).html(i),t.data[u.title]=i,o.operate&&o.operate(t)},h.children(".layui-tree-editInput").blur(function(){i(p(this))}),h.children(".layui-tree-editInput").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),i(p(this)))})):y.confirm('\u786e\u8ba4\u5220\u9664\u8be5\u8282\u70b9 "'+(d[u.title]||"")+'" \u5417\uff1f',function(e){if(o.operate&&o.operate(t),t.status="remove",y.close(e),!r.prev("."+m)[0]&&!r.next("."+m)[0]&&!r.parent("."+w)[0])return r.remove(),void s.elem.append(s.elemNone);var l,a,i;r.siblings("."+m).children("."+x)[0]?(o.showCheckbox&&(l=function(e){var i,a,n,t;e.parents("."+m)[0]&&(i=e.siblings("."+m).children("."+x),a=(e=e.parent("."+w).prev()).find('input[same="layuiTreeCheck"]')[0],n=1,(t=0)==a.checked&&(i.each(function(e,i){i=p(i).find('input[same="layuiTreeCheck"]')[0];0!=i.checked||i.disabled||(n=0),i.disabled||(t=1)}),1==n&&1==t&&(a.checked=!0,s.renderForm("checkbox"),l(e.parent("."+m)))))})(r),o.showLine&&(e=r.siblings("."+m),a=1,i=r.parent("."+w),layui.each(e,function(e,i){p(i).children("."+w)[0]||(a=0)}),1==a?(n[0]||(i.removeClass(L),e.children("."+w).addClass(T),e.children("."+w).children("."+m).removeClass(F)),(r.next()[0]?i.children("."+m).last():r.prev()).children("."+w).children("."+m).last().addClass(F),r.next()[0]||r.parents("."+m)[1]||r.parents("."+m).eq(0).next()[0]||r.prev("."+m).addClass(F)):!r.next()[0]&&r.hasClass(F)&&r.prev().addClass(F))):(e=r.parent("."+w).prev(),o.showLine?(e.find("."+k).removeClass("layui-tree-icon"),e.find("."+k).children(".layui-icon").removeClass(v).addClass("layui-icon-file"),(i=e.parents("."+w).eq(0)).addClass(L),i.children("."+m).each(function(){p(this).children("."+w).children("."+m).last().addClass(F)})):e.find(".layui-tree-iconArrow").addClass(f),r.parents("."+m).eq(0).removeClass(N),r.parent("."+w).remove()),r.remove()})})},l.prototype.events=function(){var i=this,t=i.config;i.elem.find(".layui-tree-checkedFirst");i.setChecked(i.checkids),i.elem.find(".layui-tree-search").on("keyup",function(){var e=p(this),a=e.val(),e=e.nextAll(),n=[];e.find("."+g).each(function(){var i,e=p(this).parents("."+x);-1!=p(this).html().indexOf(a)&&(n.push(p(this).parent()),(i=function(e){e.addClass("layui-tree-searchShow"),e.parent("."+w)[0]&&i(e.parent("."+w).parent("."+m))})(e.parent("."+m)))}),e.find("."+x).each(function(){var e=p(this).parent("."+m);e.hasClass("layui-tree-searchShow")||e.addClass(f)}),0==e.find(".layui-tree-searchShow").length&&i.elem.append(i.elemNone),t.onsearch&&t.onsearch({elem:n})}),i.elem.find(".layui-tree-search").on("keydown",function(){p(this).nextAll().find("."+x).each(function(){p(this).parent("."+m).removeClass("layui-tree-searchShow "+f)}),p(".layui-tree-emptyText")[0]&&p(".layui-tree-emptyText").remove()})},l.prototype.getChecked=function(){var t=this,e=t.config,l=e.customName,i=[],a=[],c=(t.elem.find(".layui-form-checked").each(function(){i.push(p(this).prev()[0].value)}),function(e,n){layui.each(e,function(e,a){layui.each(i,function(e,i){if(a[l.id]==i)return t.updateFieldValue(a,"checked",!0),delete(i=p.extend({},a))[l.children],n.push(i),a[l.children]&&(i[l.children]=[],c(a[l.children],i[l.children])),!0})})});return c(p.extend({},e.data),a),a},l.prototype.setChecked=function(l){this.config;this.elem.find("."+m).each(function(e,i){var a=p(this).data("id"),n=p(i).children("."+x).find('input[same="layuiTreeCheck"]'),t=n.next();if("number"==typeof l){if(a.toString()==l.toString())return n[0].checked||t.click(),!1}else"object"==typeof l&&layui.each(l,function(e,i){if(i.toString()==a.toString()&&!n[0].checked)return t.click(),!0})})},n.that={},n.config={},t.reload=function(e,i){e=n.that[e];return e.reload(i),n.call(e)},t.getChecked=function(e){return n.that[e].getChecked()},t.setChecked=function(e,i){return n.that[e].setChecked(i)},t.render=function(e){e=new l(e);return n.call(e)},e(a,t)});layui.define(["laytpl","form"],function(e){"use strict";var s=layui.$,n=layui.laytpl,t=layui.form,a="transfer",i={config:{},index:layui[a]?layui[a].index+1e4:0,set:function(e){var t=this;return t.config=s.extend({},t.config,e),t},on:function(e,t){return layui.onevent.call(this,a,e,t)}},l=function(){var t=this,e=t.config,a=e.id||t.index;return l.that[a]=t,{config:l.config[a]=e,reload:function(e){t.reload.call(t,e)},getData:function(){return t.getData.call(t)}}},d="layui-hide",h="layui-btn-disabled",r="layui-none",c="layui-transfer-box",u="layui-transfer-header",o="layui-transfer-search",f="layui-transfer-data",y=function(e){return['
          ','
          ','","
          ","{{# if(d.data.showSearch){ }}",'","{{# } }}",'
            ',"
            "].join("")},p=['
            ',y({index:0,checkAllName:"layTransferLeftCheckAll"}),'
            ','",'","
            ",y({index:1,checkAllName:"layTransferRightCheckAll"}),"
            "].join(""),v=function(e){var t=this;t.index=++i.index,t.config=s.extend({},t.config,i.config,e),t.render()};v.prototype.config={title:["\u5217\u8868\u4e00","\u5217\u8868\u4e8c"],width:200,height:360,data:[],value:[],showSearch:!1,id:"",text:{none:"\u65e0\u6570\u636e",searchNone:"\u65e0\u5339\u914d\u6570\u636e"}},v.prototype.reload=function(e){var t=this;t.config=s.extend({},t.config,e),t.render()},v.prototype.render=function(){var e=this,t=e.config,a=e.elem=s(n(p,{open:"{{",close:"}}"}).render({data:t,index:e.index})),i=t.elem=s(t.elem);i[0]&&(t.data=t.data||[],t.value=t.value||[],t.id="id"in t?t.id:elem.attr("id")||e.index,e.key=t.id,i.html(e.elem),e.layBox=e.elem.find("."+c),e.layHeader=e.elem.find("."+u),e.laySearch=e.elem.find("."+o),e.layData=a.find("."+f),e.layBtn=a.find(".layui-transfer-active .layui-btn"),e.layBox.css({width:t.width,height:t.height}),e.layData.css({height:(i=t.height-e.layHeader.outerHeight(),t.showSearch&&(i-=e.laySearch.outerHeight()),i-2)}),e.renderData(),e.events())},v.prototype.renderData=function(){var e=this,t=e.config,l=[{checkName:"layTransferLeftCheck",views:[]},{checkName:"layTransferRightCheck",views:[]}];e.parseData(function(a){var i=a.selected?1:0,n=["
          • ",'',"
          • "].join("");i?layui.each(t.value,function(e,t){t==a.value&&a.selected&&(l[i].views[e]=n)}):l[i].views.push(n),delete a.selected}),e.layData.eq(0).html(l[0].views.join("")),e.layData.eq(1).html(l[1].views.join("")),e.renderCheckBtn()},v.prototype.renderForm=function(e){t.render(e,"LAY-transfer-"+this.index)},v.prototype.renderCheckBtn=function(r){var c=this,o=c.config;r=r||{},c.layBox.each(function(e){var t=s(this),a=t.find("."+f),t=t.find("."+u).find('input[type="checkbox"]'),i=a.find('input[type="checkbox"]'),n=0,l=!1;i.each(function(){var e=s(this).data("hide");(this.checked||this.disabled||e)&&n++,this.checked&&!e&&(l=!0)}),t.prop("checked",l&&n===i.length),c.layBtn.eq(e)[l?"removeClass":"addClass"](h),r.stopNone||(i=a.children("li:not(."+d+")").length,c.noneView(a,i?"":o.text.none))}),c.renderForm("checkbox")},v.prototype.noneView=function(e,t){var a=s('

            '+(t||"")+"

            ");e.find("."+r)[0]&&e.find("."+r).remove(),t.replace(/\s/g,"")&&e.append(a)},v.prototype.setValue=function(){var e=this.config,t=[];return this.layBox.eq(1).find("."+f+' input[type="checkbox"]').each(function(){s(this).data("hide")||t.push(this.value)}),e.value=t,this},v.prototype.parseData=function(t){var i=this.config,n=[];return layui.each(i.data,function(e,a){a=("function"==typeof i.parseData?i.parseData(a):a)||a,n.push(a=s.extend({},a)),layui.each(i.value,function(e,t){t==a.value&&(a.selected=!0)}),t&&t(a)}),i.data=n,this},v.prototype.getData=function(e){var t=this.config,i=[];return this.setValue(),layui.each(e||t.value,function(e,a){layui.each(t.data,function(e,t){delete t.selected,a==t.value&&i.push(t)})}),i},v.prototype.transfer=function(e,t){var a,i=this,n=i.config,l=i.layBox.eq(e),r=[],t=(t?((a=(t=t).find('input[type="checkbox"]'))[0].checked=!1,l.siblings("."+c).find("."+f).append(t.clone()),t.remove(),r.push(a[0].value),i.setValue()):l.each(function(e){s(this).find("."+f).children("li").each(function(){var e=s(this),t=e.find('input[type="checkbox"]'),a=t.data("hide");t[0].checked&&!a&&(t[0].checked=!1,l.siblings("."+c).find("."+f).append(e.clone()),e.remove(),r.push(t[0].value)),i.setValue()})}),i.renderCheckBtn(),l.siblings("."+c).find("."+o+" input"));""!==t.val()&&t.trigger("keyup"),n.onchange&&n.onchange(i.getData(r),e)},v.prototype.events=function(){var n=this,l=n.config;n.elem.on("click",'input[lay-filter="layTransferCheckbox"]+',function(){var e=s(this).prev(),t=e[0].checked,a=e.parents("."+c).eq(0).find("."+f);e[0].disabled||("all"===e.attr("lay-type")&&a.find('input[type="checkbox"]').each(function(){this.disabled||(this.checked=t)}),setTimeout(function(){n.renderCheckBtn({stopNone:!0})},0))}),n.elem.on("dblclick","."+f+">li",function(e){var t=s(this),a=t.children('input[type="checkbox"]'),i=t.parent().parent();a[0].disabled||n.transfer(i.data("index"),t)}),n.layBtn.on("click",function(){var e=s(this),t=e.data("index");e.hasClass(h)||n.transfer(t)}),n.laySearch.find("input").on("keyup",function(){var i=this.value,e=s(this).parents("."+o).eq(0).siblings("."+f),t=e.children("li"),t=(t.each(function(){var e=s(this),t=e.find('input[type="checkbox"]'),a=t[0].title,a=("cs"!==l.showSearch&&(a=a.toLowerCase(),i=i.toLowerCase()),-1!==a.indexOf(i));e[a?"removeClass":"addClass"](d),t.data("hide",!a)}),n.renderCheckBtn(),t.length===e.children("li."+d).length);n.noneView(e,t?l.text.searchNone:"")})},l.that={},l.config={},i.reload=function(e,t){e=l.that[e];return e.reload(t),l.call(e)},i.getData=function(e){return l.that[e].getData()},i.render=function(e){e=new v(e);return l.call(e)},e(a,i)});layui.define(["jquery","lay"],function(e){"use strict";var a=layui.$,t=layui.lay,o=(layui.hint(),layui.device(),{config:{},set:function(e){var i=this;return i.config=a.extend({},i.config,e),i},on:function(e,i){return layui.onevent.call(this,r,e,i)}}),r="carousel",d="layui-this",s="layui-carousel-left",u="layui-carousel-right",c="layui-carousel-prev",m="layui-carousel-next",l="layui-carousel-arrow",f="layui-carousel-ind",i=function(e){var i=this;i.config=a.extend({},i.config,o.config,e),i.render()};i.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},i.prototype.render=function(){var e=this,i=e.config,n=a(i.elem);if(1*[carousel-item]>*"),i.index<0&&(i.index=0),i.index>=e.elemItem.length&&(i.index=e.elemItem.length-1),i.interval<800&&(i.interval=800),i.full?i.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):i.elem.css({width:i.width,height:i.height}),i.elem.attr("lay-anim",i.anim),e.elemItem.eq(i.index).addClass(d),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},i.prototype.reload=function(e){var i=this;clearInterval(i.timer),i.config=a.extend({},i.config,e),i.render()},i.prototype.prevIndex=function(){var e=this.config.index-1;return e=e<0?this.elemItem.length-1:e},i.prototype.nextIndex=function(){var e=this.config.index+1;return e=e>=this.elemItem.length?0:e},i.prototype.addIndex=function(e){var i=this.config;i.index=i.index+(e=e||1),i.index>=this.elemItem.length&&(i.index=0)},i.prototype.subIndex=function(e){var i=this.config;i.index=i.index-(e=e||1),i.index<0&&(i.index=this.elemItem.length-1)},i.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(clearInterval(e.timer),e.timer=setInterval(function(){e.slide()},i.interval))},i.prototype.arrow=function(){var i=this,e=i.config,n=a(['",'"].join(""));e.elem.attr("lay-arrow",e.arrow),e.elem.find("."+l)[0]&&e.elem.find("."+l).remove(),e.elem.append(n),n.on("click",function(){var e=a(this).attr("lay-type");i.slide(e)})},i.prototype["goto"]=function(e){var i=this,n=i.config;e>n.index?i.slide("add",e-n.index):e
              ',(i=[],layui.each(e.elemItem,function(e){i.push("")}),i.join("")),"
            "].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+f)[0]&&n.elem.find("."+f).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-t.height()/2),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){e["goto"](a(this).index())})},i.prototype.slide=function(e,i){var n=this,t=n.elemItem,a=n.config,o=a.index,l=a.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),t.eq(a.index).addClass(c),setTimeout(function(){t.eq(o).addClass(u),t.eq(a.index).addClass(u)},50)):(n.addIndex(i),t.eq(a.index).addClass(m),setTimeout(function(){t.eq(o).addClass(s),t.eq(a.index).addClass(s)},50)),setTimeout(function(){t.removeClass(d+" "+c+" "+m+" "+s+" "+u),t.eq(a.index).addClass(d),n.haveSlide=!1},300),n.elemInd.find("li").eq(a.index).addClass(d).siblings().removeClass(d),n.haveSlide=!0,e={index:a.index,prevIndex:o,item:t.eq(a.index)},"function"==typeof a.change&&a.change(e),layui.event.call(this,r,"change("+l+")",e))},i.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){"always"!==e.config.autoplay&&clearInterval(e.timer)}).on("mouseleave",function(){"always"!==e.config.autoplay&&e.autoplay()}),i.elem.data("haveEvents",!0))},o.render=function(e){return new i(e)},e(r,o)});layui.define(["jquery","lay"],function(e){"use strict";var s=layui.jquery,r=layui.lay,c={config:{},index:layui.rate?layui.rate.index+1e4:0,set:function(e){var a=this;return a.config=s.extend({},a.config,e),a},on:function(e,a){return layui.onevent.call(this,l,e,a)}},l="rate",f="layui-icon-rate",h="layui-icon-rate-solid",o="layui-icon-rate-half",u="layui-icon-rate-solid layui-icon-rate-half",v="layui-icon-rate layui-icon-rate-half",a=function(e){var a=this;a.index=++c.index,a.config=s.extend({},a.config,c.config,e),a.render()};a.prototype.config={length:5,text:!1,readonly:!1,half:!1,value:0,theme:""},a.prototype.render=function(){var e=this,a=e.config,l=s(a.elem);if(1a.length&&(a.value=a.length),parseInt(a.value)===a.value||a.half||(a.value=Math.ceil(a.value)-a.value<.5?Math.ceil(a.value):Math.floor(a.value)),'
              "),t=1;t<=a.length;t++){var o='
            • ";a.half&&parseInt(a.value)!==a.value&&t==Math.ceil(a.value)?n=n+'
            • ":n+=o}n+="
            "+(a.text?''+a.value+"\u661f":"")+"";var l=a.elem,u=l.next(".layui-rate");u[0]&&u.remove(),e.elemTemp=s(n),a.span=e.elemTemp.next("span"),a.setText&&a.setText(a.value),l.html(e.elemTemp),l.addClass("layui-inline"),a.readonly||e.action()},a.prototype.setvalue=function(e){this.config.value=e,this.render()},a.prototype.action=function(){var i=this.config,n=this.elemTemp,t=n.find("i").width();n.children("li").each(function(e){var a=e+1,l=s(this);l.on("click",function(e){i.value=a,i.half&&e.pageX-s(this).offset().left<=t/2&&(i.value=i.value-.5),i.text&&n.next("span").text(i.value+"\u661f"),i.choose&&i.choose(i.value),i.setText&&i.setText(i.value)}),l.on("mousemove",function(e){n.find("i").each(function(){s(this).addClass(f).removeClass(u)}),n.find("i:lt("+a+")").each(function(){s(this).addClass(h).removeClass(v)}),i.half&&e.pageX-s(this).offset().left<=t/2&&l.children("i").addClass(o).removeClass(h)}),l.on("mouseleave",function(){n.find("i").each(function(){s(this).addClass(f).removeClass(u)}),n.find("i:lt("+Math.floor(i.value)+")").each(function(){s(this).addClass(h).removeClass(v)}),i.half&&parseInt(i.value)!==i.value&&n.children("li:eq("+Math.floor(i.value)+")").children("i").addClass(o).removeClass("layui-icon-rate-solid layui-icon-rate")})})},a.prototype.events=function(){},c.render=function(e){e=new a(e);return function(){var a=this;return{setvalue:function(e){a.setvalue.call(a,e)},config:a.config}}.call(e)},e(l,c)});layui.define("jquery",function(l){"use strict";var g=layui.$,e=function(l){};e.prototype.load=function(l){var t,i,o,n,e,r,a,c,m,s,u,f,y,d=this,p=0,h=g((l=l||{}).elem);if(h[0])return e=g(l.scrollElem||document),r=l.mb||50,a=!("isAuto"in l)||l.isAuto,c=l.end||"\u6ca1\u6709\u66f4\u591a\u4e86",m=l.scrollElem&&l.scrollElem!==document,s="\u52a0\u8f7d\u66f4\u591a",u=g('"),h.find(".layui-flow-more")[0]||h.append(u),f=function(l,e){l=g(l),u.before(l),(e=0==e||null)?u.html(c):u.find("a").html(s),i=e,t=null,o&&o()},y=function(){t=!0,u.find("a").html(''),"function"==typeof l.done&&l.done(++p,f)},y(),u.find("a").on("click",function(){g(this);i||t||y()}),l.isLazyimg&&(o=d.lazyimg({elem:l.elem+" img",scrollElem:l.scrollElem})),a&&e.on("scroll",function(){var e=g(this),o=e.scrollTop();n&&clearTimeout(n),!i&&h.width()&&(n=setTimeout(function(){var l=(m?e:g(window)).height();(m?e.prop("scrollHeight"):document.documentElement.scrollHeight)-o-l<=r&&(t||y())},100))}),d},e.prototype.lazyimg=function(l){var e,c=this,m=0,s=g((l=l||{}).scrollElem||document),u=l.elem||"img",f=l.scrollElem&&l.scrollElem!==document,y=function(e,l){var o,t=s.scrollTop(),l=t+l,i=f?e.offset().top-s.offset().top+t:e.offset().top;t<=i&&i<=l&&e.attr("lay-src")&&(o=e.attr("lay-src"),layui.img(o,function(){var l=c.lazyimg.elem.eq(m);e.attr("src",o).removeAttr("lay-src"),l[0]&&n(l),m++},function(){c.lazyimg.elem.eq(m);e.removeAttr("lay-src")}))},n=function(l,e){var o=(f?e||s:g(window)).height(),t=s.scrollTop(),i=t+o;if(c.lazyimg.elem=g(u),l)y(l,o);else for(var n=0;n"),preview:"Preview"}},I=function(e){return _.trim(e).replace(/^\n|\n$/,"")};e("code",function(e){var C=e=_.extend(!0,{},a,e);e.elem=_(e.elem),e.elem[0]&&layui.each(e.elem.get().reverse(),function(e,a){var l,n,t,i,o,s,c,d,r,u,y,E,p=_(a),v=_.extend(!0,{},C,lay.options(a),(l={},layui.each(["title","height","encode","skin","about"],function(e,a){var t=p.attr("lay-"+a);"string"==typeof t&&(l[a]=t)}),l)),f=p.data("code")||(t=[],p.children("textarea").each(function(){t.push(I(this.value))}),0===t.length&&t.push(I(p.html())),t),a=(p.data("code",f),n=f.join("")),m=("function"==typeof v.codeParse&&(a=n=v.codeParse(a)),{copy:{className:"file-b",title:["\u590d\u5236\u4ee3\u7801"],event:function(e,a){var t=b.unescape(n);try{navigator.clipboard.writeText(t).then(function(){x.msg("\u5df2\u590d\u5236",{icon:1})})}catch(i){var l=document.createElement("textarea");l.value=t,l.style.position="absolute",l.style.opacity="0",document.body.appendChild(l),l.select();try{document.execCommand("copy"),x.msg("\u5df2\u590d\u5236",{icon:1})}catch(o){x.msg("\u590d\u5236\u5931\u8d25",{icon:2})}l.remove()}"function"==typeof v.onCopy&&v.onCopy(t)}}}),h=(v.preview&&(i="LAY-CODE-DF-"+e,E=v.layout||["code","preview"],o="iframe"===v.preview,u=_('
            '),y=_('
            '),s=_('
            '),c=_('
            '),d=_('
            '),M=p.parent("."+T.ELEM_PREVIEW),h=p.prev("."+T.ELEM_TAB),L=p.next("."+T.ELEM_ITEM+"-preview"),v.id&&u.attr("id",v.id),u.addClass(v.className),y.attr("lay-filter",i),v.encode=!0,layui.each(E,function(e,a){var t=_('
          • ');0===e&&t.addClass("layui-this"),t.html(v.text[a]),s.append(t)}),_.extend(m,{full:{className:"screen-full",title:["\u6700\u5927\u5316\u663e\u793a","\u8fd8\u539f\u663e\u793a"],event:function(e,a){var t=e.closest("."+T.ELEM_PREVIEW),l="layui-icon-"+this.className,i="layui-icon-screen-restore",o=this.title,n=_("html,body"),s="layui-scrollbar-hide";e.hasClass(l)?(t.addClass(T.ELEM_FULL),e.removeClass(l).addClass(i),e.attr("title",o[1]),n.addClass(s)):(t.removeClass(T.ELEM_FULL),e.removeClass(i).addClass(l),e.attr("title",o[0]),n.removeClass(s))}},window:{className:"release",title:["\u5728\u65b0\u7a97\u53e3\u9884\u89c8"],event:function(e,a){b.openWin({content:n})}}}),v.copy&&("array"===layui.type(v.tools)?-1===v.tools.indexOf("copy")&&v.tools.unshift("copy"):v.tools=["copy"]),d.on("click",">i",function(){var e=_(this),a=e.data("type");m[a]&&"function"==typeof m[a].event&&m[a].event(e,a),"function"==typeof v.toolsEvent&&v.toolsEvent(e,a)}),layui.each(v.tools,function(e,a){var t=m[a]&&m[a].className||a,l=m[a]&&m[a].title||[""];d.append('')}),h[0]&&h.remove(),L[0]&&L.remove(),M[0]&&p.unwrap(),y.append(s),v.tools&&y.append(d),p.wrap(u).addClass(T.ELEM_ITEM).before(y),o&&c.html(''),r=function(e){var a=e.children("iframe")[0],t=(o&&a?a.srcdoc=n:e.html(f.join("")),{container:e,render:function(){g.render(e.find(".layui-form")),w.render()}});setTimeout(function(){"function"==typeof v.done&&v.done(t)},3)},"preview"===E[0]?(c.addClass(T.ELEM_SHOW),p.before(c),r(c)):p.addClass(T.ELEM_SHOW).after(c),v.codeStyle=[v.style,v.codeStyle].join(""),v.previewStyle=[v.style,v.previewStyle].join(""),c.attr("style",v.previewStyle),w.on("tab("+i+")",function(e){var a=_(this),t=_(e.elem).closest("."+T.ELEM_PREVIEW).find("."+T.ELEM_ITEM),e=t.eq(e.index);t.removeClass(T.ELEM_SHOW),e.addClass(T.ELEM_SHOW),"preview"===a.attr("lay-id")&&r(e)})),v.ln?"ol":"ul"),L=_("<"+h+' class="layui-code-'+h+'">'),M=_('
            ');p.addClass("layui-code-view layui-box"),v.skin&&("notepad"===v.skin&&(v.skin="dark"),p.removeClass("layui-code-dark layui-code-light"),p.addClass("layui-code-"+v.skin)),a=(a=v.encode?b.escape(a):a).replace(/[\r\t\n]+/g,"
          • "),p.html(L.html("
          • "+a+"
          • ")),v.header&&!p.children("."+T.ELEM_TITLE)[0]&&(M.html((v.title||v.text.code)+(v.about?'
            '+v.about+"
            ":"")),p.prepend(M)),v.elem.length===e+1&&"function"==typeof v.allDone&&v.allDone(),0<(u=Math.floor(L.find("li").length/100))&&L.css("margin-left",u+"px"),v.height&&L.css("max-height",v.height),L.attr("style",v.codeStyle),v.copy&&!v.preview&&(y=_(['','',""].join("")),E=p.children("."+T.ELEM_COPY),(L[0].style.height||L[0].style.maxHeight)&&y.addClass(T.ELEM_COPY+"-offset"),E[0]&&E.remove(),p.append(y),y.on("click",function(){m.copy.event()}))})})}),layui["layui.all"]||layui.addcss("modules/code.css?v=3","skincodecss"); \ No newline at end of file diff --git a/public/static/component/pear/module/imagecut.js b/public/static/component/pear/module/imagecut.js new file mode 100644 index 0000000..6f931a5 --- /dev/null +++ b/public/static/component/pear/module/imagecut.js @@ -0,0 +1,105 @@ +/** + images压缩扩展模块 + changlin_zhao@qq.com + 2023.5.23 + **/ +layui.define(['upload','layer'],function(exports){ + + var layer = layui.layer; + + var Compressor = { + upload: function (obj) { + // opthions = { + // width: option[0], + // height: option[1], + // quality: option[2] + // } + obj.preview(function(index, file, result){ + canvasDataURL(result, {quality: 0.7}, function(base64Codes){ + obj.upload(index, convertBase64UrlTo(base64Codes, file.name)); + }); + }); + } + } + + // 已知 base64 + // canvasDataURL(base64, {quality: 0.7}, function(base64Codes){ + // // base64Codes 为压缩后的 + // // 其中 convertBase64UrlTo(base64Codes, file.name) 可返回 File 对象和 Blob + // obj.upload(index, convertBase64UrlTo(base64Codes, file.name)); + // }); + + // 未知 base64 + // imageCompress(file, {quality: 0.7}, function(base64Codes){ + // // base64Codes 为压缩后的 + // obj.upload(index, convertBase64UrlTo(base64Codes, file.name)); + // }); + + /** + * 读取文件 + * @param {file or Blob} file 上传文件 + * @param {object} config 压缩配置 可配置压缩长宽、质量等 + * @param {function} callback + */ + function imageCompress(file, config, callback){ + var ready = new FileReader(); + ready.readAsDataURL(file); + + ready.onload=function(){ + canvasDataURL(this.result, config, callback) + } + } + + /** + * + * @param {string} path + * @param {object} config -- {width: '', height: '', quality: 0.7} + * @param {function} callback + */ + function canvasDataURL(path, config, callback){ + var img = new Image(); + img.src = path; + + img.onload = function(){ + var that = this, quality = 0.6; + var w = that.width, h = that.height, scale = w / h; + w = config.width || w; + h = config.height || (w / scale); + + //生成canvas + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + var anw = document.createAttribute("width"); + anw.nodeValue = w; + var anh = document.createAttribute("height"); + anh.nodeValue = h; + canvas.setAttributeNode(anw); + canvas.setAttributeNode(anh); + ctx.drawImage(that, 0, 0, w, h); + + if(config.quality && config.quality <= 1 && config.quality > 0){ + quality = config.quality; + } + callback(canvas.toDataURL('image/jpeg', quality)); + } + } + + /** + * 将图片 base64 转为 File 对象或者 Blob + * @param {*} urlData 图片 base64 + * @param {*} filename 图片名 没有图片名将转为 Blob + */ + function convertBase64UrlTo(urlData, filename = null){ + var base64Arr = urlData.split(','), mime = base64Arr[0].match(/:(.*?);/)[1], + bstr = atob(base64Arr[1]), n = bstr.length, u8arr = new Uint8Array(n); + while(n--){ + u8arr[n] = bstr.charCodeAt(n); + } + + return filename ? new File([u8arr], filename, {type:mime}) : new Blob([u8arr], {type:mime}); + } + + //输出 imagecut接口 + exports('imagecut', Compressor); + +}); \ No newline at end of file diff --git a/public/static/res/mods/imagecut.js b/public/static/res/mods/imagecut.js index a6bdb73..6f931a5 100644 --- a/public/static/res/mods/imagecut.js +++ b/public/static/res/mods/imagecut.js @@ -61,7 +61,7 @@ layui.define(['upload','layer'],function(exports){ img.src = path; img.onload = function(){ - var that = this, quality = 0.7; + var that = this, quality = 0.6; var w = that.width, h = that.height, scale = w / h; w = config.width || w; h = config.height || (w / scale); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 2a84e1c..24f86d2 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -9,9 +9,9 @@ return array( '9b552a3cc426e3287cc811caefa3cf53' => $vendorDir . '/topthink/think-helper/src/helper.php', '35fab96057f1bf5e7aba31a8a6d5fdde' => $vendorDir . '/topthink/think-orm/stubs/load_stubs.php', '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', - 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php', + 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php', diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 09a75b3..a7b402e 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -7,17 +7,15 @@ $baseDir = dirname($vendorDir); return array( 'yzh52521\\EasyHttp\\' => array($vendorDir . '/yzh52521/easyhttp/src'), - 'wamkj\\thinkphp\\' => array($vendorDir . '/wamkj/thinkphp6.0-databackup/src'), 'think\\view\\driver\\' => array($vendorDir . '/topthink/think-view/src'), 'think\\trace\\' => array($vendorDir . '/topthink/think-trace/src'), 'think\\migration\\' => array($vendorDir . '/topthink/think-migration/src'), 'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'), 'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'), 'think\\app\\' => array($vendorDir . '/topthink/think-multi-app/src'), - 'think\\' => array($vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-orm/src', $vendorDir . '/topthink/think-template/src', $vendorDir . '/topthink/framework/src/think'), + 'think\\' => array($vendorDir . '/topthink/framework/src/think', $vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-orm/src', $vendorDir . '/topthink/think-template/src'), 'taoser\\think\\' => array($vendorDir . '/taoser/think-auth/src'), 'taoser\\' => array($vendorDir . '/taoser/think-addons/src', $vendorDir . '/taoser/think-setarr/src'), - 'phpspirit\\databackup\\' => array($vendorDir . '/lotofbadcode/phpspirit_databackup/src'), 'liliuwei\\social\\' => array($vendorDir . '/liliuwei/thinkphp-social/src'), 'app\\' => array($baseDir . '/app'), 'Yansongda\\Supports\\' => array($vendorDir . '/yansongda/supports/src'), @@ -38,9 +36,10 @@ return array( 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), 'PhpDocReader\\' => array($vendorDir . '/php-di/phpdoc-reader/src/PhpDocReader'), - 'Phinx\\' => array($vendorDir . '/topthink/think-migration/phinx/src/Phinx'), + 'Phinx\\' => array($vendorDir . '/topthink/think-migration/phinx'), 'PHPSocketIO\\' => array($vendorDir . '/workerman/phpsocket.io/src'), 'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'), + 'Overtrue\\EasySms\\' => array($vendorDir . '/overtrue/easy-sms/src'), 'League\\MimeTypeDetection\\' => array($vendorDir . '/league/mime-type-detection/src'), 'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'), 'Laravel\\SerializableClosure\\' => array($vendorDir . '/laravel/serializable-closure/src'), @@ -49,6 +48,7 @@ return array( 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), + 'Firebase\\JWT\\' => array($vendorDir . '/firebase/php-jwt/src'), 'Endroid\\QrCode\\' => array($vendorDir . '/endroid/qr-code/src'), 'DI\\' => array($vendorDir . '/php-di/php-di/src'), 'DASPRiD\\Enum\\' => array($vendorDir . '/dasprid/enum/src'), diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index ab45f3b..b974c2b 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -10,9 +10,9 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2 '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', '35fab96057f1bf5e7aba31a8a6d5fdde' => __DIR__ . '/..' . '/topthink/think-orm/stubs/load_stubs.php', '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', - 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', + 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', @@ -32,10 +32,6 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2 array ( 'yzh52521\\EasyHttp\\' => 18, ), - 'w' => - array ( - 'wamkj\\thinkphp\\' => 15, - ), 't' => array ( 'think\\view\\driver\\' => 18, @@ -48,10 +44,6 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2 'taoser\\think\\' => 13, 'taoser\\' => 7, ), - 'p' => - array ( - 'phpspirit\\databackup\\' => 21, - ), 'l' => array ( 'liliuwei\\social\\' => 16, @@ -99,6 +91,10 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2 'PHPSocketIO\\' => 12, 'PHPMailer\\PHPMailer\\' => 20, ), + 'O' => + array ( + 'Overtrue\\EasySms\\' => 17, + ), 'L' => array ( 'League\\MimeTypeDetection\\' => 25, @@ -119,6 +115,10 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2 'GuzzleHttp\\Promise\\' => 19, 'GuzzleHttp\\' => 11, ), + 'F' => + array ( + 'Firebase\\JWT\\' => 13, + ), 'E' => array ( 'Endroid\\QrCode\\' => 15, @@ -146,10 +146,6 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2 array ( 0 => __DIR__ . '/..' . '/yzh52521/easyhttp/src', ), - 'wamkj\\thinkphp\\' => - array ( - 0 => __DIR__ . '/..' . '/wamkj/thinkphp6.0-databackup/src', - ), 'think\\view\\driver\\' => array ( 0 => __DIR__ . '/..' . '/topthink/think-view/src', @@ -176,10 +172,10 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2 ), 'think\\' => array ( - 0 => __DIR__ . '/..' . '/topthink/think-helper/src', - 1 => __DIR__ . '/..' . '/topthink/think-orm/src', - 2 => __DIR__ . '/..' . '/topthink/think-template/src', - 3 => __DIR__ . '/..' . '/topthink/framework/src/think', + 0 => __DIR__ . '/..' . '/topthink/framework/src/think', + 1 => __DIR__ . '/..' . '/topthink/think-helper/src', + 2 => __DIR__ . '/..' . '/topthink/think-orm/src', + 3 => __DIR__ . '/..' . '/topthink/think-template/src', ), 'taoser\\think\\' => array ( @@ -190,10 +186,6 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2 0 => __DIR__ . '/..' . '/taoser/think-addons/src', 1 => __DIR__ . '/..' . '/taoser/think-setarr/src', ), - 'phpspirit\\databackup\\' => - array ( - 0 => __DIR__ . '/..' . '/lotofbadcode/phpspirit_databackup/src', - ), 'liliuwei\\social\\' => array ( 0 => __DIR__ . '/..' . '/liliuwei/thinkphp-social/src', @@ -276,7 +268,7 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2 ), 'Phinx\\' => array ( - 0 => __DIR__ . '/..' . '/topthink/think-migration/phinx/src/Phinx', + 0 => __DIR__ . '/..' . '/topthink/think-migration/phinx', ), 'PHPSocketIO\\' => array ( @@ -286,6 +278,10 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2 array ( 0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src', ), + 'Overtrue\\EasySms\\' => + array ( + 0 => __DIR__ . '/..' . '/overtrue/easy-sms/src', + ), 'League\\MimeTypeDetection\\' => array ( 0 => __DIR__ . '/..' . '/league/mime-type-detection/src', @@ -318,6 +314,10 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2 array ( 0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src', ), + 'Firebase\\JWT\\' => + array ( + 0 => __DIR__ . '/..' . '/firebase/php-jwt/src', + ), 'Endroid\\QrCode\\' => array ( 0 => __DIR__ . '/..' . '/endroid/qr-code/src', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 56b9137..b02a72f 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -269,24 +269,18 @@ }, { "name": "dasprid/enum", - "version": "1.0.4", - "version_normalized": "1.0.4.0", + "version": "1.0.5", + "version_normalized": "1.0.5.0", "source": { "type": "git", "url": "https://github.com/DASPRiD/Enum.git", - "reference": "8e6b6ea76eabbf19ea2bf5b67b98e1860474012f" + "reference": "6faf451159fb8ba4126b925ed2d78acfce0dc016" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/8e6b6ea76eabbf19ea2bf5b67b98e1860474012f", - "reference": "8e6b6ea76eabbf19ea2bf5b67b98e1860474012f", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/6faf451159fb8ba4126b925ed2d78acfce0dc016", + "reference": "6faf451159fb8ba4126b925ed2d78acfce0dc016", + "shasum": "" }, "require": { "php": ">=7.1 <9.0" @@ -295,7 +289,7 @@ "phpunit/phpunit": "^7 | ^8 | ^9", "squizlabs/php_codesniffer": "*" }, - "time": "2023-03-01T18:44:03+00:00", + "time": "2023-08-25T16:18:39+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -322,7 +316,7 @@ ], "support": { "issues": "https://github.com/DASPRiD/Enum/issues", - "source": "https://github.com/DASPRiD/Enum/tree/1.0.4" + "source": "https://github.com/DASPRiD/Enum/tree/1.0.5" }, "install-path": "../dasprid/enum" }, @@ -401,6 +395,72 @@ ], "install-path": "../endroid/qr-code" }, + { + "name": "firebase/php-jwt", + "version": "v6.8.1", + "version_normalized": "6.8.1.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/5dbc8959427416b8ee09a100d7a8588c00fb2e26", + "reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26", + "shasum": "" + }, + "require": { + "php": "^7.4||^8.0" + }, + "require-dev": { + "guzzlehttp/guzzle": "^6.5||^7.4", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "psr/cache": "^1.0||^2.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0" + }, + "suggest": { + "ext-sodium": "Support EdDSA (Ed25519) signatures", + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + }, + "time": "2023-07-14T18:33:00+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/v6.8.1" + }, + "install-path": "../firebase/php-jwt" + }, { "name": "guzzlehttp/guzzle", "version": "7.0.0", @@ -1016,29 +1076,29 @@ }, { "name": "league/mime-type-detection", - "version": "1.11.0", - "version_normalized": "1.11.0.0", + "version": "1.13.0", + "version_normalized": "1.13.0.0", "source": { "type": "git", "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "ff6248ea87a9f116e78edd6002e39e5128a0d4dd" + "reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ff6248ea87a9f116e78edd6002e39e5128a0d4dd", - "reference": "ff6248ea87a9f116e78edd6002e39e5128a0d4dd", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/a6dfb1194a2946fcdc1f38219445234f65b35c96", + "reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96", "shasum": "" }, "require": { "ext-fileinfo": "*", - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.2", "phpstan/phpstan": "^0.12.68", - "phpunit/phpunit": "^8.5.8 || ^9.3" + "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0" }, - "time": "2022-04-17T13:12:02+00:00", + "time": "2023-08-05T12:09:49+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1059,7 +1119,7 @@ "description": "Mime-type detection for Flysystem", "support": { "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.11.0" + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.13.0" }, "funding": [ { @@ -1158,71 +1218,87 @@ "install-path": "../liliuwei/thinkphp-social" }, { - "name": "lotofbadcode/phpspirit_databackup", - "version": "v1.2", - "version_normalized": "1.2.0.0", + "name": "overtrue/easy-sms", + "version": "2.5.0", + "version_normalized": "2.5.0.0", "source": { "type": "git", - "url": "https://github.com/lotofbadcode/phpspirit_databackup.git", - "reference": "77c2421f8461392c044cf8c29918f495c22a5612" + "url": "https://github.com/overtrue/easy-sms.git", + "reference": "81d4deec69bbb6de6e5fdd7ab90cc933bd3e3046" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lotofbadcode/phpspirit_databackup/zipball/77c2421f8461392c044cf8c29918f495c22a5612", - "reference": "77c2421f8461392c044cf8c29918f495c22a5612", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/overtrue/easy-sms/zipball/81d4deec69bbb6de6e5fdd7ab90cc933bd3e3046", + "reference": "81d4deec69bbb6de6e5fdd7ab90cc933bd3e3046", + "shasum": "" }, "require": { - "php": ">=7.0" + "ext-json": "*", + "guzzlehttp/guzzle": "^6.2 || ^7.0", + "php": ">=5.6" }, - "time": "2023-05-12T12:02:05+00:00", + "require-dev": { + "brainmaestro/composer-git-hooks": "^2.8", + "jetbrains/phpstorm-attributes": "^1.0", + "mockery/mockery": "~1.3.3 || ^1.4.2", + "phpunit/phpunit": "^5.7 || ^7.5 || ^8.5.19 || ^9.5.8" + }, + "time": "2023-08-07T07:51:17+00:00", "type": "library", + "extra": { + "hooks": { + "pre-commit": [ + "composer check-style", + "composer psalm", + "composer test" + ], + "pre-push": [ + "composer check-style" + ] + } + }, "installation-source": "dist", "autoload": { "psr-4": { - "phpspirit\\databackup\\": "src/" + "Overtrue\\EasySms\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache-2.0" + "MIT" ], "authors": [ { - "name": "代码庸医", - "email": "3359964266@qq.com" + "name": "overtrue", + "email": "i@overtrue.me" } ], - "description": "一个PHP数据库备份恢复的插件", - "keywords": [ - "library", - "php" - ], + "description": "The easiest way to send short message.", "support": { - "issues": "https://github.com/lotofbadcode/phpspirit_databackup/issues", - "source": "https://github.com/lotofbadcode/phpspirit_databackup/tree/v1.2" + "issues": "https://github.com/overtrue/easy-sms/issues", + "source": "https://github.com/overtrue/easy-sms/tree/2.5.0" }, - "install-path": "../lotofbadcode/phpspirit_databackup" + "funding": [ + { + "url": "https://github.com/overtrue", + "type": "github" + } + ], + "install-path": "../overtrue/easy-sms" }, { "name": "php-di/invoker", - "version": "2.3.3", - "version_normalized": "2.3.3.0", + "version": "2.3.4", + "version_normalized": "2.3.4.0", "source": { "type": "git", "url": "https://github.com/PHP-DI/Invoker.git", - "reference": "cd6d9f267d1a3474bdddf1be1da079f01b942786" + "reference": "33234b32dafa8eb69202f950a1fc92055ed76a86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/cd6d9f267d1a3474bdddf1be1da079f01b942786", - "reference": "cd6d9f267d1a3474bdddf1be1da079f01b942786", + "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/33234b32dafa8eb69202f950a1fc92055ed76a86", + "reference": "33234b32dafa8eb69202f950a1fc92055ed76a86", "shasum": "" }, "require": { @@ -1234,7 +1310,7 @@ "mnapoli/hard-mode": "~0.3.0", "phpunit/phpunit": "^9.0" }, - "time": "2021-12-13T09:22:56+00:00", + "time": "2023-09-08T09:24:21+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1258,7 +1334,7 @@ ], "support": { "issues": "https://github.com/PHP-DI/Invoker/issues", - "source": "https://github.com/PHP-DI/Invoker/tree/2.3.3" + "source": "https://github.com/PHP-DI/Invoker/tree/2.3.4" }, "funding": [ { @@ -1394,17 +1470,17 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.8.0", - "version_normalized": "6.8.0.0", + "version": "v6.8.1", + "version_normalized": "6.8.1.0", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "df16b615e371d81fb79e506277faea67a1be18f1" + "reference": "e88da8d679acc3824ff231fdc553565b802ac016" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/df16b615e371d81fb79e506277faea67a1be18f1", - "reference": "df16b615e371d81fb79e506277faea67a1be18f1", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e88da8d679acc3824ff231fdc553565b802ac016", + "reference": "e88da8d679acc3824ff231fdc553565b802ac016", "shasum": "" }, "require": { @@ -1414,13 +1490,13 @@ "php": ">=5.5.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "doctrine/annotations": "^1.2.6 || ^1.13.3", "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.7.1", + "squizlabs/php_codesniffer": "^3.7.2", "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { @@ -1433,7 +1509,7 @@ "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)", "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication" }, - "time": "2023-03-06T14:43:22+00:00", + "time": "2023-08-29T08:26:30+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1465,7 +1541,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.8.0" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.8.1" }, "funding": [ { @@ -1922,24 +1998,18 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", + "version": "v1.28.0", + "version_normalized": "1.28.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", + "shasum": "" }, "require": { "php": ">=7.1" @@ -1950,11 +2020,11 @@ "suggest": { "ext-mbstring": "For best performance" }, - "time": "2022-11-03T14:55:06+00:00", + "time": "2023-07-28T09:04:16+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1994,7 +2064,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -2014,33 +2084,27 @@ }, { "name": "symfony/polyfill-php72", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", + "version": "v1.28.0", + "version_normalized": "1.28.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", + "shasum": "" }, "require": { "php": ">=7.1" }, - "time": "2022-11-03T14:55:06+00:00", + "time": "2023-01-26T09:26:14+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2079,7 +2143,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0" }, "funding": [ { @@ -2099,33 +2163,27 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", + "version": "v1.28.0", + "version_normalized": "1.28.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "shasum": "" }, "require": { "php": ">=7.1" }, - "time": "2022-11-03T14:55:06+00:00", + "time": "2023-01-26T09:26:14+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2171,7 +2229,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -2832,30 +2890,33 @@ }, { "name": "topthink/think-migration", - "version": "v3.0.6", - "version_normalized": "3.0.6.0", + "version": "v3.1.1", + "version_normalized": "3.1.1.0", "source": { "type": "git", "url": "https://github.com/top-think/think-migration.git", - "reference": "82c4226cb14f973b9377c7fc6e89c525cbb8b030" + "reference": "22c44058e1454f3af1d346e7f6524fbe654de7fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-migration/zipball/82c4226cb14f973b9377c7fc6e89c525cbb8b030", - "reference": "82c4226cb14f973b9377c7fc6e89c525cbb8b030", + "url": "https://api.github.com/repos/top-think/think-migration/zipball/22c44058e1454f3af1d346e7f6524fbe654de7fb", + "reference": "22c44058e1454f3af1d346e7f6524fbe654de7fb", "shasum": "" }, "require": { + "php": ">=7.2", "topthink/framework": "^6.0 || ^8.0", "topthink/think-helper": "^3.0.3" }, "require-dev": { - "fzaninotto/faker": "^1.8" + "composer/composer": "^2.5.8", + "fzaninotto/faker": "^1.8", + "robmorgan/phinx": "^0.13.4" }, "suggest": { "fzaninotto/faker": "Required to use the factory builder (^1.8)." }, - "time": "2023-07-01T11:01:52+00:00", + "time": "2023-09-14T05:51:31+00:00", "type": "library", "extra": { "think": { @@ -2867,7 +2928,7 @@ "installation-source": "dist", "autoload": { "psr-4": { - "Phinx\\": "phinx/src/Phinx", + "Phinx\\": "phinx", "think\\migration\\": "src" } }, @@ -2883,7 +2944,7 @@ ], "support": { "issues": "https://github.com/top-think/think-migration/issues", - "source": "https://github.com/top-think/think-migration/tree/v3.0.6" + "source": "https://github.com/top-think/think-migration/tree/v3.1.1" }, "install-path": "../topthink/think-migration" }, @@ -3164,60 +3225,6 @@ "description": "thinkphp template driver", "install-path": "../topthink/think-view" }, - { - "name": "wamkj/thinkphp6.0-databackup", - "version": "v1.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/wamkj/thinkphp6.0-databackup.git", - "reference": "28a0e406d827132942723a3c9f69bb20c98e652f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wamkj/thinkphp6.0-databackup/zipball/28a0e406d827132942723a3c9f69bb20c98e652f", - "reference": "28a0e406d827132942723a3c9f69bb20c98e652f", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1.0", - "topthink/framework": "^6.0" - }, - "time": "2020-02-15T13:04:16+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "wamkj\\thinkphp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "wamkj", - "email": "1149183529@qq.com" - } - ], - "description": "thinkphp6.0的数据库自动备份扩展", - "keywords": [ - "think-databackup", - "thinkphp" - ], - "support": { - "issues": "https://github.com/wamkj/thinkphp6.0-databackup/issues", - "source": "https://github.com/wamkj/thinkphp6.0-databackup/tree/v1.0" - }, - "install-path": "../wamkj/thinkphp6.0-databackup" - }, { "name": "workerman/channel", "version": "v1.2.0", @@ -3524,31 +3531,25 @@ }, { "name": "yzh52521/easyhttp", - "version": "v1.0.7", - "version_normalized": "1.0.7.0", + "version": "v1.1.0", + "version_normalized": "1.1.0.0", "source": { "type": "git", "url": "https://github.com/yzh52521/easyhttp.git", - "reference": "52cb9aba60a725bef77acd9c4c48ecc78931af9e" + "reference": "78ec5cea1884d6da0709cac95a1e4d23fe9bfc65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yzh52521/easyhttp/zipball/52cb9aba60a725bef77acd9c4c48ecc78931af9e", - "reference": "52cb9aba60a725bef77acd9c4c48ecc78931af9e", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/yzh52521/easyhttp/zipball/78ec5cea1884d6da0709cac95a1e4d23fe9bfc65", + "reference": "78ec5cea1884d6da0709cac95a1e4d23fe9bfc65", + "shasum": "" }, "require": { "guzzlehttp/guzzle": "^6.0|^7.0", - "php": "^7.2.5|^8.0", + "php": ">=7.2.5", "psr/log": "^1.0|^2.0|^3.0" }, - "time": "2023-02-16T03:04:02+00:00", + "time": "2023-08-31T06:20:52+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -3579,7 +3580,7 @@ ], "support": { "issues": "https://github.com/yzh52521/easyhttp/issues", - "source": "https://github.com/yzh52521/easyhttp/tree/v1.0.7" + "source": "https://github.com/yzh52521/easyhttp/tree/v1.1.0" }, "install-path": "../yzh52521/easyhttp" } diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index de4a46e..c7c0536 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'taoser/taoler', 'pretty_version' => '2.3.10.x-dev', 'version' => '2.3.10.9999999-dev', - 'reference' => '0c2f0154a81dd0a6268da627982d1bf41c0ef231', + 'reference' => 'c237566bcd13c4e1ed7fff650c97d64a9fa2c9d8', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -47,9 +47,9 @@ 'dev_requirement' => false, ), 'dasprid/enum' => array( - 'pretty_version' => '1.0.4', - 'version' => '1.0.4.0', - 'reference' => '8e6b6ea76eabbf19ea2bf5b67b98e1860474012f', + 'pretty_version' => '1.0.5', + 'version' => '1.0.5.0', + 'reference' => '6faf451159fb8ba4126b925ed2d78acfce0dc016', 'type' => 'library', 'install_path' => __DIR__ . '/../dasprid/enum', 'aliases' => array(), @@ -64,6 +64,15 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'firebase/php-jwt' => array( + 'pretty_version' => 'v6.8.1', + 'version' => '6.8.1.0', + 'reference' => '5dbc8959427416b8ee09a100d7a8588c00fb2e26', + 'type' => 'library', + 'install_path' => __DIR__ . '/../firebase/php-jwt', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'guzzlehttp/guzzle' => array( 'pretty_version' => '7.0.0', 'version' => '7.0.0.0', @@ -137,9 +146,9 @@ 'dev_requirement' => false, ), 'league/mime-type-detection' => array( - 'pretty_version' => '1.11.0', - 'version' => '1.11.0.0', - 'reference' => 'ff6248ea87a9f116e78edd6002e39e5128a0d4dd', + 'pretty_version' => '1.13.0', + 'version' => '1.13.0.0', + 'reference' => 'a6dfb1194a2946fcdc1f38219445234f65b35c96', 'type' => 'library', 'install_path' => __DIR__ . '/../league/mime-type-detection', 'aliases' => array(), @@ -154,19 +163,19 @@ 'aliases' => array(), 'dev_requirement' => false, ), - 'lotofbadcode/phpspirit_databackup' => array( - 'pretty_version' => 'v1.2', - 'version' => '1.2.0.0', - 'reference' => '77c2421f8461392c044cf8c29918f495c22a5612', + 'overtrue/easy-sms' => array( + 'pretty_version' => '2.5.0', + 'version' => '2.5.0.0', + 'reference' => '81d4deec69bbb6de6e5fdd7ab90cc933bd3e3046', 'type' => 'library', - 'install_path' => __DIR__ . '/../lotofbadcode/phpspirit_databackup', + 'install_path' => __DIR__ . '/../overtrue/easy-sms', 'aliases' => array(), 'dev_requirement' => false, ), 'php-di/invoker' => array( - 'pretty_version' => '2.3.3', - 'version' => '2.3.3.0', - 'reference' => 'cd6d9f267d1a3474bdddf1be1da079f01b942786', + 'pretty_version' => '2.3.4', + 'version' => '2.3.4.0', + 'reference' => '33234b32dafa8eb69202f950a1fc92055ed76a86', 'type' => 'library', 'install_path' => __DIR__ . '/../php-di/invoker', 'aliases' => array(), @@ -191,9 +200,9 @@ 'dev_requirement' => false, ), 'phpmailer/phpmailer' => array( - 'pretty_version' => 'v6.8.0', - 'version' => '6.8.0.0', - 'reference' => 'df16b615e371d81fb79e506277faea67a1be18f1', + 'pretty_version' => 'v6.8.1', + 'version' => '6.8.1.0', + 'reference' => 'e88da8d679acc3824ff231fdc553565b802ac016', 'type' => 'library', 'install_path' => __DIR__ . '/../phpmailer/phpmailer', 'aliases' => array(), @@ -302,27 +311,27 @@ 'dev_requirement' => false, ), 'symfony/polyfill-mbstring' => array( - 'pretty_version' => 'v1.27.0', - 'version' => '1.27.0.0', - 'reference' => '8ad114f6b39e2c98a8b0e3bd907732c207c2b534', + 'pretty_version' => 'v1.28.0', + 'version' => '1.28.0.0', + 'reference' => '42292d99c55abe617799667f454222c54c60e229', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/polyfill-php72' => array( - 'pretty_version' => 'v1.27.0', - 'version' => '1.27.0.0', - 'reference' => '869329b1e9894268a8a61dabb69153029b7a8c97', + 'pretty_version' => 'v1.28.0', + 'version' => '1.28.0.0', + 'reference' => '70f4aebd92afca2f865444d30a4d2151c13c3179', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php72', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/polyfill-php80' => array( - 'pretty_version' => 'v1.27.0', - 'version' => '1.27.0.0', - 'reference' => '7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936', + 'pretty_version' => 'v1.28.0', + 'version' => '1.28.0.0', + 'reference' => '6caa57379c4aec19c0a12a38b59b26487dcfe4b5', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php80', 'aliases' => array(), @@ -349,7 +358,7 @@ 'taoser/taoler' => array( 'pretty_version' => '2.3.10.x-dev', 'version' => '2.3.10.9999999-dev', - 'reference' => '0c2f0154a81dd0a6268da627982d1bf41c0ef231', + 'reference' => 'c237566bcd13c4e1ed7fff650c97d64a9fa2c9d8', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -428,9 +437,9 @@ 'dev_requirement' => false, ), 'topthink/think-migration' => array( - 'pretty_version' => 'v3.0.6', - 'version' => '3.0.6.0', - 'reference' => '82c4226cb14f973b9377c7fc6e89c525cbb8b030', + 'pretty_version' => 'v3.1.1', + 'version' => '3.1.1.0', + 'reference' => '22c44058e1454f3af1d346e7f6524fbe654de7fb', 'type' => 'library', 'install_path' => __DIR__ . '/../topthink/think-migration', 'aliases' => array(), @@ -481,15 +490,6 @@ 'aliases' => array(), 'dev_requirement' => false, ), - 'wamkj/thinkphp6.0-databackup' => array( - 'pretty_version' => 'v1.0', - 'version' => '1.0.0.0', - 'reference' => '28a0e406d827132942723a3c9f69bb20c98e652f', - 'type' => 'library', - 'install_path' => __DIR__ . '/../wamkj/thinkphp6.0-databackup', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'workerman/channel' => array( 'pretty_version' => 'v1.2.0', 'version' => '1.2.0.0', @@ -536,9 +536,9 @@ 'dev_requirement' => false, ), 'yzh52521/easyhttp' => array( - 'pretty_version' => 'v1.0.7', - 'version' => '1.0.7.0', - 'reference' => '52cb9aba60a725bef77acd9c4c48ecc78931af9e', + 'pretty_version' => 'v1.1.0', + 'version' => '1.1.0.0', + 'reference' => '78ec5cea1884d6da0709cac95a1e4d23fe9bfc65', 'type' => 'library', 'install_path' => __DIR__ . '/../yzh52521/easyhttp', 'aliases' => array(), diff --git a/vendor/firebase/php-jwt/CHANGELOG.md b/vendor/firebase/php-jwt/CHANGELOG.md new file mode 100644 index 0000000..353766e --- /dev/null +++ b/vendor/firebase/php-jwt/CHANGELOG.md @@ -0,0 +1,156 @@ +# Changelog + +## [6.8.1](https://github.com/firebase/php-jwt/compare/v6.8.0...v6.8.1) (2023-07-14) + + +### Bug Fixes + +* accept float claims but round down to ignore them ([#492](https://github.com/firebase/php-jwt/issues/492)) ([3936842](https://github.com/firebase/php-jwt/commit/39368423beeaacb3002afa7dcb75baebf204fe7e)) +* different BeforeValidException messages for nbf and iat ([#526](https://github.com/firebase/php-jwt/issues/526)) ([0a53cf2](https://github.com/firebase/php-jwt/commit/0a53cf2986e45c2bcbf1a269f313ebf56a154ee4)) + +## [6.8.0](https://github.com/firebase/php-jwt/compare/v6.7.0...v6.8.0) (2023-06-14) + + +### Features + +* add support for P-384 curve ([#515](https://github.com/firebase/php-jwt/issues/515)) ([5de4323](https://github.com/firebase/php-jwt/commit/5de4323f4baf4d70bca8663bd87682a69c656c3d)) + + +### Bug Fixes + +* handle invalid http responses ([#508](https://github.com/firebase/php-jwt/issues/508)) ([91c39c7](https://github.com/firebase/php-jwt/commit/91c39c72b22fc3e1191e574089552c1f2041c718)) + +## [6.7.0](https://github.com/firebase/php-jwt/compare/v6.6.0...v6.7.0) (2023-06-14) + + +### Features + +* add ed25519 support to JWK (public keys) ([#452](https://github.com/firebase/php-jwt/issues/452)) ([e53979a](https://github.com/firebase/php-jwt/commit/e53979abae927de916a75b9d239cfda8ce32be2a)) + +## [6.6.0](https://github.com/firebase/php-jwt/compare/v6.5.0...v6.6.0) (2023-06-13) + + +### Features + +* allow get headers when decoding token ([#442](https://github.com/firebase/php-jwt/issues/442)) ([fb85f47](https://github.com/firebase/php-jwt/commit/fb85f47cfaeffdd94faf8defdf07164abcdad6c3)) + + +### Bug Fixes + +* only check iat if nbf is not used ([#493](https://github.com/firebase/php-jwt/issues/493)) ([398ccd2](https://github.com/firebase/php-jwt/commit/398ccd25ea12fa84b9e4f1085d5ff448c21ec797)) + +## [6.5.0](https://github.com/firebase/php-jwt/compare/v6.4.0...v6.5.0) (2023-05-12) + + +### Bug Fixes + +* allow KID of '0' ([#505](https://github.com/firebase/php-jwt/issues/505)) ([9dc46a9](https://github.com/firebase/php-jwt/commit/9dc46a9c3e5801294249cfd2554c5363c9f9326a)) + + +### Miscellaneous Chores + +* drop support for PHP 7.3 ([#495](https://github.com/firebase/php-jwt/issues/495)) + +## [6.4.0](https://github.com/firebase/php-jwt/compare/v6.3.2...v6.4.0) (2023-02-08) + + +### Features + +* add support for W3C ES256K ([#462](https://github.com/firebase/php-jwt/issues/462)) ([213924f](https://github.com/firebase/php-jwt/commit/213924f51936291fbbca99158b11bd4ae56c2c95)) +* improve caching by only decoding jwks when necessary ([#486](https://github.com/firebase/php-jwt/issues/486)) ([78d3ed1](https://github.com/firebase/php-jwt/commit/78d3ed1073553f7d0bbffa6c2010009a0d483d5c)) + +## [6.3.2](https://github.com/firebase/php-jwt/compare/v6.3.1...v6.3.2) (2022-11-01) + + +### Bug Fixes + +* check kid before using as array index ([bad1b04](https://github.com/firebase/php-jwt/commit/bad1b040d0c736bbf86814c6b5ae614f517cf7bd)) + +## [6.3.1](https://github.com/firebase/php-jwt/compare/v6.3.0...v6.3.1) (2022-11-01) + + +### Bug Fixes + +* casing of GET for PSR compat ([#451](https://github.com/firebase/php-jwt/issues/451)) ([60b52b7](https://github.com/firebase/php-jwt/commit/60b52b71978790eafcf3b95cfbd83db0439e8d22)) +* string interpolation format for php 8.2 ([#446](https://github.com/firebase/php-jwt/issues/446)) ([2e07d8a](https://github.com/firebase/php-jwt/commit/2e07d8a1524d12b69b110ad649f17461d068b8f2)) + +## 6.3.0 / 2022-07-15 + + - Added ES256 support to JWK parsing ([#399](https://github.com/firebase/php-jwt/pull/399)) + - Fixed potential caching error in `CachedKeySet` by caching jwks as strings ([#435](https://github.com/firebase/php-jwt/pull/435)) + +## 6.2.0 / 2022-05-14 + + - Added `CachedKeySet` ([#397](https://github.com/firebase/php-jwt/pull/397)) + - Added `$defaultAlg` parameter to `JWT::parseKey` and `JWT::parseKeySet` ([#426](https://github.com/firebase/php-jwt/pull/426)). + +## 6.1.0 / 2022-03-23 + + - Drop support for PHP 5.3, 5.4, 5.5, 5.6, and 7.0 + - Add parameter typing and return types where possible + +## 6.0.0 / 2022-01-24 + + - **Backwards-Compatibility Breaking Changes**: See the [Release Notes](https://github.com/firebase/php-jwt/releases/tag/v6.0.0) for more information. + - New Key object to prevent key/algorithm type confusion (#365) + - Add JWK support (#273) + - Add ES256 support (#256) + - Add ES384 support (#324) + - Add Ed25519 support (#343) + +## 5.0.0 / 2017-06-26 +- Support RS384 and RS512. + See [#117](https://github.com/firebase/php-jwt/pull/117). Thanks [@joostfaassen](https://github.com/joostfaassen)! +- Add an example for RS256 openssl. + See [#125](https://github.com/firebase/php-jwt/pull/125). Thanks [@akeeman](https://github.com/akeeman)! +- Detect invalid Base64 encoding in signature. + See [#162](https://github.com/firebase/php-jwt/pull/162). Thanks [@psignoret](https://github.com/psignoret)! +- Update `JWT::verify` to handle OpenSSL errors. + See [#159](https://github.com/firebase/php-jwt/pull/159). Thanks [@bshaffer](https://github.com/bshaffer)! +- Add `array` type hinting to `decode` method + See [#101](https://github.com/firebase/php-jwt/pull/101). Thanks [@hywak](https://github.com/hywak)! +- Add all JSON error types. + See [#110](https://github.com/firebase/php-jwt/pull/110). Thanks [@gbalduzzi](https://github.com/gbalduzzi)! +- Bugfix 'kid' not in given key list. + See [#129](https://github.com/firebase/php-jwt/pull/129). Thanks [@stampycode](https://github.com/stampycode)! +- Miscellaneous cleanup, documentation and test fixes. + See [#107](https://github.com/firebase/php-jwt/pull/107), [#115](https://github.com/firebase/php-jwt/pull/115), + [#160](https://github.com/firebase/php-jwt/pull/160), [#161](https://github.com/firebase/php-jwt/pull/161), and + [#165](https://github.com/firebase/php-jwt/pull/165). Thanks [@akeeman](https://github.com/akeeman), + [@chinedufn](https://github.com/chinedufn), and [@bshaffer](https://github.com/bshaffer)! + +## 4.0.0 / 2016-07-17 +- Add support for late static binding. See [#88](https://github.com/firebase/php-jwt/pull/88) for details. Thanks to [@chappy84](https://github.com/chappy84)! +- Use static `$timestamp` instead of `time()` to improve unit testing. See [#93](https://github.com/firebase/php-jwt/pull/93) for details. Thanks to [@josephmcdermott](https://github.com/josephmcdermott)! +- Fixes to exceptions classes. See [#81](https://github.com/firebase/php-jwt/pull/81) for details. Thanks to [@Maks3w](https://github.com/Maks3w)! +- Fixes to PHPDoc. See [#76](https://github.com/firebase/php-jwt/pull/76) for details. Thanks to [@akeeman](https://github.com/akeeman)! + +## 3.0.0 / 2015-07-22 +- Minimum PHP version updated from `5.2.0` to `5.3.0`. +- Add `\Firebase\JWT` namespace. See +[#59](https://github.com/firebase/php-jwt/pull/59) for details. Thanks to +[@Dashron](https://github.com/Dashron)! +- Require a non-empty key to decode and verify a JWT. See +[#60](https://github.com/firebase/php-jwt/pull/60) for details. Thanks to +[@sjones608](https://github.com/sjones608)! +- Cleaner documentation blocks in the code. See +[#62](https://github.com/firebase/php-jwt/pull/62) for details. Thanks to +[@johanderuijter](https://github.com/johanderuijter)! + +## 2.2.0 / 2015-06-22 +- Add support for adding custom, optional JWT headers to `JWT::encode()`. See +[#53](https://github.com/firebase/php-jwt/pull/53/files) for details. Thanks to +[@mcocaro](https://github.com/mcocaro)! + +## 2.1.0 / 2015-05-20 +- Add support for adding a leeway to `JWT:decode()` that accounts for clock skew +between signing and verifying entities. Thanks to [@lcabral](https://github.com/lcabral)! +- Add support for passing an object implementing the `ArrayAccess` interface for +`$keys` argument in `JWT::decode()`. Thanks to [@aztech-dev](https://github.com/aztech-dev)! + +## 2.0.0 / 2015-04-01 +- **Note**: It is strongly recommended that you update to > v2.0.0 to address + known security vulnerabilities in prior versions when both symmetric and + asymmetric keys are used together. +- Update signature for `JWT::decode(...)` to require an array of supported + algorithms to use when verifying token signatures. diff --git a/vendor/firebase/php-jwt/README.md b/vendor/firebase/php-jwt/README.md index 1d392cd..701de23 100644 --- a/vendor/firebase/php-jwt/README.md +++ b/vendor/firebase/php-jwt/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/firebase/php-jwt.png?branch=master)](https://travis-ci.org/firebase/php-jwt) +![Build Status](https://github.com/firebase/php-jwt/actions/workflows/tests.yml/badge.svg) [![Latest Stable Version](https://poser.pugx.org/firebase/php-jwt/v/stable)](https://packagist.org/packages/firebase/php-jwt) [![Total Downloads](https://poser.pugx.org/firebase/php-jwt/downloads)](https://packagist.org/packages/firebase/php-jwt) [![License](https://poser.pugx.org/firebase/php-jwt/license)](https://packagist.org/packages/firebase/php-jwt) @@ -29,13 +29,13 @@ Example use Firebase\JWT\JWT; use Firebase\JWT\Key; -$key = "example_key"; -$payload = array( - "iss" => "http://example.org", - "aud" => "http://example.com", - "iat" => 1356999524, - "nbf" => 1357000000 -); +$key = 'example_key'; +$payload = [ + 'iss' => 'http://example.org', + 'aud' => 'http://example.com', + 'iat' => 1356999524, + 'nbf' => 1357000000 +]; /** * IMPORTANT: @@ -45,9 +45,12 @@ $payload = array( */ $jwt = JWT::encode($payload, $key, 'HS256'); $decoded = JWT::decode($jwt, new Key($key, 'HS256')); - print_r($decoded); +// Pass a stdClass in as the third parameter to get the decoded header values +$decoded = JWT::decode($jwt, new Key($key, 'HS256'), $headers = new stdClass()); +print_r($headers); + /* NOTE: This will now be an object instead of an associative array. To get an associative array, you will need to cast it as such: @@ -65,6 +68,40 @@ $decoded_array = (array) $decoded; JWT::$leeway = 60; // $leeway in seconds $decoded = JWT::decode($jwt, new Key($key, 'HS256')); ``` +Example encode/decode headers +------- +Decoding the JWT headers without verifying the JWT first is NOT recommended, and is not supported by +this library. This is because without verifying the JWT, the header values could have been tampered with. +Any value pulled from an unverified header should be treated as if it could be any string sent in from an +attacker. If this is something you still want to do in your application for whatever reason, it's possible to +decode the header values manually simply by calling `json_decode` and `base64_decode` on the JWT +header part: +```php +use Firebase\JWT\JWT; + +$key = 'example_key'; +$payload = [ + 'iss' => 'http://example.org', + 'aud' => 'http://example.com', + 'iat' => 1356999524, + 'nbf' => 1357000000 +]; + +$headers = [ + 'x-forwarded-for' => 'www.google.com' +]; + +// Encode headers in the JWT string +$jwt = JWT::encode($payload, $key, 'HS256', null, $headers); + +// Decode headers from the JWT string WITHOUT validation +// **IMPORTANT**: This operation is vulnerable to attacks, as the JWT has not yet been verified. +// These headers could be any value sent by an attacker. +list($headersB64, $payloadB64, $sig) = explode('.', $jwt); +$decoded = json_decode(base64_decode($headersB64), true); + +print_r($decoded); +``` Example with RS256 (openssl) ---------------------------- ```php @@ -73,37 +110,52 @@ use Firebase\JWT\Key; $privateKey = << "example.org", - "aud" => "example.com", - "iat" => 1356999524, - "nbf" => 1357000000 -); +$payload = [ + 'iss' => 'example.org', + 'aud' => 'example.com', + 'iat' => 1356999524, + 'nbf' => 1357000000 +]; $jwt = JWT::encode($payload, $privateKey, 'RS256'); echo "Encode:\n" . print_r($jwt, true) . "\n"; @@ -139,12 +191,12 @@ $privateKey = openssl_pkey_get_private( $passphrase ); -$payload = array( - "iss" => "example.org", - "aud" => "example.com", - "iat" => 1356999524, - "nbf" => 1357000000 -); +$payload = [ + 'iss' => 'example.org', + 'aud' => 'example.com', + 'iat' => 1356999524, + 'nbf' => 1357000000 +]; $jwt = JWT::encode($payload, $privateKey, 'RS256'); echo "Encode:\n" . print_r($jwt, true) . "\n"; @@ -173,12 +225,12 @@ $privateKey = base64_encode(sodium_crypto_sign_secretkey($keyPair)); $publicKey = base64_encode(sodium_crypto_sign_publickey($keyPair)); -$payload = array( - "iss" => "example.org", - "aud" => "example.com", - "iat" => 1356999524, - "nbf" => 1357000000 -); +$payload = [ + 'iss' => 'example.org', + 'aud' => 'example.com', + 'iat' => 1356999524, + 'nbf' => 1357000000 +]; $jwt = JWT::encode($payload, $privateKey, 'EdDSA'); echo "Encode:\n" . print_r($jwt, true) . "\n"; @@ -187,6 +239,44 @@ $decoded = JWT::decode($jwt, new Key($publicKey, 'EdDSA')); echo "Decode:\n" . print_r((array) $decoded, true) . "\n"; ```` +Example with multiple keys +-------------------------- +```php +use Firebase\JWT\JWT; +use Firebase\JWT\Key; + +// Example RSA keys from previous example +// $privateKey1 = '...'; +// $publicKey1 = '...'; + +// Example EdDSA keys from previous example +// $privateKey2 = '...'; +// $publicKey2 = '...'; + +$payload = [ + 'iss' => 'example.org', + 'aud' => 'example.com', + 'iat' => 1356999524, + 'nbf' => 1357000000 +]; + +$jwt1 = JWT::encode($payload, $privateKey1, 'RS256', 'kid1'); +$jwt2 = JWT::encode($payload, $privateKey2, 'EdDSA', 'kid2'); +echo "Encode 1:\n" . print_r($jwt1, true) . "\n"; +echo "Encode 2:\n" . print_r($jwt2, true) . "\n"; + +$keys = [ + 'kid1' => new Key($publicKey1, 'RS256'), + 'kid2' => new Key($publicKey2, 'EdDSA'), +]; + +$decoded1 = JWT::decode($jwt1, $keys); +$decoded2 = JWT::decode($jwt2, $keys); + +echo "Decode 1:\n" . print_r((array) $decoded1, true) . "\n"; +echo "Decode 2:\n" . print_r((array) $decoded2, true) . "\n"; +``` + Using JWKs ---------- @@ -198,72 +288,117 @@ use Firebase\JWT\JWT; // this endpoint: https://www.gstatic.com/iap/verify/public_key-jwk $jwks = ['keys' => []]; -// JWK::parseKeySet($jwks) returns an associative array of **kid** to private -// key. Pass this as the second parameter to JWT::decode. -// NOTE: The deprecated $supportedAlgorithm must be supplied when parsing from JWK. -JWT::decode($payload, JWK::parseKeySet($jwks), $supportedAlgorithm); +// JWK::parseKeySet($jwks) returns an associative array of **kid** to Firebase\JWT\Key +// objects. Pass this as the second parameter to JWT::decode. +JWT::decode($payload, JWK::parseKeySet($jwks)); ``` -Changelog ---------- +Using Cached Key Sets +--------------------- -#### 5.0.0 / 2017-06-26 -- Support RS384 and RS512. - See [#117](https://github.com/firebase/php-jwt/pull/117). Thanks [@joostfaassen](https://github.com/joostfaassen)! -- Add an example for RS256 openssl. - See [#125](https://github.com/firebase/php-jwt/pull/125). Thanks [@akeeman](https://github.com/akeeman)! -- Detect invalid Base64 encoding in signature. - See [#162](https://github.com/firebase/php-jwt/pull/162). Thanks [@psignoret](https://github.com/psignoret)! -- Update `JWT::verify` to handle OpenSSL errors. - See [#159](https://github.com/firebase/php-jwt/pull/159). Thanks [@bshaffer](https://github.com/bshaffer)! -- Add `array` type hinting to `decode` method - See [#101](https://github.com/firebase/php-jwt/pull/101). Thanks [@hywak](https://github.com/hywak)! -- Add all JSON error types. - See [#110](https://github.com/firebase/php-jwt/pull/110). Thanks [@gbalduzzi](https://github.com/gbalduzzi)! -- Bugfix 'kid' not in given key list. - See [#129](https://github.com/firebase/php-jwt/pull/129). Thanks [@stampycode](https://github.com/stampycode)! -- Miscellaneous cleanup, documentation and test fixes. - See [#107](https://github.com/firebase/php-jwt/pull/107), [#115](https://github.com/firebase/php-jwt/pull/115), - [#160](https://github.com/firebase/php-jwt/pull/160), [#161](https://github.com/firebase/php-jwt/pull/161), and - [#165](https://github.com/firebase/php-jwt/pull/165). Thanks [@akeeman](https://github.com/akeeman), - [@chinedufn](https://github.com/chinedufn), and [@bshaffer](https://github.com/bshaffer)! +The `CachedKeySet` class can be used to fetch and cache JWKS (JSON Web Key Sets) from a public URI. +This has the following advantages: -#### 4.0.0 / 2016-07-17 -- Add support for late static binding. See [#88](https://github.com/firebase/php-jwt/pull/88) for details. Thanks to [@chappy84](https://github.com/chappy84)! -- Use static `$timestamp` instead of `time()` to improve unit testing. See [#93](https://github.com/firebase/php-jwt/pull/93) for details. Thanks to [@josephmcdermott](https://github.com/josephmcdermott)! -- Fixes to exceptions classes. See [#81](https://github.com/firebase/php-jwt/pull/81) for details. Thanks to [@Maks3w](https://github.com/Maks3w)! -- Fixes to PHPDoc. See [#76](https://github.com/firebase/php-jwt/pull/76) for details. Thanks to [@akeeman](https://github.com/akeeman)! +1. The results are cached for performance. +2. If an unrecognized key is requested, the cache is refreshed, to accomodate for key rotation. +3. If rate limiting is enabled, the JWKS URI will not make more than 10 requests a second. -#### 3.0.0 / 2015-07-22 -- Minimum PHP version updated from `5.2.0` to `5.3.0`. -- Add `\Firebase\JWT` namespace. See -[#59](https://github.com/firebase/php-jwt/pull/59) for details. Thanks to -[@Dashron](https://github.com/Dashron)! -- Require a non-empty key to decode and verify a JWT. See -[#60](https://github.com/firebase/php-jwt/pull/60) for details. Thanks to -[@sjones608](https://github.com/sjones608)! -- Cleaner documentation blocks in the code. See -[#62](https://github.com/firebase/php-jwt/pull/62) for details. Thanks to -[@johanderuijter](https://github.com/johanderuijter)! +```php +use Firebase\JWT\CachedKeySet; +use Firebase\JWT\JWT; -#### 2.2.0 / 2015-06-22 -- Add support for adding custom, optional JWT headers to `JWT::encode()`. See -[#53](https://github.com/firebase/php-jwt/pull/53/files) for details. Thanks to -[@mcocaro](https://github.com/mcocaro)! +// The URI for the JWKS you wish to cache the results from +$jwksUri = 'https://www.gstatic.com/iap/verify/public_key-jwk'; -#### 2.1.0 / 2015-05-20 -- Add support for adding a leeway to `JWT:decode()` that accounts for clock skew -between signing and verifying entities. Thanks to [@lcabral](https://github.com/lcabral)! -- Add support for passing an object implementing the `ArrayAccess` interface for -`$keys` argument in `JWT::decode()`. Thanks to [@aztech-dev](https://github.com/aztech-dev)! +// Create an HTTP client (can be any PSR-7 compatible HTTP client) +$httpClient = new GuzzleHttp\Client(); -#### 2.0.0 / 2015-04-01 -- **Note**: It is strongly recommended that you update to > v2.0.0 to address - known security vulnerabilities in prior versions when both symmetric and - asymmetric keys are used together. -- Update signature for `JWT::decode(...)` to require an array of supported - algorithms to use when verifying token signatures. +// Create an HTTP request factory (can be any PSR-17 compatible HTTP request factory) +$httpFactory = new GuzzleHttp\Psr\HttpFactory(); +// Create a cache item pool (can be any PSR-6 compatible cache item pool) +$cacheItemPool = Phpfastcache\CacheManager::getInstance('files'); + +$keySet = new CachedKeySet( + $jwksUri, + $httpClient, + $httpFactory, + $cacheItemPool, + null, // $expiresAfter int seconds to set the JWKS to expire + true // $rateLimit true to enable rate limit of 10 RPS on lookup of invalid keys +); + +$jwt = 'eyJhbGci...'; // Some JWT signed by a key from the $jwkUri above +$decoded = JWT::decode($jwt, $keySet); +``` + +Miscellaneous +------------- + +#### Exception Handling + +When a call to `JWT::decode` is invalid, it will throw one of the following exceptions: + +```php +use Firebase\JWT\JWT; +use Firebase\JWT\SignatureInvalidException; +use Firebase\JWT\BeforeValidException; +use Firebase\JWT\ExpiredException; +use DomainException; +use InvalidArgumentException; +use UnexpectedValueException; + +try { + $decoded = JWT::decode($payload, $keys); +} catch (InvalidArgumentException $e) { + // provided key/key-array is empty or malformed. +} catch (DomainException $e) { + // provided algorithm is unsupported OR + // provided key is invalid OR + // unknown error thrown in openSSL or libsodium OR + // libsodium is required but not available. +} catch (SignatureInvalidException $e) { + // provided JWT signature verification failed. +} catch (BeforeValidException $e) { + // provided JWT is trying to be used before "nbf" claim OR + // provided JWT is trying to be used before "iat" claim. +} catch (ExpiredException $e) { + // provided JWT is trying to be used after "exp" claim. +} catch (UnexpectedValueException $e) { + // provided JWT is malformed OR + // provided JWT is missing an algorithm / using an unsupported algorithm OR + // provided JWT algorithm does not match provided key OR + // provided key ID in key/key-array is empty or invalid. +} +``` + +All exceptions in the `Firebase\JWT` namespace extend `UnexpectedValueException`, and can be simplified +like this: + +```php +use Firebase\JWT\JWT; +use UnexpectedValueException; +try { + $decoded = JWT::decode($payload, $keys); +} catch (LogicException $e) { + // errors having to do with environmental setup or malformed JWT Keys +} catch (UnexpectedValueException $e) { + // errors having to do with JWT signature and claims +} +``` + +#### Casting to array + +The return value of `JWT::decode` is the generic PHP object `stdClass`. If you'd like to handle with arrays +instead, you can do the following: + +```php +// return type is stdClass +$decoded = JWT::decode($payload, $keys); + +// cast to array +$decoded = json_decode(json_encode($decoded), true); +``` Tests ----- diff --git a/vendor/firebase/php-jwt/composer.json b/vendor/firebase/php-jwt/composer.json index 6146e2d..e23dfe3 100644 --- a/vendor/firebase/php-jwt/composer.json +++ b/vendor/firebase/php-jwt/composer.json @@ -20,10 +20,11 @@ ], "license": "BSD-3-Clause", "require": { - "php": ">=5.3.0" + "php": "^7.4||^8.0" }, "suggest": { - "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present", + "ext-sodium": "Support EdDSA (Ed25519) signatures" }, "autoload": { "psr-4": { @@ -31,6 +32,11 @@ } }, "require-dev": { - "phpunit/phpunit": ">=4.8 <=9" + "guzzlehttp/guzzle": "^6.5||^7.4", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "psr/cache": "^1.0||^2.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0" } } diff --git a/vendor/firebase/php-jwt/src/CachedKeySet.php b/vendor/firebase/php-jwt/src/CachedKeySet.php new file mode 100644 index 0000000..ee529f9 --- /dev/null +++ b/vendor/firebase/php-jwt/src/CachedKeySet.php @@ -0,0 +1,268 @@ + + */ +class CachedKeySet implements ArrayAccess +{ + /** + * @var string + */ + private $jwksUri; + /** + * @var ClientInterface + */ + private $httpClient; + /** + * @var RequestFactoryInterface + */ + private $httpFactory; + /** + * @var CacheItemPoolInterface + */ + private $cache; + /** + * @var ?int + */ + private $expiresAfter; + /** + * @var ?CacheItemInterface + */ + private $cacheItem; + /** + * @var array> + */ + private $keySet; + /** + * @var string + */ + private $cacheKey; + /** + * @var string + */ + private $cacheKeyPrefix = 'jwks'; + /** + * @var int + */ + private $maxKeyLength = 64; + /** + * @var bool + */ + private $rateLimit; + /** + * @var string + */ + private $rateLimitCacheKey; + /** + * @var int + */ + private $maxCallsPerMinute = 10; + /** + * @var string|null + */ + private $defaultAlg; + + public function __construct( + string $jwksUri, + ClientInterface $httpClient, + RequestFactoryInterface $httpFactory, + CacheItemPoolInterface $cache, + int $expiresAfter = null, + bool $rateLimit = false, + string $defaultAlg = null + ) { + $this->jwksUri = $jwksUri; + $this->httpClient = $httpClient; + $this->httpFactory = $httpFactory; + $this->cache = $cache; + $this->expiresAfter = $expiresAfter; + $this->rateLimit = $rateLimit; + $this->defaultAlg = $defaultAlg; + $this->setCacheKeys(); + } + + /** + * @param string $keyId + * @return Key + */ + public function offsetGet($keyId): Key + { + if (!$this->keyIdExists($keyId)) { + throw new OutOfBoundsException('Key ID not found'); + } + return JWK::parseKey($this->keySet[$keyId], $this->defaultAlg); + } + + /** + * @param string $keyId + * @return bool + */ + public function offsetExists($keyId): bool + { + return $this->keyIdExists($keyId); + } + + /** + * @param string $offset + * @param Key $value + */ + public function offsetSet($offset, $value): void + { + throw new LogicException('Method not implemented'); + } + + /** + * @param string $offset + */ + public function offsetUnset($offset): void + { + throw new LogicException('Method not implemented'); + } + + /** + * @return array + */ + private function formatJwksForCache(string $jwks): array + { + $jwks = json_decode($jwks, true); + + if (!isset($jwks['keys'])) { + throw new UnexpectedValueException('"keys" member must exist in the JWK Set'); + } + + if (empty($jwks['keys'])) { + throw new InvalidArgumentException('JWK Set did not contain any keys'); + } + + $keys = []; + foreach ($jwks['keys'] as $k => $v) { + $kid = isset($v['kid']) ? $v['kid'] : $k; + $keys[(string) $kid] = $v; + } + + return $keys; + } + + private function keyIdExists(string $keyId): bool + { + if (null === $this->keySet) { + $item = $this->getCacheItem(); + // Try to load keys from cache + if ($item->isHit()) { + // item found! retrieve it + $this->keySet = $item->get(); + // If the cached item is a string, the JWKS response was cached (previous behavior). + // Parse this into expected format array instead. + if (\is_string($this->keySet)) { + $this->keySet = $this->formatJwksForCache($this->keySet); + } + } + } + + if (!isset($this->keySet[$keyId])) { + if ($this->rateLimitExceeded()) { + return false; + } + $request = $this->httpFactory->createRequest('GET', $this->jwksUri); + $jwksResponse = $this->httpClient->sendRequest($request); + if ($jwksResponse->getStatusCode() !== 200) { + throw new UnexpectedValueException( + sprintf('HTTP Error: %d %s for URI "%s"', + $jwksResponse->getStatusCode(), + $jwksResponse->getReasonPhrase(), + $this->jwksUri, + ), + $jwksResponse->getStatusCode() + ); + } + $this->keySet = $this->formatJwksForCache((string) $jwksResponse->getBody()); + + if (!isset($this->keySet[$keyId])) { + return false; + } + + $item = $this->getCacheItem(); + $item->set($this->keySet); + if ($this->expiresAfter) { + $item->expiresAfter($this->expiresAfter); + } + $this->cache->save($item); + } + + return true; + } + + private function rateLimitExceeded(): bool + { + if (!$this->rateLimit) { + return false; + } + + $cacheItem = $this->cache->getItem($this->rateLimitCacheKey); + if (!$cacheItem->isHit()) { + $cacheItem->expiresAfter(1); // # of calls are cached each minute + } + + $callsPerMinute = (int) $cacheItem->get(); + if (++$callsPerMinute > $this->maxCallsPerMinute) { + return true; + } + $cacheItem->set($callsPerMinute); + $this->cache->save($cacheItem); + return false; + } + + private function getCacheItem(): CacheItemInterface + { + if (\is_null($this->cacheItem)) { + $this->cacheItem = $this->cache->getItem($this->cacheKey); + } + + return $this->cacheItem; + } + + private function setCacheKeys(): void + { + if (empty($this->jwksUri)) { + throw new RuntimeException('JWKS URI is empty'); + } + + // ensure we do not have illegal characters + $key = preg_replace('|[^a-zA-Z0-9_\.!]|', '', $this->jwksUri); + + // add prefix + $key = $this->cacheKeyPrefix . $key; + + // Hash keys if they exceed $maxKeyLength of 64 + if (\strlen($key) > $this->maxKeyLength) { + $key = substr(hash('sha256', $key), 0, $this->maxKeyLength); + } + + $this->cacheKey = $key; + + if ($this->rateLimit) { + // add prefix + $rateLimitKey = $this->cacheKeyPrefix . 'ratelimit' . $key; + + // Hash keys if they exceed $maxKeyLength of 64 + if (\strlen($rateLimitKey) > $this->maxKeyLength) { + $rateLimitKey = substr(hash('sha256', $rateLimitKey), 0, $this->maxKeyLength); + } + + $this->rateLimitCacheKey = $rateLimitKey; + } + } +} diff --git a/vendor/firebase/php-jwt/src/JWK.php b/vendor/firebase/php-jwt/src/JWK.php index 981a9ba..63fb248 100644 --- a/vendor/firebase/php-jwt/src/JWK.php +++ b/vendor/firebase/php-jwt/src/JWK.php @@ -20,12 +20,31 @@ use UnexpectedValueException; */ class JWK { + private const OID = '1.2.840.10045.2.1'; + private const ASN1_OBJECT_IDENTIFIER = 0x06; + private const ASN1_SEQUENCE = 0x10; // also defined in JWT + private const ASN1_BIT_STRING = 0x03; + private const EC_CURVES = [ + 'P-256' => '1.2.840.10045.3.1.7', // Len: 64 + 'secp256k1' => '1.3.132.0.10', // Len: 64 + 'P-384' => '1.3.132.0.34', // Len: 96 + // 'P-521' => '1.3.132.0.35', // Len: 132 (not supported) + ]; + + // For keys with "kty" equal to "OKP" (Octet Key Pair), the "crv" parameter must contain the key subtype. + // This library supports the following subtypes: + private const OKP_SUBTYPES = [ + 'Ed25519' => true, // RFC 8037 + ]; + /** * Parse a set of JWK keys * - * @param array $jwks The JSON Web Key Set as an associative array + * @param array $jwks The JSON Web Key Set as an associative array + * @param string $defaultAlg The algorithm for the Key object if "alg" is not set in the + * JSON Web Key Set * - * @return array An associative array that represents the set of keys + * @return array An associative array of key IDs (kid) to Key objects * * @throws InvalidArgumentException Provided JWK Set is empty * @throws UnexpectedValueException Provided JWK Set was invalid @@ -33,21 +52,22 @@ class JWK * * @uses parseKey */ - public static function parseKeySet(array $jwks) + public static function parseKeySet(array $jwks, string $defaultAlg = null): array { - $keys = array(); + $keys = []; if (!isset($jwks['keys'])) { throw new UnexpectedValueException('"keys" member must exist in the JWK Set'); } + if (empty($jwks['keys'])) { throw new InvalidArgumentException('JWK Set did not contain any keys'); } foreach ($jwks['keys'] as $k => $v) { $kid = isset($v['kid']) ? $v['kid'] : $k; - if ($key = self::parseKey($v)) { - $keys[$kid] = $key; + if ($key = self::parseKey($v, $defaultAlg)) { + $keys[(string) $kid] = $key; } } @@ -61,9 +81,11 @@ class JWK /** * Parse a JWK key * - * @param array $jwk An individual JWK + * @param array $jwk An individual JWK + * @param string $defaultAlg The algorithm for the Key object if "alg" is not set in the + * JSON Web Key Set * - * @return resource|array An associative array that represents the key + * @return Key The key object for the JWK * * @throws InvalidArgumentException Provided JWK is empty * @throws UnexpectedValueException Provided JWK was invalid @@ -71,15 +93,27 @@ class JWK * * @uses createPemFromModulusAndExponent */ - public static function parseKey(array $jwk) + public static function parseKey(array $jwk, string $defaultAlg = null): ?Key { if (empty($jwk)) { throw new InvalidArgumentException('JWK must not be empty'); } + if (!isset($jwk['kty'])) { throw new UnexpectedValueException('JWK must contain a "kty" parameter'); } + if (!isset($jwk['alg'])) { + if (\is_null($defaultAlg)) { + // The "alg" parameter is optional in a KTY, but an algorithm is required + // for parsing in this library. Use the $defaultAlg parameter when parsing the + // key set in order to prevent this error. + // @see https://datatracker.ietf.org/doc/html/rfc7517#section-4.4 + throw new UnexpectedValueException('JWK must contain an "alg" parameter'); + } + $jwk['alg'] = $defaultAlg; + } + switch ($jwk['kty']) { case 'RSA': if (!empty($jwk['d'])) { @@ -96,11 +130,92 @@ class JWK 'OpenSSL error: ' . \openssl_error_string() ); } - return $publicKey; + return new Key($publicKey, $jwk['alg']); + case 'EC': + if (isset($jwk['d'])) { + // The key is actually a private key + throw new UnexpectedValueException('Key data must be for a public key'); + } + + if (empty($jwk['crv'])) { + throw new UnexpectedValueException('crv not set'); + } + + if (!isset(self::EC_CURVES[$jwk['crv']])) { + throw new DomainException('Unrecognised or unsupported EC curve'); + } + + if (empty($jwk['x']) || empty($jwk['y'])) { + throw new UnexpectedValueException('x and y not set'); + } + + $publicKey = self::createPemFromCrvAndXYCoordinates($jwk['crv'], $jwk['x'], $jwk['y']); + return new Key($publicKey, $jwk['alg']); + case 'OKP': + if (isset($jwk['d'])) { + // The key is actually a private key + throw new UnexpectedValueException('Key data must be for a public key'); + } + + if (!isset($jwk['crv'])) { + throw new UnexpectedValueException('crv not set'); + } + + if (empty(self::OKP_SUBTYPES[$jwk['crv']])) { + throw new DomainException('Unrecognised or unsupported OKP key subtype'); + } + + if (empty($jwk['x'])) { + throw new UnexpectedValueException('x not set'); + } + + // This library works internally with EdDSA keys (Ed25519) encoded in standard base64. + $publicKey = JWT::convertBase64urlToBase64($jwk['x']); + return new Key($publicKey, $jwk['alg']); default: - // Currently only RSA is supported break; } + + return null; + } + + /** + * Converts the EC JWK values to pem format. + * + * @param string $crv The EC curve (only P-256 & P-384 is supported) + * @param string $x The EC x-coordinate + * @param string $y The EC y-coordinate + * + * @return string + */ + private static function createPemFromCrvAndXYCoordinates(string $crv, string $x, string $y): string + { + $pem = + self::encodeDER( + self::ASN1_SEQUENCE, + self::encodeDER( + self::ASN1_SEQUENCE, + self::encodeDER( + self::ASN1_OBJECT_IDENTIFIER, + self::encodeOID(self::OID) + ) + . self::encodeDER( + self::ASN1_OBJECT_IDENTIFIER, + self::encodeOID(self::EC_CURVES[$crv]) + ) + ) . + self::encodeDER( + self::ASN1_BIT_STRING, + \chr(0x00) . \chr(0x04) + . JWT::urlsafeB64Decode($x) + . JWT::urlsafeB64Decode($y) + ) + ); + + return sprintf( + "-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----\n", + wordwrap(base64_encode($pem), 64, "\n", true) + ); } /** @@ -113,22 +228,22 @@ class JWK * * @uses encodeLength */ - private static function createPemFromModulusAndExponent($n, $e) - { - $modulus = JWT::urlsafeB64Decode($n); - $publicExponent = JWT::urlsafeB64Decode($e); + private static function createPemFromModulusAndExponent( + string $n, + string $e + ): string { + $mod = JWT::urlsafeB64Decode($n); + $exp = JWT::urlsafeB64Decode($e); - $components = array( - 'modulus' => \pack('Ca*a*', 2, self::encodeLength(\strlen($modulus)), $modulus), - 'publicExponent' => \pack('Ca*a*', 2, self::encodeLength(\strlen($publicExponent)), $publicExponent) - ); + $modulus = \pack('Ca*a*', 2, self::encodeLength(\strlen($mod)), $mod); + $publicExponent = \pack('Ca*a*', 2, self::encodeLength(\strlen($exp)), $exp); $rsaPublicKey = \pack( 'Ca*a*a*', 48, - self::encodeLength(\strlen($components['modulus']) + \strlen($components['publicExponent'])), - $components['modulus'], - $components['publicExponent'] + self::encodeLength(\strlen($modulus) + \strlen($publicExponent)), + $modulus, + $publicExponent ); // sequence(oid(1.2.840.113549.1.1.1), null)) = rsaEncryption. @@ -143,11 +258,9 @@ class JWK $rsaOID . $rsaPublicKey ); - $rsaPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" . + return "-----BEGIN PUBLIC KEY-----\r\n" . \chunk_split(\base64_encode($rsaPublicKey), 64) . '-----END PUBLIC KEY-----'; - - return $rsaPublicKey; } /** @@ -159,7 +272,7 @@ class JWK * @param int $length * @return string */ - private static function encodeLength($length) + private static function encodeLength(int $length): string { if ($length <= 0x7F) { return \chr($length); @@ -169,4 +282,68 @@ class JWK return \pack('Ca*', 0x80 | \strlen($temp), $temp); } + + /** + * Encodes a value into a DER object. + * Also defined in Firebase\JWT\JWT + * + * @param int $type DER tag + * @param string $value the value to encode + * @return string the encoded object + */ + private static function encodeDER(int $type, string $value): string + { + $tag_header = 0; + if ($type === self::ASN1_SEQUENCE) { + $tag_header |= 0x20; + } + + // Type + $der = \chr($tag_header | $type); + + // Length + $der .= \chr(\strlen($value)); + + return $der . $value; + } + + /** + * Encodes a string into a DER-encoded OID. + * + * @param string $oid the OID string + * @return string the binary DER-encoded OID + */ + private static function encodeOID(string $oid): string + { + $octets = explode('.', $oid); + + // Get the first octet + $first = (int) array_shift($octets); + $second = (int) array_shift($octets); + $oid = \chr($first * 40 + $second); + + // Iterate over subsequent octets + foreach ($octets as $octet) { + if ($octet == 0) { + $oid .= \chr(0x00); + continue; + } + $bin = ''; + + while ($octet) { + $bin .= \chr(0x80 | ($octet & 0x7f)); + $octet >>= 7; + } + $bin[0] = $bin[0] & \chr(0x7f); + + // Convert to big endian if necessary + if (pack('V', 65534) == pack('L', 65534)) { + $oid .= strrev($bin); + } else { + $oid .= $bin; + } + } + + return $oid; + } } diff --git a/vendor/firebase/php-jwt/src/JWT.php b/vendor/firebase/php-jwt/src/JWT.php index ec1641b..1892745 100644 --- a/vendor/firebase/php-jwt/src/JWT.php +++ b/vendor/firebase/php-jwt/src/JWT.php @@ -3,12 +3,14 @@ namespace Firebase\JWT; use ArrayAccess; +use DateTime; use DomainException; use Exception; use InvalidArgumentException; use OpenSSLAsymmetricKey; +use OpenSSLCertificate; +use stdClass; use UnexpectedValueException; -use DateTime; /** * JSON Web Token implementation, based on this spec: @@ -25,52 +27,63 @@ use DateTime; */ class JWT { - const ASN1_INTEGER = 0x02; - const ASN1_SEQUENCE = 0x10; - const ASN1_BIT_STRING = 0x03; + private const ASN1_INTEGER = 0x02; + private const ASN1_SEQUENCE = 0x10; + private const ASN1_BIT_STRING = 0x03; /** * When checking nbf, iat or expiration times, * we want to provide some extra leeway time to * account for clock skew. + * + * @var int */ public static $leeway = 0; /** * Allow the current timestamp to be specified. * Useful for fixing a value within unit testing. - * * Will default to PHP time() value if null. + * + * @var ?int */ public static $timestamp = null; - public static $supported_algs = array( - 'ES384' => array('openssl', 'SHA384'), - 'ES256' => array('openssl', 'SHA256'), - 'HS256' => array('hash_hmac', 'SHA256'), - 'HS384' => array('hash_hmac', 'SHA384'), - 'HS512' => array('hash_hmac', 'SHA512'), - 'RS256' => array('openssl', 'SHA256'), - 'RS384' => array('openssl', 'SHA384'), - 'RS512' => array('openssl', 'SHA512'), - 'EdDSA' => array('sodium_crypto', 'EdDSA'), - ); + /** + * @var array + */ + public static $supported_algs = [ + 'ES384' => ['openssl', 'SHA384'], + 'ES256' => ['openssl', 'SHA256'], + 'ES256K' => ['openssl', 'SHA256'], + 'HS256' => ['hash_hmac', 'SHA256'], + 'HS384' => ['hash_hmac', 'SHA384'], + 'HS512' => ['hash_hmac', 'SHA512'], + 'RS256' => ['openssl', 'SHA256'], + 'RS384' => ['openssl', 'SHA384'], + 'RS512' => ['openssl', 'SHA512'], + 'EdDSA' => ['sodium_crypto', 'EdDSA'], + ]; /** * Decodes a JWT string into a PHP object. * - * @param string $jwt The JWT - * @param Key|array|mixed $keyOrKeyArray The Key or array of Key objects. - * If the algorithm used is asymmetric, this is the public key - * Each Key object contains an algorithm and matching key. - * Supported algorithms are 'ES384','ES256', 'HS256', 'HS384', - * 'HS512', 'RS256', 'RS384', and 'RS512' - * @param array $allowed_algs [DEPRECATED] List of supported verification algorithms. Only - * should be used for backwards compatibility. + * @param string $jwt The JWT + * @param Key|ArrayAccess|array $keyOrKeyArray The Key or associative array of key IDs + * (kid) to Key objects. + * If the algorithm used is asymmetric, this is + * the public key. + * Each Key object contains an algorithm and + * matching key. + * Supported algorithms are 'ES384','ES256', + * 'HS256', 'HS384', 'HS512', 'RS256', 'RS384' + * and 'RS512'. + * @param stdClass $headers Optional. Populates stdClass with headers. * - * @return object The JWT's payload as a PHP object + * @return stdClass The JWT's payload as a PHP object * - * @throws InvalidArgumentException Provided JWT was empty + * @throws InvalidArgumentException Provided key/key-array was empty or malformed + * @throws DomainException Provided JWT is malformed * @throws UnexpectedValueException Provided JWT was invalid * @throws SignatureInvalidException Provided JWT was invalid because the signature verification failed * @throws BeforeValidException Provided JWT is trying to be used before it's eligible as defined by 'nbf' @@ -80,27 +93,41 @@ class JWT * @uses jsonDecode * @uses urlsafeB64Decode */ - public static function decode($jwt, $keyOrKeyArray, array $allowed_algs = array()) - { + public static function decode( + string $jwt, + $keyOrKeyArray, + stdClass &$headers = null + ): stdClass { + // Validate JWT $timestamp = \is_null(static::$timestamp) ? \time() : static::$timestamp; if (empty($keyOrKeyArray)) { throw new InvalidArgumentException('Key may not be empty'); } $tks = \explode('.', $jwt); - if (\count($tks) != 3) { + if (\count($tks) !== 3) { throw new UnexpectedValueException('Wrong number of segments'); } list($headb64, $bodyb64, $cryptob64) = $tks; - if (null === ($header = static::jsonDecode(static::urlsafeB64Decode($headb64)))) { + $headerRaw = static::urlsafeB64Decode($headb64); + if (null === ($header = static::jsonDecode($headerRaw))) { throw new UnexpectedValueException('Invalid header encoding'); } - if (null === $payload = static::jsonDecode(static::urlsafeB64Decode($bodyb64))) { + if ($headers !== null) { + $headers = $header; + } + $payloadRaw = static::urlsafeB64Decode($bodyb64); + if (null === ($payload = static::jsonDecode($payloadRaw))) { throw new UnexpectedValueException('Invalid claims encoding'); } - if (false === ($sig = static::urlsafeB64Decode($cryptob64))) { - throw new UnexpectedValueException('Invalid signature encoding'); + if (\is_array($payload)) { + // prevent PHP Fatal Error in edge-cases when payload is empty array + $payload = (object) $payload; } + if (!$payload instanceof stdClass) { + throw new UnexpectedValueException('Payload must be a JSON object'); + } + $sig = static::urlsafeB64Decode($cryptob64); if (empty($header->alg)) { throw new UnexpectedValueException('Empty algorithm'); } @@ -108,48 +135,35 @@ class JWT throw new UnexpectedValueException('Algorithm not supported'); } - list($keyMaterial, $algorithm) = self::getKeyMaterialAndAlgorithm( - $keyOrKeyArray, - empty($header->kid) ? null : $header->kid - ); + $key = self::getKey($keyOrKeyArray, property_exists($header, 'kid') ? $header->kid : null); - if (empty($algorithm)) { - // Use deprecated "allowed_algs" to determine if the algorithm is supported. - // This opens up the possibility of an attack in some implementations. - // @see https://github.com/firebase/php-jwt/issues/351 - if (!\in_array($header->alg, $allowed_algs)) { - throw new UnexpectedValueException('Algorithm not allowed'); - } - } else { - // Check the algorithm - if (!self::constantTimeEquals($algorithm, $header->alg)) { - // See issue #351 - throw new UnexpectedValueException('Incorrect key for this algorithm'); - } + // Check the algorithm + if (!self::constantTimeEquals($key->getAlgorithm(), $header->alg)) { + // See issue #351 + throw new UnexpectedValueException('Incorrect key for this algorithm'); } - if ($header->alg === 'ES256' || $header->alg === 'ES384') { - // OpenSSL expects an ASN.1 DER sequence for ES256/ES384 signatures + if (\in_array($header->alg, ['ES256', 'ES256K', 'ES384'], true)) { + // OpenSSL expects an ASN.1 DER sequence for ES256/ES256K/ES384 signatures $sig = self::signatureToDER($sig); } - - if (!static::verify("$headb64.$bodyb64", $sig, $keyMaterial, $header->alg)) { + if (!self::verify("{$headb64}.{$bodyb64}", $sig, $key->getKeyMaterial(), $header->alg)) { throw new SignatureInvalidException('Signature verification failed'); } // Check the nbf if it is defined. This is the time that the // token can actually be used. If it's not yet that time, abort. - if (isset($payload->nbf) && $payload->nbf > ($timestamp + static::$leeway)) { + if (isset($payload->nbf) && floor($payload->nbf) > ($timestamp + static::$leeway)) { throw new BeforeValidException( - 'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->nbf) + 'Cannot handle token with nbf prior to ' . \date(DateTime::ISO8601, (int) $payload->nbf) ); } // Check that this token has been created before 'now'. This prevents // using tokens that have been created for later use (and haven't // correctly used the nbf claim). - if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) { + if (!isset($payload->nbf) && isset($payload->iat) && floor($payload->iat) > ($timestamp + static::$leeway)) { throw new BeforeValidException( - 'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->iat) + 'Cannot handle token with iat prior to ' . \date(DateTime::ISO8601, (int) $payload->iat) ); } @@ -162,34 +176,37 @@ class JWT } /** - * Converts and signs a PHP object or array into a JWT string. + * Converts and signs a PHP array into a JWT string. * - * @param object|array $payload PHP object or array - * @param string|resource $key The secret key. - * If the algorithm used is asymmetric, this is the private key - * @param string $alg The signing algorithm. - * Supported algorithms are 'ES384','ES256', 'HS256', 'HS384', - * 'HS512', 'RS256', 'RS384', and 'RS512' - * @param mixed $keyId - * @param array $head An array with header elements to attach + * @param array $payload PHP array + * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $key The secret key. + * @param string $alg Supported algorithms are 'ES384','ES256', 'ES256K', 'HS256', + * 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512' + * @param string $keyId + * @param array $head An array with header elements to attach * * @return string A signed JWT * * @uses jsonEncode * @uses urlsafeB64Encode */ - public static function encode($payload, $key, $alg = 'HS256', $keyId = null, $head = null) - { - $header = array('typ' => 'JWT', 'alg' => $alg); + public static function encode( + array $payload, + $key, + string $alg, + string $keyId = null, + array $head = null + ): string { + $header = ['typ' => 'JWT', 'alg' => $alg]; if ($keyId !== null) { $header['kid'] = $keyId; } if (isset($head) && \is_array($head)) { $header = \array_merge($head, $header); } - $segments = array(); - $segments[] = static::urlsafeB64Encode(static::jsonEncode($header)); - $segments[] = static::urlsafeB64Encode(static::jsonEncode($payload)); + $segments = []; + $segments[] = static::urlsafeB64Encode((string) static::jsonEncode($header)); + $segments[] = static::urlsafeB64Encode((string) static::jsonEncode($payload)); $signing_input = \implode('.', $segments); $signature = static::sign($signing_input, $key, $alg); @@ -201,67 +218,84 @@ class JWT /** * Sign a string with a given key and algorithm. * - * @param string $msg The message to sign - * @param string|resource $key The secret key - * @param string $alg The signing algorithm. - * Supported algorithms are 'ES384','ES256', 'HS256', 'HS384', - * 'HS512', 'RS256', 'RS384', and 'RS512' + * @param string $msg The message to sign + * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $key The secret key. + * @param string $alg Supported algorithms are 'EdDSA', 'ES384', 'ES256', 'ES256K', 'HS256', + * 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512' * * @return string An encrypted message * * @throws DomainException Unsupported algorithm or bad key was specified */ - public static function sign($msg, $key, $alg = 'HS256') - { + public static function sign( + string $msg, + $key, + string $alg + ): string { if (empty(static::$supported_algs[$alg])) { throw new DomainException('Algorithm not supported'); } list($function, $algorithm) = static::$supported_algs[$alg]; switch ($function) { case 'hash_hmac': + if (!\is_string($key)) { + throw new InvalidArgumentException('key must be a string when using hmac'); + } return \hash_hmac($algorithm, $msg, $key, true); case 'openssl': $signature = ''; - $success = \openssl_sign($msg, $signature, $key, $algorithm); + $success = \openssl_sign($msg, $signature, $key, $algorithm); // @phpstan-ignore-line if (!$success) { - throw new DomainException("OpenSSL unable to sign data"); + throw new DomainException('OpenSSL unable to sign data'); } - if ($alg === 'ES256') { + if ($alg === 'ES256' || $alg === 'ES256K') { $signature = self::signatureFromDER($signature, 256); } elseif ($alg === 'ES384') { $signature = self::signatureFromDER($signature, 384); } return $signature; case 'sodium_crypto': - if (!function_exists('sodium_crypto_sign_detached')) { + if (!\function_exists('sodium_crypto_sign_detached')) { throw new DomainException('libsodium is not available'); } + if (!\is_string($key)) { + throw new InvalidArgumentException('key must be a string when using EdDSA'); + } try { // The last non-empty line is used as the key. $lines = array_filter(explode("\n", $key)); - $key = base64_decode(end($lines)); + $key = base64_decode((string) end($lines)); + if (\strlen($key) === 0) { + throw new DomainException('Key cannot be empty string'); + } return sodium_crypto_sign_detached($msg, $key); } catch (Exception $e) { throw new DomainException($e->getMessage(), 0, $e); } } + + throw new DomainException('Algorithm not supported'); } /** * Verify a signature with the message, key and method. Not all methods * are symmetric, so we must have a separate verify and sign method. * - * @param string $msg The original message (header and body) - * @param string $signature The original signature - * @param string|resource $key For HS*, a string key works. for RS*, must be a resource of an openssl public key - * @param string $alg The algorithm + * @param string $msg The original message (header and body) + * @param string $signature The original signature + * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial For Ed*, ES*, HS*, a string key works. for RS*, must be an instance of OpenSSLAsymmetricKey + * @param string $alg The algorithm * * @return bool * * @throws DomainException Invalid Algorithm, bad key, or OpenSSL failure */ - private static function verify($msg, $signature, $key, $alg) - { + private static function verify( + string $msg, + string $signature, + $keyMaterial, + string $alg + ): bool { if (empty(static::$supported_algs[$alg])) { throw new DomainException('Algorithm not supported'); } @@ -269,10 +303,11 @@ class JWT list($function, $algorithm) = static::$supported_algs[$alg]; switch ($function) { case 'openssl': - $success = \openssl_verify($msg, $signature, $key, $algorithm); + $success = \openssl_verify($msg, $signature, $keyMaterial, $algorithm); // @phpstan-ignore-line if ($success === 1) { return true; - } elseif ($success === 0) { + } + if ($success === 0) { return false; } // returns 1 on success, 0 on failure, -1 on error. @@ -280,21 +315,33 @@ class JWT 'OpenSSL error: ' . \openssl_error_string() ); case 'sodium_crypto': - if (!function_exists('sodium_crypto_sign_verify_detached')) { - throw new DomainException('libsodium is not available'); - } - try { - // The last non-empty line is used as the key. - $lines = array_filter(explode("\n", $key)); - $key = base64_decode(end($lines)); - return sodium_crypto_sign_verify_detached($signature, $msg, $key); - } catch (Exception $e) { - throw new DomainException($e->getMessage(), 0, $e); - } + if (!\function_exists('sodium_crypto_sign_verify_detached')) { + throw new DomainException('libsodium is not available'); + } + if (!\is_string($keyMaterial)) { + throw new InvalidArgumentException('key must be a string when using EdDSA'); + } + try { + // The last non-empty line is used as the key. + $lines = array_filter(explode("\n", $keyMaterial)); + $key = base64_decode((string) end($lines)); + if (\strlen($key) === 0) { + throw new DomainException('Key cannot be empty string'); + } + if (\strlen($signature) === 0) { + throw new DomainException('Signature cannot be empty string'); + } + return sodium_crypto_sign_verify_detached($signature, $msg, $key); + } catch (Exception $e) { + throw new DomainException($e->getMessage(), 0, $e); + } case 'hash_hmac': default: - $hash = \hash_hmac($algorithm, $msg, $key, true); - return self::constantTimeEquals($signature, $hash); + if (!\is_string($keyMaterial)) { + throw new InvalidArgumentException('key must be a string when using hmac'); + } + $hash = \hash_hmac($algorithm, $msg, $keyMaterial, true); + return self::constantTimeEquals($hash, $signature); } } @@ -303,30 +350,16 @@ class JWT * * @param string $input JSON string * - * @return object Object representation of JSON string + * @return mixed The decoded JSON string * * @throws DomainException Provided string was invalid JSON */ - public static function jsonDecode($input) + public static function jsonDecode(string $input) { - if (\version_compare(PHP_VERSION, '5.4.0', '>=') && !(\defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) { - /** In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you - * to specify that large ints (like Steam Transaction IDs) should be treated as - * strings, rather than the PHP default behaviour of converting them to floats. - */ - $obj = \json_decode($input, false, 512, JSON_BIGINT_AS_STRING); - } else { - /** Not all servers will support that, however, so for older versions we must - * manually detect large ints in the JSON string and quote them (thus converting - *them to strings) before decoding, hence the preg_replace() call. - */ - $max_int_length = \strlen((string) PHP_INT_MAX) - 1; - $json_without_bigints = \preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input); - $obj = \json_decode($json_without_bigints); - } + $obj = \json_decode($input, false, 512, JSON_BIGINT_AS_STRING); if ($errno = \json_last_error()) { - static::handleJsonError($errno); + self::handleJsonError($errno); } elseif ($obj === null && $input !== 'null') { throw new DomainException('Null result with non-null input'); } @@ -334,22 +367,30 @@ class JWT } /** - * Encode a PHP object into a JSON string. + * Encode a PHP array into a JSON string. * - * @param object|array $input A PHP object or array + * @param array $input A PHP array * - * @return string JSON representation of the PHP object or array + * @return string JSON representation of the PHP array * * @throws DomainException Provided object could not be encoded to valid JSON */ - public static function jsonEncode($input) + public static function jsonEncode(array $input): string { - $json = \json_encode($input); + if (PHP_VERSION_ID >= 50400) { + $json = \json_encode($input, \JSON_UNESCAPED_SLASHES); + } else { + // PHP 5.3 only + $json = \json_encode($input); + } if ($errno = \json_last_error()) { - static::handleJsonError($errno); - } elseif ($json === 'null' && $input !== null) { + self::handleJsonError($errno); + } elseif ($json === 'null') { throw new DomainException('Null result with non-null input'); } + if ($json === false) { + throw new DomainException('Provided object could not be encoded to valid JSON'); + } return $json; } @@ -359,15 +400,32 @@ class JWT * @param string $input A Base64 encoded string * * @return string A decoded string + * + * @throws InvalidArgumentException invalid base64 characters */ - public static function urlsafeB64Decode($input) + public static function urlsafeB64Decode(string $input): string + { + return \base64_decode(self::convertBase64UrlToBase64($input)); + } + + /** + * Convert a string in the base64url (URL-safe Base64) encoding to standard base64. + * + * @param string $input A Base64 encoded string with URL-safe characters (-_ and no padding) + * + * @return string A Base64 encoded string with standard characters (+/) and padding (=), when + * needed. + * + * @see https://www.rfc-editor.org/rfc/rfc4648 + */ + public static function convertBase64UrlToBase64(string $input): string { $remainder = \strlen($input) % 4; if ($remainder) { $padlen = 4 - $remainder; $input .= \str_repeat('=', $padlen); } - return \base64_decode(\strtr($input, '-_', '+/')); + return \strtr($input, '-_', '+/'); } /** @@ -377,7 +435,7 @@ class JWT * * @return string The base64 encode of what you passed in */ - public static function urlsafeB64Encode($input) + public static function urlsafeB64Encode(string $input): string { return \str_replace('=', '', \strtr(\base64_encode($input), '+/', '-_')); } @@ -386,67 +444,54 @@ class JWT /** * Determine if an algorithm has been provided for each Key * - * @param Key|array|mixed $keyOrKeyArray - * @param string|null $kid + * @param Key|ArrayAccess|array $keyOrKeyArray + * @param string|null $kid * * @throws UnexpectedValueException * - * @return array containing the keyMaterial and algorithm + * @return Key */ - private static function getKeyMaterialAndAlgorithm($keyOrKeyArray, $kid = null) - { - if ( - is_string($keyOrKeyArray) - || is_resource($keyOrKeyArray) - || $keyOrKeyArray instanceof OpenSSLAsymmetricKey - ) { - return array($keyOrKeyArray, null); - } - + private static function getKey( + $keyOrKeyArray, + ?string $kid + ): Key { if ($keyOrKeyArray instanceof Key) { - return array($keyOrKeyArray->getKeyMaterial(), $keyOrKeyArray->getAlgorithm()); + return $keyOrKeyArray; } - if (is_array($keyOrKeyArray) || $keyOrKeyArray instanceof ArrayAccess) { - if (!isset($kid)) { - throw new UnexpectedValueException('"kid" empty, unable to lookup correct key'); - } - if (!isset($keyOrKeyArray[$kid])) { - throw new UnexpectedValueException('"kid" invalid, unable to lookup correct key'); - } - - $key = $keyOrKeyArray[$kid]; - - if ($key instanceof Key) { - return array($key->getKeyMaterial(), $key->getAlgorithm()); - } - - return array($key, null); + if (empty($kid) && $kid !== '0') { + throw new UnexpectedValueException('"kid" empty, unable to lookup correct key'); } - throw new UnexpectedValueException( - '$keyOrKeyArray must be a string|resource key, an array of string|resource keys, ' - . 'an instance of Firebase\JWT\Key key or an array of Firebase\JWT\Key keys' - ); + if ($keyOrKeyArray instanceof CachedKeySet) { + // Skip "isset" check, as this will automatically refresh if not set + return $keyOrKeyArray[$kid]; + } + + if (!isset($keyOrKeyArray[$kid])) { + throw new UnexpectedValueException('"kid" invalid, unable to lookup correct key'); + } + + return $keyOrKeyArray[$kid]; } /** - * @param string $left - * @param string $right + * @param string $left The string of known length to compare against + * @param string $right The user-supplied string * @return bool */ - public static function constantTimeEquals($left, $right) + public static function constantTimeEquals(string $left, string $right): bool { if (\function_exists('hash_equals')) { return \hash_equals($left, $right); } - $len = \min(static::safeStrlen($left), static::safeStrlen($right)); + $len = \min(self::safeStrlen($left), self::safeStrlen($right)); $status = 0; for ($i = 0; $i < $len; $i++) { $status |= (\ord($left[$i]) ^ \ord($right[$i])); } - $status |= (static::safeStrlen($left) ^ static::safeStrlen($right)); + $status |= (self::safeStrlen($left) ^ self::safeStrlen($right)); return ($status === 0); } @@ -456,17 +501,19 @@ class JWT * * @param int $errno An error number from json_last_error() * + * @throws DomainException + * * @return void */ - private static function handleJsonError($errno) + private static function handleJsonError(int $errno): void { - $messages = array( + $messages = [ JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON', JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON', JSON_ERROR_UTF8 => 'Malformed UTF-8 characters' //PHP >= 5.3.3 - ); + ]; throw new DomainException( isset($messages[$errno]) ? $messages[$errno] @@ -481,7 +528,7 @@ class JWT * * @return int */ - private static function safeStrlen($str) + private static function safeStrlen(string $str): int { if (\function_exists('mb_strlen')) { return \mb_strlen($str, '8bit'); @@ -495,10 +542,11 @@ class JWT * @param string $sig The ECDSA signature to convert * @return string The encoded DER object */ - private static function signatureToDER($sig) + private static function signatureToDER(string $sig): string { // Separate the signature into r-value and s-value - list($r, $s) = \str_split($sig, (int) (\strlen($sig) / 2)); + $length = max(1, (int) (\strlen($sig) / 2)); + list($r, $s) = \str_split($sig, $length); // Trim leading zeros $r = \ltrim($r, "\x00"); @@ -525,9 +573,10 @@ class JWT * * @param int $type DER tag * @param string $value the value to encode + * * @return string the encoded object */ - private static function encodeDER($type, $value) + private static function encodeDER(int $type, string $value): string { $tag_header = 0; if ($type === self::ASN1_SEQUENCE) { @@ -548,9 +597,10 @@ class JWT * * @param string $der binary signature in DER format * @param int $keySize the number of bits in the key + * * @return string the signature */ - private static function signatureFromDER($der, $keySize) + private static function signatureFromDER(string $der, int $keySize): string { // OpenSSL returns the ECDSA signatures as a binary ASN.1 DER SEQUENCE list($offset, $_) = self::readDER($der); @@ -575,9 +625,10 @@ class JWT * @param string $der the binary data in DER format * @param int $offset the offset of the data stream containing the object * to decode - * @return array [$offset, $data] the new offset and the decoded object + * + * @return array{int, string|null} the new offset and the decoded object */ - private static function readDER($der, $offset = 0) + private static function readDER(string $der, int $offset = 0): array { $pos = $offset; $size = \strlen($der); @@ -595,7 +646,7 @@ class JWT } // Value - if ($type == self::ASN1_BIT_STRING) { + if ($type === self::ASN1_BIT_STRING) { $pos++; // Skip the first contents octet (padding indicator) $data = \substr($der, $pos, $len - 1); $pos += $len - 1; @@ -606,6 +657,6 @@ class JWT $data = null; } - return array($pos, $data); + return [$pos, $data]; } } diff --git a/vendor/firebase/php-jwt/src/Key.php b/vendor/firebase/php-jwt/src/Key.php index f1ede6f..00cf7f2 100644 --- a/vendor/firebase/php-jwt/src/Key.php +++ b/vendor/firebase/php-jwt/src/Key.php @@ -4,37 +4,42 @@ namespace Firebase\JWT; use InvalidArgumentException; use OpenSSLAsymmetricKey; +use OpenSSLCertificate; +use TypeError; class Key { - /** @var string $algorithm */ + /** @var string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate */ + private $keyMaterial; + /** @var string */ private $algorithm; - /** @var string|resource|OpenSSLAsymmetricKey $keyMaterial */ - private $keyMaterial; - /** - * @param string|resource|OpenSSLAsymmetricKey $keyMaterial + * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial * @param string $algorithm */ - public function __construct($keyMaterial, $algorithm) - { + public function __construct( + $keyMaterial, + string $algorithm + ) { if ( - !is_string($keyMaterial) - && !is_resource($keyMaterial) + !\is_string($keyMaterial) && !$keyMaterial instanceof OpenSSLAsymmetricKey + && !$keyMaterial instanceof OpenSSLCertificate + && !\is_resource($keyMaterial) ) { - throw new InvalidArgumentException('Type error: $keyMaterial must be a string, resource, or OpenSSLAsymmetricKey'); + throw new TypeError('Key material must be a string, resource, or OpenSSLAsymmetricKey'); } if (empty($keyMaterial)) { - throw new InvalidArgumentException('Type error: $keyMaterial must not be empty'); + throw new InvalidArgumentException('Key material must not be empty'); } - if (!is_string($algorithm)|| empty($keyMaterial)) { - throw new InvalidArgumentException('Type error: $algorithm must be a string'); + if (empty($algorithm)) { + throw new InvalidArgumentException('Algorithm must not be empty'); } + // TODO: Remove in PHP 8.0 in favor of class constructor property promotion $this->keyMaterial = $keyMaterial; $this->algorithm = $algorithm; } @@ -44,13 +49,13 @@ class Key * * @return string */ - public function getAlgorithm() + public function getAlgorithm(): string { return $this->algorithm; } /** - * @return string|resource|OpenSSLAsymmetricKey + * @return string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate */ public function getKeyMaterial() { diff --git a/vendor/league/mime-type-detection/CHANGELOG.md b/vendor/league/mime-type-detection/CHANGELOG.md index 2264f7a..653ca51 100644 --- a/vendor/league/mime-type-detection/CHANGELOG.md +++ b/vendor/league/mime-type-detection/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 1.13.0 - 2022-08-05 + +### Added + +- A reverse lookup mechanism to fetch one or all extensions for a given mimetype + +## 1.12.0 - 2022-08-03 + +### Updated + +- Updated lookup + +## 1.11.0 - 2022-04-17 + +### Updated + +- Updated lookup + ## 1.10.0 - 2022-04-11 ### Fixed diff --git a/vendor/league/mime-type-detection/LICENSE b/vendor/league/mime-type-detection/LICENSE index 1f01652..39d50b5 100644 --- a/vendor/league/mime-type-detection/LICENSE +++ b/vendor/league/mime-type-detection/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013-2022 Frank de Jonge +Copyright (c) 2013-2023 Frank de Jonge Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/league/mime-type-detection/composer.json b/vendor/league/mime-type-detection/composer.json index 80ca1af..cd75bee 100644 --- a/vendor/league/mime-type-detection/composer.json +++ b/vendor/league/mime-type-detection/composer.json @@ -13,11 +13,11 @@ "phpstan": "vendor/bin/phpstan analyse -l 6 src" }, "require": { - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", "ext-fileinfo": "*" }, "require-dev": { - "phpunit/phpunit": "^8.5.8 || ^9.3", + "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0", "phpstan/phpstan": "^0.12.68", "friendsofphp/php-cs-fixer": "^3.2" }, @@ -28,7 +28,7 @@ }, "config": { "platform": { - "php": "7.2.0" + "php": "7.4.0" } } } diff --git a/vendor/league/mime-type-detection/src/ExtensionLookup.php b/vendor/league/mime-type-detection/src/ExtensionLookup.php new file mode 100644 index 0000000..14b89df --- /dev/null +++ b/vendor/league/mime-type-detection/src/ExtensionLookup.php @@ -0,0 +1,14 @@ +extensions instanceof ExtensionLookup + ? $this->extensions->lookupExtension($mimetype) + : null; + } + + public function lookupAllExtensions(string $mimetype): array + { + return $this->extensions instanceof ExtensionLookup + ? $this->extensions->lookupAllExtensions($mimetype) + : []; + } } diff --git a/vendor/league/mime-type-detection/src/FinfoMimeTypeDetector.php b/vendor/league/mime-type-detection/src/FinfoMimeTypeDetector.php index ba91938..8084f92 100644 --- a/vendor/league/mime-type-detection/src/FinfoMimeTypeDetector.php +++ b/vendor/league/mime-type-detection/src/FinfoMimeTypeDetector.php @@ -9,7 +9,7 @@ use const FILEINFO_MIME_TYPE; use const PATHINFO_EXTENSION; use finfo; -class FinfoMimeTypeDetector implements MimeTypeDetector +class FinfoMimeTypeDetector implements MimeTypeDetector, ExtensionLookup { private const INCONCLUSIVE_MIME_TYPES = [ 'application/x-empty', @@ -89,4 +89,18 @@ class FinfoMimeTypeDetector implements MimeTypeDetector return (string) substr($contents, 0, $this->bufferSampleSize); } + + public function lookupExtension(string $mimetype): ?string + { + return $this->extensionMap instanceof ExtensionLookup + ? $this->extensionMap->lookupExtension($mimetype) + : null; + } + + public function lookupAllExtensions(string $mimetype): array + { + return $this->extensionMap instanceof ExtensionLookup + ? $this->extensionMap->lookupAllExtensions($mimetype) + : []; + } } diff --git a/vendor/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php b/vendor/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php index f092388..72f515f 100644 --- a/vendor/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php +++ b/vendor/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php @@ -4,10 +4,10 @@ declare(strict_types=1); namespace League\MimeTypeDetection; -class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap +class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap, ExtensionLookup { /** - * @var string[] + * @var array * * @internal */ @@ -23,7 +23,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap '7zip' => 'application/x-7z-compressed', '123' => 'application/vnd.lotus-1-2-3', 'aab' => 'application/x-authorware-bin', - 'aac' => 'audio/x-acc', + 'aac' => 'audio/acc', 'aam' => 'application/x-authorware-map', 'aas' => 'application/x-authorware-seg', 'abw' => 'application/x-abiword', @@ -34,6 +34,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'acu' => 'application/vnd.acucobol', 'acutc' => 'application/vnd.acucorp', 'adp' => 'audio/adpcm', + 'adts' => 'audio/aac', 'aep' => 'application/vnd.audiograph', 'afm' => 'application/x-font-type1', 'afp' => 'application/vnd.ibm.modcap', @@ -46,11 +47,16 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'air' => 'application/vnd.adobe.air-application-installer-package+zip', 'ait' => 'application/vnd.dvb.ait', 'ami' => 'application/vnd.amiga.ami', + 'aml' => 'application/automationml-aml+xml', + 'amlx' => 'application/automationml-amlx+zip', 'amr' => 'audio/amr', 'apk' => 'application/vnd.android.package-archive', 'apng' => 'image/apng', 'appcache' => 'text/cache-manifest', + 'appinstaller' => 'application/appinstaller', 'application' => 'application/x-ms-application', + 'appx' => 'application/appx', + 'appxbundle' => 'application/appxbundle', 'apr' => 'application/vnd.lotus-approach', 'arc' => 'application/x-freearc', 'arj' => 'application/x-arj', @@ -95,6 +101,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'bpk' => 'application/octet-stream', 'bpmn' => 'application/octet-stream', 'bsp' => 'model/vnd.valve.source.compiled-map', + 'btf' => 'image/prs.btif', 'btif' => 'image/prs.btif', 'buffer' => 'application/octet-stream', 'bz' => 'application/x-bzip', @@ -146,6 +153,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'cjs' => 'application/node', 'cla' => 'application/vnd.claymore', 'class' => 'application/octet-stream', + 'cld' => 'model/vnd.cld', 'clkk' => 'application/vnd.crick.clicker.keyboard', 'clkp' => 'application/vnd.crick.clicker.palette', 'clkt' => 'application/vnd.crick.clicker.template', @@ -180,6 +188,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'csv' => 'text/csv', 'cu' => 'application/cu-seeme', 'curl' => 'text/vnd.curl', + 'cwl' => 'application/cwl', 'cww' => 'application/prs.cww', 'cxt' => 'application/x-director', 'cxx' => 'text/x-c', @@ -202,6 +211,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'der' => 'application/x-x509-ca-cert', 'dfac' => 'application/vnd.dreamfactory', 'dgc' => 'application/x-dgc-compressed', + 'dib' => 'image/bmp', 'dic' => 'text/x-c', 'dir' => 'application/x-director', 'dis' => 'application/vnd.mobius.dis', @@ -224,6 +234,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'dp' => 'application/vnd.osgi.dp', 'dpg' => 'application/vnd.dpgraph', + 'dpx' => 'image/dpx', 'dra' => 'audio/vnd.dra', 'drle' => 'image/dicom-rle', 'dsc' => 'text/prs.lines.tag', @@ -260,7 +271,6 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'eot' => 'application/vnd.ms-fontobject', 'eps' => 'application/postscript', 'epub' => 'application/epub+zip', - 'es' => 'application/ecmascript', 'es3' => 'application/vnd.eszigno3+xml', 'esa' => 'application/vnd.osgi.subsystem', 'esf' => 'application/vnd.epson.esf', @@ -453,6 +463,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'jsonld' => 'application/ld+json', 'jsonml' => 'application/jsonml+json', 'jsx' => 'text/jsx', + 'jt' => 'model/jt', 'jxr' => 'image/jxr', 'jxra' => 'image/jxra', 'jxrs' => 'image/jxrs', @@ -557,7 +568,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'mime' => 'message/rfc822', 'mj2' => 'video/mj2', 'mjp2' => 'video/mj2', - 'mjs' => 'application/javascript', + 'mjs' => 'text/javascript', 'mk3d' => 'video/x-matroska', 'mka' => 'audio/x-matroska', 'mkd' => 'text/x-markdown', @@ -607,6 +618,8 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'msg' => 'application/vnd.ms-outlook', 'msh' => 'model/mesh', 'msi' => 'application/x-msdownload', + 'msix' => 'application/msix', + 'msixbundle' => 'application/msixbundle', 'msl' => 'application/vnd.mobius.msl', 'msm' => 'application/octet-stream', 'msp' => 'application/octet-stream', @@ -780,6 +793,8 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'pvb' => 'application/vnd.3gpp.pic-bw-var', 'pwn' => 'application/vnd.3m.post-it-notes', 'pya' => 'audio/vnd.ms-playready.media.pya', + 'pyo' => 'model/vnd.pytha.pyox', + 'pyox' => 'model/vnd.pytha.pyox', 'pyv' => 'video/vnd.ms-playready.media.pyv', 'qam' => 'application/vnd.epson.quickanime', 'qbo' => 'application/vnd.intu.qbo', @@ -928,10 +943,12 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'st' => 'application/vnd.sailingtracker.track', 'stc' => 'application/vnd.sun.xml.calc.template', 'std' => 'application/vnd.sun.xml.draw.template', + 'step' => 'application/STEP', 'stf' => 'application/vnd.wt.stf', 'sti' => 'application/vnd.sun.xml.impress.template', 'stk' => 'application/hyperstudio', 'stl' => 'model/stl', + 'stp' => 'application/STEP', 'stpx' => 'model/step+xml', 'stpxz' => 'model/step-xml+zip', 'stpz' => 'model/step+zip', @@ -1018,10 +1035,12 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'ulx' => 'application/x-glulx', 'umj' => 'application/vnd.umajin', 'unityweb' => 'application/vnd.unity', + 'uo' => 'application/vnd.uoml+xml', 'uoml' => 'application/vnd.uoml+xml', 'uri' => 'text/uri-list', 'uris' => 'text/uri-list', 'urls' => 'text/uri-list', + 'usda' => 'model/vnd.usda', 'usdz' => 'model/vnd.usdz+zip', 'ustar' => 'application/x-ustar', 'utz' => 'application/vnd.uiq.theme', @@ -1101,6 +1120,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'webmanifest' => 'application/manifest+json', 'webp' => 'image/webp', 'wg' => 'application/vnd.pmi.widget', + 'wgsl' => 'text/wgsl', 'wgt' => 'application/widget', 'wif' => 'application/watcherinfo+xml', 'wks' => 'application/vnd.ms-works', @@ -1155,9 +1175,10 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'xel' => 'application/xcap-el+xml', 'xenc' => 'application/xenc+xml', 'xer' => 'application/patch-ops-error+xml', - 'xfdf' => 'application/vnd.adobe.xfdf', + 'xfdf' => 'application/xfdf', 'xfdl' => 'application/vnd.xfdl', 'xht' => 'application/xhtml+xml', + 'xhtm' => 'application/vnd.pwg-xhtml-print+xml', 'xhtml' => 'application/xhtml+xml', 'xhvml' => 'application/xv+xml', 'xif' => 'image/vnd.xiff', @@ -1188,6 +1209,7 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'xpw' => 'application/vnd.intercon.formnet', 'xpx' => 'application/vnd.intercon.formnet', 'xsd' => 'application/xml', + 'xsf' => 'application/prs.xsf+xml', 'xsl' => 'application/xml', 'xslt' => 'application/xslt+xml', 'xsm' => 'application/vnd.syncml+xml', @@ -1220,8 +1242,1050 @@ class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap 'zsh' => 'text/x-scriptzsh', ]; + /** + * @var array + * + * @internal + */ + public const EXTENSIONS_FOR_MIME_TIMES = [ + 'application/andrew-inset' => ['ez'], + 'application/appinstaller' => ['appinstaller'], + 'application/applixware' => ['aw'], + 'application/appx' => ['appx'], + 'application/appxbundle' => ['appxbundle'], + 'application/atom+xml' => ['atom'], + 'application/atomcat+xml' => ['atomcat'], + 'application/atomdeleted+xml' => ['atomdeleted'], + 'application/atomsvc+xml' => ['atomsvc'], + 'application/atsc-dwd+xml' => ['dwd'], + 'application/atsc-held+xml' => ['held'], + 'application/atsc-rsat+xml' => ['rsat'], + 'application/automationml-aml+xml' => ['aml'], + 'application/automationml-amlx+zip' => ['amlx'], + 'application/bdoc' => ['bdoc'], + 'application/calendar+xml' => ['xcs'], + 'application/ccxml+xml' => ['ccxml'], + 'application/cdfx+xml' => ['cdfx'], + 'application/cdmi-capability' => ['cdmia'], + 'application/cdmi-container' => ['cdmic'], + 'application/cdmi-domain' => ['cdmid'], + 'application/cdmi-object' => ['cdmio'], + 'application/cdmi-queue' => ['cdmiq'], + 'application/cpl+xml' => ['cpl'], + 'application/cu-seeme' => ['cu'], + 'application/cwl' => ['cwl'], + 'application/dash+xml' => ['mpd'], + 'application/dash-patch+xml' => ['mpp'], + 'application/davmount+xml' => ['davmount'], + 'application/docbook+xml' => ['dbk'], + 'application/dssc+der' => ['dssc'], + 'application/dssc+xml' => ['xdssc'], + 'application/ecmascript' => ['ecma'], + 'application/emma+xml' => ['emma'], + 'application/emotionml+xml' => ['emotionml'], + 'application/epub+zip' => ['epub'], + 'application/exi' => ['exi'], + 'application/express' => ['exp'], + 'application/fdf' => ['fdf'], + 'application/fdt+xml' => ['fdt'], + 'application/font-tdpfr' => ['pfr'], + 'application/geo+json' => ['geojson'], + 'application/gml+xml' => ['gml'], + 'application/gpx+xml' => ['gpx'], + 'application/gxf' => ['gxf'], + 'application/gzip' => ['gz', 'gzip'], + 'application/hjson' => ['hjson'], + 'application/hyperstudio' => ['stk'], + 'application/inkml+xml' => ['ink', 'inkml'], + 'application/ipfix' => ['ipfix'], + 'application/its+xml' => ['its'], + 'application/java-archive' => ['jar', 'war', 'ear'], + 'application/java-serialized-object' => ['ser'], + 'application/java-vm' => ['class'], + 'application/javascript' => ['js'], + 'application/json' => ['json', 'map'], + 'application/json5' => ['json5'], + 'application/jsonml+json' => ['jsonml'], + 'application/ld+json' => ['jsonld'], + 'application/lgr+xml' => ['lgr'], + 'application/lost+xml' => ['lostxml'], + 'application/mac-binhex40' => ['hqx'], + 'application/mac-compactpro' => ['cpt'], + 'application/mads+xml' => ['mads'], + 'application/manifest+json' => ['webmanifest'], + 'application/marc' => ['mrc'], + 'application/marcxml+xml' => ['mrcx'], + 'application/mathematica' => ['ma', 'nb', 'mb'], + 'application/mathml+xml' => ['mathml'], + 'application/mbox' => ['mbox'], + 'application/media-policy-dataset+xml' => ['mpf'], + 'application/mediaservercontrol+xml' => ['mscml'], + 'application/metalink+xml' => ['metalink'], + 'application/metalink4+xml' => ['meta4'], + 'application/mets+xml' => ['mets'], + 'application/mmt-aei+xml' => ['maei'], + 'application/mmt-usd+xml' => ['musd'], + 'application/mods+xml' => ['mods'], + 'application/mp21' => ['m21', 'mp21'], + 'application/mp4' => ['mp4', 'mpg4', 'mp4s', 'm4p'], + 'application/msix' => ['msix'], + 'application/msixbundle' => ['msixbundle'], + 'application/msword' => ['doc', 'dot', 'word'], + 'application/mxf' => ['mxf'], + 'application/n-quads' => ['nq'], + 'application/n-triples' => ['nt'], + 'application/node' => ['cjs'], + 'application/octet-stream' => ['bin', 'dms', 'lrf', 'mar', 'so', 'dist', 'distz', 'pkg', 'bpk', 'dump', 'elc', 'deploy', 'exe', 'dll', 'deb', 'dmg', 'iso', 'img', 'msi', 'msp', 'msm', 'buffer', 'phar', 'lha', 'lzh', 'class', 'sea', 'dmn', 'bpmn', 'kdb', 'sst', 'csr'], + 'application/oda' => ['oda'], + 'application/oebps-package+xml' => ['opf'], + 'application/ogg' => ['ogx'], + 'application/omdoc+xml' => ['omdoc'], + 'application/onenote' => ['onetoc', 'onetoc2', 'onetmp', 'onepkg'], + 'application/oxps' => ['oxps'], + 'application/p2p-overlay+xml' => ['relo'], + 'application/patch-ops-error+xml' => ['xer'], + 'application/pdf' => ['pdf', 'ai'], + 'application/pgp-encrypted' => ['pgp'], + 'application/pgp-keys' => ['asc'], + 'application/pgp-signature' => ['sig', 'asc'], + 'application/pics-rules' => ['prf'], + 'application/pkcs10' => ['p10'], + 'application/pkcs7-mime' => ['p7m', 'p7c'], + 'application/pkcs7-signature' => ['p7s'], + 'application/pkcs8' => ['p8'], + 'application/pkix-attr-cert' => ['ac'], + 'application/pkix-cert' => ['cer'], + 'application/pkix-crl' => ['crl'], + 'application/pkix-pkipath' => ['pkipath'], + 'application/pkixcmp' => ['pki'], + 'application/pls+xml' => ['pls'], + 'application/postscript' => ['ai', 'eps', 'ps'], + 'application/provenance+xml' => ['provx'], + 'application/prs.cww' => ['cww'], + 'application/prs.xsf+xml' => ['xsf'], + 'application/pskc+xml' => ['pskcxml'], + 'application/raml+yaml' => ['raml'], + 'application/rdf+xml' => ['rdf', 'owl'], + 'application/reginfo+xml' => ['rif'], + 'application/relax-ng-compact-syntax' => ['rnc'], + 'application/resource-lists+xml' => ['rl'], + 'application/resource-lists-diff+xml' => ['rld'], + 'application/rls-services+xml' => ['rs'], + 'application/route-apd+xml' => ['rapd'], + 'application/route-s-tsid+xml' => ['sls'], + 'application/route-usd+xml' => ['rusd'], + 'application/rpki-ghostbusters' => ['gbr'], + 'application/rpki-manifest' => ['mft'], + 'application/rpki-roa' => ['roa'], + 'application/rsd+xml' => ['rsd'], + 'application/rss+xml' => ['rss'], + 'application/rtf' => ['rtf'], + 'application/sbml+xml' => ['sbml'], + 'application/scvp-cv-request' => ['scq'], + 'application/scvp-cv-response' => ['scs'], + 'application/scvp-vp-request' => ['spq'], + 'application/scvp-vp-response' => ['spp'], + 'application/sdp' => ['sdp'], + 'application/senml+xml' => ['senmlx'], + 'application/sensml+xml' => ['sensmlx'], + 'application/set-payment-initiation' => ['setpay'], + 'application/set-registration-initiation' => ['setreg'], + 'application/shf+xml' => ['shf'], + 'application/sieve' => ['siv', 'sieve'], + 'application/smil+xml' => ['smi', 'smil'], + 'application/sparql-query' => ['rq'], + 'application/sparql-results+xml' => ['srx'], + 'application/sql' => ['sql'], + 'application/srgs' => ['gram'], + 'application/srgs+xml' => ['grxml'], + 'application/sru+xml' => ['sru'], + 'application/ssdl+xml' => ['ssdl'], + 'application/ssml+xml' => ['ssml'], + 'application/swid+xml' => ['swidtag'], + 'application/tei+xml' => ['tei', 'teicorpus'], + 'application/thraud+xml' => ['tfi'], + 'application/timestamped-data' => ['tsd'], + 'application/toml' => ['toml'], + 'application/trig' => ['trig'], + 'application/ttml+xml' => ['ttml'], + 'application/ubjson' => ['ubj'], + 'application/urc-ressheet+xml' => ['rsheet'], + 'application/urc-targetdesc+xml' => ['td'], + 'application/vnd.1000minds.decision-model+xml' => ['1km'], + 'application/vnd.3gpp.pic-bw-large' => ['plb'], + 'application/vnd.3gpp.pic-bw-small' => ['psb'], + 'application/vnd.3gpp.pic-bw-var' => ['pvb'], + 'application/vnd.3gpp2.tcap' => ['tcap'], + 'application/vnd.3m.post-it-notes' => ['pwn'], + 'application/vnd.accpac.simply.aso' => ['aso'], + 'application/vnd.accpac.simply.imp' => ['imp'], + 'application/vnd.acucobol' => ['acu'], + 'application/vnd.acucorp' => ['atc', 'acutc'], + 'application/vnd.adobe.air-application-installer-package+zip' => ['air'], + 'application/vnd.adobe.formscentral.fcdt' => ['fcdt'], + 'application/vnd.adobe.fxp' => ['fxp', 'fxpl'], + 'application/vnd.adobe.xdp+xml' => ['xdp'], + 'application/vnd.adobe.xfdf' => ['xfdf'], + 'application/vnd.age' => ['age'], + 'application/vnd.ahead.space' => ['ahead'], + 'application/vnd.airzip.filesecure.azf' => ['azf'], + 'application/vnd.airzip.filesecure.azs' => ['azs'], + 'application/vnd.amazon.ebook' => ['azw'], + 'application/vnd.americandynamics.acc' => ['acc'], + 'application/vnd.amiga.ami' => ['ami'], + 'application/vnd.android.package-archive' => ['apk'], + 'application/vnd.anser-web-certificate-issue-initiation' => ['cii'], + 'application/vnd.anser-web-funds-transfer-initiation' => ['fti'], + 'application/vnd.antix.game-component' => ['atx'], + 'application/vnd.apple.installer+xml' => ['mpkg'], + 'application/vnd.apple.keynote' => ['key'], + 'application/vnd.apple.mpegurl' => ['m3u8'], + 'application/vnd.apple.numbers' => ['numbers'], + 'application/vnd.apple.pages' => ['pages'], + 'application/vnd.apple.pkpass' => ['pkpass'], + 'application/vnd.aristanetworks.swi' => ['swi'], + 'application/vnd.astraea-software.iota' => ['iota'], + 'application/vnd.audiograph' => ['aep'], + 'application/vnd.balsamiq.bmml+xml' => ['bmml'], + 'application/vnd.blueice.multipass' => ['mpm'], + 'application/vnd.bmi' => ['bmi'], + 'application/vnd.businessobjects' => ['rep'], + 'application/vnd.chemdraw+xml' => ['cdxml'], + 'application/vnd.chipnuts.karaoke-mmd' => ['mmd'], + 'application/vnd.cinderella' => ['cdy'], + 'application/vnd.citationstyles.style+xml' => ['csl'], + 'application/vnd.claymore' => ['cla'], + 'application/vnd.cloanto.rp9' => ['rp9'], + 'application/vnd.clonk.c4group' => ['c4g', 'c4d', 'c4f', 'c4p', 'c4u'], + 'application/vnd.cluetrust.cartomobile-config' => ['c11amc'], + 'application/vnd.cluetrust.cartomobile-config-pkg' => ['c11amz'], + 'application/vnd.commonspace' => ['csp'], + 'application/vnd.contact.cmsg' => ['cdbcmsg'], + 'application/vnd.cosmocaller' => ['cmc'], + 'application/vnd.crick.clicker' => ['clkx'], + 'application/vnd.crick.clicker.keyboard' => ['clkk'], + 'application/vnd.crick.clicker.palette' => ['clkp'], + 'application/vnd.crick.clicker.template' => ['clkt'], + 'application/vnd.crick.clicker.wordbank' => ['clkw'], + 'application/vnd.criticaltools.wbs+xml' => ['wbs'], + 'application/vnd.ctc-posml' => ['pml'], + 'application/vnd.cups-ppd' => ['ppd'], + 'application/vnd.curl.car' => ['car'], + 'application/vnd.curl.pcurl' => ['pcurl'], + 'application/vnd.dart' => ['dart'], + 'application/vnd.data-vision.rdz' => ['rdz'], + 'application/vnd.dbf' => ['dbf'], + 'application/vnd.dece.data' => ['uvf', 'uvvf', 'uvd', 'uvvd'], + 'application/vnd.dece.ttml+xml' => ['uvt', 'uvvt'], + 'application/vnd.dece.unspecified' => ['uvx', 'uvvx'], + 'application/vnd.dece.zip' => ['uvz', 'uvvz'], + 'application/vnd.denovo.fcselayout-link' => ['fe_launch'], + 'application/vnd.dna' => ['dna'], + 'application/vnd.dolby.mlp' => ['mlp'], + 'application/vnd.dpgraph' => ['dpg'], + 'application/vnd.dreamfactory' => ['dfac'], + 'application/vnd.ds-keypoint' => ['kpxx'], + 'application/vnd.dvb.ait' => ['ait'], + 'application/vnd.dvb.service' => ['svc'], + 'application/vnd.dynageo' => ['geo'], + 'application/vnd.ecowin.chart' => ['mag'], + 'application/vnd.enliven' => ['nml'], + 'application/vnd.epson.esf' => ['esf'], + 'application/vnd.epson.msf' => ['msf'], + 'application/vnd.epson.quickanime' => ['qam'], + 'application/vnd.epson.salt' => ['slt'], + 'application/vnd.epson.ssf' => ['ssf'], + 'application/vnd.eszigno3+xml' => ['es3', 'et3'], + 'application/vnd.ezpix-album' => ['ez2'], + 'application/vnd.ezpix-package' => ['ez3'], + 'application/vnd.fdf' => ['fdf'], + 'application/vnd.fdsn.mseed' => ['mseed'], + 'application/vnd.fdsn.seed' => ['seed', 'dataless'], + 'application/vnd.flographit' => ['gph'], + 'application/vnd.fluxtime.clip' => ['ftc'], + 'application/vnd.framemaker' => ['fm', 'frame', 'maker', 'book'], + 'application/vnd.frogans.fnc' => ['fnc'], + 'application/vnd.frogans.ltf' => ['ltf'], + 'application/vnd.fsc.weblaunch' => ['fsc'], + 'application/vnd.fujitsu.oasys' => ['oas'], + 'application/vnd.fujitsu.oasys2' => ['oa2'], + 'application/vnd.fujitsu.oasys3' => ['oa3'], + 'application/vnd.fujitsu.oasysgp' => ['fg5'], + 'application/vnd.fujitsu.oasysprs' => ['bh2'], + 'application/vnd.fujixerox.ddd' => ['ddd'], + 'application/vnd.fujixerox.docuworks' => ['xdw'], + 'application/vnd.fujixerox.docuworks.binder' => ['xbd'], + 'application/vnd.fuzzysheet' => ['fzs'], + 'application/vnd.genomatix.tuxedo' => ['txd'], + 'application/vnd.geogebra.file' => ['ggb'], + 'application/vnd.geogebra.tool' => ['ggt'], + 'application/vnd.geometry-explorer' => ['gex', 'gre'], + 'application/vnd.geonext' => ['gxt'], + 'application/vnd.geoplan' => ['g2w'], + 'application/vnd.geospace' => ['g3w'], + 'application/vnd.gmx' => ['gmx'], + 'application/vnd.google-apps.document' => ['gdoc'], + 'application/vnd.google-apps.presentation' => ['gslides'], + 'application/vnd.google-apps.spreadsheet' => ['gsheet'], + 'application/vnd.google-earth.kml+xml' => ['kml'], + 'application/vnd.google-earth.kmz' => ['kmz'], + 'application/vnd.grafeq' => ['gqf', 'gqs'], + 'application/vnd.groove-account' => ['gac'], + 'application/vnd.groove-help' => ['ghf'], + 'application/vnd.groove-identity-message' => ['gim'], + 'application/vnd.groove-injector' => ['grv'], + 'application/vnd.groove-tool-message' => ['gtm'], + 'application/vnd.groove-tool-template' => ['tpl'], + 'application/vnd.groove-vcard' => ['vcg'], + 'application/vnd.hal+xml' => ['hal'], + 'application/vnd.handheld-entertainment+xml' => ['zmm'], + 'application/vnd.hbci' => ['hbci'], + 'application/vnd.hhe.lesson-player' => ['les'], + 'application/vnd.hp-hpgl' => ['hpgl'], + 'application/vnd.hp-hpid' => ['hpid'], + 'application/vnd.hp-hps' => ['hps'], + 'application/vnd.hp-jlyt' => ['jlt'], + 'application/vnd.hp-pcl' => ['pcl'], + 'application/vnd.hp-pclxl' => ['pclxl'], + 'application/vnd.hydrostatix.sof-data' => ['sfd-hdstx'], + 'application/vnd.ibm.minipay' => ['mpy'], + 'application/vnd.ibm.modcap' => ['afp', 'listafp', 'list3820'], + 'application/vnd.ibm.rights-management' => ['irm'], + 'application/vnd.ibm.secure-container' => ['sc'], + 'application/vnd.iccprofile' => ['icc', 'icm'], + 'application/vnd.igloader' => ['igl'], + 'application/vnd.immervision-ivp' => ['ivp'], + 'application/vnd.immervision-ivu' => ['ivu'], + 'application/vnd.insors.igm' => ['igm'], + 'application/vnd.intercon.formnet' => ['xpw', 'xpx'], + 'application/vnd.intergeo' => ['i2g'], + 'application/vnd.intu.qbo' => ['qbo'], + 'application/vnd.intu.qfx' => ['qfx'], + 'application/vnd.ipunplugged.rcprofile' => ['rcprofile'], + 'application/vnd.irepository.package+xml' => ['irp'], + 'application/vnd.is-xpr' => ['xpr'], + 'application/vnd.isac.fcs' => ['fcs'], + 'application/vnd.jam' => ['jam'], + 'application/vnd.jcp.javame.midlet-rms' => ['rms'], + 'application/vnd.jisp' => ['jisp'], + 'application/vnd.joost.joda-archive' => ['joda'], + 'application/vnd.kahootz' => ['ktz', 'ktr'], + 'application/vnd.kde.karbon' => ['karbon'], + 'application/vnd.kde.kchart' => ['chrt'], + 'application/vnd.kde.kformula' => ['kfo'], + 'application/vnd.kde.kivio' => ['flw'], + 'application/vnd.kde.kontour' => ['kon'], + 'application/vnd.kde.kpresenter' => ['kpr', 'kpt'], + 'application/vnd.kde.kspread' => ['ksp'], + 'application/vnd.kde.kword' => ['kwd', 'kwt'], + 'application/vnd.kenameaapp' => ['htke'], + 'application/vnd.kidspiration' => ['kia'], + 'application/vnd.kinar' => ['kne', 'knp'], + 'application/vnd.koan' => ['skp', 'skd', 'skt', 'skm'], + 'application/vnd.kodak-descriptor' => ['sse'], + 'application/vnd.las.las+xml' => ['lasxml'], + 'application/vnd.llamagraphics.life-balance.desktop' => ['lbd'], + 'application/vnd.llamagraphics.life-balance.exchange+xml' => ['lbe'], + 'application/vnd.lotus-1-2-3' => ['123'], + 'application/vnd.lotus-approach' => ['apr'], + 'application/vnd.lotus-freelance' => ['pre'], + 'application/vnd.lotus-notes' => ['nsf'], + 'application/vnd.lotus-organizer' => ['org'], + 'application/vnd.lotus-screencam' => ['scm'], + 'application/vnd.lotus-wordpro' => ['lwp'], + 'application/vnd.macports.portpkg' => ['portpkg'], + 'application/vnd.mapbox-vector-tile' => ['mvt'], + 'application/vnd.mcd' => ['mcd'], + 'application/vnd.medcalcdata' => ['mc1'], + 'application/vnd.mediastation.cdkey' => ['cdkey'], + 'application/vnd.mfer' => ['mwf'], + 'application/vnd.mfmp' => ['mfm'], + 'application/vnd.micrografx.flo' => ['flo'], + 'application/vnd.micrografx.igx' => ['igx'], + 'application/vnd.mif' => ['mif'], + 'application/vnd.mobius.daf' => ['daf'], + 'application/vnd.mobius.dis' => ['dis'], + 'application/vnd.mobius.mbk' => ['mbk'], + 'application/vnd.mobius.mqy' => ['mqy'], + 'application/vnd.mobius.msl' => ['msl'], + 'application/vnd.mobius.plc' => ['plc'], + 'application/vnd.mobius.txf' => ['txf'], + 'application/vnd.mophun.application' => ['mpn'], + 'application/vnd.mophun.certificate' => ['mpc'], + 'application/vnd.mozilla.xul+xml' => ['xul'], + 'application/vnd.ms-artgalry' => ['cil'], + 'application/vnd.ms-cab-compressed' => ['cab'], + 'application/vnd.ms-excel' => ['xls', 'xlm', 'xla', 'xlc', 'xlt', 'xlw'], + 'application/vnd.ms-excel.addin.macroenabled.12' => ['xlam'], + 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => ['xlsb'], + 'application/vnd.ms-excel.sheet.macroenabled.12' => ['xlsm'], + 'application/vnd.ms-excel.template.macroenabled.12' => ['xltm'], + 'application/vnd.ms-fontobject' => ['eot'], + 'application/vnd.ms-htmlhelp' => ['chm'], + 'application/vnd.ms-ims' => ['ims'], + 'application/vnd.ms-lrm' => ['lrm'], + 'application/vnd.ms-officetheme' => ['thmx'], + 'application/vnd.ms-outlook' => ['msg'], + 'application/vnd.ms-pki.seccat' => ['cat'], + 'application/vnd.ms-pki.stl' => ['stl'], + 'application/vnd.ms-powerpoint' => ['ppt', 'pps', 'pot', 'ppa'], + 'application/vnd.ms-powerpoint.addin.macroenabled.12' => ['ppam'], + 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => ['pptm'], + 'application/vnd.ms-powerpoint.slide.macroenabled.12' => ['sldm'], + 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => ['ppsm'], + 'application/vnd.ms-powerpoint.template.macroenabled.12' => ['potm'], + 'application/vnd.ms-project' => ['mpp', 'mpt'], + 'application/vnd.ms-word.document.macroenabled.12' => ['docm'], + 'application/vnd.ms-word.template.macroenabled.12' => ['dotm'], + 'application/vnd.ms-works' => ['wps', 'wks', 'wcm', 'wdb'], + 'application/vnd.ms-wpl' => ['wpl'], + 'application/vnd.ms-xpsdocument' => ['xps'], + 'application/vnd.mseq' => ['mseq'], + 'application/vnd.musician' => ['mus'], + 'application/vnd.muvee.style' => ['msty'], + 'application/vnd.mynfc' => ['taglet'], + 'application/vnd.neurolanguage.nlu' => ['nlu'], + 'application/vnd.nitf' => ['ntf', 'nitf'], + 'application/vnd.noblenet-directory' => ['nnd'], + 'application/vnd.noblenet-sealer' => ['nns'], + 'application/vnd.noblenet-web' => ['nnw'], + 'application/vnd.nokia.n-gage.ac+xml' => ['ac'], + 'application/vnd.nokia.n-gage.data' => ['ngdat'], + 'application/vnd.nokia.n-gage.symbian.install' => ['n-gage'], + 'application/vnd.nokia.radio-preset' => ['rpst'], + 'application/vnd.nokia.radio-presets' => ['rpss'], + 'application/vnd.novadigm.edm' => ['edm'], + 'application/vnd.novadigm.edx' => ['edx'], + 'application/vnd.novadigm.ext' => ['ext'], + 'application/vnd.oasis.opendocument.chart' => ['odc'], + 'application/vnd.oasis.opendocument.chart-template' => ['otc'], + 'application/vnd.oasis.opendocument.database' => ['odb'], + 'application/vnd.oasis.opendocument.formula' => ['odf'], + 'application/vnd.oasis.opendocument.formula-template' => ['odft'], + 'application/vnd.oasis.opendocument.graphics' => ['odg'], + 'application/vnd.oasis.opendocument.graphics-template' => ['otg'], + 'application/vnd.oasis.opendocument.image' => ['odi'], + 'application/vnd.oasis.opendocument.image-template' => ['oti'], + 'application/vnd.oasis.opendocument.presentation' => ['odp'], + 'application/vnd.oasis.opendocument.presentation-template' => ['otp'], + 'application/vnd.oasis.opendocument.spreadsheet' => ['ods'], + 'application/vnd.oasis.opendocument.spreadsheet-template' => ['ots'], + 'application/vnd.oasis.opendocument.text' => ['odt'], + 'application/vnd.oasis.opendocument.text-master' => ['odm'], + 'application/vnd.oasis.opendocument.text-template' => ['ott'], + 'application/vnd.oasis.opendocument.text-web' => ['oth'], + 'application/vnd.olpc-sugar' => ['xo'], + 'application/vnd.oma.dd2+xml' => ['dd2'], + 'application/vnd.openblox.game+xml' => ['obgx'], + 'application/vnd.openofficeorg.extension' => ['oxt'], + 'application/vnd.openstreetmap.data+xml' => ['osm'], + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => ['pptx'], + 'application/vnd.openxmlformats-officedocument.presentationml.slide' => ['sldx'], + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => ['ppsx'], + 'application/vnd.openxmlformats-officedocument.presentationml.template' => ['potx'], + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => ['xlsx'], + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => ['xltx'], + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => ['docx'], + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => ['dotx'], + 'application/vnd.osgeo.mapguide.package' => ['mgp'], + 'application/vnd.osgi.dp' => ['dp'], + 'application/vnd.osgi.subsystem' => ['esa'], + 'application/vnd.palm' => ['pdb', 'pqa', 'oprc'], + 'application/vnd.pawaafile' => ['paw'], + 'application/vnd.pg.format' => ['str'], + 'application/vnd.pg.osasli' => ['ei6'], + 'application/vnd.picsel' => ['efif'], + 'application/vnd.pmi.widget' => ['wg'], + 'application/vnd.pocketlearn' => ['plf'], + 'application/vnd.powerbuilder6' => ['pbd'], + 'application/vnd.previewsystems.box' => ['box'], + 'application/vnd.proteus.magazine' => ['mgz'], + 'application/vnd.publishare-delta-tree' => ['qps'], + 'application/vnd.pvi.ptid1' => ['ptid'], + 'application/vnd.pwg-xhtml-print+xml' => ['xhtm'], + 'application/vnd.quark.quarkxpress' => ['qxd', 'qxt', 'qwd', 'qwt', 'qxl', 'qxb'], + 'application/vnd.rar' => ['rar'], + 'application/vnd.realvnc.bed' => ['bed'], + 'application/vnd.recordare.musicxml' => ['mxl'], + 'application/vnd.recordare.musicxml+xml' => ['musicxml'], + 'application/vnd.rig.cryptonote' => ['cryptonote'], + 'application/vnd.rim.cod' => ['cod'], + 'application/vnd.rn-realmedia' => ['rm'], + 'application/vnd.rn-realmedia-vbr' => ['rmvb'], + 'application/vnd.route66.link66+xml' => ['link66'], + 'application/vnd.sailingtracker.track' => ['st'], + 'application/vnd.seemail' => ['see'], + 'application/vnd.sema' => ['sema'], + 'application/vnd.semd' => ['semd'], + 'application/vnd.semf' => ['semf'], + 'application/vnd.shana.informed.formdata' => ['ifm'], + 'application/vnd.shana.informed.formtemplate' => ['itp'], + 'application/vnd.shana.informed.interchange' => ['iif'], + 'application/vnd.shana.informed.package' => ['ipk'], + 'application/vnd.simtech-mindmapper' => ['twd', 'twds'], + 'application/vnd.smaf' => ['mmf'], + 'application/vnd.smart.teacher' => ['teacher'], + 'application/vnd.software602.filler.form+xml' => ['fo'], + 'application/vnd.solent.sdkm+xml' => ['sdkm', 'sdkd'], + 'application/vnd.spotfire.dxp' => ['dxp'], + 'application/vnd.spotfire.sfs' => ['sfs'], + 'application/vnd.stardivision.calc' => ['sdc'], + 'application/vnd.stardivision.draw' => ['sda'], + 'application/vnd.stardivision.impress' => ['sdd'], + 'application/vnd.stardivision.math' => ['smf'], + 'application/vnd.stardivision.writer' => ['sdw', 'vor'], + 'application/vnd.stardivision.writer-global' => ['sgl'], + 'application/vnd.stepmania.package' => ['smzip'], + 'application/vnd.stepmania.stepchart' => ['sm'], + 'application/vnd.sun.wadl+xml' => ['wadl'], + 'application/vnd.sun.xml.calc' => ['sxc'], + 'application/vnd.sun.xml.calc.template' => ['stc'], + 'application/vnd.sun.xml.draw' => ['sxd'], + 'application/vnd.sun.xml.draw.template' => ['std'], + 'application/vnd.sun.xml.impress' => ['sxi'], + 'application/vnd.sun.xml.impress.template' => ['sti'], + 'application/vnd.sun.xml.math' => ['sxm'], + 'application/vnd.sun.xml.writer' => ['sxw'], + 'application/vnd.sun.xml.writer.global' => ['sxg'], + 'application/vnd.sun.xml.writer.template' => ['stw'], + 'application/vnd.sus-calendar' => ['sus', 'susp'], + 'application/vnd.svd' => ['svd'], + 'application/vnd.symbian.install' => ['sis', 'sisx'], + 'application/vnd.syncml+xml' => ['xsm'], + 'application/vnd.syncml.dm+wbxml' => ['bdm'], + 'application/vnd.syncml.dm+xml' => ['xdm'], + 'application/vnd.syncml.dmddf+xml' => ['ddf'], + 'application/vnd.tao.intent-module-archive' => ['tao'], + 'application/vnd.tcpdump.pcap' => ['pcap', 'cap', 'dmp'], + 'application/vnd.tmobile-livetv' => ['tmo'], + 'application/vnd.trid.tpt' => ['tpt'], + 'application/vnd.triscape.mxs' => ['mxs'], + 'application/vnd.trueapp' => ['tra'], + 'application/vnd.ufdl' => ['ufd', 'ufdl'], + 'application/vnd.uiq.theme' => ['utz'], + 'application/vnd.umajin' => ['umj'], + 'application/vnd.unity' => ['unityweb'], + 'application/vnd.uoml+xml' => ['uoml', 'uo'], + 'application/vnd.vcx' => ['vcx'], + 'application/vnd.visio' => ['vsd', 'vst', 'vss', 'vsw'], + 'application/vnd.visionary' => ['vis'], + 'application/vnd.vsf' => ['vsf'], + 'application/vnd.wap.wbxml' => ['wbxml'], + 'application/vnd.wap.wmlc' => ['wmlc'], + 'application/vnd.wap.wmlscriptc' => ['wmlsc'], + 'application/vnd.webturbo' => ['wtb'], + 'application/vnd.wolfram.player' => ['nbp'], + 'application/vnd.wordperfect' => ['wpd'], + 'application/vnd.wqd' => ['wqd'], + 'application/vnd.wt.stf' => ['stf'], + 'application/vnd.xara' => ['xar'], + 'application/vnd.xfdl' => ['xfdl'], + 'application/vnd.yamaha.hv-dic' => ['hvd'], + 'application/vnd.yamaha.hv-script' => ['hvs'], + 'application/vnd.yamaha.hv-voice' => ['hvp'], + 'application/vnd.yamaha.openscoreformat' => ['osf'], + 'application/vnd.yamaha.openscoreformat.osfpvg+xml' => ['osfpvg'], + 'application/vnd.yamaha.smaf-audio' => ['saf'], + 'application/vnd.yamaha.smaf-phrase' => ['spf'], + 'application/vnd.yellowriver-custom-menu' => ['cmp'], + 'application/vnd.zul' => ['zir', 'zirz'], + 'application/vnd.zzazz.deck+xml' => ['zaz'], + 'application/voicexml+xml' => ['vxml'], + 'application/wasm' => ['wasm'], + 'application/watcherinfo+xml' => ['wif'], + 'application/widget' => ['wgt'], + 'application/winhlp' => ['hlp'], + 'application/wsdl+xml' => ['wsdl'], + 'application/wspolicy+xml' => ['wspolicy'], + 'application/x-7z-compressed' => ['7z', '7zip'], + 'application/x-abiword' => ['abw'], + 'application/x-ace-compressed' => ['ace'], + 'application/x-apple-diskimage' => ['dmg'], + 'application/x-arj' => ['arj'], + 'application/x-authorware-bin' => ['aab', 'x32', 'u32', 'vox'], + 'application/x-authorware-map' => ['aam'], + 'application/x-authorware-seg' => ['aas'], + 'application/x-bcpio' => ['bcpio'], + 'application/x-bdoc' => ['bdoc'], + 'application/x-bittorrent' => ['torrent'], + 'application/x-blorb' => ['blb', 'blorb'], + 'application/x-bzip' => ['bz'], + 'application/x-bzip2' => ['bz2', 'boz'], + 'application/x-cbr' => ['cbr', 'cba', 'cbt', 'cbz', 'cb7'], + 'application/x-cdlink' => ['vcd'], + 'application/x-cfs-compressed' => ['cfs'], + 'application/x-chat' => ['chat'], + 'application/x-chess-pgn' => ['pgn'], + 'application/x-chrome-extension' => ['crx'], + 'application/x-cocoa' => ['cco'], + 'application/x-conference' => ['nsc'], + 'application/x-cpio' => ['cpio'], + 'application/x-csh' => ['csh'], + 'application/x-debian-package' => ['deb', 'udeb'], + 'application/x-dgc-compressed' => ['dgc'], + 'application/x-director' => ['dir', 'dcr', 'dxr', 'cst', 'cct', 'cxt', 'w3d', 'fgd', 'swa'], + 'application/x-doom' => ['wad'], + 'application/x-dtbncx+xml' => ['ncx'], + 'application/x-dtbook+xml' => ['dtb'], + 'application/x-dtbresource+xml' => ['res'], + 'application/x-dvi' => ['dvi'], + 'application/x-envoy' => ['evy'], + 'application/x-eva' => ['eva'], + 'application/x-font-bdf' => ['bdf'], + 'application/x-font-ghostscript' => ['gsf'], + 'application/x-font-linux-psf' => ['psf'], + 'application/x-font-pcf' => ['pcf'], + 'application/x-font-snf' => ['snf'], + 'application/x-font-type1' => ['pfa', 'pfb', 'pfm', 'afm'], + 'application/x-freearc' => ['arc'], + 'application/x-futuresplash' => ['spl'], + 'application/x-gca-compressed' => ['gca'], + 'application/x-glulx' => ['ulx'], + 'application/x-gnumeric' => ['gnumeric'], + 'application/x-gramps-xml' => ['gramps'], + 'application/x-gtar' => ['gtar'], + 'application/x-hdf' => ['hdf'], + 'application/x-httpd-php' => ['php', 'php4', 'php3', 'phtml'], + 'application/x-install-instructions' => ['install'], + 'application/x-iso9660-image' => ['iso'], + 'application/x-iwork-keynote-sffkey' => ['key'], + 'application/x-iwork-numbers-sffnumbers' => ['numbers'], + 'application/x-iwork-pages-sffpages' => ['pages'], + 'application/x-java-archive-diff' => ['jardiff'], + 'application/x-java-jnlp-file' => ['jnlp'], + 'application/x-keepass2' => ['kdbx'], + 'application/x-latex' => ['latex'], + 'application/x-lua-bytecode' => ['luac'], + 'application/x-lzh-compressed' => ['lzh', 'lha'], + 'application/x-makeself' => ['run'], + 'application/x-mie' => ['mie'], + 'application/x-mobipocket-ebook' => ['prc', 'mobi'], + 'application/x-ms-application' => ['application'], + 'application/x-ms-shortcut' => ['lnk'], + 'application/x-ms-wmd' => ['wmd'], + 'application/x-ms-wmz' => ['wmz'], + 'application/x-ms-xbap' => ['xbap'], + 'application/x-msaccess' => ['mdb'], + 'application/x-msbinder' => ['obd'], + 'application/x-mscardfile' => ['crd'], + 'application/x-msclip' => ['clp'], + 'application/x-msdos-program' => ['exe'], + 'application/x-msdownload' => ['exe', 'dll', 'com', 'bat', 'msi'], + 'application/x-msmediaview' => ['mvb', 'm13', 'm14'], + 'application/x-msmetafile' => ['wmf', 'wmz', 'emf', 'emz'], + 'application/x-msmoney' => ['mny'], + 'application/x-mspublisher' => ['pub'], + 'application/x-msschedule' => ['scd'], + 'application/x-msterminal' => ['trm'], + 'application/x-mswrite' => ['wri'], + 'application/x-netcdf' => ['nc', 'cdf'], + 'application/x-ns-proxy-autoconfig' => ['pac'], + 'application/x-nzb' => ['nzb'], + 'application/x-perl' => ['pl', 'pm'], + 'application/x-pilot' => ['prc', 'pdb'], + 'application/x-pkcs12' => ['p12', 'pfx'], + 'application/x-pkcs7-certificates' => ['p7b', 'spc'], + 'application/x-pkcs7-certreqresp' => ['p7r'], + 'application/x-rar-compressed' => ['rar'], + 'application/x-redhat-package-manager' => ['rpm'], + 'application/x-research-info-systems' => ['ris'], + 'application/x-sea' => ['sea'], + 'application/x-sh' => ['sh'], + 'application/x-shar' => ['shar'], + 'application/x-shockwave-flash' => ['swf'], + 'application/x-silverlight-app' => ['xap'], + 'application/x-sql' => ['sql'], + 'application/x-stuffit' => ['sit'], + 'application/x-stuffitx' => ['sitx'], + 'application/x-subrip' => ['srt'], + 'application/x-sv4cpio' => ['sv4cpio'], + 'application/x-sv4crc' => ['sv4crc'], + 'application/x-t3vm-image' => ['t3'], + 'application/x-tads' => ['gam'], + 'application/x-tar' => ['tar', 'tgz'], + 'application/x-tcl' => ['tcl', 'tk'], + 'application/x-tex' => ['tex'], + 'application/x-tex-tfm' => ['tfm'], + 'application/x-texinfo' => ['texinfo', 'texi'], + 'application/x-tgif' => ['obj'], + 'application/x-ustar' => ['ustar'], + 'application/x-virtualbox-hdd' => ['hdd'], + 'application/x-virtualbox-ova' => ['ova'], + 'application/x-virtualbox-ovf' => ['ovf'], + 'application/x-virtualbox-vbox' => ['vbox'], + 'application/x-virtualbox-vbox-extpack' => ['vbox-extpack'], + 'application/x-virtualbox-vdi' => ['vdi'], + 'application/x-virtualbox-vhd' => ['vhd'], + 'application/x-virtualbox-vmdk' => ['vmdk'], + 'application/x-wais-source' => ['src'], + 'application/x-web-app-manifest+json' => ['webapp'], + 'application/x-x509-ca-cert' => ['der', 'crt', 'pem'], + 'application/x-xfig' => ['fig'], + 'application/x-xliff+xml' => ['xlf'], + 'application/x-xpinstall' => ['xpi'], + 'application/x-xz' => ['xz'], + 'application/x-zmachine' => ['z1', 'z2', 'z3', 'z4', 'z5', 'z6', 'z7', 'z8'], + 'application/xaml+xml' => ['xaml'], + 'application/xcap-att+xml' => ['xav'], + 'application/xcap-caps+xml' => ['xca'], + 'application/xcap-diff+xml' => ['xdf'], + 'application/xcap-el+xml' => ['xel'], + 'application/xcap-ns+xml' => ['xns'], + 'application/xenc+xml' => ['xenc'], + 'application/xfdf' => ['xfdf'], + 'application/xhtml+xml' => ['xhtml', 'xht'], + 'application/xliff+xml' => ['xlf'], + 'application/xml' => ['xml', 'xsl', 'xsd', 'rng'], + 'application/xml-dtd' => ['dtd'], + 'application/xop+xml' => ['xop'], + 'application/xproc+xml' => ['xpl'], + 'application/xslt+xml' => ['xsl', 'xslt'], + 'application/xspf+xml' => ['xspf'], + 'application/xv+xml' => ['mxml', 'xhvml', 'xvml', 'xvm'], + 'application/yang' => ['yang'], + 'application/yin+xml' => ['yin'], + 'application/zip' => ['zip'], + 'audio/3gpp' => ['3gpp'], + 'audio/aac' => ['adts', 'aac'], + 'audio/adpcm' => ['adp'], + 'audio/amr' => ['amr'], + 'audio/basic' => ['au', 'snd'], + 'audio/midi' => ['mid', 'midi', 'kar', 'rmi'], + 'audio/mobile-xmf' => ['mxmf'], + 'audio/mp3' => ['mp3'], + 'audio/mp4' => ['m4a', 'mp4a'], + 'audio/mpeg' => ['mpga', 'mp2', 'mp2a', 'mp3', 'm2a', 'm3a'], + 'audio/ogg' => ['oga', 'ogg', 'spx', 'opus'], + 'audio/s3m' => ['s3m'], + 'audio/silk' => ['sil'], + 'audio/vnd.dece.audio' => ['uva', 'uvva'], + 'audio/vnd.digital-winds' => ['eol'], + 'audio/vnd.dra' => ['dra'], + 'audio/vnd.dts' => ['dts'], + 'audio/vnd.dts.hd' => ['dtshd'], + 'audio/vnd.lucent.voice' => ['lvp'], + 'audio/vnd.ms-playready.media.pya' => ['pya'], + 'audio/vnd.nuera.ecelp4800' => ['ecelp4800'], + 'audio/vnd.nuera.ecelp7470' => ['ecelp7470'], + 'audio/vnd.nuera.ecelp9600' => ['ecelp9600'], + 'audio/vnd.rip' => ['rip'], + 'audio/wav' => ['wav'], + 'audio/wave' => ['wav'], + 'audio/webm' => ['weba'], + 'audio/x-aac' => ['aac'], + 'audio/x-aiff' => ['aif', 'aiff', 'aifc'], + 'audio/x-caf' => ['caf'], + 'audio/x-flac' => ['flac'], + 'audio/x-m4a' => ['m4a'], + 'audio/x-matroska' => ['mka'], + 'audio/x-mpegurl' => ['m3u'], + 'audio/x-ms-wax' => ['wax'], + 'audio/x-ms-wma' => ['wma'], + 'audio/x-pn-realaudio' => ['ram', 'ra', 'rm'], + 'audio/x-pn-realaudio-plugin' => ['rmp', 'rpm'], + 'audio/x-realaudio' => ['ra'], + 'audio/x-wav' => ['wav'], + 'audio/xm' => ['xm'], + 'chemical/x-cdx' => ['cdx'], + 'chemical/x-cif' => ['cif'], + 'chemical/x-cmdf' => ['cmdf'], + 'chemical/x-cml' => ['cml'], + 'chemical/x-csml' => ['csml'], + 'chemical/x-xyz' => ['xyz'], + 'font/collection' => ['ttc'], + 'font/otf' => ['otf'], + 'font/ttf' => ['ttf'], + 'font/woff' => ['woff'], + 'font/woff2' => ['woff2'], + 'image/aces' => ['exr'], + 'image/apng' => ['apng'], + 'image/avci' => ['avci'], + 'image/avcs' => ['avcs'], + 'image/avif' => ['avif'], + 'image/bmp' => ['bmp', 'dib'], + 'image/cgm' => ['cgm'], + 'image/dicom-rle' => ['drle'], + 'image/dpx' => ['dpx'], + 'image/emf' => ['emf'], + 'image/fits' => ['fits'], + 'image/g3fax' => ['g3'], + 'image/gif' => ['gif'], + 'image/heic' => ['heic'], + 'image/heic-sequence' => ['heics'], + 'image/heif' => ['heif'], + 'image/heif-sequence' => ['heifs'], + 'image/hej2k' => ['hej2'], + 'image/hsj2' => ['hsj2'], + 'image/ief' => ['ief'], + 'image/jls' => ['jls'], + 'image/jp2' => ['jp2', 'jpg2'], + 'image/jpeg' => ['jpeg', 'jpg', 'jpe'], + 'image/jph' => ['jph'], + 'image/jphc' => ['jhc'], + 'image/jpm' => ['jpm', 'jpgm'], + 'image/jpx' => ['jpx', 'jpf'], + 'image/jxr' => ['jxr'], + 'image/jxra' => ['jxra'], + 'image/jxrs' => ['jxrs'], + 'image/jxs' => ['jxs'], + 'image/jxsc' => ['jxsc'], + 'image/jxsi' => ['jxsi'], + 'image/jxss' => ['jxss'], + 'image/ktx' => ['ktx'], + 'image/ktx2' => ['ktx2'], + 'image/png' => ['png'], + 'image/prs.btif' => ['btif', 'btf'], + 'image/prs.pti' => ['pti'], + 'image/sgi' => ['sgi'], + 'image/svg+xml' => ['svg', 'svgz'], + 'image/t38' => ['t38'], + 'image/tiff' => ['tif', 'tiff'], + 'image/tiff-fx' => ['tfx'], + 'image/vnd.adobe.photoshop' => ['psd'], + 'image/vnd.airzip.accelerator.azv' => ['azv'], + 'image/vnd.dece.graphic' => ['uvi', 'uvvi', 'uvg', 'uvvg'], + 'image/vnd.djvu' => ['djvu', 'djv'], + 'image/vnd.dvb.subtitle' => ['sub'], + 'image/vnd.dwg' => ['dwg'], + 'image/vnd.dxf' => ['dxf'], + 'image/vnd.fastbidsheet' => ['fbs'], + 'image/vnd.fpx' => ['fpx'], + 'image/vnd.fst' => ['fst'], + 'image/vnd.fujixerox.edmics-mmr' => ['mmr'], + 'image/vnd.fujixerox.edmics-rlc' => ['rlc'], + 'image/vnd.microsoft.icon' => ['ico'], + 'image/vnd.ms-dds' => ['dds'], + 'image/vnd.ms-modi' => ['mdi'], + 'image/vnd.ms-photo' => ['wdp'], + 'image/vnd.net-fpx' => ['npx'], + 'image/vnd.pco.b16' => ['b16'], + 'image/vnd.tencent.tap' => ['tap'], + 'image/vnd.valve.source.texture' => ['vtf'], + 'image/vnd.wap.wbmp' => ['wbmp'], + 'image/vnd.xiff' => ['xif'], + 'image/vnd.zbrush.pcx' => ['pcx'], + 'image/webp' => ['webp'], + 'image/wmf' => ['wmf'], + 'image/x-3ds' => ['3ds'], + 'image/x-cmu-raster' => ['ras'], + 'image/x-cmx' => ['cmx'], + 'image/x-freehand' => ['fh', 'fhc', 'fh4', 'fh5', 'fh7'], + 'image/x-icon' => ['ico'], + 'image/x-jng' => ['jng'], + 'image/x-mrsid-image' => ['sid'], + 'image/x-ms-bmp' => ['bmp'], + 'image/x-pcx' => ['pcx'], + 'image/x-pict' => ['pic', 'pct'], + 'image/x-portable-anymap' => ['pnm'], + 'image/x-portable-bitmap' => ['pbm'], + 'image/x-portable-graymap' => ['pgm'], + 'image/x-portable-pixmap' => ['ppm'], + 'image/x-rgb' => ['rgb'], + 'image/x-tga' => ['tga'], + 'image/x-xbitmap' => ['xbm'], + 'image/x-xpixmap' => ['xpm'], + 'image/x-xwindowdump' => ['xwd'], + 'message/disposition-notification' => ['disposition-notification'], + 'message/global' => ['u8msg'], + 'message/global-delivery-status' => ['u8dsn'], + 'message/global-disposition-notification' => ['u8mdn'], + 'message/global-headers' => ['u8hdr'], + 'message/rfc822' => ['eml', 'mime'], + 'message/vnd.wfa.wsc' => ['wsc'], + 'model/3mf' => ['3mf'], + 'model/gltf+json' => ['gltf'], + 'model/gltf-binary' => ['glb'], + 'model/iges' => ['igs', 'iges'], + 'model/jt' => ['jt'], + 'model/mesh' => ['msh', 'mesh', 'silo'], + 'model/mtl' => ['mtl'], + 'model/obj' => ['obj'], + 'model/prc' => ['prc'], + 'model/step+xml' => ['stpx'], + 'model/step+zip' => ['stpz'], + 'model/step-xml+zip' => ['stpxz'], + 'model/stl' => ['stl'], + 'model/u3d' => ['u3d'], + 'model/vnd.cld' => ['cld'], + 'model/vnd.collada+xml' => ['dae'], + 'model/vnd.dwf' => ['dwf'], + 'model/vnd.gdl' => ['gdl'], + 'model/vnd.gtw' => ['gtw'], + 'model/vnd.mts' => ['mts'], + 'model/vnd.opengex' => ['ogex'], + 'model/vnd.parasolid.transmit.binary' => ['x_b'], + 'model/vnd.parasolid.transmit.text' => ['x_t'], + 'model/vnd.pytha.pyox' => ['pyo', 'pyox'], + 'model/vnd.sap.vds' => ['vds'], + 'model/vnd.usda' => ['usda'], + 'model/vnd.usdz+zip' => ['usdz'], + 'model/vnd.valve.source.compiled-map' => ['bsp'], + 'model/vnd.vtu' => ['vtu'], + 'model/vrml' => ['wrl', 'vrml'], + 'model/x3d+binary' => ['x3db', 'x3dbz'], + 'model/x3d+fastinfoset' => ['x3db'], + 'model/x3d+vrml' => ['x3dv', 'x3dvz'], + 'model/x3d+xml' => ['x3d', 'x3dz'], + 'model/x3d-vrml' => ['x3dv'], + 'text/cache-manifest' => ['appcache', 'manifest'], + 'text/calendar' => ['ics', 'ifb'], + 'text/coffeescript' => ['coffee', 'litcoffee'], + 'text/css' => ['css'], + 'text/csv' => ['csv'], + 'text/html' => ['html', 'htm', 'shtml'], + 'text/jade' => ['jade'], + 'text/javascript' => ['js', 'mjs'], + 'text/jsx' => ['jsx'], + 'text/less' => ['less'], + 'text/markdown' => ['md', 'markdown'], + 'text/mathml' => ['mml'], + 'text/mdx' => ['mdx'], + 'text/n3' => ['n3'], + 'text/plain' => ['txt', 'text', 'conf', 'def', 'list', 'log', 'in', 'ini', 'm3u'], + 'text/prs.lines.tag' => ['dsc'], + 'text/richtext' => ['rtx'], + 'text/rtf' => ['rtf'], + 'text/sgml' => ['sgml', 'sgm'], + 'text/shex' => ['shex'], + 'text/slim' => ['slim', 'slm'], + 'text/spdx' => ['spdx'], + 'text/stylus' => ['stylus', 'styl'], + 'text/tab-separated-values' => ['tsv'], + 'text/troff' => ['t', 'tr', 'roff', 'man', 'me', 'ms'], + 'text/turtle' => ['ttl'], + 'text/uri-list' => ['uri', 'uris', 'urls'], + 'text/vcard' => ['vcard'], + 'text/vnd.curl' => ['curl'], + 'text/vnd.curl.dcurl' => ['dcurl'], + 'text/vnd.curl.mcurl' => ['mcurl'], + 'text/vnd.curl.scurl' => ['scurl'], + 'text/vnd.dvb.subtitle' => ['sub'], + 'text/vnd.familysearch.gedcom' => ['ged'], + 'text/vnd.fly' => ['fly'], + 'text/vnd.fmi.flexstor' => ['flx'], + 'text/vnd.graphviz' => ['gv'], + 'text/vnd.in3d.3dml' => ['3dml'], + 'text/vnd.in3d.spot' => ['spot'], + 'text/vnd.sun.j2me.app-descriptor' => ['jad'], + 'text/vnd.wap.wml' => ['wml'], + 'text/vnd.wap.wmlscript' => ['wmls'], + 'text/vtt' => ['vtt'], + 'text/wgsl' => ['wgsl'], + 'text/x-asm' => ['s', 'asm'], + 'text/x-c' => ['c', 'cc', 'cxx', 'cpp', 'h', 'hh', 'dic'], + 'text/x-component' => ['htc'], + 'text/x-fortran' => ['f', 'for', 'f77', 'f90'], + 'text/x-handlebars-template' => ['hbs'], + 'text/x-java-source' => ['java'], + 'text/x-lua' => ['lua'], + 'text/x-markdown' => ['mkd'], + 'text/x-nfo' => ['nfo'], + 'text/x-opml' => ['opml'], + 'text/x-org' => ['org'], + 'text/x-pascal' => ['p', 'pas'], + 'text/x-processing' => ['pde'], + 'text/x-sass' => ['sass'], + 'text/x-scss' => ['scss'], + 'text/x-setext' => ['etx'], + 'text/x-sfv' => ['sfv'], + 'text/x-suse-ymp' => ['ymp'], + 'text/x-uuencode' => ['uu'], + 'text/x-vcalendar' => ['vcs'], + 'text/x-vcard' => ['vcf'], + 'text/xml' => ['xml'], + 'text/yaml' => ['yaml', 'yml'], + 'video/3gpp' => ['3gp', '3gpp'], + 'video/3gpp2' => ['3g2'], + 'video/h261' => ['h261'], + 'video/h263' => ['h263'], + 'video/h264' => ['h264'], + 'video/iso.segment' => ['m4s'], + 'video/jpeg' => ['jpgv'], + 'video/jpm' => ['jpm', 'jpgm'], + 'video/mj2' => ['mj2', 'mjp2'], + 'video/mp2t' => ['ts'], + 'video/mp4' => ['mp4', 'mp4v', 'mpg4', 'f4v'], + 'video/mpeg' => ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'], + 'video/ogg' => ['ogv'], + 'video/quicktime' => ['qt', 'mov'], + 'video/vnd.dece.hd' => ['uvh', 'uvvh'], + 'video/vnd.dece.mobile' => ['uvm', 'uvvm'], + 'video/vnd.dece.pd' => ['uvp', 'uvvp'], + 'video/vnd.dece.sd' => ['uvs', 'uvvs'], + 'video/vnd.dece.video' => ['uvv', 'uvvv'], + 'video/vnd.dvb.file' => ['dvb'], + 'video/vnd.fvt' => ['fvt'], + 'video/vnd.mpegurl' => ['mxu', 'm4u'], + 'video/vnd.ms-playready.media.pyv' => ['pyv'], + 'video/vnd.uvvu.mp4' => ['uvu', 'uvvu'], + 'video/vnd.vivo' => ['viv'], + 'video/webm' => ['webm'], + 'video/x-f4v' => ['f4v'], + 'video/x-fli' => ['fli'], + 'video/x-flv' => ['flv'], + 'video/x-m4v' => ['m4v'], + 'video/x-matroska' => ['mkv', 'mk3d', 'mks'], + 'video/x-mng' => ['mng'], + 'video/x-ms-asf' => ['asf', 'asx'], + 'video/x-ms-vob' => ['vob'], + 'video/x-ms-wm' => ['wm'], + 'video/x-ms-wmv' => ['wmv'], + 'video/x-ms-wmx' => ['wmx'], + 'video/x-ms-wvx' => ['wvx'], + 'video/x-msvideo' => ['avi'], + 'video/x-sgi-movie' => ['movie'], + 'video/x-smv' => ['smv'], + 'x-conference/x-cooltalk' => ['ice'], + 'application/x-photoshop' => ['psd'], + 'application/smil' => ['smi', 'smil'], + 'application/powerpoint' => ['ppt'], + 'application/vnd.ms-powerpoint.addin.macroEnabled.12' => ['ppam'], + 'application/vnd.ms-powerpoint.presentation.macroEnabled.12' => ['pptm', 'potm'], + 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12' => ['ppsm'], + 'application/wbxml' => ['wbxml'], + 'application/wmlc' => ['wmlc'], + 'application/x-httpd-php-source' => ['phps'], + 'application/x-compress' => ['z'], + 'application/x-rar' => ['rar'], + 'video/vnd.rn-realvideo' => ['rv'], + 'application/vnd.ms-word.template.macroEnabled.12' => ['docm', 'dotm'], + 'application/vnd.ms-excel.sheet.macroEnabled.12' => ['xlsm'], + 'application/vnd.ms-excel.template.macroEnabled.12' => ['xltm'], + 'application/vnd.ms-excel.addin.macroEnabled.12' => ['xlam'], + 'application/vnd.ms-excel.sheet.binary.macroEnabled.12' => ['xlsb'], + 'application/excel' => ['xl'], + 'application/x-x509-user-cert' => ['pem'], + 'application/x-pkcs10' => ['p10'], + 'application/x-pkcs7-signature' => ['p7a'], + 'application/pgp' => ['pgp'], + 'application/gpg-keys' => ['gpg'], + 'application/x-pkcs7' => ['rsa'], + 'video/3gp' => ['3gp'], + 'audio/acc' => ['aac'], + 'application/vnd.mpegurl' => ['m4u'], + 'application/videolan' => ['vlc'], + 'audio/x-au' => ['au'], + 'audio/ac3' => ['ac3'], + 'text/x-scriptzsh' => ['zsh'], + 'application/cdr' => ['cdr'], + 'application/STEP' => ['step', 'stp'], + ]; + public function lookupMimeType(string $extension): ?string { return self::MIME_TYPES_FOR_EXTENSIONS[$extension] ?? null; } + + public function lookupExtension(string $mimetype): ?string + { + return self::EXTENSIONS_FOR_MIME_TIMES[$mimetype][0] ?? null; + } + + /** + * @return string[] + */ + public function lookupAllExtensions(string $mimetype): array + { + return self::EXTENSIONS_FOR_MIME_TIMES[$mimetype] ?? []; + } } diff --git a/vendor/overtrue/easy-sms/.editorconfig b/vendor/overtrue/easy-sms/.editorconfig new file mode 100644 index 0000000..df55cd7 --- /dev/null +++ b/vendor/overtrue/easy-sms/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = false + +[*.{vue,js,scss}] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false \ No newline at end of file diff --git a/vendor/overtrue/easy-sms/.github/FUNDING.yml b/vendor/overtrue/easy-sms/.github/FUNDING.yml new file mode 100644 index 0000000..273b78e --- /dev/null +++ b/vendor/overtrue/easy-sms/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: [overtrue] diff --git a/vendor/overtrue/easy-sms/.github/workflows/tests.yml b/vendor/overtrue/easy-sms/.github/workflows/tests.yml new file mode 100644 index 0000000..263a7d0 --- /dev/null +++ b/vendor/overtrue/easy-sms/.github/workflows/tests.yml @@ -0,0 +1,24 @@ +name: Tests + +on: + push: + branches: [ master ] + pull_request: + +jobs: + phpunit: + strategy: + matrix: + php_version: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup PHP environment + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php_version }} + coverage: xdebug + - name: Install dependencies + run: composer install + - name: PHPUnit check + run: ./vendor/bin/phpunit --coverage-text diff --git a/vendor/overtrue/easy-sms/.php-cs-fixer.dist.php b/vendor/overtrue/easy-sms/.php-cs-fixer.dist.php new file mode 100644 index 0000000..e755e85 --- /dev/null +++ b/vendor/overtrue/easy-sms/.php-cs-fixer.dist.php @@ -0,0 +1,49 @@ +setRules([ + '@PSR12' => true, + 'binary_operator_spaces' => true, + 'blank_line_after_opening_tag' => true, + 'compact_nullable_typehint' => true, + 'declare_equal_normalize' => true, + 'lowercase_cast' => true, + 'lowercase_static_reference' => true, + 'new_with_braces' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_leading_import_slash' => true, + 'no_whitespace_in_blank_line' => true, + 'no_unused_imports' => true, + 'ordered_class_elements' => [ + 'order' => [ + 'use_trait', + ], + ], + 'ordered_imports' => [ + 'imports_order' => [ + 'class', + 'function', + 'const', + ], + 'sort_algorithm' => 'none', + ], + 'return_type_declaration' => true, + 'short_scalar_cast' => true, + 'single_blank_line_before_namespace' => true, + 'single_trait_insert_per_statement' => true, + 'ternary_operator_spaces' => true, + 'unary_operator_spaces' => true, + 'visibility_required' => [ + 'elements' => [ +// 'const', + 'method', + 'property', + ], + ], + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('vendor') + ->in([__DIR__.'/src/', __DIR__.'/tests/']) + ) +; diff --git a/vendor/overtrue/easy-sms/LICENSE b/vendor/overtrue/easy-sms/LICENSE new file mode 100644 index 0000000..8afd9ea --- /dev/null +++ b/vendor/overtrue/easy-sms/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 overtrue + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/overtrue/easy-sms/README.md b/vendor/overtrue/easy-sms/README.md new file mode 100644 index 0000000..052ca09 --- /dev/null +++ b/vendor/overtrue/easy-sms/README.md @@ -0,0 +1,1007 @@ +

            Easy SMS

            + +

            :calling: 一款满足你的多种发送需求的短信发送组件

            + +

            +Build Status +Latest Stable Version +Latest Unstable Version +Code Coverage +Total Downloads +License +

            + +

            +Sponsor me +

            + + +## 特点 + +1. 支持目前市面多家服务商 +1. 一套写法兼容所有平台 +1. 简单配置即可灵活增减服务商 +1. 内置多种服务商轮询策略、支持自定义轮询策略 +1. 统一的返回值格式,便于日志与监控 +1. 自动轮询选择可用的服务商 +1. 更多等你去发现与改进... + +## 平台支持 + +- [腾讯云 SMS](https://cloud.tencent.com/product/sms) +- [Ucloud](https://www.ucloud.cn) +- [七牛云](https://www.qiniu.com/) +- [SendCloud](http://www.sendcloud.net/) +- [阿里云](https://www.aliyun.com/) +- [云片](https://www.yunpian.com) +- [Submail](https://www.mysubmail.com) +- [螺丝帽](https://luosimao.com/) +- [容联云通讯](http://www.yuntongxun.com) +- [互亿无线](http://www.ihuyi.com) +- [聚合数据](https://www.juhe.cn) +- [百度云](https://cloud.baidu.com/) +- [华信短信平台](http://www.ipyy.com/) +- [253云通讯(创蓝)](https://www.253.com/) +- [创蓝云智](https://www.chuanglan.com/) +- [融云](http://www.rongcloud.cn) +- [天毅无线](http://www.85hu.com/) +- [阿凡达数据](http://www.avatardata.cn/) +- [华为云](https://www.huaweicloud.com/product/msgsms.html) +- [网易云信](https://yunxin.163.com/sms) +- [云之讯](https://www.ucpaas.com/index.html) +- [凯信通](http://www.kingtto.cn/) +- [UE35.net](http://uesms.ue35.cn/) +- [短信宝](http://www.smsbao.com/) +- [Tiniyo](https://tiniyo.com/) +- [摩杜云](https://www.moduyun.com/) +- [融合云(助通)](https://www.ztinfo.cn/products/sms) +- [蜘蛛云](https://zzyun.com/) +- [融合云信](https://maap.wo.cn/) +- [天瑞云](http://cms.tinree.com/) +- [时代互联](https://www.now.cn/) +- [火山引擎](https://console.volcengine.com/sms/) + +## 环境需求 + +- PHP >= 5.6 + +## 安装 + +```shell +$ composer require "overtrue/easy-sms" +``` + +**For Laravel notification** + +如果你喜欢使用 [Laravel Notification](https://laravel.com/docs/5.8/notifications), 可以考虑直接使用朋友封装的拓展包: + +https://github.com/yl/easysms-notification-channel + +## 使用 + +```php +use Overtrue\EasySms\EasySms; + +$config = [ + // HTTP 请求的超时时间(秒) + 'timeout' => 5.0, + + // 默认发送配置 + 'default' => [ + // 网关调用策略,默认:顺序调用 + 'strategy' => \Overtrue\EasySms\Strategies\OrderStrategy::class, + + // 默认可用的发送网关 + 'gateways' => [ + 'yunpian', 'aliyun', + ], + ], + // 可用的网关配置 + 'gateways' => [ + 'errorlog' => [ + 'file' => '/tmp/easy-sms.log', + ], + 'yunpian' => [ + 'api_key' => '824f0ff2f71cab52936axxxxxxxxxx', + ], + 'aliyun' => [ + 'access_key_id' => '', + 'access_key_secret' => '', + 'sign_name' => '', + ], + //... + ], +]; + +$easySms = new EasySms($config); + +$easySms->send(13188888888, [ + 'content' => '您的验证码为: 6379', + 'template' => 'SMS_001', + 'data' => [ + 'code' => 6379 + ], +]); +``` + +## 短信内容 + +由于使用多网关发送,所以一条短信要支持多平台发送,每家的发送方式不一样,但是我们抽象定义了以下公用属性: + +- `content` 文字内容,使用在像云片类似的以文字内容发送的平台 +- `template` 模板 ID,使用在以模板ID来发送短信的平台 +- `data` 模板变量,使用在以模板ID来发送短信的平台 + +所以,在使用过程中你可以根据所要使用的平台定义发送的内容。 + +```php +$easySms->send(13188888888, [ + 'content' => '您的验证码为: 6379', + 'template' => 'SMS_001', + 'data' => [ + 'code' => 6379 + ], +]); +``` + +你也可以使用闭包来返回对应的值: + +```php +$easySms->send(13188888888, [ + 'content' => function($gateway){ + return '您的验证码为: 6379'; + }, + 'template' => function($gateway){ + return 'SMS_001'; + }, + 'data' => function($gateway){ + return [ + 'code' => 6379 + ]; + }, +]); +``` + +你可以根据 `$gateway` 参数类型来判断返回值,例如: + +```php +$easySms->send(13188888888, [ + 'content' => function($gateway){ + if ($gateway->getName() == 'yunpian') { + return '云片专用验证码:1235'; + } + return '您的验证码为: 6379'; + }, + 'template' => function($gateway){ + if ($gateway->getName() == 'aliyun') { + return 'TP2818'; + } + return 'SMS_001'; + }, + 'data' => function($gateway){ + return [ + 'code' => 6379 + ]; + }, +]); +``` + +## 发送网关 + +默认使用 `default` 中的设置来发送,如果某一条短信你想要覆盖默认的设置。在 `send` 方法中使用第三个参数即可: + +```php +$easySms->send(13188888888, [ + 'content' => '您的验证码为: 6379', + 'template' => 'SMS_001', + 'data' => [ + 'code' => 6379 + ], + ], ['yunpian', 'juhe']); // 这里的网关配置将会覆盖全局默认值 +``` + +## 返回值 + +由于使用多网关发送,所以返回值为一个数组,结构如下: +```php +[ + 'yunpian' => [ + 'gateway' => 'yunpian', + 'status' => 'success', + 'result' => [...] // 平台返回值 + ], + 'juhe' => [ + 'gateway' => 'juhe', + 'status' => 'failure', + 'exception' => \Overtrue\EasySms\Exceptions\GatewayErrorException 对象 + ], + //... +] +``` + +如果所选网关列表均发送失败时,将会抛出 `Overtrue\EasySms\Exceptions\NoGatewayAvailableException` 异常,你可以使用 `$e->results` 获取发送结果。 + +你也可以使用 `$e` 提供的更多便捷方法: + +```php +$e->getResults(); // 返回所有 API 的结果,结构同上 +$e->getExceptions(); // 返回所有调用异常列表 +$e->getException($gateway); // 返回指定网关名称的异常对象 +$e->getLastException(); // 获取最后一个失败的异常对象 +``` + +## 自定义网关 + +本拓展已经支持用户自定义网关,你可以很方便的配置即可当成与其它拓展一样的使用: + +```php +$config = [ + ... + 'default' => [ + 'gateways' => [ + 'mygateway', // 配置你的网站到可用的网关列表 + ], + ], + 'gateways' => [ + 'mygateway' => [...], // 你网关所需要的参数,如果没有可以不配置 + ], +]; + +$easySms = new EasySms($config); + +// 注册 +$easySms->extend('mygateway', function($gatewayConfig){ + // $gatewayConfig 来自配置文件里的 `gateways.mygateway` + return new MyGateway($gatewayConfig); +}); + +$easySms->send(13188888888, [ + 'content' => '您的验证码为: 6379', + 'template' => 'SMS_001', + 'data' => [ + 'code' => 6379 + ], +]); +``` + +## 国际短信 + +国际短信与国内短信的区别是号码前面需要加国际码,但是由于各平台对国际号码的写法不一致,所以在发送国际短信的时候有一点区别: + +```php +use Overtrue\EasySms\PhoneNumber; + +// 发送到国际码为 31 的国际号码 +$number = new PhoneNumber(13188888888, 31); + +$easySms->send($number, [ + 'content' => '您的验证码为: 6379', + 'template' => 'SMS_001', + 'data' => [ + 'code' => 6379 + ], +]); +``` + +## 定义短信 + +你可以根据发送场景的不同,定义不同的短信类,从而实现一处定义多处调用,你可以继承 `Overtrue\EasySms\Message` 来定义短信模型: + +```php +order = $order; + } + + // 定义直接使用内容发送平台的内容 + public function getContent(GatewayInterface $gateway = null) + { + return sprintf('您的订单:%s, 已经完成付款', $this->order->no); + } + + // 定义使用模板发送方式平台所需要的模板 ID + public function getTemplate(GatewayInterface $gateway = null) + { + return 'SMS_003'; + } + + // 模板参数 + public function getData(GatewayInterface $gateway = null) + { + return [ + 'order_no' => $this->order->no + ]; + } +} +``` + +> 更多自定义方式请参考:[`Overtrue\EasySms\Message`](Overtrue\EasySms\Message;) + +发送自定义短信: + +```php +$order = ...; +$message = new OrderPaidMessage($order); + +$easySms->send(13188888888, $message); +``` + +## 各平台配置说明 + +### [阿里云](https://www.aliyun.com/) + +短信内容使用 `template` + `data` + +```php + 'aliyun' => [ + 'access_key_id' => '', + 'access_key_secret' => '', + 'sign_name' => '', + ], +``` + +### [阿里云Rest](https://www.aliyun.com/) + +短信内容使用 `template` + `data` + +```php + 'aliyunrest' => [ + 'app_key' => '', + 'app_secret_key' => '', + 'sign_name' => '', + ], +``` + +### [阿里云国际](https://www.alibabacloud.com/help/zh/doc-detail/160524.html) + +短信内容使用 `template` + `data` + +```php + 'aliyunintl' => [ + 'access_key_id' => '', + 'access_key_secret' => '', + 'sign_name' => '', + ], +``` + +发送示例: + +```php +use Overtrue\EasySms\PhoneNumber; + +$easySms = new EasySms($config); +$phone_number = new PhoneNumber(18888888888, 86); + +$easySms->send($phone_number, [ + 'content' => '您好:先生/女士!您的验证码为${code},有效时间是5分钟,请及时验证。', + 'template' => 'SMS_00000001', // 模板ID + 'data' => [ + "code" => 521410, + ], +]); +``` + +### [云片](https://www.yunpian.com) + +短信内容使用 `content` + +```php + 'yunpian' => [ + 'api_key' => '', + 'signature' => '【默认签名】', // 内容中无签名时使用 + ], +``` + +### [Submail](https://www.mysubmail.com) + +短信内容使用 `data` + +```php + 'submail' => [ + 'app_id' => '', + 'app_key' => '', + 'project' => '', // 默认 project,可在发送时 data 中指定 + ], +``` + +### [螺丝帽](https://luosimao.com/) + +短信内容使用 `content` + +```php + 'luosimao' => [ + 'api_key' => '', + ], +``` + +### [容联云通讯](http://www.yuntongxun.com) + +短信内容使用 `template` + `data` + +```php + 'yuntongxun' => [ + 'app_id' => '', + 'account_sid' => '', + 'account_token' => '', + 'is_sub_account' => false, + ], +``` + +### [互亿无线](http://www.ihuyi.com) + +短信内容使用 `content` + +```php + 'huyi' => [ + 'api_id' => '', + 'api_key' => '', + 'signature' => '', + ], +``` + +### [聚合数据](https://www.juhe.cn) + +短信内容使用 `template` + `data` + +```php + 'juhe' => [ + 'app_key' => '', + ], +``` + +### [SendCloud](http://www.sendcloud.net/) + +短信内容使用 `template` + `data` + +```php + 'sendcloud' => [ + 'sms_user' => '', + 'sms_key' => '', + 'timestamp' => false, // 是否启用时间戳 + ], +``` +### [百度云](https://cloud.baidu.com/) + +短信内容使用 `template` + `data` + +```php + 'baidu' => [ + 'ak' => '', + 'sk' => '', + 'invoke_id' => '', + 'domain' => '', + ], +``` + +### [华信短信平台](http://www.ipyy.com/) + +短信内容使用 `content` + +```php + 'huaxin' => [ + 'user_id' => '', + 'password' => '', + 'account' => '', + 'ip' => '', + 'ext_no' => '', + ], +``` + +### [253云通讯(创蓝)](https://www.253.com/) + +短信内容使用 `content` + +```php + 'chuanglan' => [ + 'account' => '', + 'password' => '', + + // 国际短信时必填 + 'intel_account' => '', + 'intel_password' => '', + + // \Overtrue\EasySms\Gateways\ChuanglanGateway::CHANNEL_VALIDATE_CODE => 验证码通道(默认) + // \Overtrue\EasySms\Gateways\ChuanglanGateway::CHANNEL_PROMOTION_CODE => 会员营销通道 + 'channel' => \Overtrue\EasySms\Gateways\ChuanglanGateway::CHANNEL_VALIDATE_CODE, + + // 会员营销通道 特定参数。创蓝规定:api提交营销短信的时候,需要自己加短信的签名及退订信息 + 'sign' => '【通讯云】', + 'unsubscribe' => '回TD退订', + ], +``` + +### [创蓝云智](https://www.chuanglan.com/) + +普通短信发送内容使用 `content` + +```php + 'chuanglanv1' => [ + 'account' => '', + 'password' => '', + 'needstatus' => false, + 'channel' => \Overtrue\EasySms\Gateways\ChuanglanV1Gateway::CHANNEL_NORMAL_CODE, + ], +``` +发送示例: + +```php +$easySms->send(18888888888, [ + 'content' => xxxxxxx +]); +``` + +变量短信发送内容使用 `template` + `data` + +```php + 'chuanglanv1' => [ + 'account' => '', + 'password' => '', + 'needstatus' => false, + 'channel' => \Overtrue\EasySms\Gateways\ChuanglanV1Gateway::CHANNEL_VARIABLE_CODE, + ], +``` +发送示例: + +```php +$easySms->send(18888888888, [ + 'template' => xxxxxx, // 模板内容 + 'data' => 'phone":"15800000000,1234;15300000000,4321', +]); +``` + +### [融云](http://www.rongcloud.cn) + +短信分为两大类,验证类和通知类短信。 发送验证类短信使用 `template` + `data` + +```php + 'rongcloud' => [ + 'app_key' => '', + 'app_secret' => '', + ] +``` + +### [天毅无线](http://www.85hu.com/) + +短信内容使用 `content` + +```php + 'tianyiwuxian' => [ + 'username' => '', //用户名 + 'password' => '', //密码 + 'gwid' => '', //网关ID + ] +``` + +### [twilio](https://www.twilio.com) + +短信使用 `content` +发送对象需要 使用`+`添加区号 + +```php + 'twilio' => [ + 'account_sid' => '', // sid + 'from' => '', // 发送的号码 可以在控制台购买 + 'token' => '', // apitoken + ], +``` + +### [tiniyo](https://www.tiniyo.com) + +短信使用 `content` +发送对象需要 使用`+`添加区号 + +```php + 'tiniyo' => [ + 'account_sid' => '', // auth_id from https://tiniyo.com + 'from' => '', // 发送的号码 可以在控制台购买 + 'token' => '', // auth_secret from https://tiniyo.com + ], +``` + + +### [腾讯云 SMS](https://cloud.tencent.com/product/sms) + +短信内容使用 `template` + `data` + +```php + 'qcloud' => [ + 'sdk_app_id' => '', // 短信应用的 SDK APP ID + 'secret_id' => '', // SECRET ID + 'secret_key' => '', // SECRET KEY + 'sign_name' => '腾讯CoDesign', // 短信签名 + ], +``` + +发送示例: + +```php +$easySms->send(18888888888, [ + 'template' => 101234, // 模板ID + 'data' => [ + "a", 'b', 'c', 'd', //按占位顺序给值 + ], +]); +``` + +### [阿凡达数据](http://www.avatardata.cn/) + +短信内容使用 `template` + `data` + +```php + 'avatardata' => [ + 'app_key' => '', // APP KEY + ], +``` + +### [华为云 SMS](https://www.huaweicloud.com/product/msgsms.html) + +短信内容使用 `template` + `data` + +```php + 'huawei' => [ + 'endpoint' => '', // APP接入地址 + 'app_key' => '', // APP KEY + 'app_secret' => '', // APP SECRET + 'from' => [ + 'default' => '1069012345', // 默认使用签名通道号 + 'custom' => 'csms12345', // 其他签名通道号 可以在 data 中定义 from 来指定 + 'abc' => 'csms67890', // 其他签名通道号 + ... + ], + 'callback' => '' // 短信状态回调地址 + ], +``` + +使用默认签名通道 `default` + +```php +$easySms->send(13188888888, [ + 'template' => 'SMS_001', + 'data' => [ + 6379 + ], +]); +``` + +使用指定签名通道 + +```php +$easySms->send(13188888888, [ + 'template' => 'SMS_001', + 'data' => [ + 6379, + 'from' => 'custom' // 对应 config 中的 from 数组中 custom + ], +]); +``` + +### [网易云信](https://yunxin.163.com/sms) + +短信内容使用 `template` + `data` + +```php + 'yunxin' => [ + 'app_key' => '', + 'app_secret' => '', + 'code_length' => 4, // 随机验证码长度,范围 4~10,默认为 4 + 'need_up' => false, // 是否需要支持短信上行 + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => 'SMS_001', // 不填则使用默认模板 + 'data' => [ + 'code' => 8946, // 如果设置了该参数,则 code_length 参数无效 + 'action' => 'sendCode', // 默认为 `sendCode`,校验短信验证码使用 `verifyCode` + ], +]); +``` + +### [云之讯](https://www.ucpaas.com/index.html) + +短信内容使用 `template` + `data` + +```php + 'yunzhixun' => [ + 'sid' => '', + 'token' => '', + 'app_id' => '', + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => 'SMS_001', + 'data' => [ + 'params' => '8946,3', // 模板参数,多个参数使用 `,` 分割,模板无参数时可为空 + 'uid' => 'hexianghui', // 用户 ID,随状态报告返回,可为空 + 'mobiles' => '18888888888,188888888889', // 批量发送短信,手机号使用 `,` 分割,不使用批量发送请不要设置该参数 + ], +]); +``` + +### [凯信通](http://www.kingtto.cn/) + +短信内容使用 `content` + +```php + 'kingtto' => [ + 'userid' => '', + 'account' => '', + 'password' => '', + ], +``` + +```php +$easySms->send(18888888888, [ + 'content' => '您的验证码为: 6379', +]); +``` + +### [七牛云](https://www.qiniu.com/) + +短信内容使用 `template` + `data` + +```php + 'qiniu' => [ + 'secret_key' => '', + 'access_key' => '', + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => '1231234123412341234', + 'data' => [ + 'code' => 1234, + ], +]); +``` +### [Ucloud](https://www.ucloud.cn/) +短信使用 `template` + `data` + +```php + 'ucloud' => [ + 'private_key' => '', //私钥 + 'public_key' => '', //公钥 + 'sig_content' => '', // 短信签名, + 'project_id' => '', //项目ID,子账号才需要该参数 + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => 'UTAXXXXX', //短信模板 + 'data' => [ + 'code' => 1234, //模板参数,模板没有参数不用则填写,有多个参数请用数组,[1111,1111] + 'mobiles' =>'', //同时发送多个手机短信,请用数组[xxx,xxx] + ], +]); + +``` + + +### [短信宝](http://www.smsbao.com/) +短信使用 `content` + +```php + 'smsbao' => [ + 'user' => '', //账号 + 'password' => '' //密码 + ], +``` + +```php +$easySms->send(18888888888, [ + 'content' => '您的验证码为: 6379', //短信模板 +]); + +``` + +### [摩杜云](https://www.moduyun.com/) +短信使用 `template` + `data` + +```php + 'moduyun' => [ + 'accesskey' => '', //必填 ACCESS KEY + 'secretkey' => '', //必填 SECRET KEY + 'signId' => '', //选填 短信签名,如果使用默认签名,该字段可缺省 + 'type' => 0, //选填 0:普通短信;1:营销短信 + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => '5a95****b953', //短信模板 + 'data' => [ + 1234, //模板参数,对应模板的{1} + 30 //模板参数,对应模板的{2} + //... + ], +]); + +``` + +### [融合云(助通)](https://www.ztinfo.cn/products/sms) + +短信使用 `template` + `data` + +```php + 'rongheyun' => [ + 'username' => '', //必填 用户名 + 'password' => '', //必填 密码 + 'signature'=> '', //必填 已报备的签名 + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => '31874', //短信模板 + 'data' => [ + 'valid_code' => '888888', //模板参数,对应模板的{valid_code} + //... + ], +]); + +``` + +### [蜘蛛云](https://zzyun.com/) + +短信使用 `template` + `data` + +```php + 'zzyun' => [ + 'user_id' => '', //必填 会员ID + 'secret' => '', //必填 接口密钥 + 'sign_name'=> '', //必填 短信签名 + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => 'SMS_210317****', //短信模板 + 'data' => [ + 'code' => '888888', //模板参数,对应模板的{code} + //... + ], +]); + +``` + +### [融合云信](https://maap.wo.cn/) + +短信使用 `template` + `data` + +```php + 'maap' => [ + 'cpcode' => '', //必填 商户编码 + 'key' => '', //必填 接口密钥 + 'excode'=> '', //选填 扩展名 + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => '356120', //短信模板 + 'data' => [ + '123465' + ],//模板参数 +]); + +``` + +### [天瑞云](http://cms.tinree.com/) + +短信内容使用 `template` + `data` + +```php + 'tinree' => [ + 'accesskey' => '', // 平台分配给用户的accesskey + 'secret' => '', // 平台分配给用户的secret + 'sign' => '', // 平台上申请的接口短信签名或者签名ID + ], +``` + +发送示例: + +```php +$easySms->send(18888888888, [ + 'template' => '123456', // 模板ID + 'data' => [ + "a", 'b', 'c', //按模板变量占位顺序 + ], +]); +``` + +### [时代互联](https://www.now.cn/) + +短信使用 `content` + +```php + 'nowcn' => [ + 'key' => '', //用户ID + 'secret' => '', //开发密钥 + 'api_type' => '', // 短信通道, + ], +``` + +发送示例: +```php +$easySms->send(18888888888, [ + 'content' => '您的验证码为: 6379', +]); +``` + +### [火山引擎](https://console.volcengine.com/sms/) + +短信内容使用 `template` + `data` + +```php + 'volcengine' => [ + 'access_key_id' => '', // 平台分配给用户的access_key_id + 'access_key_secret' => '', // 平台分配给用户的access_key_secret + 'region_id' => 'cn-north-1', // 国内节点 cn-north-1,国外节点 ap-singapore-1,不填或填错,默认使用国内节点 + 'sign_name' => '', // 平台上申请的接口短信签名或者签名ID,可不填,发送短信时data中指定 + 'sms_account' => '', // 消息组帐号,火山短信页面右上角,短信应用括号中的字符串,可不填,发送短信时data中指定 + ], +``` + +发送示例1: + +```php +$easySms->send(18888888888, [ + 'template' => 'SMS_123456', // 模板ID + 'data' => [ + "code" => 1234 // 模板变量 + ], +]); +``` + +发送示例2: +```php +$easySms->send(18888888888, [ + 'template' => 'SMS_123456', // 模板ID + 'data' => [ + "template_param" => ["code" => 1234], // 模板变量参数 + "sign_name" => "yoursignname", // 签名,覆盖配置文件中的sign_name + "sms_account" => "yoursmsaccount", // 消息组帐号,覆盖配置文件中的sms_account + "phone_numbers" => "18888888888,18888888889", // 手机号,批量发送,英文的逗号连接多个手机号,覆盖发送方法中的填入的手机号 + ], +]); +``` + +## :heart: 支持我 + +[![Sponsor me](https://github.com/overtrue/overtrue/blob/master/sponsor-me.svg?raw=true)](https://github.com/sponsors/overtrue) + +如果你喜欢我的项目并想支持它,[点击这里 :heart:](https://github.com/sponsors/overtrue) + +## Project supported by JetBrains + +Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects. + +[![](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=https://github.com/overtrue) + + +## PHP 扩展包开发 + +> 想知道如何从零开始构建 PHP 扩展包? +> +> 请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— [《PHP 扩展包实战教程 - 从入门到发布》](https://learnku.com/courses/creating-package) + +## License + +MIT diff --git a/vendor/overtrue/easy-sms/composer.json b/vendor/overtrue/easy-sms/composer.json new file mode 100644 index 0000000..716c516 --- /dev/null +++ b/vendor/overtrue/easy-sms/composer.json @@ -0,0 +1,62 @@ +{ + "name": "overtrue/easy-sms", + "description": "The easiest way to send short message.", + "type": "library", + "require": { + "guzzlehttp/guzzle": "^6.2 || ^7.0", + "php": ">=5.6", + "ext-json": "*" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^7.5 || ^8.5.19 || ^9.5.8", + "mockery/mockery": "~1.3.3 || ^1.4.2", + "brainmaestro/composer-git-hooks": "^2.8", + "jetbrains/phpstorm-attributes": "^1.0" + }, + "autoload": { + "psr-4": { + "Overtrue\\EasySms\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Overtrue\\EasySms\\Tests\\": "tests" + } + }, + "license": "MIT", + "authors": [{ + "name": "overtrue", + "email": "i@overtrue.me" + }], + "extra": { + "hooks": { + "pre-commit": [ + "composer check-style", + "composer psalm", + "composer test" + ], + "pre-push": [ + "composer check-style" + ] + } + }, + "scripts": { + "post-update-cmd": [ + "cghooks remove", + "cghooks add --ignore-lock", + "cghooks update" + ], + "post-merge": "composer install", + "post-install-cmd": [ + "cghooks remove", + "cghooks add --ignore-lock", + "cghooks update" + ], + "phpstan": "phpstan analyse", + "check-style": "php-cs-fixer fix --using-cache=no --diff --config=.php-cs-fixer.dist.php --dry-run --allow-risky=yes --ansi", + "fix-style": "php-cs-fixer fix --using-cache=no --config=.php-cs-fixer.dist.php --allow-risky=yes --ansi", + "test": "phpunit --colors", + "psalm": "psalm --show-info=true --no-cache", + "psalm-fix": "psalm --no-cache --alter --issues=MissingReturnType,MissingParamType" + } +} diff --git a/vendor/overtrue/easy-sms/psalm.xml b/vendor/overtrue/easy-sms/psalm.xml new file mode 100644 index 0000000..f8edfd3 --- /dev/null +++ b/vendor/overtrue/easy-sms/psalm.xml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/vendor/overtrue/easy-sms/src/Contracts/GatewayInterface.php b/vendor/overtrue/easy-sms/src/Contracts/GatewayInterface.php new file mode 100644 index 0000000..3424677 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Contracts/GatewayInterface.php @@ -0,0 +1,38 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Contracts; + +use Overtrue\EasySms\Support\Config; + +/** + * Class GatewayInterface. + */ +interface GatewayInterface +{ + /** + * Get gateway name. + * + * @return string + */ + public function getName(); + + /** + * Send a short message. + * + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config); +} diff --git a/vendor/overtrue/easy-sms/src/Contracts/MessageInterface.php b/vendor/overtrue/easy-sms/src/Contracts/MessageInterface.php new file mode 100644 index 0000000..7c17f10 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Contracts/MessageInterface.php @@ -0,0 +1,63 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Contracts; + +/** + * Interface MessageInterface. + */ +interface MessageInterface +{ + const TEXT_MESSAGE = 'text'; + + const VOICE_MESSAGE = 'voice'; + + /** + * Return the message type. + * + * @return string + */ + public function getMessageType(); + + /** + * Return message content. + * + * @param \Overtrue\EasySms\Contracts\GatewayInterface|null $gateway + * + * @return string + */ + public function getContent(GatewayInterface $gateway = null); + + /** + * Return the template id of message. + * + * @param \Overtrue\EasySms\Contracts\GatewayInterface|null $gateway + * + * @return string + */ + public function getTemplate(GatewayInterface $gateway = null); + + /** + * Return the template data of message. + * + * @param \Overtrue\EasySms\Contracts\GatewayInterface|null $gateway + * + * @return array + */ + public function getData(GatewayInterface $gateway = null); + + /** + * Return message supported gateways. + * + * @return array + */ + public function getGateways(); +} diff --git a/vendor/overtrue/easy-sms/src/Contracts/PhoneNumberInterface.php b/vendor/overtrue/easy-sms/src/Contracts/PhoneNumberInterface.php new file mode 100644 index 0000000..7d64648 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Contracts/PhoneNumberInterface.php @@ -0,0 +1,53 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Contracts; + +/** + * Interface PhoneNumberInterface. + * + * @author overtrue + */ +interface PhoneNumberInterface extends \JsonSerializable +{ + /** + * 86. + * + * @return int + */ + public function getIDDCode(); + + /** + * 18888888888. + * + * @return int + */ + public function getNumber(); + + /** + * +8618888888888. + * + * @return string + */ + public function getUniversalNumber(); + + /** + * 008618888888888. + * + * @return string + */ + public function getZeroPrefixedNumber(); + + /** + * @return string + */ + public function __toString(); +} diff --git a/vendor/overtrue/easy-sms/src/Contracts/StrategyInterface.php b/vendor/overtrue/easy-sms/src/Contracts/StrategyInterface.php new file mode 100644 index 0000000..1cda2c7 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Contracts/StrategyInterface.php @@ -0,0 +1,27 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Contracts; + +/** + * Interface StrategyInterface. + */ +interface StrategyInterface +{ + /** + * Apply the strategy and return result. + * + * @param array $gateways + * + * @return array + */ + public function apply(array $gateways); +} diff --git a/vendor/overtrue/easy-sms/src/EasySms.php b/vendor/overtrue/easy-sms/src/EasySms.php new file mode 100644 index 0000000..9fc68e7 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/EasySms.php @@ -0,0 +1,326 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms; + +use Closure; +use Overtrue\EasySms\Contracts\GatewayInterface; +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Contracts\StrategyInterface; +use Overtrue\EasySms\Exceptions\InvalidArgumentException; +use Overtrue\EasySms\Gateways\Gateway; +use Overtrue\EasySms\Strategies\OrderStrategy; +use Overtrue\EasySms\Support\Config; + +/** + * Class EasySms. + */ +class EasySms +{ + /** + * @var \Overtrue\EasySms\Support\Config + */ + protected $config; + + /** + * @var string + */ + protected $defaultGateway; + + /** + * @var array + */ + protected $customCreators = []; + + /** + * @var array + */ + protected $gateways = []; + + /** + * @var \Overtrue\EasySms\Messenger + */ + protected $messenger; + + /** + * @var array + */ + protected $strategies = []; + + /** + * Constructor. + * + * @param array $config + */ + public function __construct(array $config) + { + $this->config = new Config($config); + } + + /** + * Send a message. + * + * @param string|array $to + * @param \Overtrue\EasySms\Contracts\MessageInterface|array $message + * @param array $gateways + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException + * @throws \Overtrue\EasySms\Exceptions\NoGatewayAvailableException + */ + public function send($to, $message, array $gateways = []) + { + $to = $this->formatPhoneNumber($to); + $message = $this->formatMessage($message); + $gateways = empty($gateways) ? $message->getGateways() : $gateways; + + if (empty($gateways)) { + $gateways = $this->config->get('default.gateways', []); + } + + return $this->getMessenger()->send($to, $message, $this->formatGateways($gateways)); + } + + /** + * Create a gateway. + * + * @param string|null $name + * + * @return \Overtrue\EasySms\Contracts\GatewayInterface + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException + */ + public function gateway($name) + { + if (!isset($this->gateways[$name])) { + $this->gateways[$name] = $this->createGateway($name); + } + + return $this->gateways[$name]; + } + + /** + * Get a strategy instance. + * + * @param string|null $strategy + * + * @return \Overtrue\EasySms\Contracts\StrategyInterface + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException + */ + public function strategy($strategy = null) + { + if (\is_null($strategy)) { + $strategy = $this->config->get('default.strategy', OrderStrategy::class); + } + + if (!\class_exists($strategy)) { + $strategy = __NAMESPACE__.'\Strategies\\'.\ucfirst($strategy); + } + + if (!\class_exists($strategy)) { + throw new InvalidArgumentException("Unsupported strategy \"{$strategy}\""); + } + + if (empty($this->strategies[$strategy]) || !($this->strategies[$strategy] instanceof StrategyInterface)) { + $this->strategies[$strategy] = new $strategy($this); + } + + return $this->strategies[$strategy]; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $name + * @param \Closure $callback + * + * @return $this + */ + public function extend($name, Closure $callback) + { + $this->customCreators[$name] = $callback; + + return $this; + } + + /** + * @return \Overtrue\EasySms\Support\Config + */ + public function getConfig() + { + return $this->config; + } + + /** + * @return \Overtrue\EasySms\Messenger + */ + public function getMessenger() + { + return $this->messenger ?: $this->messenger = new Messenger($this); + } + + /** + * Create a new driver instance. + * + * @param string $name + * + * @throws \InvalidArgumentException + * + * @return GatewayInterface + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException + */ + protected function createGateway($name) + { + $config = $this->config->get("gateways.{$name}", []); + + if (!isset($config['timeout'])) { + $config['timeout'] = $this->config->get('timeout', Gateway::DEFAULT_TIMEOUT); + } + + $config['options'] = $this->config->get('options', []); + + if (isset($this->customCreators[$name])) { + $gateway = $this->callCustomCreator($name, $config); + } else { + $className = $this->formatGatewayClassName($name); + $gateway = $this->makeGateway($className, $config); + } + + if (!($gateway instanceof GatewayInterface)) { + throw new InvalidArgumentException(\sprintf('Gateway "%s" must implement interface %s.', $name, GatewayInterface::class)); + } + + return $gateway; + } + + /** + * Make gateway instance. + * + * @param string $gateway + * @param array $config + * + * @return \Overtrue\EasySms\Contracts\GatewayInterface + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException + */ + protected function makeGateway($gateway, $config) + { + if (!\class_exists($gateway) || !\in_array(GatewayInterface::class, \class_implements($gateway))) { + throw new InvalidArgumentException(\sprintf('Class "%s" is a invalid easy-sms gateway.', $gateway)); + } + + return new $gateway($config); + } + + /** + * Format gateway name. + * + * @param string $name + * + * @return string + */ + protected function formatGatewayClassName($name) + { + if (\class_exists($name) && \in_array(GatewayInterface::class, \class_implements($name))) { + return $name; + } + + $name = \ucfirst(\str_replace(['-', '_', ''], '', $name)); + + return __NAMESPACE__."\\Gateways\\{$name}Gateway"; + } + + /** + * Call a custom gateway creator. + * + * @param string $gateway + * @param array $config + * + * @return mixed + */ + protected function callCustomCreator($gateway, $config) + { + return \call_user_func($this->customCreators[$gateway], $config); + } + + /** + * @param string|\Overtrue\EasySms\Contracts\PhoneNumberInterface $number + * + * @return \Overtrue\EasySms\Contracts\PhoneNumberInterface|string + */ + protected function formatPhoneNumber($number) + { + if ($number instanceof PhoneNumberInterface) { + return $number; + } + + return new PhoneNumber(\trim($number)); + } + + /** + * @param array|string|\Overtrue\EasySms\Contracts\MessageInterface $message + * + * @return \Overtrue\EasySms\Contracts\MessageInterface + */ + protected function formatMessage($message) + { + if (!($message instanceof MessageInterface)) { + if (!\is_array($message)) { + $message = [ + 'content' => $message, + 'template' => $message, + ]; + } + + $message = new Message($message); + } + + return $message; + } + + /** + * @param array $gateways + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException + */ + protected function formatGateways(array $gateways) + { + $formatted = []; + + foreach ($gateways as $gateway => $setting) { + if (\is_int($gateway) && \is_string($setting)) { + $gateway = $setting; + $setting = []; + } + + $formatted[$gateway] = $setting; + $globalSettings = $this->config->get("gateways.{$gateway}", []); + + if (\is_string($gateway) && !empty($globalSettings) && \is_array($setting)) { + $formatted[$gateway] = new Config(\array_merge($globalSettings, $setting)); + } + } + + $result = []; + + foreach ($this->strategy()->apply($formatted) as $name) { + $result[$name] = $formatted[$name]; + } + + return $result; + } +} diff --git a/vendor/overtrue/easy-sms/src/Exceptions/Exception.php b/vendor/overtrue/easy-sms/src/Exceptions/Exception.php new file mode 100644 index 0000000..079d415 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Exceptions/Exception.php @@ -0,0 +1,21 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Exceptions; + +/** + * Class Exception. + * + * @author overtrue + */ +class Exception extends \Exception +{ +} diff --git a/vendor/overtrue/easy-sms/src/Exceptions/GatewayErrorException.php b/vendor/overtrue/easy-sms/src/Exceptions/GatewayErrorException.php new file mode 100644 index 0000000..e183def --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Exceptions/GatewayErrorException.php @@ -0,0 +1,37 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Exceptions; + +/** + * Class GatewayErrorException. + */ +class GatewayErrorException extends Exception +{ + /** + * @var array + */ + public $raw = []; + + /** + * GatewayErrorException constructor. + * + * @param string $message + * @param int $code + * @param array $raw + */ + public function __construct($message, $code, array $raw = []) + { + parent::__construct($message, intval($code)); + + $this->raw = $raw; + } +} diff --git a/vendor/overtrue/easy-sms/src/Exceptions/InvalidArgumentException.php b/vendor/overtrue/easy-sms/src/Exceptions/InvalidArgumentException.php new file mode 100644 index 0000000..c2be998 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Exceptions/InvalidArgumentException.php @@ -0,0 +1,19 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Exceptions; + +/** + * Class InvalidArgumentException. + */ +class InvalidArgumentException extends Exception +{ +} diff --git a/vendor/overtrue/easy-sms/src/Exceptions/NoGatewayAvailableException.php b/vendor/overtrue/easy-sms/src/Exceptions/NoGatewayAvailableException.php new file mode 100644 index 0000000..7c804d9 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Exceptions/NoGatewayAvailableException.php @@ -0,0 +1,81 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Exceptions; + +use Throwable; + +/** + * Class NoGatewayAvailableException. + * + * @author overtrue + */ +class NoGatewayAvailableException extends Exception +{ + /** + * @var array + */ + public $results = []; + + /** + * @var array + */ + public $exceptions = []; + + /** + * NoGatewayAvailableException constructor. + * + * @param array $results + * @param int $code + * @param \Throwable|null $previous + */ + public function __construct(array $results = [], $code = 0, Throwable $previous = null) + { + $this->results = $results; + $this->exceptions = \array_column($results, 'exception', 'gateway'); + + parent::__construct('All the gateways have failed. You can get error details by `$exception->getExceptions()`', $code, $previous); + } + + /** + * @return array + */ + public function getResults() + { + return $this->results; + } + + /** + * @param string $gateway + * + * @return mixed|null + */ + public function getException($gateway) + { + return isset($this->exceptions[$gateway]) ? $this->exceptions[$gateway] : null; + } + + /** + * @return array + */ + public function getExceptions() + { + return $this->exceptions; + } + + /** + * @return mixed + */ + public function getLastException() + { + return end($this->exceptions); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/AliyunGateway.php b/vendor/overtrue/easy-sms/src/Gateways/AliyunGateway.php new file mode 100644 index 0000000..c061dd2 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/AliyunGateway.php @@ -0,0 +1,107 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class AliyunGateway. + * + * @author carson + * + * @see https://help.aliyun.com/document_detail/55451.html + */ +class AliyunGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'http://dysmsapi.aliyuncs.com'; + + const ENDPOINT_METHOD = 'SendSms'; + + const ENDPOINT_VERSION = '2017-05-25'; + + const ENDPOINT_FORMAT = 'JSON'; + + const ENDPOINT_REGION_ID = 'cn-hangzhou'; + + const ENDPOINT_SIGNATURE_METHOD = 'HMAC-SHA1'; + + const ENDPOINT_SIGNATURE_VERSION = '1.0'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $data = $message->getData($this); + + $signName = !empty($data['sign_name']) ? $data['sign_name'] : $config->get('sign_name'); + + unset($data['sign_name']); + + $params = [ + 'RegionId' => self::ENDPOINT_REGION_ID, + 'AccessKeyId' => $config->get('access_key_id'), + 'Format' => self::ENDPOINT_FORMAT, + 'SignatureMethod' => self::ENDPOINT_SIGNATURE_METHOD, + 'SignatureVersion' => self::ENDPOINT_SIGNATURE_VERSION, + 'SignatureNonce' => uniqid(), + 'Timestamp' => gmdate('Y-m-d\TH:i:s\Z'), + 'Action' => self::ENDPOINT_METHOD, + 'Version' => self::ENDPOINT_VERSION, + 'PhoneNumbers' => !\is_null($to->getIDDCode()) ? strval($to->getZeroPrefixedNumber()) : $to->getNumber(), + 'SignName' => $signName, + 'TemplateCode' => $message->getTemplate($this), + 'TemplateParam' => json_encode($data, JSON_FORCE_OBJECT), + ]; + + $params['Signature'] = $this->generateSign($params); + + $result = $this->get(self::ENDPOINT_URL, $params); + + if (!empty($result['Code']) && 'OK' != $result['Code']) { + throw new GatewayErrorException($result['Message'], $result['Code'], $result); + } + + return $result; + } + + /** + * Generate Sign. + * + * @param array $params + * + * @return string + * + * @see https://help.aliyun.com/document_detail/101343.html + */ + protected function generateSign($params) + { + ksort($params); + $accessKeySecret = $this->config->get('access_key_secret'); + $stringToSign = 'GET&%2F&'.urlencode(http_build_query($params, '', '&', PHP_QUERY_RFC3986)); + $stringToSign = str_replace('%7E', '~', $stringToSign); + + return base64_encode(hash_hmac('sha1', $stringToSign, $accessKeySecret.'&', true)); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/AliyunIntlGateway.php b/vendor/overtrue/easy-sms/src/Gateways/AliyunIntlGateway.php new file mode 100644 index 0000000..dcd7880 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/AliyunIntlGateway.php @@ -0,0 +1,97 @@ +getData($this); + + $signName = !empty($data['sign_name']) ? $data['sign_name'] : $config->get('sign_name'); + + unset($data['sign_name']); + + $params = [ + 'RegionId' => self::ENDPOINT_REGION_ID, + 'AccessKeyId' => $config->get('access_key_id'), + 'Format' => self::ENDPOINT_FORMAT, + 'SignatureMethod' => self::ENDPOINT_SIGNATURE_METHOD, + 'SignatureVersion' => self::ENDPOINT_SIGNATURE_VERSION, + 'SignatureNonce' => uniqid('', true), + 'Timestamp' => gmdate('Y-m-d\TH:i:s\Z'), + 'Version' => self::ENDPOINT_VERSION, + 'To' => !\is_null($to->getIDDCode()) ? (int) $to->getZeroPrefixedNumber() : $to->getNumber(), + 'Action' => self::ENDPOINT_ACTION, + 'From' => $signName, + 'TemplateCode' => $message->getTemplate($this), + 'TemplateParam' => json_encode($data, JSON_FORCE_OBJECT), + ]; + + $params['Signature'] = $this->generateSign($params); + + $result = $this->get(self::ENDPOINT_URL, $params); + + if ('OK' !== $result['ResponseCode']) { + throw new GatewayErrorException($result['ResponseDescription'], $result['ResponseCode'], $result); + } + + return $result; + } + + /** + * Generate sign + * + * @param array $params + * + * @return string + */ + protected function generateSign(array $params) + { + ksort($params); + $accessKeySecret = $this->config->get('access_key_secret'); + $stringToSign = 'GET&%2F&'.urlencode(http_build_query($params, '', '&', PHP_QUERY_RFC3986)); + + return base64_encode(hash_hmac('sha1', $stringToSign, $accessKeySecret.'&', true)); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/AliyunrestGateway.php b/vendor/overtrue/easy-sms/src/Gateways/AliyunrestGateway.php new file mode 100644 index 0000000..d4359d2 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/AliyunrestGateway.php @@ -0,0 +1,107 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class AliyunrestGateway. + */ +class AliyunrestGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'http://gw.api.taobao.com/router/rest'; + + const ENDPOINT_VERSION = '2.0'; + + const ENDPOINT_FORMAT = 'json'; + + const ENDPOINT_METHOD = 'alibaba.aliqin.fc.sms.num.send'; + + const ENDPOINT_SIGNATURE_METHOD = 'md5'; + + const ENDPOINT_PARTNER_ID = 'EasySms'; + + /** + * @param PhoneNumberInterface $to + * @param MessageInterface $message + * @param Config $config + * + * @return array|void + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $urlParams = [ + 'app_key' => $config->get('app_key'), + 'v' => self::ENDPOINT_VERSION, + 'format' => self::ENDPOINT_FORMAT, + 'sign_method' => self::ENDPOINT_SIGNATURE_METHOD, + 'method' => self::ENDPOINT_METHOD, + 'timestamp' => date('Y-m-d H:i:s'), + 'partner_id' => self::ENDPOINT_PARTNER_ID, + ]; + + $params = [ + 'extend' => '', + 'sms_type' => 'normal', + 'sms_free_sign_name' => $config->get('sign_name'), + 'sms_param' => json_encode($message->getData($this)), + 'rec_num' => !\is_null($to->getIDDCode()) ? strval($to->getZeroPrefixedNumber()) : $to->getNumber(), + 'sms_template_code' => $message->getTemplate($this), + ]; + $urlParams['sign'] = $this->generateSign(array_merge($params, $urlParams)); + + $result = $this->post($this->getEndpointUrl($urlParams), $params); + + if (isset($result['error_response']) && 0 != $result['error_response']['code']) { + throw new GatewayErrorException($result['error_response']['msg'], $result['error_response']['code'], $result); + } + + return $result; + } + + /** + * @param array $params + * + * @return string + */ + protected function getEndpointUrl($params) + { + return self::ENDPOINT_URL.'?'.http_build_query($params); + } + + /** + * @param array $params + * + * @return string + */ + protected function generateSign($params) + { + ksort($params); + + $stringToBeSigned = $this->config->get('app_secret_key'); + foreach ($params as $k => $v) { + if (!is_array($v) && '@' != substr($v, 0, 1)) { + $stringToBeSigned .= "$k$v"; + } + } + unset($k, $v); + $stringToBeSigned .= $this->config->get('app_secret_key'); + + return strtoupper(md5($stringToBeSigned)); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/AvatardataGateway.php b/vendor/overtrue/easy-sms/src/Gateways/AvatardataGateway.php new file mode 100644 index 0000000..1958cd4 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/AvatardataGateway.php @@ -0,0 +1,60 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class AvatardataGateway. + * + * @see http://www.avatardata.cn/Docs/Api/fd475e40-7809-4be7-936c-5926dd41b0fe + */ +class AvatardataGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'http://v1.avatardata.cn/Sms/Send'; + + const ENDPOINT_FORMAT = 'json'; + + /** + * @param PhoneNumberInterface $to + * @param MessageInterface $message + * @param Config $config + * + * @return array + * + * @throws GatewayErrorException; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $params = [ + 'mobile' => $to->getNumber(), + 'templateId' => $message->getTemplate($this), + 'param' => implode(',', $message->getData($this)), + 'dtype' => self::ENDPOINT_FORMAT, + 'key' => $config->get('app_key'), + ]; + + $result = $this->get(self::ENDPOINT_URL, $params); + + if ($result['error_code']) { + throw new GatewayErrorException($result['reason'], $result['error_code'], $result); + } + + return $result; + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/BaiduGateway.php b/vendor/overtrue/easy-sms/src/Gateways/BaiduGateway.php new file mode 100644 index 0000000..5c26b0a --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/BaiduGateway.php @@ -0,0 +1,174 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class BaiduGateway. + * + * @see https://cloud.baidu.com/doc/SMS/index.html + */ +class BaiduGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_HOST = 'smsv3.bj.baidubce.com'; + + const ENDPOINT_URI = '/api/v3/sendSms'; + + const BCE_AUTH_VERSION = 'bce-auth-v1'; + + const DEFAULT_EXPIRATION_IN_SECONDS = 1800; //签名有效期默认1800秒 + + const SUCCESS_CODE = 1000; + + /** + * Send message. + * + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $params = [ + 'signatureId' => $config->get('invoke_id'), + 'mobile' => $to->getNumber(), + 'template' => $message->getTemplate($this), + 'contentVar' => $message->getData($this), + ]; + if (!empty($params['contentVar']['custom'])) { + //用户自定义参数,格式为字符串,状态回调时会回传该值 + $params['custom'] = $params['contentVar']['custom']; + unset($params['contentVar']['custom']); + } + if (!empty($params['contentVar']['userExtId'])) { + //通道自定义扩展码,上行回调时会回传该值,其格式为纯数字串。默认为不开通,请求时无需设置该参数。如需开通请联系客服申请 + $params['userExtId'] = $params['contentVar']['userExtId']; + unset($params['contentVar']['userExtId']); + } + + $datetime = gmdate('Y-m-d\TH:i:s\Z'); + + $headers = [ + 'host' => self::ENDPOINT_HOST, + 'content-type' => 'application/json', + 'x-bce-date' => $datetime, + ]; + //获得需要签名的数据 + $signHeaders = $this->getHeadersToSign($headers, ['host', 'x-bce-date']); + + $headers['Authorization'] = $this->generateSign($signHeaders, $datetime, $config); + + $result = $this->request('post', self::buildEndpoint($config), ['headers' => $headers, 'json' => $params]); + + if (self::SUCCESS_CODE != $result['code']) { + throw new GatewayErrorException($result['message'], $result['code'], $result); + } + + return $result; + } + + /** + * Build endpoint url. + * + * @param \Overtrue\EasySms\Support\Config $config + * + * @return string + */ + protected function buildEndpoint(Config $config) + { + return 'http://'.$config->get('domain', self::ENDPOINT_HOST).self::ENDPOINT_URI; + } + + /** + * Generate Authorization header. + * + * @param array $signHeaders + * @param int $datetime + * @param \Overtrue\EasySms\Support\Config $config + * + * @return string + */ + protected function generateSign(array $signHeaders, $datetime, Config $config) + { + // 生成 authString + $authString = self::BCE_AUTH_VERSION.'/'.$config->get('ak').'/' + .$datetime.'/'.self::DEFAULT_EXPIRATION_IN_SECONDS; + + // 使用 sk 和 authString 生成 signKey + $signingKey = hash_hmac('sha256', $authString, $config->get('sk')); + // 生成标准化 URI + // 根据 RFC 3986,除了:1.大小写英文字符 2.阿拉伯数字 3.点'.'、波浪线'~'、减号'-'以及下划线'_' 以外都要编码 + $canonicalURI = str_replace('%2F', '/', rawurlencode(self::ENDPOINT_URI)); + + // 生成标准化 QueryString + $canonicalQueryString = ''; // 此 api 不需要此项。返回空字符串 + + // 整理 headersToSign,以 ';' 号连接 + $signedHeaders = empty($signHeaders) ? '' : strtolower(trim(implode(';', array_keys($signHeaders)))); + + // 生成标准化 header + $canonicalHeader = $this->getCanonicalHeaders($signHeaders); + + // 组成标准请求串 + $canonicalRequest = "POST\n{$canonicalURI}\n{$canonicalQueryString}\n{$canonicalHeader}"; + + // 使用 signKey 和标准请求串完成签名 + $signature = hash_hmac('sha256', $canonicalRequest, $signingKey); + + // 组成最终签名串 + return "{$authString}/{$signedHeaders}/{$signature}"; + } + + /** + * 生成标准化 http 请求头串. + * + * @param array $headers + * + * @return string + */ + protected function getCanonicalHeaders(array $headers) + { + $headerStrings = []; + foreach ($headers as $name => $value) { + //trim后再encode,之后使用':'号连接起来 + $headerStrings[] = rawurlencode(strtolower(trim($name))).':'.rawurlencode(trim($value)); + } + + sort($headerStrings); + + return implode("\n", $headerStrings); + } + + /** + * 根据 指定的 keys 过滤应该参与签名的 header. + * + * @param array $headers + * @param array $keys + * + * @return array + */ + protected function getHeadersToSign(array $headers, array $keys) + { + return array_intersect_key($headers, array_flip($keys)); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/ChuanglanGateway.php b/vendor/overtrue/easy-sms/src/Gateways/ChuanglanGateway.php new file mode 100644 index 0000000..f22839a --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/ChuanglanGateway.php @@ -0,0 +1,156 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Exceptions\InvalidArgumentException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class ChuanglanGateway. + * + * @see https://zz.253.com/v5.html#/api_doc + */ +class ChuanglanGateway extends Gateway +{ + use HasHttpRequest; + + /** + * URL模板 + */ + const ENDPOINT_URL_TEMPLATE = 'https://%s.253.com/msg/send/json'; + + /** + * 国际短信 + */ + const INT_URL = 'http://intapi.253.com/send/json'; + + /** + * 验证码渠道code. + */ + const CHANNEL_VALIDATE_CODE = 'smsbj1'; + + /** + * 会员营销渠道code. + */ + const CHANNEL_PROMOTION_CODE = 'smssh1'; + + /** + * @param PhoneNumberInterface $to + * @param MessageInterface $message + * @param Config $config + * + * @return array + * + * @throws GatewayErrorException + * @throws InvalidArgumentException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $IDDCode = !empty($to->getIDDCode()) ? $to->getIDDCode() : 86; + + $params = [ + 'account' => $config->get('account'), + 'password' => $config->get('password'), + 'phone' => $to->getNumber(), + 'msg' => $this->wrapChannelContent($message->getContent($this), $config, $IDDCode), + ]; + + if (86 != $IDDCode) { + $params['mobile'] = $to->getIDDCode().$to->getNumber(); + $params['account'] = $config->get('intel_account') ?: $config->get('account'); + $params['password'] = $config->get('intel_password') ?: $config->get('password'); + } + + $result = $this->postJson($this->buildEndpoint($config, $IDDCode), $params); + + if (!isset($result['code']) || '0' != $result['code']) { + throw new GatewayErrorException(json_encode($result, JSON_UNESCAPED_UNICODE), isset($result['code']) ? $result['code'] : 0, $result); + } + + return $result; + } + + /** + * @param Config $config + * @param int $IDDCode + * + * @return string + * + * @throws InvalidArgumentException + */ + protected function buildEndpoint(Config $config, $IDDCode = 86) + { + $channel = $this->getChannel($config, $IDDCode); + + if (self::INT_URL === $channel) { + return $channel; + } + + return sprintf(self::ENDPOINT_URL_TEMPLATE, $channel); + } + + /** + * @param Config $config + * @param int $IDDCode + * + * @return mixed + * + * @throws InvalidArgumentException + */ + protected function getChannel(Config $config, $IDDCode) + { + if (86 != $IDDCode) { + return self::INT_URL; + } + $channel = $config->get('channel', self::CHANNEL_VALIDATE_CODE); + + if (!in_array($channel, [self::CHANNEL_VALIDATE_CODE, self::CHANNEL_PROMOTION_CODE])) { + throw new InvalidArgumentException('Invalid channel for ChuanglanGateway.'); + } + + return $channel; + } + + /** + * @param string $content + * @param Config $config + * @param int $IDDCode + * + * @return string|string + * + * @throws InvalidArgumentException + */ + protected function wrapChannelContent($content, Config $config, $IDDCode) + { + $channel = $this->getChannel($config, $IDDCode); + + if (self::CHANNEL_PROMOTION_CODE == $channel) { + $sign = (string) $config->get('sign', ''); + if (empty($sign)) { + throw new InvalidArgumentException('Invalid sign for ChuanglanGateway when using promotion channel'); + } + + $unsubscribe = (string) $config->get('unsubscribe', ''); + if (empty($unsubscribe)) { + throw new InvalidArgumentException('Invalid unsubscribe for ChuanglanGateway when using promotion channel'); + } + + $content = $sign.$content.$unsubscribe; + } + + return $content; + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/Chuanglanv1Gateway.php b/vendor/overtrue/easy-sms/src/Gateways/Chuanglanv1Gateway.php new file mode 100644 index 0000000..a81fb6a --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/Chuanglanv1Gateway.php @@ -0,0 +1,147 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Exceptions\InvalidArgumentException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class ChuanglanGateway. + * + * @see https://www.chuanglan.com/document/6110e57909fd9600010209de/62b3dc1d272e290001af3e75 + */ +class Chuanglanv1Gateway extends Gateway +{ + use HasHttpRequest; + + /** + * 国际短信 + */ + const INT_URL = 'http://intapi.253.com/send/json'; + + /** + * URL模板 + */ + const ENDPOINT_URL_TEMPLATE = 'https://smssh1.253.com/msg/%s/json'; + + /** + * 支持单发、群发短信 + */ + const CHANNEL_NORMAL_CODE = 'v1/send'; + + /** + * 单号码对应单内容批量下发 + */ + const CHANNEL_VARIABLE_CODE = 'variable'; + + /** + * @param PhoneNumberInterface $to + * @param MessageInterface $message + * @param Config $config + * + * @return array + * + * @throws GatewayErrorException + * @throws InvalidArgumentException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $IDDCode = !empty($to->getIDDCode()) ? $to->getIDDCode() : 86; + + $params = [ + 'account' => $config->get('account'), + 'password' => $config->get('password'), + 'report' => $config->get('needstatus') ?? false + ]; + + if (86 != $IDDCode) { + $params['mobile'] = $to->getIDDCode() . $to->getNumber(); + $params['account'] = $config->get('intel_account') ?: $config->get('account'); + $params['password'] = $config->get('intel_password') ?: $config->get('password'); + } + + if (self::CHANNEL_VARIABLE_CODE == $this->getChannel($config, $IDDCode)) { + $params['params'] = $message->getData($this); + $params['msg'] = $this->wrapChannelContent($message->getTemplate($this), $config, $IDDCode); + } else { + $params['phone'] = $to->getNumber(); + $params['msg'] = $this->wrapChannelContent($message->getContent($this), $config, $IDDCode); + } + + $result = $this->postJson($this->buildEndpoint($config, $IDDCode), $params); + + if (!isset($result['code']) || '0' != $result['code']) { + throw new GatewayErrorException(json_encode($result, JSON_UNESCAPED_UNICODE), isset($result['code']) ? $result['code'] : 0, $result); + } + + return $result; + } + + /** + * @param Config $config + * @param int $IDDCode + * + * @return string + * + * @throws InvalidArgumentException + */ + protected function buildEndpoint(Config $config, $IDDCode = 86) + { + $channel = $this->getChannel($config, $IDDCode); + + if (self::INT_URL === $channel) { + return $channel; + } + + return sprintf(self::ENDPOINT_URL_TEMPLATE, $channel); + } + + /** + * @param Config $config + * @param int $IDDCode + * + * @return mixed + * + * @throws InvalidArgumentException + */ + protected function getChannel(Config $config, $IDDCode) + { + if (86 != $IDDCode) { + return self::INT_URL; + } + $channel = $config->get('channel', self::CHANNEL_NORMAL_CODE); + + if (!in_array($channel, [self::CHANNEL_NORMAL_CODE, self::CHANNEL_VARIABLE_CODE])) { + throw new InvalidArgumentException('Invalid channel for ChuanglanGateway.'); + } + + return $channel; + } + + /** + * @param string $content + * @param Config $config + * @param int $IDDCode + * + * @return string|string + * + * @throws InvalidArgumentException + */ + protected function wrapChannelContent($content, Config $config, $IDDCode) + { + return $content; + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/ErrorlogGateway.php b/vendor/overtrue/easy-sms/src/Gateways/ErrorlogGateway.php new file mode 100644 index 0000000..d27b40d --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/ErrorlogGateway.php @@ -0,0 +1,50 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Support\Config; + +/** + * Class ErrorlogGateway. + */ +class ErrorlogGateway extends Gateway +{ + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + if (is_array($to)) { + $to = implode(',', $to); + } + + $message = sprintf( + "[%s] to: %s | message: \"%s\" | template: \"%s\" | data: %s\n", + date('Y-m-d H:i:s'), + $to, + $message->getContent($this), + $message->getTemplate($this), + json_encode($message->getData($this)) + ); + + $file = $this->config->get('file', ini_get('error_log')); + $status = error_log($message, 3, $file); + + return compact('status', 'file'); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/Gateway.php b/vendor/overtrue/easy-sms/src/Gateways/Gateway.php new file mode 100644 index 0000000..c6791fc --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/Gateway.php @@ -0,0 +1,120 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\GatewayInterface; +use Overtrue\EasySms\Support\Config; + +/** + * Class Gateway. + */ +abstract class Gateway implements GatewayInterface +{ + const DEFAULT_TIMEOUT = 5.0; + + /** + * @var \Overtrue\EasySms\Support\Config + */ + protected $config; + + /** + * @var array + */ + protected $options; + + /** + * @var float + */ + protected $timeout; + + /** + * Gateway constructor. + * + * @param array $config + */ + public function __construct(array $config) + { + $this->config = new Config($config); + } + + /** + * Return timeout. + * + * @return int|mixed + */ + public function getTimeout() + { + return $this->timeout ?: $this->config->get('timeout', self::DEFAULT_TIMEOUT); + } + + /** + * Set timeout. + * + * @param int $timeout + * + * @return $this + */ + public function setTimeout($timeout) + { + $this->timeout = floatval($timeout); + + return $this; + } + + /** + * @return \Overtrue\EasySms\Support\Config + */ + public function getConfig() + { + return $this->config; + } + + /** + * @param \Overtrue\EasySms\Support\Config $config + * + * @return $this + */ + public function setConfig(Config $config) + { + $this->config = $config; + + return $this; + } + + /** + * @param $options + * + * @return $this + */ + public function setGuzzleOptions($options) + { + $this->options = $options; + + return $this; + } + + /** + * @return array + */ + public function getGuzzleOptions() + { + return $this->options ?: $this->config->get('options', []); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return \strtolower(str_replace([__NAMESPACE__.'\\', 'Gateway'], '', \get_class($this))); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/HuaweiGateway.php b/vendor/overtrue/easy-sms/src/Gateways/HuaweiGateway.php new file mode 100644 index 0000000..16060ca --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/HuaweiGateway.php @@ -0,0 +1,148 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use GuzzleHttp\Exception\RequestException; +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Exceptions\InvalidArgumentException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +class HuaweiGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_HOST = 'https://api.rtc.huaweicloud.com:10443'; + + const ENDPOINT_URI = '/sms/batchSendSms/v1'; + + const SUCCESS_CODE = '000000'; + + /** + * 发送信息. + * + * @param PhoneNumberInterface $to + * @param MessageInterface $message + * @param Config $config + * + * @return array + * + * @throws GatewayErrorException + * @throws InvalidArgumentException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $appKey = $config->get('app_key'); + $appSecret = $config->get('app_secret'); + $channels = $config->get('from'); + $statusCallback = $config->get('callback', ''); + + $endpoint = $this->getEndpoint($config); + $headers = $this->getHeaders($appKey, $appSecret); + + $templateId = $message->getTemplate($this); + $messageData = $message->getData($this); + + // 短信签名通道号码 + $from = 'default'; + if (isset($messageData['from'])) { + $from = $messageData['from']; + unset($messageData['from']); + } + $channel = isset($channels[$from]) ? $channels[$from] : ''; + + if (empty($channel)) { + throw new InvalidArgumentException("From Channel [{$from}] Not Exist"); + } + + $params = [ + 'from' => $channel, + 'to' => $to->getUniversalNumber(), + 'templateId' => $templateId, + 'templateParas' => json_encode($messageData), + 'statusCallback' => $statusCallback, + ]; + + try { + $result = $this->request('post', $endpoint, [ + 'headers' => $headers, + 'form_params' => $params, + //为防止因HTTPS证书认证失败造成API调用失败,需要先忽略证书信任问题 + 'verify' => false, + ]); + } catch (RequestException $e) { + $result = $this->unwrapResponse($e->getResponse()); + } + + if (self::SUCCESS_CODE != $result['code']) { + throw new GatewayErrorException($result['description'], ltrim($result['code'], 'E'), $result); + } + + return $result; + } + + /** + * 构造 Endpoint. + * + * @param Config $config + * + * @return string + */ + protected function getEndpoint(Config $config) + { + $endpoint = rtrim($config->get('endpoint', self::ENDPOINT_HOST), '/'); + + return $endpoint.self::ENDPOINT_URI; + } + + /** + * 获取请求 Headers 参数. + * + * @param string $appKey + * @param string $appSecret + * + * @return array + */ + protected function getHeaders($appKey, $appSecret) + { + return [ + 'Content-Type' => 'application/x-www-form-urlencoded', + 'Authorization' => 'WSSE realm="SDP",profile="UsernameToken",type="Appkey"', + 'X-WSSE' => $this->buildWsseHeader($appKey, $appSecret), + ]; + } + + /** + * 构造X-WSSE参数值 + * + * @param string $appKey + * @param string $appSecret + * + * @return string + */ + protected function buildWsseHeader($appKey, $appSecret) + { + $now = date('Y-m-d\TH:i:s\Z'); + $nonce = uniqid(); + $passwordDigest = base64_encode(hash('sha256', ($nonce.$now.$appSecret))); + + return sprintf( + 'UsernameToken Username="%s",PasswordDigest="%s",Nonce="%s",Created="%s"', + $appKey, + $passwordDigest, + $nonce, + $now + ); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/HuaxinGateway.php b/vendor/overtrue/easy-sms/src/Gateways/HuaxinGateway.php new file mode 100644 index 0000000..3e5c9fe --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/HuaxinGateway.php @@ -0,0 +1,73 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class HuaxinGateway. + * + * @see http://www.ipyy.com/help/ + */ +class HuaxinGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_TEMPLATE = 'http://%s/smsJson.aspx'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $endpoint = $this->buildEndpoint($config->get('ip')); + + $result = $this->post($endpoint, [ + 'userid' => $config->get('user_id'), + 'account' => $config->get('account'), + 'password' => $config->get('password'), + 'mobile' => $to->getNumber(), + 'content' => $message->getContent($this), + 'sendTime' => '', + 'action' => 'send', + 'extno' => $config->get('ext_no'), + ]); + + if ('Success' !== $result['returnstatus']) { + throw new GatewayErrorException($result['message'], 400, $result); + } + + return $result; + } + + /** + * Build endpoint url. + * + * @param string $ip + * + * @return string + */ + protected function buildEndpoint($ip) + { + return sprintf(self::ENDPOINT_TEMPLATE, $ip); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/HuyiGateway.php b/vendor/overtrue/easy-sms/src/Gateways/HuyiGateway.php new file mode 100644 index 0000000..bcdb91b --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/HuyiGateway.php @@ -0,0 +1,77 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class HuyiGateway. + * + * @see http://www.ihuyi.com/api/sms.html + */ +class HuyiGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'http://106.ihuyi.com/webservice/sms.php?method=Submit'; + + const ENDPOINT_FORMAT = 'json'; + + const SUCCESS_CODE = 2; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $params = [ + 'account' => $config->get('api_id'), + 'mobile' => $to->getIDDCode() ? \sprintf('%s %s', $to->getIDDCode(), $to->getNumber()) : $to->getNumber(), + 'content' => $message->getContent($this), + 'time' => time(), + 'format' => self::ENDPOINT_FORMAT, + 'sign' => $config->get('signature'), + ]; + + $params['password'] = $this->generateSign($params); + + $result = $this->post(self::ENDPOINT_URL, $params); + + if (self::SUCCESS_CODE != $result['code']) { + throw new GatewayErrorException($result['msg'], $result['code'], $result); + } + + return $result; + } + + /** + * Generate Sign. + * + * @param array $params + * + * @return string + */ + protected function generateSign($params) + { + return md5($params['account'].$this->config->get('api_key').$params['mobile'].$params['content'].$params['time']); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/JuheGateway.php b/vendor/overtrue/easy-sms/src/Gateways/JuheGateway.php new file mode 100644 index 0000000..e94d707 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/JuheGateway.php @@ -0,0 +1,76 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class JuheGateway. + * + * @see https://www.juhe.cn/docs/api/id/54 + */ +class JuheGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'http://v.juhe.cn/sms/send'; + + const ENDPOINT_FORMAT = 'json'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $params = [ + 'mobile' => $to->getNumber(), + 'tpl_id' => $message->getTemplate($this), + 'tpl_value' => $this->formatTemplateVars($message->getData($this)), + 'dtype' => self::ENDPOINT_FORMAT, + 'key' => $config->get('app_key'), + ]; + + $result = $this->get(self::ENDPOINT_URL, $params); + + if ($result['error_code']) { + throw new GatewayErrorException($result['reason'], $result['error_code'], $result); + } + + return $result; + } + + /** + * @param array $vars + * + * @return string + */ + protected function formatTemplateVars(array $vars) + { + $formatted = []; + + foreach ($vars as $key => $value) { + $formatted[sprintf('#%s#', trim($key, '#'))] = $value; + } + + return urldecode(http_build_query($formatted)); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/KingttoGateway.php b/vendor/overtrue/easy-sms/src/Gateways/KingttoGateway.php new file mode 100644 index 0000000..c74795a --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/KingttoGateway.php @@ -0,0 +1,61 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class KingttoGateWay. + * + * @see http://www.kingtto.cn/ + */ +class KingttoGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'http://101.201.41.194:9999/sms.aspx'; + + const ENDPOINT_METHOD = 'send'; + + /** + * @param PhoneNumberInterface $to + * @param MessageInterface $message + * @param Config $config + * + * @return \Psr\Http\Message\ResponseInterface|array|string + * + * @throws GatewayErrorException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $params = [ + 'action' => self::ENDPOINT_METHOD, + 'userid' => $config->get('userid'), + 'account' => $config->get('account'), + 'password' => $config->get('password'), + 'mobile' => $to->getNumber(), + 'content' => $message->getContent(), + ]; + + $result = $this->post(self::ENDPOINT_URL, $params); + + if ('Success' != $result['returnstatus']) { + throw new GatewayErrorException($result['message'], $result['remainpoint'], $result); + } + + return $result; + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/LuosimaoGateway.php b/vendor/overtrue/easy-sms/src/Gateways/LuosimaoGateway.php new file mode 100644 index 0000000..07ba2b7 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/LuosimaoGateway.php @@ -0,0 +1,74 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class LuosimaoGateway. + * + * @see https://luosimao.com/docs/api/ + */ +class LuosimaoGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_TEMPLATE = 'https://%s.luosimao.com/%s/%s.%s'; + + const ENDPOINT_VERSION = 'v1'; + + const ENDPOINT_FORMAT = 'json'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $endpoint = $this->buildEndpoint('sms-api', 'send'); + + $result = $this->post($endpoint, [ + 'mobile' => $to->getNumber(), + 'message' => $message->getContent($this), + ], [ + 'Authorization' => 'Basic '.base64_encode('api:key-'.$config->get('api_key')), + ]); + + if ($result['error']) { + throw new GatewayErrorException($result['msg'], $result['error'], $result); + } + + return $result; + } + + /** + * Build endpoint url. + * + * @param string $type + * @param string $function + * + * @return string + */ + protected function buildEndpoint($type, $function) + { + return sprintf(self::ENDPOINT_TEMPLATE, $type, self::ENDPOINT_VERSION, $function, self::ENDPOINT_FORMAT); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/MaapGateway.php b/vendor/overtrue/easy-sms/src/Gateways/MaapGateway.php new file mode 100644 index 0000000..1ca44be --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/MaapGateway.php @@ -0,0 +1,72 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class MaapGateway. + * + * @see https://maap.wo.cn/ + */ +class MaapGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'http://rcsapi.wo.cn:8000/umcinterface/sendtempletmsg'; + + /** + * Send message. + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $params = [ + 'cpcode' => $config->get('cpcode'), + 'msg' => implode(',', $message->getData($this)), + 'mobiles' => $to->getNumber(), + 'excode' => $config->get('excode', ''), + 'templetid' => $message->getTemplate($this), + ]; + $params['sign'] = $this->generateSign($params, $config->get('key')); + + $result = $this->postJson(self::ENDPOINT_URL, $params); + + if (0 != $result['resultcode']) { + throw new GatewayErrorException($result['resultmsg'], $result['resultcode'], $result); + } + + return $result; + } + + /** + * Generate Sign. + * + * @param array $params + * @param string $key 签名Key + * @return string + */ + protected function generateSign($params, $key) + { + return md5($params['cpcode'] . $params['msg'] . $params['mobiles'] . $params['excode'] . $params['templetid'] . $key); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/ModuyunGateway.php b/vendor/overtrue/easy-sms/src/Gateways/ModuyunGateway.php new file mode 100644 index 0000000..7a6d152 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/ModuyunGateway.php @@ -0,0 +1,99 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class ModuyunGateway. + * + * @see https://www.moduyun.com/doc/index.html#10002 + */ +class ModuyunGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'https://live.moduyun.com/sms/v2/sendsinglesms'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $urlParams = [ + 'accesskey' => $config->get('accesskey'), + 'random' => rand(100000, 999999), + ]; + + $params = [ + 'tel' => [ + 'mobile' => $to->getNumber(), + 'nationcode' => $to->getIDDCode() ?: '86', + ], + 'signId' => $config->get('signId', ''), + 'templateId' => $message->getTemplate($this), + 'time' => time(), + 'type' => $config->get('type', 0), + 'params' => array_values($message->getData($this)), + 'ext' => '', + 'extend' => '', + ]; + $params['sig'] = $this->generateSign($params, $urlParams['random']); + + $result = $this->postJson($this->getEndpointUrl($urlParams), $params); + $result = is_string($result) ? json_decode($result, true) : $result; + if (0 != $result['result']) { + throw new GatewayErrorException($result['errmsg'], $result['result'], $result); + } + + return $result; + } + + /** + * @param array $params + * + * @return string + */ + protected function getEndpointUrl($params) + { + return self::ENDPOINT_URL . '?' . http_build_query($params); + } + + /** + * Generate Sign. + * + * @param array $params + * @param string $random + * + * @return string + */ + protected function generateSign($params, $random) + { + return hash('sha256', sprintf( + 'secretkey=%s&random=%d&time=%d&mobile=%s', + $this->config->get('secretkey'), + $random, + $params['time'], + $params['tel']['mobile'] + )); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/NowcnGateway.php b/vendor/overtrue/easy-sms/src/Gateways/NowcnGateway.php new file mode 100644 index 0000000..f138675 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/NowcnGateway.php @@ -0,0 +1,34 @@ + $to->getNumber(), + 'content' => $message->getContent($this), + 'userId' => $config->get('key'), + 'password' => $config->get('secret'), + 'apiType' => $config->get('api_type'), + ]; + $result = $this->get(self::ENDPOINT_URL, $params); + if (self::SUCCESS_CODE != $result['code']) { + throw new GatewayErrorException($result['msg'], $result['code'], $result); + } + return $result; + } +} \ No newline at end of file diff --git a/vendor/overtrue/easy-sms/src/Gateways/QcloudGateway.php b/vendor/overtrue/easy-sms/src/Gateways/QcloudGateway.php new file mode 100644 index 0000000..2aaad18 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/QcloudGateway.php @@ -0,0 +1,137 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class QcloudGateway. + * + * @see https://cloud.tencent.com/document/api/382/55981 + */ +class QcloudGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'https://sms.tencentcloudapi.com'; + + const ENDPOINT_HOST = 'sms.tencentcloudapi.com'; + + const ENDPOINT_SERVICE = 'sms'; + + const ENDPOINT_METHOD = 'SendSms'; + + const ENDPOINT_VERSION = '2021-01-11'; + + const ENDPOINT_REGION = 'ap-guangzhou'; + + const ENDPOINT_FORMAT = 'json'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $data = $message->getData($this); + + $signName = !empty($data['sign_name']) ? $data['sign_name'] : $config->get('sign_name', ''); + + unset($data['sign_name']); + + $phone = !\is_null($to->getIDDCode()) ? strval($to->getUniversalNumber()) : $to->getNumber(); + $params = [ + 'PhoneNumberSet' => [ + $phone + ], + 'SmsSdkAppId' => $this->config->get('sdk_app_id'), + 'SignName' => $signName, + 'TemplateId' => (string) $message->getTemplate($this), + 'TemplateParamSet' => array_map('strval', array_values($data)), + ]; + + $time = time(); + + $result = $this->request('post', self::ENDPOINT_URL, [ + 'headers' => [ + 'Authorization' => $this->generateSign($params, $time), + 'Host' => self::ENDPOINT_HOST, + 'Content-Type' => 'application/json; charset=utf-8', + 'X-TC-Action' => self::ENDPOINT_METHOD, + 'X-TC-Region' => $this->config->get('region', self::ENDPOINT_REGION), + 'X-TC-Timestamp' => $time, + 'X-TC-Version' => self::ENDPOINT_VERSION, + ], + 'json' => $params, + ]); + + if (!empty($result['Response']['Error']['Code'])) { + throw new GatewayErrorException($result['Response']['Error']['Message'], 400, $result); + } + + if (!empty($result['Response']['SendStatusSet'])) { + foreach ($result['Response']['SendStatusSet'] as $group) { + if ($group['Code'] != 'Ok') { + throw new GatewayErrorException($group['Message'], 400, $result); + } + } + } + + return $result; + } + + /** + * Generate Sign. + * + * @param array $params + * + * @return string + */ + protected function generateSign($params, $timestamp) + { + $date = gmdate("Y-m-d", $timestamp); + $secretKey = $this->config->get('secret_key'); + $secretId = $this->config->get('secret_id'); + + $canonicalRequest = 'POST'."\n". + '/'."\n". + '' ."\n". + 'content-type:application/json; charset=utf-8'."\n". + 'host:' . self::ENDPOINT_HOST."\n"."\n". + 'content-type;host'."\n". + hash("SHA256", json_encode($params)); + + $stringToSign = + 'TC3-HMAC-SHA256'."\n". + $timestamp."\n". + $date . '/'. self::ENDPOINT_SERVICE .'/tc3_request'."\n". + hash("SHA256", $canonicalRequest); + + $secretDate = hash_hmac("SHA256", $date, "TC3".$secretKey, true); + $secretService = hash_hmac("SHA256", self::ENDPOINT_SERVICE, $secretDate, true); + $secretSigning = hash_hmac("SHA256", "tc3_request", $secretService, true); + $signature = hash_hmac("SHA256", $stringToSign, $secretSigning); + + return 'TC3-HMAC-SHA256' + ." Credential=". $secretId ."/". $date . '/'. self::ENDPOINT_SERVICE .'/tc3_request' + .", SignedHeaders=content-type;host, Signature=".$signature; + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/QiniuGateway.php b/vendor/overtrue/easy-sms/src/Gateways/QiniuGateway.php new file mode 100644 index 0000000..9a9ad31 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/QiniuGateway.php @@ -0,0 +1,148 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class QiniuGateway. + * + * @see https://developer.qiniu.com/sms/api/5897/sms-api-send-message + */ +class QiniuGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_TEMPLATE = 'https://%s.qiniuapi.com/%s/%s'; + + const ENDPOINT_VERSION = 'v1'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $endpoint = $this->buildEndpoint('sms', 'message/single'); + + $data = $message->getData($this); + + $params = [ + 'template_id' => $message->getTemplate($this), + 'mobile' => $to->getNumber(), + ]; + + if (!empty($data)) { + $params['parameters'] = $data; + } + + $headers = [ + 'Content-Type' => 'application/json', + ]; + + $headers['Authorization'] = $this->generateSign($endpoint, 'POST', json_encode($params), $headers['Content-Type'], $config); + + $result = $this->postJson($endpoint, $params, $headers); + + if (isset($result['error'])) { + throw new GatewayErrorException($result['message'], $result['error'], $result); + } + + return $result; + } + + /** + * Build endpoint url. + * + * @param string $type + * @param string $function + * + * @return string + */ + protected function buildEndpoint($type, $function) + { + return sprintf(self::ENDPOINT_TEMPLATE, $type, self::ENDPOINT_VERSION, $function); + } + + /** + * Build endpoint url. + * + * @param string $url + * @param string $method + * @param string $body + * @param string $contentType + * @param Config $config + * + * @return string + */ + protected function generateSign($url, $method, $body, $contentType, Config $config) + { + $urlItems = parse_url($url); + $host = $urlItems['host']; + if (isset($urlItems['port'])) { + $port = $urlItems['port']; + } else { + $port = ''; + } + $path = $urlItems['path']; + if (isset($urlItems['query'])) { + $query = $urlItems['query']; + } else { + $query = ''; + } + //write request uri + $toSignStr = $method.' '.$path; + if (!empty($query)) { + $toSignStr .= '?'.$query; + } + //write host and port + $toSignStr .= "\nHost: ".$host; + if (!empty($port)) { + $toSignStr .= ':'.$port; + } + //write content type + if (!empty($contentType)) { + $toSignStr .= "\nContent-Type: ".$contentType; + } + $toSignStr .= "\n\n"; + //write body + if (!empty($body)) { + $toSignStr .= $body; + } + + $hmac = hash_hmac('sha1', $toSignStr, $config->get('secret_key'), true); + + return 'Qiniu '.$config->get('access_key').':'.$this->base64UrlSafeEncode($hmac); + } + + /** + * @param string $data + * + * @return string + */ + protected function base64UrlSafeEncode($data) + { + $find = array('+', '/'); + $replace = array('-', '_'); + + return str_replace($find, $replace, base64_encode($data)); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/RongcloudGateway.php b/vendor/overtrue/easy-sms/src/Gateways/RongcloudGateway.php new file mode 100644 index 0000000..8464a1c --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/RongcloudGateway.php @@ -0,0 +1,134 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use GuzzleHttp\Exception\ClientException; +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class RongcloudGateway. + * + * @author Darren Gao + * + * @see http://www.rongcloud.cn/docs/sms_service.html#send_sms_code + */ +class RongcloudGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_TEMPLATE = 'http://api.sms.ronghub.com/%s.%s'; + + const ENDPOINT_ACTION = 'sendCode'; + + const ENDPOINT_FORMAT = 'json'; + + const ENDPOINT_REGION = '86'; // 中国区,目前只支持此国别 + + const SUCCESS_CODE = 200; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $data = $message->getData(); + $action = array_key_exists('action', $data) ? $data['action'] : self::ENDPOINT_ACTION; + $endpoint = $this->buildEndpoint($action); + + $headers = [ + 'Nonce' => uniqid(), + 'App-Key' => $config->get('app_key'), + 'Timestamp' => time(), + ]; + $headers['Signature'] = $this->generateSign($headers, $config); + + switch ($action) { + case 'sendCode': + $params = [ + 'mobile' => $to->getNumber(), + 'region' => self::ENDPOINT_REGION, + 'templateId' => $message->getTemplate($this), + ]; + + break; + case 'verifyCode': + if (!array_key_exists('code', $data) + or !array_key_exists('sessionId', $data)) { + throw new GatewayErrorException('"code" or "sessionId" is not set', 0); + } + $params = [ + 'code' => $data['code'], + 'sessionId' => $data['sessionId'], + ]; + + break; + case 'sendNotify': + $params = [ + 'mobile' => $to->getNumber(), + 'region' => self::ENDPOINT_REGION, + 'templateId' => $message->getTemplate($this), + ]; + $params = array_merge($params, $data); + + break; + default: + throw new GatewayErrorException(sprintf('action: %s not supported', $action)); + } + + try { + $result = $this->post($endpoint, $params, $headers); + + if (self::SUCCESS_CODE !== $result['code']) { + throw new GatewayErrorException($result['errorMessage'], $result['code'], $result); + } + } catch (ClientException $e) { + throw new GatewayErrorException($e->getMessage(), $e->getCode()); + } + + return $result; + } + + /** + * Generate Sign. + * + * @param array $params + * @param \Overtrue\EasySms\Support\Config $config + * + * @return string + */ + protected function generateSign($params, Config $config) + { + return sha1(sprintf('%s%s%s', $config->get('app_secret'), $params['Nonce'], $params['Timestamp'])); + } + + /** + * Build endpoint url. + * + * @param string $action + * + * @return string + */ + protected function buildEndpoint($action) + { + return sprintf(self::ENDPOINT_TEMPLATE, $action, self::ENDPOINT_FORMAT); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/RongheyunGateway.php b/vendor/overtrue/easy-sms/src/Gateways/RongheyunGateway.php new file mode 100644 index 0000000..aa63c65 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/RongheyunGateway.php @@ -0,0 +1,69 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class RongheyunGateway. + * + * @see https://doc.zthysms.com/web/#/1?page_id=13 + */ +class RongheyunGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'https://api.mix2.zthysms.com/v2/sendSmsTp'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $tKey = time(); + $password = md5(md5($config->get('password')) . $tKey); + $params = [ + 'username' => $config->get('username', ''), + 'password' => $password, + 'tKey' => $tKey, + 'signature' => $config->get('signature', ''), + 'tpId' => $message->getTemplate($this), + 'ext' => '', + 'extend' => '', + 'records' => [ + 'mobile' => $to->getNumber(), + 'tpContent' => $message->getData($this), + ], + ]; + + $result = $this->postJson( + self::ENDPOINT_URL, + $params, + ['Content-Type' => 'application/json; charset="UTF-8"'] + ); + if (200 != $result['code']) { + throw new GatewayErrorException($result['msg'], $result['code'], $result); + } + + return $result; + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/SendcloudGateway.php b/vendor/overtrue/easy-sms/src/Gateways/SendcloudGateway.php new file mode 100644 index 0000000..5da3a4f --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/SendcloudGateway.php @@ -0,0 +1,95 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class SendcloudGateway. + * + * @see http://sendcloud.sohu.com/doc/sms/ + */ +class SendcloudGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_TEMPLATE = 'http://www.sendcloud.net/smsapi/%s'; + + /** + * Send a short message. + * + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $params = [ + 'smsUser' => $config->get('sms_user'), + 'templateId' => $message->getTemplate($this), + 'msgType' => $to->getIDDCode() ? 2 : 0, + 'phone' => $to->getZeroPrefixedNumber(), + 'vars' => $this->formatTemplateVars($message->getData($this)), + ]; + + if ($config->get('timestamp', false)) { + $params['timestamp'] = time() * 1000; + } + + $params['signature'] = $this->sign($params, $config->get('sms_key')); + + $result = $this->post(sprintf(self::ENDPOINT_TEMPLATE, 'send'), $params); + + if (!$result['result']) { + throw new GatewayErrorException($result['message'], $result['statusCode'], $result); + } + + return $result; + } + + /** + * @param array $vars + * + * @return string + */ + protected function formatTemplateVars(array $vars) + { + $formatted = []; + + foreach ($vars as $key => $value) { + $formatted[sprintf('%%%s%%', trim($key, '%'))] = $value; + } + + return json_encode($formatted, JSON_FORCE_OBJECT); + } + + /** + * @param array $params + * @param string $key + * + * @return string + */ + protected function sign($params, $key) + { + ksort($params); + + return md5(sprintf('%s&%s&%s', $key, urldecode(http_build_query($params)), $key)); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/SmsbaoGateway.php b/vendor/overtrue/easy-sms/src/Gateways/SmsbaoGateway.php new file mode 100644 index 0000000..b202d4c --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/SmsbaoGateway.php @@ -0,0 +1,77 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class SmsbaoGateway + * @author iwindy <203962638@qq.com> + * @see http://www.smsbao.com/openapi/ + */ +class SmsbaoGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'http://api.smsbao.com/%s'; + + const SUCCESS_CODE = '0'; + + protected $errorStatuses = [ + '0' => '短信发送成功', + '-1' => '参数不全', + '-2' => '服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!', + '30' => '密码错误', + '40' => '账号不存在', + '41' => '余额不足', + '42' => '帐户已过期', + '43' => 'IP地址限制', + '50' => '内容含有敏感词' + ]; + + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $data = $message->getContent($this); + + if (is_null($to->getIDDCode()) || $to->getIDDCode() == '86') { + $number = $to->getNumber(); + $action = 'sms'; + } else { + $number = $to->getUniversalNumber(); + $action = 'wsms'; + } + + $params = [ + 'u' => $config->get('user'), + 'p' => md5($config->get('password')), + 'm' => $number, + 'c' => $data + ]; + + $result = $this->get($this->buildEndpoint($action), $params); + + if ($result !== self::SUCCESS_CODE) { + throw new GatewayErrorException($this->errorStatuses[$result], $result); + } + + return $result; + } + + protected function buildEndpoint($type) + { + return sprintf(self::ENDPOINT_URL, $type); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/SubmailGateway.php b/vendor/overtrue/easy-sms/src/Gateways/SubmailGateway.php new file mode 100644 index 0000000..7d4678f --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/SubmailGateway.php @@ -0,0 +1,88 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class SubmailGateway. + * + * @see https://www.mysubmail.com/chs/documents/developer/index + */ +class SubmailGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_TEMPLATE = 'https://api.mysubmail.com/%s.%s'; + + const ENDPOINT_FORMAT = 'json'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $endpoint = $this->buildEndpoint($this->inChineseMainland($to) ? 'message/xsend' : 'internationalsms/xsend'); + + $data = $message->getData($this); + + $result = $this->post($endpoint, [ + 'appid' => $config->get('app_id'), + 'signature' => $config->get('app_key'), + 'project' => !empty($data['project']) ? $data['project'] : $config->get('project'), + 'to' => $to->getUniversalNumber(), + 'vars' => json_encode($data, JSON_FORCE_OBJECT), + ]); + + if ('success' != $result['status']) { + throw new GatewayErrorException($result['msg'], $result['code'], $result); + } + + return $result; + } + + /** + * Build endpoint url. + * + * @param string $function + * + * @return string + */ + protected function buildEndpoint($function) + { + return sprintf(self::ENDPOINT_TEMPLATE, $function, self::ENDPOINT_FORMAT); + } + + /** + * Check if the phone number belongs to chinese mainland. + * + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * + * @return bool + */ + protected function inChineseMainland($to) + { + $code = $to->getIDDCode(); + + return empty($code) || 86 === $code; + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/TianyiwuxianGateway.php b/vendor/overtrue/easy-sms/src/Gateways/TianyiwuxianGateway.php new file mode 100644 index 0000000..a30758c --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/TianyiwuxianGateway.php @@ -0,0 +1,84 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class TianyiwuxianGateway. + * + * @author Darren Gao + */ +class TianyiwuxianGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_TEMPLATE = 'http://jk.106api.cn/sms%s.aspx'; + + const ENDPOINT_ENCODE = 'UTF8'; + + const ENDPOINT_TYPE = 'send'; + + const ENDPOINT_FORMAT = 'json'; + + const SUCCESS_STATUS = 'success'; + + const SUCCESS_CODE = '0'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $endpoint = $this->buildEndpoint(); + + $params = [ + 'gwid' => $config->get('gwid'), + 'type' => self::ENDPOINT_TYPE, + 'rece' => self::ENDPOINT_FORMAT, + 'mobile' => $to->getNumber(), + 'message' => $message->getContent($this), + 'username' => $config->get('username'), + 'password' => strtoupper(md5($config->get('password'))), + ]; + + $result = $this->post($endpoint, $params); + + $result = json_decode($result, true); + + if (self::SUCCESS_STATUS !== $result['returnstatus'] || self::SUCCESS_CODE !== $result['code']) { + throw new GatewayErrorException($result['remark'], $result['code']); + } + + return $result; + } + + /** + * Build endpoint url. + * + * @return string + */ + protected function buildEndpoint() + { + return sprintf(self::ENDPOINT_TEMPLATE, self::ENDPOINT_ENCODE); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/TiniyoGateway.php b/vendor/overtrue/easy-sms/src/Gateways/TiniyoGateway.php new file mode 100644 index 0000000..f3faff3 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/TiniyoGateway.php @@ -0,0 +1,85 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class Tiniyo Gateway. + * + * @see https://tiniyo.com/sms.html + */ +class TiniyoGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'https://api.tiniyo.com/v1/Account/%s/Message'; + + const SUCCESS_CODE = '000000'; + + public function getName() + { + return 'tiniyo'; + } + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $accountSid = $config->get('account_sid'); + $endpoint = $this->buildEndPoint($accountSid); + + $params = [ + 'dst' => $to->getUniversalNumber(), + 'src' => $config->get('from'), + 'text' => $message->getContent($this), + ]; + + $result = $this->request('post', $endpoint, [ + 'json' => $params, + 'headers' => [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json;charset=utf-8', + 'Authorization' => base64_encode($config->get('account_sid').':'.$config->get('token')), + ], + ]); + + if (self::SUCCESS_CODE != $result['statusCode']) { + throw new GatewayErrorException($result['statusCode'], $result['statusCode'], $result); + } + + return $result; + } + + /** + * build endpoint url. + * + * @param string $accountSid + * + * @return string + */ + protected function buildEndPoint($accountSid) + { + return sprintf(self::ENDPOINT_URL, $accountSid); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/TinreeGateway.php b/vendor/overtrue/easy-sms/src/Gateways/TinreeGateway.php new file mode 100644 index 0000000..7a72dd9 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/TinreeGateway.php @@ -0,0 +1,77 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; + +/** + * Class TinreeGateway. + * + * @see http://cms.tinree.com + */ +class TinreeGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'http://api.tinree.com/api/v2/single_send'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $params = [ + 'accesskey' => $config->get('accesskey'), + 'secret' => $config->get('secret'), + 'sign' => $config->get('sign'), + 'templateId' => $message->getTemplate($this), + 'mobile' => $to->getNumber(), + 'content' => $this->buildContent($message), + ]; + + $result = $this->post(self::ENDPOINT_URL, $params); + + if (0 != $result['code']) { + throw new GatewayErrorException($result['msg'], $result['code'], $result); + } + + return $result; + } + + /** + * 构建发送内容 + * 用 data 数据合成内容,或者直接使用 data 的值 + * + * @param MessageInterface $message + * @return string + */ + protected function buildContent(MessageInterface $message) + { + $data = $message->getData($this); + + if (is_array($data)) { + return implode("##", $data); + } + + return $data; + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/TwilioGateway.php b/vendor/overtrue/easy-sms/src/Gateways/TwilioGateway.php new file mode 100644 index 0000000..95e572c --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/TwilioGateway.php @@ -0,0 +1,91 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use GuzzleHttp\Exception\ClientException; +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class TwilioGateway. + * + * @see https://www.twilio.com/docs/api/messaging/send-messages + */ +class TwilioGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'https://api.twilio.com/2010-04-01/Accounts/%s/Messages.json'; + + protected $errorStatuses = [ + 'failed', + 'undelivered', + ]; + + public function getName() + { + return 'twilio'; + } + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $accountSid = $config->get('account_sid'); + $endpoint = $this->buildEndPoint($accountSid); + + $params = [ + 'To' => $to->getUniversalNumber(), + 'From' => $config->get('from'), + 'Body' => $message->getContent($this), + ]; + + try { + $result = $this->request('post', $endpoint, [ + 'auth' => [ + $accountSid, + $config->get('token'), + ], + 'form_params' => $params, + ]); + if (in_array($result['status'], $this->errorStatuses) || !is_null($result['error_code'])) { + throw new GatewayErrorException($result['message'], $result['error_code'], $result); + } + } catch (ClientException $e) { + throw new GatewayErrorException($e->getMessage(), $e->getCode()); + } + + return $result; + } + + /** + * build endpoint url. + * + * @param string $accountSid + * + * @return string + */ + protected function buildEndPoint($accountSid) + { + return sprintf(self::ENDPOINT_URL, $accountSid); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/UcloudGateway.php b/vendor/overtrue/easy-sms/src/Gateways/UcloudGateway.php new file mode 100644 index 0000000..fddfd3c --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/UcloudGateway.php @@ -0,0 +1,130 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class UcloudGateway. + */ +class UcloudGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'https://api.ucloud.cn'; + + const ENDPOINT_Action = 'SendUSMSMessage'; + + const SUCCESS_CODE = 0; + + /** + * Send Message. + * + * @param PhoneNumberInterface $to + * @param MessageInterface $message + * @param Config $config + * + * @return array + * + * @throws GatewayErrorException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $params = $this->buildParams($to, $message, $config); + + $result = $this->get(self::ENDPOINT_URL, $params); + + if (self::SUCCESS_CODE != $result['RetCode']) { + throw new GatewayErrorException($result['Message'], $result['RetCode'], $result); + } + + return $result; + } + + /** + * Build Params. + * + * @param PhoneNumberInterface $to + * @param MessageInterface $message + * @param Config $config + * + * @return array + */ + protected function buildParams(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $data = $message->getData($this); + $params = [ + 'Action' => self::ENDPOINT_Action, + 'SigContent' => !empty($data['sig_content']) ? $data['sig_content'] : $config->get('sig_content', ''), + 'TemplateId' => $message->getTemplate($this), + 'PublicKey' => $config->get('public_key'), + ]; + $code = isset($data['code']) ? $data['code'] : ''; + if (is_array($code) && !empty($code)) { + foreach ($code as $key => $value) { + $params['TemplateParams.'.$key] = $value; + } + } else { + if (!empty($code) || !is_null($code)) { + $params['TemplateParams.0'] = $code; + } + } + + $mobiles = isset($data['mobiles']) ? $data['mobiles'] : ''; + if (!empty($mobiles) && !is_null($mobiles)) { + if (is_array($mobiles)) { + foreach ($mobiles as $key => $value) { + $params['PhoneNumbers.'.$key] = $value; + } + } else { + $params['PhoneNumbers.0'] = $mobiles; + } + } else { + $params['PhoneNumbers.0'] = $to->getNumber(); + } + + if (!is_null($config->get('project_id')) && !empty($config->get('project_id'))) { + $params['ProjectId'] = $config->get('project_id'); + } + + $signature = $this->getSignature($params, $config->get('private_key')); + $params['Signature'] = $signature; + + return $params; + } + + /** + * Generate Sign. + * + * @param array $params + * @param string $privateKey + * + * @return string + */ + protected function getSignature($params, $privateKey) + { + ksort($params); + + $paramsData = ''; + foreach ($params as $key => $value) { + $paramsData .= $key; + $paramsData .= $value; + } + $paramsData .= $privateKey; + + return sha1($paramsData); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/Ue35Gateway.php b/vendor/overtrue/easy-sms/src/Gateways/Ue35Gateway.php new file mode 100644 index 0000000..9e05e1d --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/Ue35Gateway.php @@ -0,0 +1,77 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class Ue35Gateway. + * + * @see https://shimo.im/docs/380b42d8cba24521 + */ +class Ue35Gateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_HOST = 'sms.ue35.cn'; + + const ENDPOINT_URI = '/sms/interface/sendmess.htm'; + + const SUCCESS_CODE = 1; + + /** + * Send message. + * + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $params = [ + 'username' => $config->get('username'), + 'userpwd' => $config->get('userpwd'), + 'mobiles' => $to->getNumber(), + 'content' => $message->getContent($this), + ]; + + $headers = [ + 'host' => static::ENDPOINT_HOST, + 'content-type' => 'application/json', + 'user-agent' => 'PHP EasySms Client', + ]; + + $result = $this->request('get', self::getEndpointUri().'?'.http_build_query($params), ['headers' => $headers]); + if (is_string($result)) { + $result = json_decode(json_encode(simplexml_load_string($result)), true); + } + + if (self::SUCCESS_CODE != $result['errorcode']) { + throw new GatewayErrorException($result['message'], $result['errorcode'], $result); + } + + return $result; + } + + public static function getEndpointUri() + { + return 'http://'.static::ENDPOINT_HOST.static::ENDPOINT_URI; + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/VolcengineGateway.php b/vendor/overtrue/easy-sms/src/Gateways/VolcengineGateway.php new file mode 100644 index 0000000..536e7c5 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/VolcengineGateway.php @@ -0,0 +1,311 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use GuzzleHttp\Exception\ClientException; +use GuzzleHttp\HandlerStack; +use GuzzleHttp\Psr7\Query; +use GuzzleHttp\Psr7\Utils; +use GuzzleHttp\Psr7; +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; +use Psr\Http\Message\RequestInterface; + +/** + * Class VolcengineGateway. + * + * @see https://www.volcengine.com/docs/6361/66704 + */ +class VolcengineGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_ACTION = 'SendSms'; + const ENDPOINT_VERSION = '2020-01-01'; + const ENDPOINT_CONTENT_TYPE = 'application/json; charset=utf-8'; + const ENDPOINT_ACCEPT = 'application/json'; + const ENDPOINT_USER_AGENT = 'overtrue/easy-sms'; + const ENDPOINT_SERVICE = 'volcSMS'; + + const Algorithm = 'HMAC-SHA256'; + + const ENDPOINT_DEFAULT_REGION_ID = 'cn-north-1'; + + public static $endpoints = [ + 'cn-north-1' => 'https://sms.volcengineapi.com', + 'ap-singapore-1' => 'https://sms.byteplusapi.com', + ]; + + private $regionId = self::ENDPOINT_DEFAULT_REGION_ID; + protected $requestDate; + + + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $data = $message->getData($this); + $signName = !empty($data['sign_name']) ? $data['sign_name'] : $config->get('sign_name'); + $smsAccount = !empty($data['sms_account']) ? $data['sms_account'] : $config->get('sms_account'); + $templateId = $message->getTemplate($this); + $phoneNumbers = !empty($data['phone_numbers']) ? $data['phone_numbers'] : $to->getNumber(); + $templateParam = !empty($data['template_param']) ? $data['template_param'] : $message->getData($this); + + $tag = !empty($data['tag']) ? $data['tag'] : ''; + + $payload = [ + 'SmsAccount' => $smsAccount, // 消息组帐号,火山短信页面右上角,短信应用括号中的字符串 + 'Sign' => $signName, // 短信签名 + 'TemplateID' => $templateId, // 短信模板ID + 'TemplateParam' => json_encode($templateParam), // 短信模板占位符要替换的值 + 'PhoneNumbers' => $phoneNumbers, // 手机号,如果有多个使用英文逗号分割 + ]; + if ($tag) { + $payload['Tag'] = $tag; + } + $queries = [ + 'Action' => self::ENDPOINT_ACTION, + 'Version' => self::ENDPOINT_VERSION, + ]; + + try { + $stack = HandlerStack::create(); + $stack->push($this->signHandle()); + $this->setGuzzleOptions([ + 'headers' => [ + 'Content-Type' => self::ENDPOINT_CONTENT_TYPE, + 'Accept' => self::ENDPOINT_ACCEPT, + 'User-Agent' => self::ENDPOINT_USER_AGENT + ], + 'timeout' => $this->getTimeout(), + 'handler' => $stack, + 'base_uri' => $this->getEndpoint(), + ]); + + $response = $this->request('post', $this->getEndpoint().$this->getCanonicalURI(), [ + 'query' => $queries, + 'json' => $payload, + ]); + if ($response instanceof Psr7\Response) { + $response = json_decode($response->getBody()->getContents(), true); + } + if (isset($response['ResponseMetadata']['Error'])) { // 请求错误参数,如果请求没有错误,则不存在该参数返回 + // 火山引擎错误码格式为:'ZJ'+ 5位数字,比如 ZJ20009,取出数字部分 + preg_match('/\d+/', $response['ResponseMetadata']['Error']['Code'], $matches); + throw new GatewayErrorException($response['ResponseMetadata']['Error']['Code'].":".$response['ResponseMetadata']['Error']['Message'], $matches[0], $response); + } + return $response; + } catch (ClientException $exception) { + $responseContent = $exception->getResponse()->getBody()->getContents(); + $response = json_decode($responseContent, true); + if (isset($response['ResponseMetadata']['Error']) && $error = $response['ResponseMetadata']['Error']) { // 请求错误参数,如果请求没有错误,则不存在该参数返回 + // 火山引擎公共错误码Error与业务错误码略有不同,比如:"Error":{"CodeN":100004,"Code":"MissingRequestInfo","Message":"The request is missing timestamp information."} + // 此处错误码直接取 CodeN + throw new GatewayErrorException($error["CodeN"].":".$error['Message'], $error["CodeN"], $response); + } + throw new GatewayErrorException($responseContent, $exception->getCode(), ['content' => $responseContent]); + } + } + + protected function signHandle() + { + return function (callable $handler) { + return function (RequestInterface $request, array $options) use ($handler) { + $request = $request->withHeader('X-Date', $this->getRequestDate()); + list($canonicalHeaders, $signedHeaders) = $this->getCanonicalHeaders($request); + + $queries = Query::parse($request->getUri()->getQuery()); + $canonicalRequest = $request->getMethod()."\n" + .$this->getCanonicalURI()."\n" + .$this->getCanonicalQueryString($queries)."\n" + .$canonicalHeaders."\n" + .$signedHeaders."\n" + .$this->getPayloadHash($request); + + $stringToSign = $this->getStringToSign($canonicalRequest); + + $signingKey = $this->getSigningKey(); + + $signature = hash_hmac('sha256', $stringToSign, $signingKey); + $parsed = $this->parseRequest($request); + + $parsed['headers']['Authorization'] = self::Algorithm. + ' Credential='.$this->getAccessKeyId().'/'.$this->getCredentialScope().', SignedHeaders='.$signedHeaders.', Signature='.$signature; + + $buildRequest = function () use ($request, $parsed) { + if ($parsed['query']) { + $parsed['uri'] = $parsed['uri']->withQuery(Query::build($parsed['query'])); + } + + return new Psr7\Request( + $parsed['method'], + $parsed['uri'], + $parsed['headers'], + $parsed['body'], + $parsed['version'] + ); + }; + + return $handler($buildRequest(), $options); + }; + }; + } + + private function parseRequest(RequestInterface $request) + { + $uri = $request->getUri(); + return [ + 'method' => $request->getMethod(), + 'path' => $uri->getPath(), + 'query' => Query::parse($uri->getQuery()), + 'uri' => $uri, + 'headers' => $request->getHeaders(), + 'body' => $request->getBody(), + 'version' => $request->getProtocolVersion() + ]; + } + + public function getPayloadHash(RequestInterface $request) + { + if ($request->hasHeader('X-Content-Sha256')) { + return $request->getHeaderLine('X-Content-Sha256'); + } + + return Utils::hash($request->getBody(), 'sha256'); + } + + public function getRegionId() + { + return $this->config->get('region_id', self::ENDPOINT_DEFAULT_REGION_ID); + } + + public function getEndpoint() + { + $regionId = $this->getRegionId(); + if (!in_array($regionId, array_keys(self::$endpoints))) { + $regionId = self::ENDPOINT_DEFAULT_REGION_ID; + } + return static::$endpoints[$regionId]; + } + + public function getRequestDate() + { + return $this->requestDate ?: gmdate('Ymd\THis\Z'); + } + + + /** + * 指代信任状,格式为:YYYYMMDD/region/service/request + * @return string + */ + public function getCredentialScope() + { + return date('Ymd', strtotime($this->getRequestDate())).'/'.$this->getRegionId().'/'.self::ENDPOINT_SERVICE.'/request'; + } + + /** + * 计算签名密钥 + * 在计算签名前,首先从私有访问密钥(Secret Access Key)派生出签名密钥(signing key),而不是直接使用私有访问密钥。具体计算过程如下: + * kSecret = *Your Secret Access Key* + * kDate = HMAC(kSecret, Date) + * kRegion = HMAC(kDate, Region) + * kService = HMAC(kRegion, Service) + * kSigning = HMAC(kService, "request") + * 其中Date精确到日,与RequestDate中YYYYMMDD部分相同。 + * @return string + */ + protected function getSigningKey() + { + $dateKey = hash_hmac('sha256', date("Ymd", strtotime($this->getRequestDate())), $this->getAccessKeySecret(), true); + $regionKey = hash_hmac('sha256', $this->getRegionId(), $dateKey, true); + $serviceKey = hash_hmac('sha256', self::ENDPOINT_SERVICE, $regionKey, true); + return hash_hmac('sha256', 'request', $serviceKey, true); + } + + /** + * 创建签名字符串 + * 签名字符串主要包含请求以及正规化请求的元数据信息,由签名算法、请求日期、信任状和正规化请求哈希值连接组成,伪代码如下: + * StringToSign = Algorithm + '\n' + RequestDate + '\n' + CredentialScope + '\n' + HexEncode(Hash(CanonicalRequest)) + * @return string + */ + public function getStringToSign($canonicalRequest) + { + return self::Algorithm."\n".$this->getRequestDate()."\n".$this->getCredentialScope()."\n".hash('sha256', $canonicalRequest); + } + + /** + * @return string + */ + public function getAccessKeySecret() + { + return $this->config->get('access_key_secret'); + } + + /** + * @return string + */ + public function getAccessKeyId() + { + return $this->config->get('access_key_id'); + } + + /** + * 指代正规化后的Header。 + * 其中伪代码如下: + * CanonicalHeaders = CanonicalHeadersEntry0 + CanonicalHeadersEntry1 + ... + CanonicalHeadersEntryN + * 其中CanonicalHeadersEntry = Lowercase(HeaderName) + ':' + Trimall(HeaderValue) + '\n' + * Lowcase代表将Header的名称全部转化成小写,Trimall表示去掉Header的值的前后多余的空格。 + * 特别注意:最后需要添加"\n"的换行符,header的顺序是以headerName的小写后ascii排序。 + * @return array + */ + public function getCanonicalHeaders(RequestInterface $request) + { + $headers = $request->getHeaders(); + ksort($headers); + $canonicalHeaders = ''; + $signedHeaders = []; + foreach ($headers as $key => $val) { + $lowerKey = strtolower($key); + $canonicalHeaders .= $lowerKey.':'.trim($val[0]).PHP_EOL; + $signedHeaders[] = $lowerKey; + } + $signedHeadersString = implode(';', $signedHeaders); + return [$canonicalHeaders, $signedHeadersString]; + } + + /** + * urlencode(注:同RFC3986方法)每一个querystring参数名称和参数值。 + * 按照ASCII字节顺序对参数名称严格排序,相同参数名的不同参数值需保持请求的原始顺序。 + * 将排序好的参数名称和参数值用=连接,按照排序结果将“参数对”用&连接。 + * 例如:CanonicalQueryString = "Action=ListUsers&Version=2018-01-01" + * @return string + */ + public function getCanonicalQueryString(array $query) + { + ksort($query); + return http_build_query($query); + } + + /** + * 指代正规化后的URI。 + * 如果URI为空,那么使用"/"作为绝对路径。 + * 在火山引擎中绝大多数接口的URI都为"/"。 + * 如果是复杂的path,请通过RFC3986规范进行编码。 + * + * @return string + */ + public function getCanonicalURI() + { + return '/'; + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/YunpianGateway.php b/vendor/overtrue/easy-sms/src/Gateways/YunpianGateway.php new file mode 100644 index 0000000..e60942f --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/YunpianGateway.php @@ -0,0 +1,101 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class YunpianGateway. + * + * @see https://www.yunpian.com/doc/zh_CN/intl/single_send.html + */ +class YunpianGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_TEMPLATE = 'https://%s.yunpian.com/%s/%s/%s.%s'; + + const ENDPOINT_VERSION = 'v2'; + + const ENDPOINT_FORMAT = 'json'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $template = $message->getTemplate($this); + $function = 'single_send'; + $option = [ + 'form_params' => [ + 'apikey' => $config->get('api_key'), + 'mobile' => $to->getUniversalNumber() + ], + 'exceptions' => false, + ]; + + if (!is_null($template)) { + $function = 'tpl_single_send'; + $data = []; + + $templateData = $message->getData($this); + $templateData = isset($templateData) ? $templateData : []; + foreach ($templateData as $key => $value) { + $data[] = urlencode('#'.$key.'#') . '=' . urlencode($value); + } + + $option['form_params'] = array_merge($option['form_params'], [ + 'tpl_id' => $template, + 'tpl_value' => implode('&', $data) + ]); + } else { + $content = $message->getContent($this); + $signature = $config->get('signature', ''); + $option['form_params'] = array_merge($option['form_params'], [ + 'text' => 0 === \stripos($content, '【') ? $content : $signature.$content + ]); + } + + $endpoint = $this->buildEndpoint('sms', 'sms', $function); + $result = $this->request('post', $endpoint, $option); + + if ($result['code']) { + throw new GatewayErrorException($result['msg'], $result['code'], $result); + } + + return $result; + } + + /** + * Build endpoint url. + * + * @param string $type + * @param string $resource + * @param string $function + * + * @return string + */ + protected function buildEndpoint($type, $resource, $function) + { + return sprintf(self::ENDPOINT_TEMPLATE, $type, self::ENDPOINT_VERSION, $resource, $function, self::ENDPOINT_FORMAT); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/YuntongxunGateway.php b/vendor/overtrue/easy-sms/src/Gateways/YuntongxunGateway.php new file mode 100644 index 0000000..9554434 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/YuntongxunGateway.php @@ -0,0 +1,123 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class YuntongxunGateway. + * + * @see Chinese Mainland: http://doc.yuntongxun.com/pe/5a533de33b8496dd00dce07c + * @see International: http://doc.yuntongxun.com/pe/604f29eda80948a1006e928d + */ +class YuntongxunGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_TEMPLATE = 'https://%s:%s/%s/%s/%s/%s/%s?sig=%s'; + + const SERVER_IP = 'app.cloopen.com'; + + const DEBUG_SERVER_IP = 'sandboxapp.cloopen.com'; + + const DEBUG_TEMPLATE_ID = 1; + + const SERVER_PORT = '8883'; + + const SDK_VERSION = '2013-12-26'; + + const SDK_VERSION_INT = 'v2'; + + const SUCCESS_CODE = '000000'; + + private $international = false; // if international SMS, default false means no. + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $datetime = date('YmdHis'); + + $data = [ + 'appId' => $config->get('app_id'), + ]; + + if ($to->inChineseMainland()) { + $type = 'SMS'; + $resource = 'TemplateSMS'; + $data['to'] = $to->getNumber(); + $data['templateId'] = (int) ($this->config->get('debug') ? self::DEBUG_TEMPLATE_ID : $message->getTemplate($this)); + $data['datas'] = $message->getData($this); + } else { + $type = 'international'; + $resource = 'send'; + $this->international = true; + $data['mobile'] = $to->getZeroPrefixedNumber(); + $data['content'] = $message->getContent($this); + } + + $endpoint = $this->buildEndpoint($type, $resource, $datetime, $config); + + $result = $this->request('post', $endpoint, [ + 'json' => $data, + 'headers' => [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json;charset=utf-8', + 'Authorization' => base64_encode($config->get('account_sid').':'.$datetime), + ], + ]); + + if (self::SUCCESS_CODE != $result['statusCode']) { + throw new GatewayErrorException($result['statusCode'], $result['statusCode'], $result); + } + + return $result; + } + + /** + * Build endpoint url. + * + * @param string $type + * @param string $resource + * @param string $datetime + * @param \Overtrue\EasySms\Support\Config $config + * + * @return string + */ + protected function buildEndpoint($type, $resource, $datetime, Config $config) + { + $serverIp = $this->config->get('debug') ? self::DEBUG_SERVER_IP : self::SERVER_IP; + + if ($this->international) { + $accountType = 'account'; + $sdkVersion = self::SDK_VERSION_INT; + } else { + $accountType = $this->config->get('is_sub_account') ? 'SubAccounts' : 'Accounts'; + $sdkVersion = self::SDK_VERSION; + } + + $sig = strtoupper(md5($config->get('account_sid').$config->get('account_token').$datetime)); + + return sprintf(self::ENDPOINT_TEMPLATE, $serverIp, self::SERVER_PORT, $sdkVersion, $accountType, $config->get('account_sid'), $type, $resource, $sig); + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/YunxinGateway.php b/vendor/overtrue/easy-sms/src/Gateways/YunxinGateway.php new file mode 100644 index 0000000..aadf2fa --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/YunxinGateway.php @@ -0,0 +1,162 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class YunxinGateway. + * + * @author her-cat + * + * @see https://dev.yunxin.163.com/docs/product/%E7%9F%AD%E4%BF%A1/%E7%9F%AD%E4%BF%A1%E6%8E%A5%E5%8F%A3%E6%8C%87%E5%8D%97 + */ +class YunxinGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_TEMPLATE = 'https://api.netease.im/%s/%s.action'; + + const ENDPOINT_ACTION = 'sendCode'; + + const SUCCESS_CODE = 200; + + /** + * Send a short message. + * + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws GatewayErrorException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $data = $message->getData($this); + + $action = isset($data['action']) ? $data['action'] : self::ENDPOINT_ACTION; + + $endpoint = $this->buildEndpoint('sms', $action); + + switch ($action) { + case 'sendCode': + $params = $this->buildSendCodeParams($to, $message, $config); + + break; + case 'verifyCode': + $params = $this->buildVerifyCodeParams($to, $message); + + break; + default: + throw new GatewayErrorException(sprintf('action: %s not supported', $action), 0); + } + + $headers = $this->buildHeaders($config); + + try { + $result = $this->post($endpoint, $params, $headers); + + if (!isset($result['code']) || self::SUCCESS_CODE !== $result['code']) { + $code = isset($result['code']) ? $result['code'] : 0; + $error = isset($result['msg']) ? $result['msg'] : json_encode($result, JSON_UNESCAPED_UNICODE); + + throw new GatewayErrorException($error, $code); + } + } catch (\Exception $e) { + throw new GatewayErrorException($e->getMessage(), $e->getCode()); + } + + return $result; + } + + /** + * @param $resource + * @param $function + * + * @return string + */ + protected function buildEndpoint($resource, $function) + { + return sprintf(self::ENDPOINT_TEMPLATE, $resource, strtolower($function)); + } + + /** + * Get the request headers. + * + * @param Config $config + * + * @return array + */ + protected function buildHeaders(Config $config) + { + $headers = [ + 'AppKey' => $config->get('app_key'), + 'Nonce' => md5(uniqid('easysms')), + 'CurTime' => (string) time(), + 'Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8', + ]; + + $headers['CheckSum'] = sha1("{$config->get('app_secret')}{$headers['Nonce']}{$headers['CurTime']}"); + + return $headers; + } + + /** + * @param PhoneNumberInterface $to + * @param MessageInterface $message + * @param Config $config + * + * @return array + */ + public function buildSendCodeParams(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $data = $message->getData($this); + $template = $message->getTemplate($this); + + return [ + 'mobile' => $to->getUniversalNumber(), + 'authCode' => array_key_exists('code', $data) ? $data['code'] : '', + 'deviceId' => array_key_exists('device_id', $data) ? $data['device_id'] : '', + 'templateid' => is_string($template) ? $template : '', + 'codeLen' => $config->get('code_length', 4), + 'needUp' => $config->get('need_up', false), + ]; + } + + /** + * @param PhoneNumberInterface $to + * @param MessageInterface $message + * + * @return array + * + * @throws GatewayErrorException + */ + public function buildVerifyCodeParams(PhoneNumberInterface $to, MessageInterface $message) + { + $data = $message->getData($this); + + if (!array_key_exists('code', $data)) { + throw new GatewayErrorException('"code" cannot be empty', 0); + } + + return [ + 'mobile' => $to->getUniversalNumber(), + 'code' => $data['code'], + ]; + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/YunzhixunGateway.php b/vendor/overtrue/easy-sms/src/Gateways/YunzhixunGateway.php new file mode 100644 index 0000000..0e213e4 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/YunzhixunGateway.php @@ -0,0 +1,121 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class YunzhixunGateway. + * + * @author her-cat + * + * @see http://docs.ucpaas.com/doku.php?id=%E7%9F%AD%E4%BF%A1:sendsms + */ +class YunzhixunGateway extends Gateway +{ + use HasHttpRequest; + + const SUCCESS_CODE = '000000'; + + const FUNCTION_SEND_SMS = 'sendsms'; + + const FUNCTION_BATCH_SEND_SMS = 'sendsms_batch'; + + const ENDPOINT_TEMPLATE = 'https://open.ucpaas.com/ol/%s/%s'; + + /** + * Send a short message. + * + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws GatewayErrorException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $data = $message->getData($this); + + $function = isset($data['mobiles']) ? self::FUNCTION_BATCH_SEND_SMS : self::FUNCTION_SEND_SMS; + + $endpoint = $this->buildEndpoint('sms', $function); + + $params = $this->buildParams($to, $message, $config); + + return $this->execute($endpoint, $params); + } + + /** + * @param $resource + * @param $function + * + * @return string + */ + protected function buildEndpoint($resource, $function) + { + return sprintf(self::ENDPOINT_TEMPLATE, $resource, $function); + } + + /** + * @param PhoneNumberInterface $to + * @param MessageInterface $message + * @param Config $config + * + * @return array + */ + protected function buildParams(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $data = $message->getData($this); + + return [ + 'sid' => $config->get('sid'), + 'token' => $config->get('token'), + 'appid' => $config->get('app_id'), + 'templateid' => $message->getTemplate($this), + 'uid' => isset($data['uid']) ? $data['uid'] : '', + 'param' => isset($data['params']) ? $data['params'] : '', + 'mobile' => isset($data['mobiles']) ? $data['mobiles'] : $to->getNumber(), + ]; + } + + /** + * @param $endpoint + * @param $params + * + * @return array + * + * @throws GatewayErrorException + */ + protected function execute($endpoint, $params) + { + try { + $result = $this->postJson($endpoint, $params); + + if (!isset($result['code']) || self::SUCCESS_CODE !== $result['code']) { + $code = isset($result['code']) ? $result['code'] : 0; + $error = isset($result['msg']) ? $result['msg'] : json_encode($result, JSON_UNESCAPED_UNICODE); + + throw new GatewayErrorException($error, $code); + } + + return $result; + } catch (\Exception $e) { + throw new GatewayErrorException($e->getMessage(), $e->getCode()); + } + } +} diff --git a/vendor/overtrue/easy-sms/src/Gateways/ZzyunGateway.php b/vendor/overtrue/easy-sms/src/Gateways/ZzyunGateway.php new file mode 100644 index 0000000..878a6a7 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Gateways/ZzyunGateway.php @@ -0,0 +1,63 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Gateways; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\GatewayErrorException; +use Overtrue\EasySms\Support\Config; +use Overtrue\EasySms\Traits\HasHttpRequest; + +/** + * Class RongheyunGateway. + * + * @see https://zzyun.com/ + */ +class ZzyunGateway extends Gateway +{ + use HasHttpRequest; + + const ENDPOINT_URL = 'https://zzyun.com/api/sms/sendByTplCode'; + + /** + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param \Overtrue\EasySms\Support\Config $config + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\GatewayErrorException ; + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) + { + $time = time(); + $user_id = $config->get('user_id'); + $token = md5($time . $user_id . $config->get('secret')); + $params = [ + 'user_id' => $user_id, + 'time' => $time, + 'token' => $token, + 'mobiles' => $to->getNumber(),// 手机号码,多个英文逗号隔开 + 'tpl_code' => $message->getTemplate($this), + 'tpl_params' => $message->getData($this), + 'sign_name' => $config->get('sign_name'), + ]; + + $result = $this->post(self::ENDPOINT_URL, $params); + + if ('Success' != $result['Code']) { + throw new GatewayErrorException($result['Message'], $result['Code'], $result); + } + + return $result; + } +} diff --git a/vendor/overtrue/easy-sms/src/Message.php b/vendor/overtrue/easy-sms/src/Message.php new file mode 100644 index 0000000..7b76ca8 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Message.php @@ -0,0 +1,187 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms; + +use Overtrue\EasySms\Contracts\GatewayInterface; +use Overtrue\EasySms\Contracts\MessageInterface; + +/** + * Class Message. + */ +class Message implements MessageInterface +{ + /** + * @var array + */ + protected $gateways = []; + + /** + * @var string + */ + protected $type; + + /** + * @var string + */ + protected $content; + + /** + * @var string + */ + protected $template; + + /** + * @var array + */ + protected $data = []; + + /** + * Message constructor. + * + * @param array $attributes + * @param string $type + */ + public function __construct(array $attributes = [], $type = MessageInterface::TEXT_MESSAGE) + { + $this->type = $type; + + foreach ($attributes as $property => $value) { + if (property_exists($this, $property)) { + $this->$property = $value; + } + } + } + + /** + * Return the message type. + * + * @return string + */ + public function getMessageType() + { + return $this->type; + } + + /** + * Return message content. + * + * @param \Overtrue\EasySms\Contracts\GatewayInterface|null $gateway + * + * @return string + */ + public function getContent(GatewayInterface $gateway = null) + { + return is_callable($this->content) ? call_user_func($this->content, $gateway) : $this->content; + } + + /** + * Return the template id of message. + * + * @param \Overtrue\EasySms\Contracts\GatewayInterface|null $gateway + * + * @return string + */ + public function getTemplate(GatewayInterface $gateway = null) + { + return is_callable($this->template) ? call_user_func($this->template, $gateway) : $this->template; + } + + /** + * @param $type + * + * @return $this + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * @param mixed $content + * + * @return $this + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * @param mixed $template + * + * @return $this + */ + public function setTemplate($template) + { + $this->template = $template; + + return $this; + } + + /** + * @param \Overtrue\EasySms\Contracts\GatewayInterface|null $gateway + * + * @return array + */ + public function getData(GatewayInterface $gateway = null) + { + return is_callable($this->data) ? call_user_func($this->data, $gateway) : $this->data; + } + + /** + * @param array|callable $data + * + * @return $this + */ + public function setData($data) + { + $this->data = $data; + + return $this; + } + + /** + * @return array + */ + public function getGateways() + { + return $this->gateways; + } + + /** + * @param array $gateways + * + * @return $this + */ + public function setGateways(array $gateways) + { + $this->gateways = $gateways; + + return $this; + } + + /** + * @param $property + * + * @return string + */ + public function __get($property) + { + if (property_exists($this, $property)) { + return $this->$property; + } + } +} diff --git a/vendor/overtrue/easy-sms/src/Messenger.php b/vendor/overtrue/easy-sms/src/Messenger.php new file mode 100644 index 0000000..97b704c --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Messenger.php @@ -0,0 +1,92 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms; + +use Overtrue\EasySms\Contracts\MessageInterface; +use Overtrue\EasySms\Contracts\PhoneNumberInterface; +use Overtrue\EasySms\Exceptions\NoGatewayAvailableException; + +/** + * Class Messenger. + */ +class Messenger +{ + const STATUS_SUCCESS = 'success'; + + const STATUS_FAILURE = 'failure'; + + /** + * @var \Overtrue\EasySms\EasySms + */ + protected $easySms; + + /** + * Messenger constructor. + * + * @param \Overtrue\EasySms\EasySms $easySms + */ + public function __construct(EasySms $easySms) + { + $this->easySms = $easySms; + } + + /** + * Send a message. + * + * @param \Overtrue\EasySms\Contracts\PhoneNumberInterface $to + * @param \Overtrue\EasySms\Contracts\MessageInterface $message + * @param array $gateways + * + * @return array + * + * @throws \Overtrue\EasySms\Exceptions\NoGatewayAvailableException + */ + public function send(PhoneNumberInterface $to, MessageInterface $message, array $gateways = []) + { + $results = []; + $isSuccessful = false; + + foreach ($gateways as $gateway => $config) { + try { + $results[$gateway] = [ + 'gateway' => $gateway, + 'status' => self::STATUS_SUCCESS, + 'template' => $message->getTemplate($this->easySms->gateway($gateway)), + 'result' => $this->easySms->gateway($gateway)->send($to, $message, $config), + ]; + $isSuccessful = true; + + break; + } catch (\Exception $e) { + $results[$gateway] = [ + 'gateway' => $gateway, + 'status' => self::STATUS_FAILURE, + 'template' => $message->getTemplate($this->easySms->gateway($gateway)), + 'exception' => $e, + ]; + } catch (\Throwable $e) { + $results[$gateway] = [ + 'gateway' => $gateway, + 'status' => self::STATUS_FAILURE, + 'template' => $message->getTemplate($this->easySms->gateway($gateway)), + 'exception' => $e, + ]; + } + } + + if (!$isSuccessful) { + throw new NoGatewayAvailableException($results); + } + + return $results; + } +} diff --git a/vendor/overtrue/easy-sms/src/PhoneNumber.php b/vendor/overtrue/easy-sms/src/PhoneNumber.php new file mode 100644 index 0000000..cde95f5 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/PhoneNumber.php @@ -0,0 +1,126 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms; + +/** + * Class PhoneNumberInterface. + * + * @author overtrue + */ +class PhoneNumber implements \Overtrue\EasySms\Contracts\PhoneNumberInterface +{ + /** + * @var int + */ + protected $number; + + /** + * @var int + */ + protected $IDDCode; + + /** + * PhoneNumberInterface constructor. + * + * @param int $numberWithoutIDDCode + * @param string $IDDCode + */ + public function __construct($numberWithoutIDDCode, $IDDCode = null) + { + $this->number = $numberWithoutIDDCode; + $this->IDDCode = $IDDCode ? intval(ltrim($IDDCode, '+0')) : null; + } + + /** + * 86. + * + * @return int + */ + public function getIDDCode() + { + return $this->IDDCode; + } + + /** + * 18888888888. + * + * @return int + */ + public function getNumber() + { + return $this->number; + } + + /** + * +8618888888888. + * + * @return string + */ + public function getUniversalNumber() + { + return $this->getPrefixedIDDCode('+').$this->number; + } + + /** + * 008618888888888. + * + * @return string + */ + public function getZeroPrefixedNumber() + { + return $this->getPrefixedIDDCode('00').$this->number; + } + + /** + * @param string $prefix + * + * @return string|null + */ + public function getPrefixedIDDCode($prefix) + { + return $this->IDDCode ? $prefix.$this->IDDCode : null; + } + + /** + * @return string + */ + public function __toString() + { + return $this->getUniversalNumber(); + } + + /** + * Specify data which should be serialized to JSON. + * + * @see http://php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed data which can be serialized by json_encode, + * which is a value of any type other than a resource + * + * @since 5.4.0 + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return $this->getUniversalNumber(); + } + + /** + * Check if the phone number belongs to chinese mainland. + * + * @return bool + */ + public function inChineseMainland() + { + return empty($this->IDDCode) || $this->IDDCode === 86; + } +} diff --git a/vendor/overtrue/easy-sms/src/Strategies/OrderStrategy.php b/vendor/overtrue/easy-sms/src/Strategies/OrderStrategy.php new file mode 100644 index 0000000..f44b29e --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Strategies/OrderStrategy.php @@ -0,0 +1,32 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Strategies; + +use Overtrue\EasySms\Contracts\StrategyInterface; + +/** + * Class OrderStrategy. + */ +class OrderStrategy implements StrategyInterface +{ + /** + * Apply the strategy and return result. + * + * @param array $gateways + * + * @return array + */ + public function apply(array $gateways) + { + return array_keys($gateways); + } +} diff --git a/vendor/overtrue/easy-sms/src/Strategies/RandomStrategy.php b/vendor/overtrue/easy-sms/src/Strategies/RandomStrategy.php new file mode 100644 index 0000000..605c5d9 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Strategies/RandomStrategy.php @@ -0,0 +1,34 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Strategies; + +use Overtrue\EasySms\Contracts\StrategyInterface; + +/** + * Class RandomStrategy. + */ +class RandomStrategy implements StrategyInterface +{ + /** + * @param array $gateways + * + * @return array + */ + public function apply(array $gateways) + { + uasort($gateways, function () { + return mt_rand() - mt_rand(); + }); + + return array_keys($gateways); + } +} diff --git a/vendor/overtrue/easy-sms/src/Support/Config.php b/vendor/overtrue/easy-sms/src/Support/Config.php new file mode 100644 index 0000000..3b91423 --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Support/Config.php @@ -0,0 +1,147 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Support; + +use ArrayAccess; + +/** + * Class Config. + */ +class Config implements ArrayAccess +{ + /** + * @var array + */ + protected $config; + + /** + * Config constructor. + * + * @param array $config + */ + public function __construct(array $config = []) + { + $this->config = $config; + } + + /** + * Get an item from an array using "dot" notation. + * + * @param string $key + * @param mixed $default + * + * @return mixed + */ + public function get($key, $default = null) + { + $config = $this->config; + + if (isset($config[$key])) { + return $config[$key]; + } + + if (false === strpos($key, '.')) { + return $default; + } + + foreach (explode('.', $key) as $segment) { + if (!is_array($config) || !array_key_exists($segment, $config)) { + return $default; + } + $config = $config[$segment]; + } + + return $config; + } + + /** + * Whether a offset exists. + * + * @see http://php.net/manual/en/arrayaccess.offsetexists.php + * + * @param mixed $offset

            + * An offset to check for. + *

            + * + * @return bool true on success or false on failure. + *

            + *

            + * The return value will be casted to boolean if non-boolean was returned + * + * @since 5.0.0 + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + return array_key_exists($offset, $this->config); + } + + /** + * Offset to retrieve. + * + * @see http://php.net/manual/en/arrayaccess.offsetget.php + * + * @param mixed $offset

            + * The offset to retrieve. + *

            + * + * @return mixed Can return all value types + * + * @since 5.0.0 + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->get($offset); + } + + /** + * Offset to set. + * + * @see http://php.net/manual/en/arrayaccess.offsetset.php + * + * @param mixed $offset

            + * The offset to assign the value to. + *

            + * @param mixed $value

            + * The value to set. + *

            + * + * @since 5.0.0 + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + if (isset($this->config[$offset])) { + $this->config[$offset] = $value; + } + } + + /** + * Offset to unset. + * + * @see http://php.net/manual/en/arrayaccess.offsetunset.php + * + * @param mixed $offset

            + * The offset to unset. + *

            + * + * @since 5.0.0 + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + if (isset($this->config[$offset])) { + unset($this->config[$offset]); + } + } +} diff --git a/vendor/overtrue/easy-sms/src/Traits/HasHttpRequest.php b/vendor/overtrue/easy-sms/src/Traits/HasHttpRequest.php new file mode 100644 index 0000000..d861ded --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Traits/HasHttpRequest.php @@ -0,0 +1,136 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Traits; + +use GuzzleHttp\Client; +use Psr\Http\Message\ResponseInterface; + +/** + * Trait HasHttpRequest. + */ +trait HasHttpRequest +{ + /** + * Make a get request. + * + * @param string $endpoint + * @param array $query + * @param array $headers + * + * @return ResponseInterface|array|string + */ + protected function get($endpoint, $query = [], $headers = []) + { + return $this->request('get', $endpoint, [ + 'headers' => $headers, + 'query' => $query, + ]); + } + + /** + * Make a post request. + * + * @param string $endpoint + * @param array $params + * @param array $headers + * + * @return ResponseInterface|array|string + */ + protected function post($endpoint, $params = [], $headers = []) + { + return $this->request('post', $endpoint, [ + 'headers' => $headers, + 'form_params' => $params, + ]); + } + + /** + * Make a post request with json params. + * + * @param $endpoint + * @param array $params + * @param array $headers + * + * @return ResponseInterface|array|string + */ + protected function postJson($endpoint, $params = [], $headers = []) + { + return $this->request('post', $endpoint, [ + 'headers' => $headers, + 'json' => $params, + ]); + } + + /** + * Make a http request. + * + * @param string $method + * @param string $endpoint + * @param array $options http://docs.guzzlephp.org/en/latest/request-options.html + * + * @return ResponseInterface|array|string + */ + protected function request($method, $endpoint, $options = []) + { + return $this->unwrapResponse($this->getHttpClient($this->getBaseOptions())->{$method}($endpoint, $options)); + } + + /** + * Return base Guzzle options. + * + * @return array + */ + protected function getBaseOptions() + { + $options = method_exists($this, 'getGuzzleOptions') ? $this->getGuzzleOptions() : []; + + return \array_merge($options, [ + 'base_uri' => method_exists($this, 'getBaseUri') ? $this->getBaseUri() : '', + 'timeout' => method_exists($this, 'getTimeout') ? $this->getTimeout() : 5.0, + ]); + } + + /** + * Return http client. + * + * @param array $options + * + * @return \GuzzleHttp\Client + * + * @codeCoverageIgnore + */ + protected function getHttpClient(array $options = []) + { + return new Client($options); + } + + /** + * Convert response contents to json. + * + * @param \Psr\Http\Message\ResponseInterface $response + * + * @return ResponseInterface|array|string + */ + protected function unwrapResponse(ResponseInterface $response) + { + $contentType = $response->getHeaderLine('Content-Type'); + $contents = $response->getBody()->getContents(); + + if (false !== stripos($contentType, 'json') || stripos($contentType, 'javascript')) { + return json_decode($contents, true); + } elseif (false !== stripos($contentType, 'xml')) { + return json_decode(json_encode(simplexml_load_string($contents)), true); + } + + return $contents; + } +} diff --git a/vendor/php-di/invoker/README.md b/vendor/php-di/invoker/README.md index 34bc22e..adf153c 100644 --- a/vendor/php-di/invoker/README.md +++ b/vendor/php-di/invoker/README.md @@ -2,7 +2,7 @@ Generic and extensible callable invoker. -[![Build Status](https://img.shields.io/travis/PHP-DI/Invoker.svg?style=flat-square)](https://travis-ci.org/PHP-DI/Invoker) +[![CI](https://github.com/PHP-DI/Invoker/actions/workflows/ci.yml/badge.svg)](https://github.com/PHP-DI/Invoker/actions/workflows/ci.yml) [![Latest Version](https://img.shields.io/github/release/PHP-DI/invoker.svg?style=flat-square)](https://packagist.org/packages/PHP-DI/invoker) [![Total Downloads](https://img.shields.io/packagist/dt/php-di/invoker.svg?style=flat-square)](https://packagist.org/packages/php-di/invoker) @@ -12,7 +12,7 @@ Who doesn't need an over-engineered `call_user_func()`? ### Named parameters -Does this [Silex](http://silex.sensiolabs.org) example look familiar: +Does this [Silex](https://github.com/silexphp/Silex#readme) example look familiar: ```php $app->get('/project/{project}/issue/{issue}', function ($project, $issue) { @@ -28,7 +28,7 @@ $app->command('greet [name] [--yell]', function ($name, $yell) { }); ``` -Same pattern in [Slim](http://www.slimframework.com): +Same pattern in [Slim](https://www.slimframework.com): ```php $app->get('/hello/:name', function ($name) { @@ -66,7 +66,7 @@ $app->command('greet [name]', function ($name, OutputInterface $output) { }); ``` -[PHP-DI](http://php-di.org/doc/container.html) provides a way to invoke a callable and resolve all dependencies from the container using type-hints: +[PHP-DI](https://php-di.org/doc/container.html) provides a way to invoke a callable and resolve all dependencies from the container using type-hints: ```php $container->call(function (Logger $logger, EntityManager $em) { @@ -230,4 +230,4 @@ $invoker->call('WelcomeController::home'); That feature can be used as the base building block for a framework's dispatcher. -Again, any [PSR-11](http://www.php-fig.org/psr/psr-11/) compliant container can be provided. +Again, any [PSR-11](https://www.php-fig.org/psr/psr-11/) compliant container can be provided. diff --git a/vendor/phpmailer/phpmailer/README.md b/vendor/phpmailer/phpmailer/README.md index 53e66f1..878274f 100644 --- a/vendor/phpmailer/phpmailer/README.md +++ b/vendor/phpmailer/phpmailer/README.md @@ -47,7 +47,7 @@ This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lg PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file: ```json -"phpmailer/phpmailer": "^6.8.0" +"phpmailer/phpmailer": "^6.8.1" ``` or run @@ -150,7 +150,7 @@ PHPMailer defaults to English, but in the [language](https://github.com/PHPMaile $mail->setLanguage('fr', '/optional/path/to/language/directory/'); ``` -We welcome corrections and new languages – if you're looking for corrections, run the [PHPMailerLangTest.php](https://github.com/PHPMailer/PHPMailer/tree/master/test/PHPMailerLangTest.php) script in the tests folder and it will show any missing translations. +We welcome corrections and new languages – if you're looking for corrections, run the [Language/TranslationCompletenessTest.php](https://github.com/PHPMailer/PHPMailer/blob/master/test/Language/TranslationCompletenessTest.php) script in the tests folder and it will show any missing translations. ## Documentation Start reading at the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, head for [the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting) as it's frequently updated. diff --git a/vendor/phpmailer/phpmailer/VERSION b/vendor/phpmailer/phpmailer/VERSION index 8a1c5c7..23863d3 100644 --- a/vendor/phpmailer/phpmailer/VERSION +++ b/vendor/phpmailer/phpmailer/VERSION @@ -1 +1 @@ -6.8.0 \ No newline at end of file +6.8.1 \ No newline at end of file diff --git a/vendor/phpmailer/phpmailer/composer.json b/vendor/phpmailer/phpmailer/composer.json index 37e3d6e..2fd2f4c 100644 --- a/vendor/phpmailer/phpmailer/composer.json +++ b/vendor/phpmailer/phpmailer/composer.json @@ -37,13 +37,13 @@ "ext-hash": "*" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "doctrine/annotations": "^1.2.6 || ^1.13.3", "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.7.1", + "squizlabs/php_codesniffer": "^3.7.2", "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { diff --git a/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php b/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php index 243c054..6d1e637 100644 --- a/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php +++ b/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php @@ -20,7 +20,6 @@ $PHPMAILER_LANG['instantiate'] = 'mail-funktion luonti epäonnistui.'; $PHPMAILER_LANG['mailer_not_supported'] = 'postivälitintyyppiä ei tueta.'; $PHPMAILER_LANG['provide_address'] = 'Aseta vähintään yksi vastaanottajan sähköpostiosoite.'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP-virhe: seuraava vastaanottaja osoite on virheellinen.'; -$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: '; //$PHPMAILER_LANG['signing'] = 'Signing Error: '; //$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; //$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; diff --git a/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php b/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php index 38a7a8e..0d367fc 100644 --- a/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php +++ b/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php @@ -35,4 +35,3 @@ $PHPMAILER_LANG['smtp_connect_failed'] = 'La fonction SMTP connect() a échoué $PHPMAILER_LANG['smtp_detail'] = 'Détails : '; $PHPMAILER_LANG['smtp_error'] = 'Erreur du serveur SMTP : '; $PHPMAILER_LANG['variable_set'] = 'Impossible d’initialiser ou de réinitialiser une variable : '; -$PHPMAILER_LANG['extension_missing'] = 'Extension manquante : '; diff --git a/vendor/phpmailer/phpmailer/language/phpmailer.lang-nb.php b/vendor/phpmailer/phpmailer/language/phpmailer.lang-nb.php index 65793ce..c9621a1 100644 --- a/vendor/phpmailer/phpmailer/language/phpmailer.lang-nb.php +++ b/vendor/phpmailer/phpmailer/language/phpmailer.lang-nb.php @@ -5,22 +5,29 @@ * @package PHPMailer */ -$PHPMAILER_LANG['authenticate'] = 'SMTP Feil: Kunne ikke autentisere.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Feil: Kunne ikke koble til SMTP tjener.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Feil: Datainnhold ikke akseptert.'; -$PHPMAILER_LANG['empty_message'] = 'Meldingsinnhold mangler'; -$PHPMAILER_LANG['encoding'] = 'Ukjent koding: '; -$PHPMAILER_LANG['execute'] = 'Kunne ikke utføre: '; -$PHPMAILER_LANG['file_access'] = 'Får ikke tilgang til filen: '; -$PHPMAILER_LANG['file_open'] = 'Fil Feil: Kunne ikke åpne filen: '; -$PHPMAILER_LANG['from_failed'] = 'Følgende Frå adresse feilet: '; -$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere post funksjon.'; -$PHPMAILER_LANG['invalid_address'] = 'Ugyldig adresse: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' sender er ikke støttet.'; -$PHPMAILER_LANG['provide_address'] = 'Du må opppgi minst en mottakeradresse.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Feil: Følgende mottakeradresse feilet: '; -$PHPMAILER_LANG['signing'] = 'Signering Feil: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP connect() feilet.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP server feil: '; -$PHPMAILER_LANG['variable_set'] = 'Kan ikke skrive eller omskrive variabel: '; -$PHPMAILER_LANG['extension_missing'] = 'Utvidelse mangler: '; + $PHPMAILER_LANG['authenticate'] = 'SMTP-feil: Kunne ikke autentiseres.'; + $PHPMAILER_LANG['buggy_php'] = 'Din versjon av PHP er berørt av en feil som kan føre til ødelagte meldinger. For å løse problemet kan du bytte til SMTP, deaktivere alternativet mail.add_x_header i php.ini, bytte til MacOS eller Linux eller oppgradere PHP til versjon 7.0.17+ eller 7.1.3+.'; + $PHPMAILER_LANG['connect_host'] = 'SMTP-feil: Kunne ikke koble til SMTP-vert.'; + $PHPMAILER_LANG['data_not_accepted'] = 'SMTP-feil: data ikke akseptert.'; + $PHPMAILER_LANG['empty_message'] = 'Meldingstekst mangler'; + $PHPMAILER_LANG['encoding'] = 'Ukjent koding: '; + $PHPMAILER_LANG['execute'] = 'Kunne ikke utføres: '; + $PHPMAILER_LANG['extension_missing'] = 'Utvidelse mangler: '; + $PHPMAILER_LANG['file_access'] = 'Kunne ikke få tilgang til filen: '; + $PHPMAILER_LANG['file_open'] = 'Feil i fil: Kunne ikke åpne filen: '; + $PHPMAILER_LANG['from_failed'] = 'Følgende Fra-adresse mislyktes: '; + $PHPMAILER_LANG['instantiate'] = 'Kunne ikke instansiere e-postfunksjonen.'; + $PHPMAILER_LANG['invalid_address'] = 'Ugyldig adresse: '; + $PHPMAILER_LANG['invalid_header'] = 'Ugyldig headernavn eller verdi'; + $PHPMAILER_LANG['invalid_hostentry'] = 'Ugyldig vertsinngang: '; + $PHPMAILER_LANG['invalid_host'] = 'Ugyldig vert: '; + $PHPMAILER_LANG['mailer_not_supported'] = ' sender er ikke støttet.'; + $PHPMAILER_LANG['provide_address'] = 'Du må oppgi minst én mottaker-e-postadresse.'; + $PHPMAILER_LANG['recipients_failed'] = 'SMTP Feil: Følgende mottakeradresse feilet: '; + $PHPMAILER_LANG['signing'] = 'Signeringsfeil: '; + $PHPMAILER_LANG['smtp_code'] = 'SMTP-kode: '; + $PHPMAILER_LANG['smtp_code_ex'] = 'Ytterligere SMTP-info: '; + $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP connect() mislyktes.'; + $PHPMAILER_LANG['smtp_detail'] = 'Detaljer: '; + $PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfeil: '; + $PHPMAILER_LANG['variable_set'] = 'Kan ikke angi eller tilbakestille variabel: '; diff --git a/vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php b/vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php new file mode 100644 index 0000000..dce502a --- /dev/null +++ b/vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php @@ -0,0 +1,34 @@ + + */ + +$PHPMAILER_LANG['authenticate'] = 'SMTP දෝෂය: සත්‍යාපනය අසාර්ථක විය.'; +$PHPMAILER_LANG['buggy_php'] = 'ඔබගේ PHP version එකෙහි පවතින දෝෂයක් නිසා email පණිවිඩ දෝෂ සහගත වීමේ හැකියාවක් ඇත. මෙය විසදීම සදහා SMTP භාවිතා කිරීම, mail.add_x_header INI setting එක අක්‍රීය කිරීම, MacOS හෝ Linux වලට මාරු වීම, හෝ ඔබගේ PHP version එක 7.0.17+ හෝ 7.1.3+ වලට අලුත් කිරීම කරගන්න.'; +$PHPMAILER_LANG['connect_host'] = 'SMTP දෝෂය: සම්බන්ධ වීමට නොහැකි විය.'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP දෝෂය: දත්ත පිළිගනු නොලැබේ.'; +$PHPMAILER_LANG['empty_message'] = 'පණිවිඩ අන්තර්ගතය හිස්'; +$PHPMAILER_LANG['encoding'] = 'නොදන්නා කේතනය: '; +$PHPMAILER_LANG['execute'] = 'ක්‍රියාත්මක කළ නොහැකි විය: '; +$PHPMAILER_LANG['extension_missing'] = 'Extension එක නොමැත: '; +$PHPMAILER_LANG['file_access'] = 'File එකට ප්‍රවේශ විය නොහැකි විය: '; +$PHPMAILER_LANG['file_open'] = 'File දෝෂය: File එක විවෘත කළ නොහැක: '; +$PHPMAILER_LANG['from_failed'] = 'පහත From ලිපිනයන් අසාර්ථක විය: '; +$PHPMAILER_LANG['instantiate'] = 'mail function එක ක්‍රියාත්මක කළ නොහැක.'; +$PHPMAILER_LANG['invalid_address'] = 'වලංගු නොවන ලිපිනය: '; +$PHPMAILER_LANG['invalid_header'] = 'වලංගු නොවන header නාමයක් හෝ අගයක්'; +$PHPMAILER_LANG['invalid_hostentry'] = 'වලංගු නොවන hostentry එකක්: '; +$PHPMAILER_LANG['invalid_host'] = 'වලංගු නොවන host එකක්: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer සහාය නොදක්වයි.'; +$PHPMAILER_LANG['provide_address'] = 'ඔබ අවම වශයෙන් එක් ලබන්නෙකුගේ ඊමේල් ලිපිනයක් සැපයිය යුතුය.'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP දෝෂය: පහත ලබන්නන් අසමත් විය: '; +$PHPMAILER_LANG['signing'] = 'Sign කිරීමේ දෝෂය: '; +$PHPMAILER_LANG['smtp_code'] = 'SMTP කේතය: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'අමතර SMTP තොරතුරු: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP සම්බන්ධය අසාර්ථක විය.'; +$PHPMAILER_LANG['smtp_detail'] = 'තොරතුරු: '; +$PHPMAILER_LANG['smtp_error'] = 'SMTP දෝෂය: '; +$PHPMAILER_LANG['variable_set'] = 'Variable එක සැකසීමට හෝ නැවත සැකසීමට නොහැක: '; diff --git a/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php b/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php index 728a499..03d4911 100644 --- a/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php +++ b/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php @@ -9,11 +9,13 @@ */ $PHPMAILER_LANG['authenticate'] = 'SMTP 错误:登录失败。'; +$PHPMAILER_LANG['buggy_php'] = '您的 PHP 版本存在漏洞,可能会导致消息损坏。为修复此问题,请切换到使用 SMTP 发送,在您的 php.ini 中禁用 mail.add_x_header 选项。切换到 MacOS 或 Linux,或将您的 PHP 升级到 7.0.17+ 或 7.1.3+ 版本。'; $PHPMAILER_LANG['connect_host'] = 'SMTP 错误:无法连接到 SMTP 主机。'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误:数据不被接受。'; $PHPMAILER_LANG['empty_message'] = '邮件正文为空。'; $PHPMAILER_LANG['encoding'] = '未知编码:'; $PHPMAILER_LANG['execute'] = '无法执行:'; +$PHPMAILER_LANG['extension_missing'] = '缺少扩展名:'; $PHPMAILER_LANG['file_access'] = '无法访问文件:'; $PHPMAILER_LANG['file_open'] = '文件错误:无法打开文件:'; $PHPMAILER_LANG['from_failed'] = '发送地址错误:'; @@ -22,8 +24,13 @@ $PHPMAILER_LANG['invalid_address'] = '发送失败,电子邮箱地址是 $PHPMAILER_LANG['mailer_not_supported'] = '发信客户端不被支持。'; $PHPMAILER_LANG['provide_address'] = '必须提供至少一个收件人地址。'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误:收件人地址错误:'; -$PHPMAILER_LANG['signing'] = '登录失败:'; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP服务器连接失败。'; $PHPMAILER_LANG['smtp_error'] = 'SMTP服务器出错:'; $PHPMAILER_LANG['variable_set'] = '无法设置或重置变量:'; -$PHPMAILER_LANG['extension_missing'] = '丢失模块 Extension:'; +$PHPMAILER_LANG['invalid_header'] = '无效的标题名称或值'; +$PHPMAILER_LANG['invalid_hostentry'] = '无效的hostentry: '; +$PHPMAILER_LANG['invalid_host'] = '无效的主机:'; +$PHPMAILER_LANG['signing'] = '签名错误:'; +$PHPMAILER_LANG['smtp_code'] = 'SMTP代码: '; +$PHPMAILER_LANG['smtp_code_ex'] = '附加SMTP信息: '; +$PHPMAILER_LANG['smtp_detail'] = '详情:'; diff --git a/vendor/phpmailer/phpmailer/src/DSNConfigurator.php b/vendor/phpmailer/phpmailer/src/DSNConfigurator.php index ab707d2..566c961 100644 --- a/vendor/phpmailer/phpmailer/src/DSNConfigurator.php +++ b/vendor/phpmailer/phpmailer/src/DSNConfigurator.php @@ -80,9 +80,7 @@ class DSNConfigurator $config = $this->parseUrl($dsn); if (false === $config || !isset($config['scheme']) || !isset($config['host'])) { - throw new Exception( - sprintf('Malformed DSN: "%s".', $dsn) - ); + throw new Exception('Malformed DSN'); } if (isset($config['query'])) { diff --git a/vendor/phpmailer/phpmailer/src/PHPMailer.php b/vendor/phpmailer/phpmailer/src/PHPMailer.php index a644d2c..7f56ea2 100644 --- a/vendor/phpmailer/phpmailer/src/PHPMailer.php +++ b/vendor/phpmailer/phpmailer/src/PHPMailer.php @@ -750,7 +750,7 @@ class PHPMailer * * @var string */ - const VERSION = '6.8.0'; + const VERSION = '6.8.1'; /** * Error severity: message only, continue processing. @@ -795,7 +795,7 @@ class PHPMailer * The maximum line length supported by mail(). * * Background: mail() will sometimes corrupt messages - * with headers headers longer than 65 chars, see #818. + * with headers longer than 65 chars, see #818. * * @var int */ diff --git a/vendor/phpmailer/phpmailer/src/POP3.php b/vendor/phpmailer/phpmailer/src/POP3.php index d025689..b92a1f2 100644 --- a/vendor/phpmailer/phpmailer/src/POP3.php +++ b/vendor/phpmailer/phpmailer/src/POP3.php @@ -46,7 +46,7 @@ class POP3 * * @var string */ - const VERSION = '6.8.0'; + const VERSION = '6.8.1'; /** * Default POP3 port number. diff --git a/vendor/phpmailer/phpmailer/src/SMTP.php b/vendor/phpmailer/phpmailer/src/SMTP.php index fc4b781..2b63840 100644 --- a/vendor/phpmailer/phpmailer/src/SMTP.php +++ b/vendor/phpmailer/phpmailer/src/SMTP.php @@ -35,7 +35,7 @@ class SMTP * * @var string */ - const VERSION = '6.8.0'; + const VERSION = '6.8.1'; /** * SMTP line break constant. @@ -704,7 +704,7 @@ class SMTP * Send an SMTP DATA command. * Issues a data command and sends the msg_data to the server, * finalizing the mail transaction. $msg_data is the message - * that is to be send with the headers. Each header needs to be + * that is to be sent with the headers. Each header needs to be * on a single line followed by a with the message headers * and the message body being separated by an additional . * Implements RFC 821: DATA . @@ -732,7 +732,7 @@ class SMTP $lines = explode("\n", str_replace(["\r\n", "\r"], "\n", $msg_data)); /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field - * of the first line (':' separated) does not contain a space then it _should_ be a header and we will + * of the first line (':' separated) does not contain a space then it _should_ be a header, and we will * process all lines before a blank line as headers. */ diff --git a/vendor/services.php b/vendor/services.php index f919862..5793a46 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'taoser\\addons\\Service', diff --git a/vendor/symfony/polyfill-mbstring/LICENSE b/vendor/symfony/polyfill-mbstring/LICENSE index 4cd8bdd..6e3afce 100644 --- a/vendor/symfony/polyfill-mbstring/LICENSE +++ b/vendor/symfony/polyfill-mbstring/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015-2019 Fabien Potencier +Copyright (c) 2015-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/polyfill-mbstring/Mbstring.php b/vendor/symfony/polyfill-mbstring/Mbstring.php index bce5c4a..2e0b969 100644 --- a/vendor/symfony/polyfill-mbstring/Mbstring.php +++ b/vendor/symfony/polyfill-mbstring/Mbstring.php @@ -69,7 +69,7 @@ final class Mbstring { public const MB_CASE_FOLD = \PHP_INT_MAX; - private const CASE_FOLD = [ + private const SIMPLE_CASE_FOLD = [ ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"], ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'], ]; @@ -301,7 +301,11 @@ final class Mbstring $map = $upper; } else { if (self::MB_CASE_FOLD === $mode) { - $s = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $s); + static $caseFolding = null; + if (null === $caseFolding) { + $caseFolding = self::getData('caseFolding'); + } + $s = strtr($s, $caseFolding); } static $lower = null; @@ -406,6 +410,12 @@ final class Mbstring public static function mb_check_encoding($var = null, $encoding = null) { + if (PHP_VERSION_ID < 70200 && \is_array($var)) { + trigger_error('mb_check_encoding() expects parameter 1 to be string, array given', \E_USER_WARNING); + + return null; + } + if (null === $encoding) { if (null === $var) { return false; @@ -413,7 +423,21 @@ final class Mbstring $encoding = self::$internalEncoding; } - return self::mb_detect_encoding($var, [$encoding]) || false !== @iconv($encoding, $encoding, $var); + if (!\is_array($var)) { + return self::mb_detect_encoding($var, [$encoding]) || false !== @iconv($encoding, $encoding, $var); + } + + foreach ($var as $key => $value) { + if (!self::mb_check_encoding($key, $encoding)) { + return false; + } + if (!self::mb_check_encoding($value, $encoding)) { + return false; + } + } + + return true; + } public static function mb_detect_encoding($str, $encodingList = null, $strict = false) @@ -638,8 +662,10 @@ final class Mbstring public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { - $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding); - $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); + [$haystack, $needle] = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], [ + self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding), + self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding), + ]); return self::mb_strpos($haystack, $needle, $offset, $encoding); } @@ -674,8 +700,11 @@ final class Mbstring public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { - $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding); - $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); + $haystack = self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding); + $needle = self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding); + + $haystack = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $haystack); + $needle = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $needle); return self::mb_strrpos($haystack, $needle, $offset, $encoding); } @@ -798,6 +827,50 @@ final class Mbstring return $code; } + public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, string $encoding = null): string + { + if (!\in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], true)) { + throw new \ValueError('mb_str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH'); + } + + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } + + try { + $validEncoding = @self::mb_check_encoding('', $encoding); + } catch (\ValueError $e) { + throw new \ValueError(sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding)); + } + + // BC for PHP 7.3 and lower + if (!$validEncoding) { + throw new \ValueError(sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding)); + } + + if (self::mb_strlen($pad_string, $encoding) <= 0) { + throw new \ValueError('mb_str_pad(): Argument #3 ($pad_string) must be a non-empty string'); + } + + $paddingRequired = $length - self::mb_strlen($string, $encoding); + + if ($paddingRequired < 1) { + return $string; + } + + switch ($pad_type) { + case \STR_PAD_LEFT: + return self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding).$string; + case \STR_PAD_RIGHT: + return $string.self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding); + default: + $leftPaddingLength = floor($paddingRequired / 2); + $rightPaddingLength = $paddingRequired - $leftPaddingLength; + + return self::mb_substr(str_repeat($pad_string, $leftPaddingLength), 0, $leftPaddingLength, $encoding).$string.self::mb_substr(str_repeat($pad_string, $rightPaddingLength), 0, $rightPaddingLength, $encoding); + } + } + private static function getSubpart($pos, $part, $haystack, $encoding) { if (false === $pos) { diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php new file mode 100644 index 0000000..512bba0 --- /dev/null +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php @@ -0,0 +1,119 @@ + 'i̇', + 'µ' => 'μ', + 'ſ' => 's', + 'ͅ' => 'ι', + 'ς' => 'σ', + 'ϐ' => 'β', + 'ϑ' => 'θ', + 'ϕ' => 'φ', + 'ϖ' => 'π', + 'ϰ' => 'κ', + 'ϱ' => 'ρ', + 'ϵ' => 'ε', + 'ẛ' => 'ṡ', + 'ι' => 'ι', + 'ß' => 'ss', + 'ʼn' => 'ʼn', + 'ǰ' => 'ǰ', + 'ΐ' => 'ΐ', + 'ΰ' => 'ΰ', + 'և' => 'եւ', + 'ẖ' => 'ẖ', + 'ẗ' => 'ẗ', + 'ẘ' => 'ẘ', + 'ẙ' => 'ẙ', + 'ẚ' => 'aʾ', + 'ẞ' => 'ss', + 'ὐ' => 'ὐ', + 'ὒ' => 'ὒ', + 'ὔ' => 'ὔ', + 'ὖ' => 'ὖ', + 'ᾀ' => 'ἀι', + 'ᾁ' => 'ἁι', + 'ᾂ' => 'ἂι', + 'ᾃ' => 'ἃι', + 'ᾄ' => 'ἄι', + 'ᾅ' => 'ἅι', + 'ᾆ' => 'ἆι', + 'ᾇ' => 'ἇι', + 'ᾈ' => 'ἀι', + 'ᾉ' => 'ἁι', + 'ᾊ' => 'ἂι', + 'ᾋ' => 'ἃι', + 'ᾌ' => 'ἄι', + 'ᾍ' => 'ἅι', + 'ᾎ' => 'ἆι', + 'ᾏ' => 'ἇι', + 'ᾐ' => 'ἠι', + 'ᾑ' => 'ἡι', + 'ᾒ' => 'ἢι', + 'ᾓ' => 'ἣι', + 'ᾔ' => 'ἤι', + 'ᾕ' => 'ἥι', + 'ᾖ' => 'ἦι', + 'ᾗ' => 'ἧι', + 'ᾘ' => 'ἠι', + 'ᾙ' => 'ἡι', + 'ᾚ' => 'ἢι', + 'ᾛ' => 'ἣι', + 'ᾜ' => 'ἤι', + 'ᾝ' => 'ἥι', + 'ᾞ' => 'ἦι', + 'ᾟ' => 'ἧι', + 'ᾠ' => 'ὠι', + 'ᾡ' => 'ὡι', + 'ᾢ' => 'ὢι', + 'ᾣ' => 'ὣι', + 'ᾤ' => 'ὤι', + 'ᾥ' => 'ὥι', + 'ᾦ' => 'ὦι', + 'ᾧ' => 'ὧι', + 'ᾨ' => 'ὠι', + 'ᾩ' => 'ὡι', + 'ᾪ' => 'ὢι', + 'ᾫ' => 'ὣι', + 'ᾬ' => 'ὤι', + 'ᾭ' => 'ὥι', + 'ᾮ' => 'ὦι', + 'ᾯ' => 'ὧι', + 'ᾲ' => 'ὰι', + 'ᾳ' => 'αι', + 'ᾴ' => 'άι', + 'ᾶ' => 'ᾶ', + 'ᾷ' => 'ᾶι', + 'ᾼ' => 'αι', + 'ῂ' => 'ὴι', + 'ῃ' => 'ηι', + 'ῄ' => 'ήι', + 'ῆ' => 'ῆ', + 'ῇ' => 'ῆι', + 'ῌ' => 'ηι', + 'ῒ' => 'ῒ', + 'ῖ' => 'ῖ', + 'ῗ' => 'ῗ', + 'ῢ' => 'ῢ', + 'ῤ' => 'ῤ', + 'ῦ' => 'ῦ', + 'ῧ' => 'ῧ', + 'ῲ' => 'ὼι', + 'ῳ' => 'ωι', + 'ῴ' => 'ώι', + 'ῶ' => 'ῶ', + 'ῷ' => 'ῶι', + 'ῼ' => 'ωι', + 'ff' => 'ff', + 'fi' => 'fi', + 'fl' => 'fl', + 'ffi' => 'ffi', + 'ffl' => 'ffl', + 'ſt' => 'st', + 'st' => 'st', + 'ﬓ' => 'մն', + 'ﬔ' => 'մե', + 'ﬕ' => 'մի', + 'ﬖ' => 'վն', + 'ﬗ' => 'մխ', +]; diff --git a/vendor/symfony/polyfill-mbstring/bootstrap.php b/vendor/symfony/polyfill-mbstring/bootstrap.php index 1fedd1f..ecf1a03 100644 --- a/vendor/symfony/polyfill-mbstring/bootstrap.php +++ b/vendor/symfony/polyfill-mbstring/bootstrap.php @@ -132,6 +132,10 @@ if (!function_exists('mb_str_split')) { function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); } } +if (!function_exists('mb_str_pad')) { + function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } +} + if (extension_loaded('mbstring')) { return; } diff --git a/vendor/symfony/polyfill-mbstring/bootstrap80.php b/vendor/symfony/polyfill-mbstring/bootstrap80.php index 82f5ac4..2f9fb5b 100644 --- a/vendor/symfony/polyfill-mbstring/bootstrap80.php +++ b/vendor/symfony/polyfill-mbstring/bootstrap80.php @@ -128,6 +128,10 @@ if (!function_exists('mb_str_split')) { function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); } } +if (!function_exists('mb_str_pad')) { + function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } +} + if (extension_loaded('mbstring')) { return; } diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json index 4489553..943e502 100644 --- a/vendor/symfony/polyfill-mbstring/composer.json +++ b/vendor/symfony/polyfill-mbstring/composer.json @@ -31,7 +31,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", diff --git a/vendor/symfony/polyfill-php72/LICENSE b/vendor/symfony/polyfill-php72/LICENSE index 4cd8bdd..6e3afce 100644 --- a/vendor/symfony/polyfill-php72/LICENSE +++ b/vendor/symfony/polyfill-php72/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015-2019 Fabien Potencier +Copyright (c) 2015-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/polyfill-php72/composer.json b/vendor/symfony/polyfill-php72/composer.json index 5f17af3..b61b4c8 100644 --- a/vendor/symfony/polyfill-php72/composer.json +++ b/vendor/symfony/polyfill-php72/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", diff --git a/vendor/symfony/polyfill-php80/LICENSE b/vendor/symfony/polyfill-php80/LICENSE index 5593b1d..0ed3a24 100644 --- a/vendor/symfony/polyfill-php80/LICENSE +++ b/vendor/symfony/polyfill-php80/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020 Fabien Potencier +Copyright (c) 2020-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/polyfill-php80/composer.json b/vendor/symfony/polyfill-php80/composer.json index bd9a326..f1801f4 100644 --- a/vendor/symfony/polyfill-php80/composer.json +++ b/vendor/symfony/polyfill-php80/composer.json @@ -30,7 +30,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", diff --git a/vendor/topthink/think-migration/.gitignore b/vendor/topthink/think-migration/.gitignore index 30babff..a44d1dd 100644 --- a/vendor/topthink/think-migration/.gitignore +++ b/vendor/topthink/think-migration/.gitignore @@ -1,3 +1,4 @@ /vendor/ .idea composer.lock +composer.phar diff --git a/vendor/topthink/think-migration/composer.json b/vendor/topthink/think-migration/composer.json index 39980f7..b87fd32 100644 --- a/vendor/topthink/think-migration/composer.json +++ b/vendor/topthink/think-migration/composer.json @@ -9,26 +9,36 @@ "license": "Apache-2.0", "autoload": { "psr-4": { - "Phinx\\": "phinx/src/Phinx", + "Phinx\\": "phinx", "think\\migration\\": "src" } }, + "require": { + "php": ">=7.2", + "topthink/framework": "^6.0 || ^8.0", + "topthink/think-helper": "^3.0.3" + }, + "require-dev": { + "fzaninotto/faker": "^1.8", + "robmorgan/phinx": "^0.13.4", + "composer/composer": "^2.5.8" + }, + "suggest": { + "fzaninotto/faker": "Required to use the factory builder (^1.8)." + }, + "scripts": { + "post-install-cmd": [ + "think\\migration\\UsePhinx::run" + ], + "post-update-cmd": [ + "think\\migration\\UsePhinx::run" + ] + }, "extra": { "think": { "services": [ "think\\migration\\Service" ] } - }, - "require": { - "topthink/framework": "^6.0 || ^8.0", - "topthink/think-helper": "^3.0.3" - }, - "minimum-stability": "dev", - "suggest": { - "fzaninotto/faker": "Required to use the factory builder (^1.8)." - }, - "require-dev": { - "fzaninotto/faker": "^1.8" } } diff --git a/vendor/topthink/think-migration/phinx/Config/Config.php b/vendor/topthink/think-migration/phinx/Config/Config.php new file mode 100644 index 0000000..91cfbd4 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Config/Config.php @@ -0,0 +1,553 @@ +configFilePath = $configFilePath; + $this->values = $this->replaceTokens($configArray); + + if (isset($this->values['feature_flags'])) { + FeatureFlags::setFlagsFromConfig($this->values['feature_flags']); + } + } + + /** + * Create a new instance of the config class using a Yaml file path. + * + * @param string $configFilePath Path to the Yaml File + * @throws \RuntimeException + * @return \Phinx\Config\ConfigInterface + */ + public static function fromYaml(string $configFilePath): ConfigInterface + { + if (!class_exists('Symfony\\Component\\Yaml\\Yaml', true)) { + // @codeCoverageIgnoreStart + throw new RuntimeException('Missing yaml parser, symfony/yaml package is not installed.'); + // @codeCoverageIgnoreEnd + } + + $configFile = file_get_contents($configFilePath); + $configArray = Yaml::parse($configFile); + + if (!is_array($configArray)) { + throw new RuntimeException(sprintf( + 'File \'%s\' must be valid YAML', + $configFilePath + )); + } + + return new static($configArray, $configFilePath); + } + + /** + * Create a new instance of the config class using a JSON file path. + * + * @param string $configFilePath Path to the JSON File + * @throws \RuntimeException + * @return \Phinx\Config\ConfigInterface + */ + public static function fromJson(string $configFilePath): ConfigInterface + { + if (!function_exists('json_decode')) { + // @codeCoverageIgnoreStart + throw new RuntimeException('Need to install JSON PHP extension to use JSON config'); + // @codeCoverageIgnoreEnd + } + + $configArray = json_decode(file_get_contents($configFilePath), true); + if (!is_array($configArray)) { + throw new RuntimeException(sprintf( + 'File \'%s\' must be valid JSON', + $configFilePath + )); + } + + return new static($configArray, $configFilePath); + } + + /** + * Create a new instance of the config class using a PHP file path. + * + * @param string $configFilePath Path to the PHP File + * @throws \RuntimeException + * @return \Phinx\Config\ConfigInterface + */ + public static function fromPhp(string $configFilePath): ConfigInterface + { + ob_start(); + /** @noinspection PhpIncludeInspection */ + $configArray = include $configFilePath; + + // Hide console output + ob_end_clean(); + + if (!is_array($configArray)) { + throw new RuntimeException(sprintf( + 'PHP file \'%s\' must return an array', + $configFilePath + )); + } + + return new static($configArray, $configFilePath); + } + + /** + * @inheritDoc + */ + public function getEnvironments(): ?array + { + if (isset($this->values['environments'])) { + $environments = []; + foreach ($this->values['environments'] as $key => $value) { + if (is_array($value)) { + $environments[$key] = $value; + } + } + + return $environments; + } + + return null; + } + + /** + * @inheritDoc + */ + public function getEnvironment(string $name): ?array + { + $environments = $this->getEnvironments(); + + if (isset($environments[$name])) { + if ( + isset($this->values['environments']['default_migration_table']) + && !isset($environments[$name]['migration_table']) + ) { + $environments[$name]['migration_table'] = + $this->values['environments']['default_migration_table']; + } + + if ( + isset($environments[$name]['adapter']) + && $environments[$name]['adapter'] === 'sqlite' + && !empty($environments[$name]['memory']) + ) { + $environments[$name]['name'] = SQLiteAdapter::MEMORY; + } + + return $this->parseAgnosticDsn($environments[$name]); + } + + return null; + } + + /** + * @inheritDoc + */ + public function hasEnvironment(string $name): bool + { + return $this->getEnvironment($name) !== null; + } + + /** + * @inheritDoc + */ + public function getDefaultEnvironment(): string + { + // The $PHINX_ENVIRONMENT variable overrides all other default settings + $env = getenv('PHINX_ENVIRONMENT'); + if (!empty($env)) { + if ($this->hasEnvironment($env)) { + return $env; + } + + throw new RuntimeException(sprintf( + 'The environment configuration (read from $PHINX_ENVIRONMENT) for \'%s\' is missing', + $env + )); + } + + // deprecated: to be removed 0.13 + if (isset($this->values['environments']['default_database'])) { + trigger_error('default_database in the config has been deprecated since 0.12, use default_environment instead.', E_USER_DEPRECATED); + $this->values['environments']['default_environment'] = $this->values['environments']['default_database']; + } + + // if the user has configured a default environment then use it, + // providing it actually exists! + if (isset($this->values['environments']['default_environment'])) { + if ($this->hasEnvironment($this->values['environments']['default_environment'])) { + return $this->values['environments']['default_environment']; + } + + throw new RuntimeException(sprintf( + 'The environment configuration for \'%s\' is missing', + $this->values['environments']['default_environment'] + )); + } + + // else default to the first available one + if (is_array($this->getEnvironments()) && count($this->getEnvironments()) > 0) { + $names = array_keys($this->getEnvironments()); + + return $names[0]; + } + + throw new RuntimeException('Could not find a default environment'); + } + + /** + * @inheritDoc + */ + public function getAlias($alias): ?string + { + return !empty($this->values['aliases'][$alias]) ? $this->values['aliases'][$alias] : null; + } + + /** + * @inheritDoc + */ + public function getAliases(): array + { + return !empty($this->values['aliases']) ? $this->values['aliases'] : []; + } + + /** + * @inheritDoc + */ + public function getConfigFilePath(): ?string + { + return $this->configFilePath; + } + + /** + * @inheritDoc + * @throws \UnexpectedValueException + */ + public function getMigrationPaths(): array + { + if (!isset($this->values['paths']['migrations'])) { + throw new UnexpectedValueException('Migrations path missing from config file'); + } + + if (is_string($this->values['paths']['migrations'])) { + $this->values['paths']['migrations'] = [$this->values['paths']['migrations']]; + } + + return $this->values['paths']['migrations']; + } + + /** + * @inheritDoc + * @throws \UnexpectedValueException + */ + public function getSeedPaths(): array + { + if (!isset($this->values['paths']['seeds'])) { + throw new UnexpectedValueException('Seeds path missing from config file'); + } + + if (is_string($this->values['paths']['seeds'])) { + $this->values['paths']['seeds'] = [$this->values['paths']['seeds']]; + } + + return $this->values['paths']['seeds']; + } + + /** + * @inheritdoc + */ + public function getMigrationBaseClassName(bool $dropNamespace = true): string + { + $className = !isset($this->values['migration_base_class']) ? 'Phinx\Migration\AbstractMigration' : $this->values['migration_base_class']; + + return $dropNamespace ? (substr(strrchr($className, '\\'), 1) ?: $className) : $className; + } + + /** + * @inheritdoc + */ + public function getSeedBaseClassName(bool $dropNamespace = true): string + { + $className = !isset($this->values['seed_base_class']) ? 'Phinx\Seed\AbstractSeed' : $this->values['seed_base_class']; + + return $dropNamespace ? substr(strrchr($className, '\\'), 1) : $className; + } + + /** + * @inheritdoc + */ + public function getTemplateFile() + { + if (!isset($this->values['templates']['file'])) { + return false; + } + + return $this->values['templates']['file']; + } + + /** + * @inheritdoc + */ + public function getTemplateClass() + { + if (!isset($this->values['templates']['class'])) { + return false; + } + + return $this->values['templates']['class']; + } + + /** + * @inheritdoc + */ + public function getTemplateStyle(): string + { + if (!isset($this->values['templates']['style'])) { + return self::TEMPLATE_STYLE_CHANGE; + } + + return $this->values['templates']['style'] === self::TEMPLATE_STYLE_UP_DOWN ? self::TEMPLATE_STYLE_UP_DOWN : self::TEMPLATE_STYLE_CHANGE; + } + + /** + * @inheritdoc + */ + public function getDataDomain(): array + { + if (!isset($this->values['data_domain'])) { + return []; + } + + return $this->values['data_domain']; + } + + /** + * @inheritDoc + */ + public function getContainer(): ?ContainerInterface + { + if (!isset($this->values['container'])) { + return null; + } + + return $this->values['container']; + } + + /** + * @inheritdoc + */ + public function getVersionOrder(): string + { + if (!isset($this->values['version_order'])) { + return self::VERSION_ORDER_CREATION_TIME; + } + + return $this->values['version_order']; + } + + /** + * @inheritdoc + */ + public function isVersionOrderCreationTime(): bool + { + $versionOrder = $this->getVersionOrder(); + + return $versionOrder == self::VERSION_ORDER_CREATION_TIME; + } + + /** + * @inheritdoc + */ + public function getBootstrapFile() + { + if (!isset($this->values['paths']['bootstrap'])) { + return false; + } + + return $this->values['paths']['bootstrap']; + } + + /** + * Replace tokens in the specified array. + * + * @param array $arr Array to replace + * @return array + */ + protected function replaceTokens(array $arr): array + { + // Get environment variables + // Depending on configuration of server / OS and variables_order directive, + // environment variables either end up in $_SERVER (most likely) or $_ENV, + // so we search through both + $tokens = []; + foreach (array_merge($_ENV, $_SERVER) as $varname => $varvalue) { + if (strpos($varname, 'PHINX_') === 0) { + $tokens['%%' . $varname . '%%'] = $varvalue; + } + } + + // Phinx defined tokens (override env tokens) + $tokens['%%PHINX_CONFIG_PATH%%'] = $this->getConfigFilePath(); + $tokens['%%PHINX_CONFIG_DIR%%'] = $this->getConfigFilePath() !== null ? dirname($this->getConfigFilePath()) : ''; + + // Recurse the array and replace tokens + return $this->recurseArrayForTokens($arr, $tokens); + } + + /** + * Recurse an array for the specified tokens and replace them. + * + * @param array $arr Array to recurse + * @param string[] $tokens Array of tokens to search for + * @return array + */ + protected function recurseArrayForTokens(array $arr, array $tokens): array + { + $out = []; + foreach ($arr as $name => $value) { + if (is_array($value)) { + $out[$name] = $this->recurseArrayForTokens($value, $tokens); + continue; + } + if (is_string($value)) { + foreach ($tokens as $token => $tval) { + $value = str_replace($token, $tval ?? '', $value); + } + $out[$name] = $value; + continue; + } + $out[$name] = $value; + } + + return $out; + } + + /** + * Parse a database-agnostic DSN into individual options. + * + * @param array $options Options + * @return array + */ + protected function parseAgnosticDsn(array $options): array + { + $parsed = Util::parseDsn($options['dsn'] ?? ''); + if ($parsed) { + unset($options['dsn']); + } + + $options += $parsed; + + return $options; + } + + /** + * {@inheritDoc} + * + * @param mixed $id ID + * @param mixed $value Value + * @return void + */ + public function offsetSet($id, $value): void + { + $this->values[$id] = $value; + } + + /** + * {@inheritDoc} + * + * @param mixed $id ID + * @throws \InvalidArgumentException + * @return mixed + */ + #[\ReturnTypeWillChange] + public function offsetGet($id) + { + if (!array_key_exists($id, $this->values)) { + throw new InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); + } + + return $this->values[$id] instanceof Closure ? $this->values[$id]($this) : $this->values[$id]; + } + + /** + * {@inheritDoc} + * + * @param mixed $id ID + * @return bool + */ + public function offsetExists($id): bool + { + return isset($this->values[$id]); + } + + /** + * {@inheritDoc} + * + * @param mixed $id ID + * @return void + */ + public function offsetUnset($id): void + { + unset($this->values[$id]); + } + + /** + * @inheritdoc + */ + public function getSeedTemplateFile(): ?string + { + return $this->values['templates']['seedFile'] ?? null; + } +} diff --git a/vendor/topthink/think-migration/phinx/Config/ConfigInterface.php b/vendor/topthink/think-migration/phinx/Config/ConfigInterface.php new file mode 100644 index 0000000..3bd57f2 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Config/ConfigInterface.php @@ -0,0 +1,171 @@ +null if no environments exist. + * + * @return array|null + */ + public function getEnvironments(): ?array; + + /** + * Returns the configuration for a given environment. + * + * This method returns null if the specified environment + * doesn't exist. + * + * @param string $name Environment Name + * @return array|null + */ + public function getEnvironment(string $name): ?array; + + /** + * Does the specified environment exist in the configuration file? + * + * @param string $name Environment Name + * @return bool + */ + public function hasEnvironment(string $name): bool; + + /** + * Gets the default environment name. + * + * @throws \RuntimeException + * @return string + */ + public function getDefaultEnvironment(): string; + + /** + * Get the aliased value from a supplied alias. + * + * @param string $alias Alias + * @return string|null + */ + public function getAlias(string $alias): ?string; + + /** + * Get all the aliased values. + * + * @return string[] + */ + public function getAliases(): array; + + /** + * Gets the config file path. + * + * @return string|null + */ + public function getConfigFilePath(): ?string; + + /** + * Gets the paths to search for migration files. + * + * @return string[] + */ + public function getMigrationPaths(): array; + + /** + * Gets the paths to search for seed files. + * + * @return string[] + */ + public function getSeedPaths(): array; + + /** + * Get the template file name. + * + * @return string|false + */ + public function getTemplateFile(); + + /** + * Get the template class name. + * + * @return string|false + */ + public function getTemplateClass(); + + /** + * Get the template style to use, either change or up_down. + * + * @return string + */ + public function getTemplateStyle(): string; + + /** + * Get the user-provided container for instantiating seeds + * + * @return \Psr\Container\ContainerInterface|null + */ + public function getContainer(): ?ContainerInterface; + + /** + * Get the data domain array. + * + * @return array + */ + public function getDataDomain(): array; + + /** + * Get the version order. + * + * @return string + */ + public function getVersionOrder(): string; + + /** + * Is version order creation time? + * + * @return bool + */ + public function isVersionOrderCreationTime(): bool; + + /** + * Get the bootstrap file path + * + * @return string|false + */ + public function getBootstrapFile(); + + /** + * Gets the base class name for migrations. + * + * @param bool $dropNamespace Return the base migration class name without the namespace. + * @return string + */ + public function getMigrationBaseClassName(bool $dropNamespace = true): string; + + /** + * Gets the base class name for seeders. + * + * @param bool $dropNamespace Return the base seeder class name without the namespace. + * @return string + */ + public function getSeedBaseClassName(bool $dropNamespace = true): string; + + /** + * Get the seeder template file name or null if not set. + * + * @return string|null + */ + public function getSeedTemplateFile(): ?string; +} diff --git a/vendor/topthink/think-migration/phinx/Config/FeatureFlags.php b/vendor/topthink/think-migration/phinx/Config/FeatureFlags.php new file mode 100644 index 0000000..dded535 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Config/FeatureFlags.php @@ -0,0 +1,41 @@ +getMigrationPaths(); + + return $this->searchNamespace($path, $paths); + } + + /** + * Get Seed Namespace associated with path. + * + * @param string $path Path + * @return string|null + */ + public function getSeedNamespaceByPath(string $path): ?string + { + $paths = $this->getSeedPaths(); + + return $this->searchNamespace($path, $paths); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Action/Action.php b/vendor/topthink/think-migration/phinx/Db/Action/Action.php new file mode 100644 index 0000000..90c3ae4 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Action/Action.php @@ -0,0 +1,38 @@ +table = $table; + } + + /** + * The table this action will be applied to + * + * @return \Phinx\Db\Table\Table + */ + public function getTable(): Table + { + return $this->table; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Action/AddColumn.php b/vendor/topthink/think-migration/phinx/Db/Action/AddColumn.php new file mode 100644 index 0000000..299c927 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Action/AddColumn.php @@ -0,0 +1,62 @@ +column = $column; + } + + /** + * Returns a new AddColumn object after assembling the given commands + * + * @param \Phinx\Db\Table\Table $table The table to add the column to + * @param string $columnName The column name + * @param string|\Phinx\Util\Literal $type The column type + * @param array $options The column options + * @return static + */ + public static function build(Table $table, string $columnName, $type = null, array $options = []) + { + $column = new Column(); + $column->setName($columnName); + $column->setType($type); + $column->setOptions($options); // map options to column methods + + return new static($table, $column); + } + + /** + * Returns the column to be added + * + * @return \Phinx\Db\Table\Column + */ + public function getColumn(): Column + { + return $this->column; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Action/AddForeignKey.php b/vendor/topthink/think-migration/phinx/Db/Action/AddForeignKey.php new file mode 100644 index 0000000..9121cfe --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Action/AddForeignKey.php @@ -0,0 +1,78 @@ +foreignKey = $fk; + } + + /** + * Creates a new AddForeignKey object after building the foreign key with + * the passed attributes + * + * @param \Phinx\Db\Table\Table $table The table object to add the foreign key to + * @param string|string[] $columns The columns for the foreign key + * @param \Phinx\Db\Table\Table|string $referencedTable The table the foreign key references + * @param string|string[] $referencedColumns The columns in the referenced table + * @param array $options Extra options for the foreign key + * @param string|null $name The name of the foreign key + * @return static + */ + public static function build(Table $table, $columns, $referencedTable, $referencedColumns = ['id'], array $options = [], ?string $name = null) + { + if (is_string($referencedColumns)) { + $referencedColumns = [$referencedColumns]; // str to array + } + + if (is_string($referencedTable)) { + $referencedTable = new Table($referencedTable); + } + + $fk = new ForeignKey(); + $fk->setReferencedTable($referencedTable) + ->setColumns($columns) + ->setReferencedColumns($referencedColumns) + ->setOptions($options); + + if ($name !== null) { + $fk->setConstraint($name); + } + + return new static($table, $fk); + } + + /** + * Returns the foreign key to be added + * + * @return \Phinx\Db\Table\ForeignKey + */ + public function getForeignKey(): ForeignKey + { + return $this->foreignKey; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Action/AddIndex.php b/vendor/topthink/think-migration/phinx/Db/Action/AddIndex.php new file mode 100644 index 0000000..aac22cb --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Action/AddIndex.php @@ -0,0 +1,67 @@ +index = $index; + } + + /** + * Creates a new AddIndex object after building the index object with the + * provided arguments + * + * @param \Phinx\Db\Table\Table $table The table to add the index to + * @param string|string[]|\Phinx\Db\Table\Index $columns The columns to index + * @param array $options Additional options for the index creation + * @return static + */ + public static function build(Table $table, $columns, array $options = []) + { + // create a new index object if strings or an array of strings were supplied + $index = $columns; + + if (!$columns instanceof Index) { + $index = new Index(); + + $index->setColumns($columns); + $index->setOptions($options); + } + + return new static($table, $index); + } + + /** + * Returns the index to be added + * + * @return \Phinx\Db\Table\Index + */ + public function getIndex(): Index + { + return $this->index; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Action/ChangeColumn.php b/vendor/topthink/think-migration/phinx/Db/Action/ChangeColumn.php new file mode 100644 index 0000000..143baf9 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Action/ChangeColumn.php @@ -0,0 +1,87 @@ +columnName = $columnName; + $this->column = $column; + + // if the name was omitted use the existing column name + if ($column->getName() === null || strlen($column->getName()) === 0) { + $column->setName($columnName); + } + } + + /** + * Creates a new ChangeColumn object after building the column definition + * out of the provided arguments + * + * @param \Phinx\Db\Table\Table $table The table to alter + * @param string $columnName The name of the column to change + * @param string|\Phinx\Db\Table\Column|\Phinx\Util\Literal $type The type of the column + * @param array $options Additional options for the column + * @return static + */ + public static function build(Table $table, string $columnName, $type = null, array $options = []) + { + $column = new Column(); + $column->setName($columnName); + $column->setType($type); + $column->setOptions($options); // map options to column methods + + return new static($table, $columnName, $column); + } + + /** + * Returns the name of the column to change + * + * @return string + */ + public function getColumnName(): string + { + return $this->columnName; + } + + /** + * Returns the column definition + * + * @return \Phinx\Db\Table\Column + */ + public function getColumn(): Column + { + return $this->column; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Action/ChangeComment.php b/vendor/topthink/think-migration/phinx/Db/Action/ChangeComment.php new file mode 100644 index 0000000..5604530 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Action/ChangeComment.php @@ -0,0 +1,42 @@ +newComment = $newComment; + } + + /** + * Return the new comment for the table + * + * @return string|null + */ + public function getNewComment(): ?string + { + return $this->newComment; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Action/ChangePrimaryKey.php b/vendor/topthink/think-migration/phinx/Db/Action/ChangePrimaryKey.php new file mode 100644 index 0000000..bb220fd --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Action/ChangePrimaryKey.php @@ -0,0 +1,42 @@ +newColumns = $newColumns; + } + + /** + * Return the new columns for the primary key + * + * @return string|string[]|null + */ + public function getNewColumns() + { + return $this->newColumns; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Action/CreateTable.php b/vendor/topthink/think-migration/phinx/Db/Action/CreateTable.php new file mode 100644 index 0000000..8f50afa --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Action/CreateTable.php @@ -0,0 +1,12 @@ +foreignKey = $foreignKey; + } + + /** + * Creates a new DropForeignKey object after building the ForeignKey + * definition out of the passed arguments. + * + * @param \Phinx\Db\Table\Table $table The table to delete the foreign key from + * @param string|string[] $columns The columns participating in the foreign key + * @param string|null $constraint The constraint name + * @return static + */ + public static function build(Table $table, $columns, ?string $constraint = null) + { + if (is_string($columns)) { + $columns = [$columns]; + } + + $foreignKey = new ForeignKey(); + $foreignKey->setColumns($columns); + + if ($constraint) { + $foreignKey->setConstraint($constraint); + } + + return new static($table, $foreignKey); + } + + /** + * Returns the foreign key to remove + * + * @return \Phinx\Db\Table\ForeignKey + */ + public function getForeignKey(): ForeignKey + { + return $this->foreignKey; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Action/DropIndex.php b/vendor/topthink/think-migration/phinx/Db/Action/DropIndex.php new file mode 100644 index 0000000..f2b6e21 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Action/DropIndex.php @@ -0,0 +1,75 @@ +index = $index; + } + + /** + * Creates a new DropIndex object after assembling the passed + * arguments. + * + * @param \Phinx\Db\Table\Table $table The table where the index is + * @param string[] $columns the indexed columns + * @return static + */ + public static function build(Table $table, array $columns = []) + { + $index = new Index(); + $index->setColumns($columns); + + return new static($table, $index); + } + + /** + * Creates a new DropIndex when the name of the index to drop + * is known. + * + * @param \Phinx\Db\Table\Table $table The table where the index is + * @param string $name The name of the index + * @return static + */ + public static function buildFromName(Table $table, string $name) + { + $index = new Index(); + $index->setName($name); + + return new static($table, $index); + } + + /** + * Returns the index to be dropped + * + * @return \Phinx\Db\Table\Index + */ + public function getIndex(): Index + { + return $this->index; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Action/DropTable.php b/vendor/topthink/think-migration/phinx/Db/Action/DropTable.php new file mode 100644 index 0000000..6343d0b --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Action/DropTable.php @@ -0,0 +1,12 @@ +column = $column; + } + + /** + * Creates a new RemoveColumn object after assembling the + * passed arguments. + * + * @param \Phinx\Db\Table\Table $table The table where the column is + * @param string $columnName The name of the column to drop + * @return static + */ + public static function build(Table $table, string $columnName) + { + $column = new Column(); + $column->setName($columnName); + + return new static($table, $column); + } + + /** + * Returns the column to be dropped + * + * @return \Phinx\Db\Table\Column + */ + public function getColumn(): Column + { + return $this->column; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Action/RenameColumn.php b/vendor/topthink/think-migration/phinx/Db/Action/RenameColumn.php new file mode 100644 index 0000000..0f18395 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Action/RenameColumn.php @@ -0,0 +1,79 @@ +newName = $newName; + $this->column = $column; + } + + /** + * Creates a new RenameColumn object after building the passed + * arguments + * + * @param \Phinx\Db\Table\Table $table The table where the column is + * @param string $columnName The name of the column to be changed + * @param string $newName The new name for the column + * @return static + */ + public static function build(Table $table, string $columnName, string $newName) + { + $column = new Column(); + $column->setName($columnName); + + return new static($table, $column, $newName); + } + + /** + * Returns the column to be changed + * + * @return \Phinx\Db\Table\Column + */ + public function getColumn(): Column + { + return $this->column; + } + + /** + * Returns the new name for the column + * + * @return string + */ + public function getNewName(): string + { + return $this->newName; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Action/RenameTable.php b/vendor/topthink/think-migration/phinx/Db/Action/RenameTable.php new file mode 100644 index 0000000..dd9652d --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Action/RenameTable.php @@ -0,0 +1,42 @@ +newName = $newName; + } + + /** + * Return the new name for the table + * + * @return string + */ + public function getNewName(): string + { + return $this->newName; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/AbstractAdapter.php b/vendor/topthink/think-migration/phinx/Db/Adapter/AbstractAdapter.php new file mode 100644 index 0000000..720fa8c --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/AbstractAdapter.php @@ -0,0 +1,412 @@ + + */ + protected $options = []; + + /** + * @var \think\console\Input|null + */ + protected $input; + + /** + * @var \think\console\Output + */ + protected $output; + + /** + * @var string[] + */ + protected $createdTables = []; + + /** + * @var string + */ + protected $schemaTableName = 'phinxlog'; + + /** + * @var array + */ + protected $dataDomain = []; + + /** + * Class Constructor. + * + * @param array $options Options + * @param \think\console\Input|null $input Input Interface + * @param \think\console\Output|null $output Output Interface + */ + public function __construct(array $options, ?InputInterface $input = null, ?OutputInterface $output = null) + { + $this->setOptions($options); + if ($input !== null) { + $this->setInput($input); + } + if ($output !== null) { + $this->setOutput($output); + } + } + + /** + * @inheritDoc + */ + public function setOptions(array $options): AdapterInterface + { + $this->options = $options; + + if (isset($options['default_migration_table'])) { + trigger_error('The default_migration_table setting for adapter has been deprecated since 0.13.0. Use `migration_table` instead.', E_USER_DEPRECATED); + if (!isset($options['migration_table'])) { + $options['migration_table'] = $options['default_migration_table']; + } + } + + if (isset($options['migration_table'])) { + $this->setSchemaTableName($options['migration_table']); + } + + if (isset($options['data_domain'])) { + $this->setDataDomain($options['data_domain']); + } + + return $this; + } + + /** + * @inheritDoc + */ + public function getOptions(): array + { + return $this->options; + } + + /** + * @inheritDoc + */ + public function hasOption(string $name): bool + { + return isset($this->options[$name]); + } + + /** + * @inheritDoc + */ + public function getOption(string $name) + { + if (!$this->hasOption($name)) { + return null; + } + + return $this->options[$name]; + } + + /** + * @inheritDoc + */ + public function setInput(InputInterface $input): AdapterInterface + { + $this->input = $input; + + return $this; + } + + /** + * @inheritDoc + */ + public function getInput(): ?InputInterface + { + return $this->input; + } + + /** + * @inheritDoc + */ + public function setOutput(OutputInterface $output): AdapterInterface + { + $this->output = $output; + + return $this; + } + + /** + * @inheritDoc + */ + public function getOutput(): OutputInterface + { + if ($this->output === null) { + $output = new NullOutput(); + $this->setOutput($output); + } + + return $this->output; + } + + /** + * @inheritDoc + * @return array + */ + public function getVersions(): array + { + $rows = $this->getVersionLog(); + + return array_keys($rows); + } + + /** + * Gets the schema table name. + * + * @return string + */ + public function getSchemaTableName(): string + { + return $this->schemaTableName; + } + + /** + * Sets the schema table name. + * + * @param string $schemaTableName Schema Table Name + * @return $this + */ + public function setSchemaTableName(string $schemaTableName) + { + $this->schemaTableName = $schemaTableName; + + return $this; + } + + /** + * Gets the data domain. + * + * @return array + */ + public function getDataDomain(): array + { + return $this->dataDomain; + } + + /** + * Sets the data domain. + * + * @param array $dataDomain Array for the data domain + * @return $this + */ + public function setDataDomain(array $dataDomain) + { + $this->dataDomain = []; + + // Iterate over data domain field definitions and perform initial and + // simple normalization. We make sure the definition as a base 'type' + // and it is compatible with the base Phinx types. + foreach ($dataDomain as $type => $options) { + if (!isset($options['type'])) { + throw new \InvalidArgumentException(sprintf( + 'You must specify a type for data domain type "%s".', + $type + )); + } + + // Replace type if it's the name of a Phinx constant + if (defined('static::' . $options['type'])) { + $options['type'] = constant('static::' . $options['type']); + } + + if (!in_array($options['type'], $this->getColumnTypes(), true)) { + throw new \InvalidArgumentException(sprintf( + 'An invalid column type "%s" was specified for data domain type "%s".', + $options['type'], + $type + )); + } + + $internal_type = $options['type']; + unset($options['type']); + + // Do a simple replacement for the 'length' / 'limit' option and + // detect hinting values for 'limit'. + if (isset($options['length'])) { + $options['limit'] = $options['length']; + unset($options['length']); + } + + if (isset($options['limit']) && !is_numeric($options['limit'])) { + if (!defined('static::' . $options['limit'])) { + throw new \InvalidArgumentException(sprintf( + 'An invalid limit value "%s" was specified for data domain type "%s".', + $options['limit'], + $type + )); + } + + $options['limit'] = constant('static::' . $options['limit']); + } + + // Save the data domain types in a more suitable format + $this->dataDomain[$type] = [ + 'type' => $internal_type, + 'options' => $options, + ]; + } + + return $this; + } + + /** + * @inheritdoc + */ + public function getColumnForType(string $columnName, string $type, array $options): Column + { + $column = new Column(); + $column->setName($columnName); + + if (array_key_exists($type, $this->getDataDomain())) { + $column->setType($this->dataDomain[$type]['type']); + $column->setOptions($this->dataDomain[$type]['options']); + } else { + $column->setType($type); + } + + $column->setOptions($options); + + return $column; + } + + /** + * @inheritDoc + * @throws \InvalidArgumentException + * @return void + */ + public function createSchemaTable(): void + { + try { + $options = [ + 'id' => false, + 'primary_key' => 'version', + ]; + + $table = new Table($this->getSchemaTableName(), $options, $this); + $table->addColumn('version', 'biginteger', ['null' => false]) + ->addColumn('migration_name', 'string', ['limit' => 100, 'default' => null, 'null' => true]) + ->addColumn('start_time', 'timestamp', ['default' => null, 'null' => true]) + ->addColumn('end_time', 'timestamp', ['default' => null, 'null' => true]) + ->addColumn('breakpoint', 'boolean', ['default' => false, 'null' => false]) + ->save(); + } catch (Exception $exception) { + throw new InvalidArgumentException( + 'There was a problem creating the schema table: ' . $exception->getMessage(), + (int)$exception->getCode(), + $exception + ); + } + } + + /** + * @inheritDoc + */ + public function getAdapterType(): string + { + return $this->getOption('adapter'); + } + + /** + * @inheritDoc + */ + public function isValidColumnType(Column $column): bool + { + return $column->getType() instanceof Literal || in_array($column->getType(), $this->getColumnTypes(), true); + } + + /** + * Determines if instead of executing queries a dump to standard output is needed + * + * @return bool + */ + public function isDryRunEnabled(): bool + { + /** @var \think\console\Input|null $input */ + $input = $this->getInput(); + + return $input && $input->hasOption('dry-run') ? (bool)$input->getOption('dry-run') : false; + } + + /** + * Adds user-created tables (e.g. not phinxlog) to a cached list + * + * @param string $tableName The name of the table + * @return void + */ + protected function addCreatedTable(string $tableName): void + { + $tableName = $this->quoteTableName($tableName); + if (substr_compare($tableName, 'phinxlog', -strlen('phinxlog')) !== 0) { + $this->createdTables[] = $tableName; + } + } + + /** + * Updates the name of the cached table + * + * @param string $tableName Original name of the table + * @param string $newTableName New name of the table + * @return void + */ + protected function updateCreatedTableName(string $tableName, string $newTableName): void + { + $tableName = $this->quoteTableName($tableName); + $newTableName = $this->quoteTableName($newTableName); + $key = array_search($tableName, $this->createdTables, true); + if ($key !== false) { + $this->createdTables[$key] = $newTableName; + } + } + + /** + * Removes table from the cached created list + * + * @param string $tableName The name of the table + * @return void + */ + protected function removeCreatedTable(string $tableName): void + { + $tableName = $this->quoteTableName($tableName); + $key = array_search($tableName, $this->createdTables, true); + if ($key !== false) { + unset($this->createdTables[$key]); + } + } + + /** + * Check if the table is in the cached list of created tables + * + * @param string $tableName The name of the table + * @return bool + */ + protected function hasCreatedTable(string $tableName): bool + { + $tableName = $this->quoteTableName($tableName); + + return in_array($tableName, $this->createdTables, true); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/AdapterFactory.php b/vendor/topthink/think-migration/phinx/Db/Adapter/AdapterFactory.php new file mode 100644 index 0000000..3843691 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/AdapterFactory.php @@ -0,0 +1,172 @@ + + */ +class AdapterFactory +{ + /** + * @var \Phinx\Db\Adapter\AdapterFactory|null + */ + protected static $instance; + + /** + * Get the factory singleton instance. + * + * @return \Phinx\Db\Adapter\AdapterFactory + */ + public static function instance() + { + if (!static::$instance) { + static::$instance = new static(); + } + + return static::$instance; + } + + /** + * Class map of database adapters, indexed by PDO::ATTR_DRIVER_NAME. + * + * @var array + * @phpstan-var array> + */ + protected $adapters = [ + 'mysql' => 'Phinx\Db\Adapter\MysqlAdapter', + 'pgsql' => 'Phinx\Db\Adapter\PostgresAdapter', + 'sqlite' => 'Phinx\Db\Adapter\SQLiteAdapter', + 'sqlsrv' => 'Phinx\Db\Adapter\SqlServerAdapter', + ]; + + /** + * Class map of adapters wrappers, indexed by name. + * + * @var array + */ + protected $wrappers = [ + 'prefix' => 'Phinx\Db\Adapter\TablePrefixAdapter', + 'proxy' => 'Phinx\Db\Adapter\ProxyAdapter', + 'timed' => 'Phinx\Db\Adapter\TimedOutputAdapter', + ]; + + /** + * Register an adapter class with a given name. + * + * @param string $name Name + * @param object|string $class Class + * @throws \RuntimeException + * @return $this + */ + public function registerAdapter(string $name, $class) + { + if (!is_subclass_of($class, 'Phinx\Db\Adapter\AdapterInterface')) { + throw new RuntimeException(sprintf( + 'Adapter class "%s" must implement Phinx\\Db\\Adapter\\AdapterInterface', + is_string($class) ? $class : get_class($class) + )); + } + $this->adapters[$name] = $class; + + return $this; + } + + /** + * Get an adapter class by name. + * + * @param string $name Name + * @throws \RuntimeException + * @return object|string + * @phpstan-return object|class-string<\Phinx\Db\Adapter\AdapterInterface> + */ + protected function getClass(string $name) + { + if (empty($this->adapters[$name])) { + throw new RuntimeException(sprintf( + 'Adapter "%s" has not been registered', + $name + )); + } + + return $this->adapters[$name]; + } + + /** + * Get an adapter instance by name. + * + * @param string $name Name + * @param array $options Options + * @return \Phinx\Db\Adapter\AdapterInterface + */ + public function getAdapter(string $name, array $options): AdapterInterface + { + $class = $this->getClass($name); + + return new $class($options); + } + + /** + * Add or replace a wrapper with a fully qualified class name. + * + * @param string $name Name + * @param object|string $class Class + * @throws \RuntimeException + * @return $this + */ + public function registerWrapper(string $name, $class) + { + if (!is_subclass_of($class, 'Phinx\Db\Adapter\WrapperInterface')) { + throw new RuntimeException(sprintf( + 'Wrapper class "%s" must be implement Phinx\\Db\\Adapter\\WrapperInterface', + is_string($class) ? $class : get_class($class) + )); + } + $this->wrappers[$name] = $class; + + return $this; + } + + /** + * Get a wrapper class by name. + * + * @param string $name Name + * @throws \RuntimeException + * @return \Phinx\Db\Adapter\WrapperInterface|string + */ + protected function getWrapperClass(string $name) + { + if (empty($this->wrappers[$name])) { + throw new RuntimeException(sprintf( + 'Wrapper "%s" has not been registered', + $name + )); + } + + return $this->wrappers[$name]; + } + + /** + * Get a wrapper instance by name. + * + * @param string $name Name + * @param \Phinx\Db\Adapter\AdapterInterface $adapter Adapter + * @return \Phinx\Db\Adapter\AdapterWrapper + */ + public function getWrapper(string $name, AdapterInterface $adapter): AdapterWrapper + { + $class = $this->getWrapperClass($name); + + return new $class($adapter); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/AdapterInterface.php b/vendor/topthink/think-migration/phinx/Db/Adapter/AdapterInterface.php new file mode 100644 index 0000000..a59ec27 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/AdapterInterface.php @@ -0,0 +1,505 @@ + + * @method \PDO getConnection() + */ +interface AdapterInterface +{ + public const PHINX_TYPE_STRING = 'string'; + public const PHINX_TYPE_CHAR = 'char'; + public const PHINX_TYPE_TEXT = 'text'; + public const PHINX_TYPE_INTEGER = 'integer'; + public const PHINX_TYPE_TINY_INTEGER = 'tinyinteger'; + public const PHINX_TYPE_SMALL_INTEGER = 'smallinteger'; + public const PHINX_TYPE_BIG_INTEGER = 'biginteger'; + public const PHINX_TYPE_BIT = 'bit'; + public const PHINX_TYPE_FLOAT = 'float'; + public const PHINX_TYPE_DECIMAL = 'decimal'; + public const PHINX_TYPE_DOUBLE = 'double'; + public const PHINX_TYPE_DATETIME = 'datetime'; + public const PHINX_TYPE_TIMESTAMP = 'timestamp'; + public const PHINX_TYPE_TIME = 'time'; + public const PHINX_TYPE_DATE = 'date'; + public const PHINX_TYPE_BINARY = 'binary'; + public const PHINX_TYPE_VARBINARY = 'varbinary'; + public const PHINX_TYPE_BINARYUUID = 'binaryuuid'; + public const PHINX_TYPE_BLOB = 'blob'; + public const PHINX_TYPE_TINYBLOB = 'tinyblob'; // Specific to Mysql. + public const PHINX_TYPE_MEDIUMBLOB = 'mediumblob'; // Specific to Mysql + public const PHINX_TYPE_LONGBLOB = 'longblob'; // Specific to Mysql + public const PHINX_TYPE_BOOLEAN = 'boolean'; + public const PHINX_TYPE_JSON = 'json'; + public const PHINX_TYPE_JSONB = 'jsonb'; + public const PHINX_TYPE_UUID = 'uuid'; + public const PHINX_TYPE_FILESTREAM = 'filestream'; + + // Geospatial database types + public const PHINX_TYPE_GEOMETRY = 'geometry'; + public const PHINX_TYPE_GEOGRAPHY = 'geography'; + public const PHINX_TYPE_POINT = 'point'; + public const PHINX_TYPE_LINESTRING = 'linestring'; + public const PHINX_TYPE_POLYGON = 'polygon'; + + public const PHINX_TYPES_GEOSPATIAL = [ + self::PHINX_TYPE_GEOMETRY, + self::PHINX_TYPE_POINT, + self::PHINX_TYPE_LINESTRING, + self::PHINX_TYPE_POLYGON, + ]; + + // only for mysql so far + public const PHINX_TYPE_MEDIUM_INTEGER = 'mediuminteger'; + public const PHINX_TYPE_ENUM = 'enum'; + public const PHINX_TYPE_SET = 'set'; + public const PHINX_TYPE_YEAR = 'year'; + + // only for postgresql so far + public const PHINX_TYPE_CIDR = 'cidr'; + public const PHINX_TYPE_INET = 'inet'; + public const PHINX_TYPE_MACADDR = 'macaddr'; + public const PHINX_TYPE_INTERVAL = 'interval'; + + /** + * Get all migrated version numbers. + * + * @return array + */ + public function getVersions(): array; + + /** + * Get all migration log entries, indexed by version creation time and sorted ascendingly by the configuration's + * version order option + * + * @return array + */ + public function getVersionLog(): array; + + /** + * Set adapter configuration options. + * + * @param array $options Options + * @return $this + */ + public function setOptions(array $options); + + /** + * Get all adapter options. + * + * @return array + */ + public function getOptions(): array; + + /** + * Check if an option has been set. + * + * @param string $name Name + * @return bool + */ + public function hasOption(string $name): bool; + + /** + * Get a single adapter option, or null if the option does not exist. + * + * @param string $name Name + * @return mixed + */ + public function getOption(string $name); + + /** + * Sets the console input. + * + * @param \think\console\Input $input Input + * @return $this + */ + public function setInput(InputInterface $input); + + /** + * Gets the console input. + * + * @return \think\console\Input|null + */ + public function getInput(): ?InputInterface; + + /** + * Sets the console output. + * + * @param \think\console\Output $output Output + * @return $this + */ + public function setOutput(OutputInterface $output); + + /** + * Gets the console output. + * + * @return \think\console\Output + */ + public function getOutput(): OutputInterface; + + /** + * Returns a new Phinx\Db\Table\Column using the existent data domain. + * + * @param string $columnName The desired column name + * @param string $type The type for the column. Can be a data domain type. + * @param array $options Options array + * @return \Phinx\Db\Table\Column + */ + public function getColumnForType(string $columnName, string $type, array $options): Column; + + /** + * Records a migration being run. + * + * @param \Phinx\Migration\MigrationInterface $migration Migration + * @param string $direction Direction + * @param string $startTime Start Time + * @param string $endTime End Time + * @return $this + */ + public function migrated(MigrationInterface $migration, string $direction, string $startTime, string $endTime); + + /** + * Toggle a migration breakpoint. + * + * @param \Phinx\Migration\MigrationInterface $migration Migration + * @return $this + */ + public function toggleBreakpoint(MigrationInterface $migration); + + /** + * Reset all migration breakpoints. + * + * @return int The number of breakpoints reset + */ + public function resetAllBreakpoints(): int; + + /** + * Set a migration breakpoint. + * + * @param \Phinx\Migration\MigrationInterface $migration The migration target for the breakpoint set + * @return $this + */ + public function setBreakpoint(MigrationInterface $migration); + + /** + * Unset a migration breakpoint. + * + * @param \Phinx\Migration\MigrationInterface $migration The migration target for the breakpoint unset + * @return $this + */ + public function unsetBreakpoint(MigrationInterface $migration); + + /** + * Creates the schema table. + * + * @return void + */ + public function createSchemaTable(): void; + + /** + * Returns the adapter type. + * + * @return string + */ + public function getAdapterType(): string; + + /** + * Initializes the database connection. + * + * @throws \RuntimeException When the requested database driver is not installed. + * @return void + */ + public function connect(): void; + + /** + * Closes the database connection. + * + * @return void + */ + public function disconnect(): void; + + /** + * Does the adapter support transactions? + * + * @return bool + */ + public function hasTransactions(): bool; + + /** + * Begin a transaction. + * + * @return void + */ + public function beginTransaction(): void; + + /** + * Commit a transaction. + * + * @return void + */ + public function commitTransaction(): void; + + /** + * Rollback a transaction. + * + * @return void + */ + public function rollbackTransaction(): void; + + /** + * Executes a SQL statement and returns the number of affected rows. + * + * @param string $sql SQL + * @param array $params parameters to use for prepared query + * @return int + */ + public function execute(string $sql, array $params = []): int; + + /** + * Executes a list of migration actions for the given table + * + * @param \Phinx\Db\Table\Table $table The table to execute the actions for + * @param \Phinx\Db\Action\Action[] $actions The table to execute the actions for + * @return void + */ + public function executeActions(Table $table, array $actions): void; + + /** + * Returns a new Query object + * + * @return \Cake\Database\Query + */ + public function getQueryBuilder(): Query; + + /** + * Executes a SQL statement. + * + * The return type depends on the underlying adapter being used. + * + * @param string $sql SQL + * @param array $params parameters to use for prepared query + * @return mixed + */ + public function query(string $sql, array $params = []); + + /** + * Executes a query and returns only one row as an array. + * + * @param string $sql SQL + * @return array|false + */ + public function fetchRow(string $sql); + + /** + * Executes a query and returns an array of rows. + * + * @param string $sql SQL + * @return array + */ + public function fetchAll(string $sql): array; + + /** + * Inserts data into a table. + * + * @param \Phinx\Db\Table\Table $table Table where to insert data + * @param array $row Row + * @return void + */ + public function insert(Table $table, array $row): void; + + /** + * Inserts data into a table in a bulk. + * + * @param \Phinx\Db\Table\Table $table Table where to insert data + * @param array $rows Rows + * @return void + */ + public function bulkinsert(Table $table, array $rows): void; + + /** + * Quotes a table name for use in a query. + * + * @param string $tableName Table name + * @return string + */ + public function quoteTableName(string $tableName): string; + + /** + * Quotes a column name for use in a query. + * + * @param string $columnName Table name + * @return string + */ + public function quoteColumnName(string $columnName): string; + + /** + * Checks to see if a table exists. + * + * @param string $tableName Table name + * @return bool + */ + public function hasTable(string $tableName): bool; + + /** + * Creates the specified database table. + * + * @param \Phinx\Db\Table\Table $table Table + * @param \Phinx\Db\Table\Column[] $columns List of columns in the table + * @param \Phinx\Db\Table\Index[] $indexes List of indexes for the table + * @return void + */ + public function createTable(Table $table, array $columns = [], array $indexes = []): void; + + /** + * Truncates the specified table + * + * @param string $tableName Table name + * @return void + */ + public function truncateTable(string $tableName): void; + + /** + * Returns table columns + * + * @param string $tableName Table name + * @return \Phinx\Db\Table\Column[] + */ + public function getColumns(string $tableName): array; + + /** + * Checks to see if a column exists. + * + * @param string $tableName Table name + * @param string $columnName Column name + * @return bool + */ + public function hasColumn(string $tableName, string $columnName): bool; + + /** + * Checks to see if an index exists. + * + * @param string $tableName Table name + * @param string|string[] $columns Column(s) + * @return bool + */ + public function hasIndex(string $tableName, $columns): bool; + + /** + * Checks to see if an index specified by name exists. + * + * @param string $tableName Table name + * @param string $indexName Index name + * @return bool + */ + public function hasIndexByName(string $tableName, string $indexName): bool; + + /** + * Checks to see if the specified primary key exists. + * + * @param string $tableName Table name + * @param string|string[] $columns Column(s) + * @param string|null $constraint Constraint name + * @return bool + */ + public function hasPrimaryKey(string $tableName, $columns, ?string $constraint = null): bool; + + /** + * Checks to see if a foreign key exists. + * + * @param string $tableName Table name + * @param string|string[] $columns Column(s) + * @param string|null $constraint Constraint name + * @return bool + */ + public function hasForeignKey(string $tableName, $columns, ?string $constraint = null): bool; + + /** + * Returns an array of the supported Phinx column types. + * + * @return string[] + */ + public function getColumnTypes(): array; + + /** + * Checks that the given column is of a supported type. + * + * @param \Phinx\Db\Table\Column $column Column + * @return bool + */ + public function isValidColumnType(Column $column): bool; + + /** + * Converts the Phinx logical type to the adapter's SQL type. + * + * @param \Phinx\Util\Literal|string $type Type + * @param int|null $limit Limit + * @return array + */ + public function getSqlType($type, ?int $limit = null): array; + + /** + * Creates a new database. + * + * @param string $name Database Name + * @param array $options Options + * @return void + */ + public function createDatabase(string $name, array $options = []): void; + + /** + * Checks to see if a database exists. + * + * @param string $name Database Name + * @return bool + */ + public function hasDatabase(string $name): bool; + + /** + * Drops the specified database. + * + * @param string $name Database Name + * @return void + */ + public function dropDatabase(string $name): void; + + /** + * Creates the specified schema or throws an exception + * if there is no support for it. + * + * @param string $schemaName Schema Name + * @return void + */ + public function createSchema(string $schemaName = 'public'): void; + + /** + * Drops the specified schema table or throws an exception + * if there is no support for it. + * + * @param string $schemaName Schema name + * @return void + */ + public function dropSchema(string $schemaName): void; + + /** + * Cast a value to a boolean appropriate for the adapter. + * + * @param mixed $value The value to be cast + * @return mixed + */ + public function castToBool($value); +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/AdapterWrapper.php b/vendor/topthink/think-migration/phinx/Db/Adapter/AdapterWrapper.php new file mode 100644 index 0000000..153a3a7 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/AdapterWrapper.php @@ -0,0 +1,487 @@ + + */ +abstract class AdapterWrapper implements AdapterInterface, WrapperInterface +{ + /** + * @var \Phinx\Db\Adapter\AdapterInterface + */ + protected $adapter; + + /** + * @inheritDoc + */ + public function __construct(AdapterInterface $adapter) + { + $this->setAdapter($adapter); + } + + /** + * @inheritDoc + */ + public function setAdapter(AdapterInterface $adapter): AdapterInterface + { + $this->adapter = $adapter; + + return $this; + } + + /** + * @inheritDoc + */ + public function getAdapter(): AdapterInterface + { + return $this->adapter; + } + + /** + * @inheritDoc + */ + public function setOptions(array $options): AdapterInterface + { + $this->adapter->setOptions($options); + + return $this; + } + + /** + * @inheritDoc + */ + public function getOptions(): array + { + return $this->adapter->getOptions(); + } + + /** + * @inheritDoc + */ + public function hasOption(string $name): bool + { + return $this->adapter->hasOption($name); + } + + /** + * @inheritDoc + */ + public function getOption(string $name) + { + return $this->adapter->getOption($name); + } + + /** + * @inheritDoc + */ + public function setInput(InputInterface $input): AdapterInterface + { + $this->adapter->setInput($input); + + return $this; + } + + /** + * @inheritDoc + */ + public function getInput(): InputInterface + { + return $this->adapter->getInput(); + } + + /** + * @inheritDoc + */ + public function setOutput(OutputInterface $output): AdapterInterface + { + $this->adapter->setOutput($output); + + return $this; + } + + /** + * @inheritDoc + */ + public function getOutput(): OutputInterface + { + return $this->adapter->getOutput(); + } + + /** + * @inheritDoc + */ + public function getColumnForType(string $columnName, string $type, array $options): Column + { + return $this->adapter->getColumnForType($columnName, $type, $options); + } + + /** + * @inheritDoc + */ + public function connect(): void + { + $this->getAdapter()->connect(); + } + + /** + * @inheritDoc + */ + public function disconnect(): void + { + $this->getAdapter()->disconnect(); + } + + /** + * @inheritDoc + */ + public function execute(string $sql, array $params = []): int + { + return $this->getAdapter()->execute($sql, $params); + } + + /** + * @inheritDoc + */ + public function query(string $sql, array $params = []) + { + return $this->getAdapter()->query($sql, $params); + } + + /** + * @inheritDoc + */ + public function insert(Table $table, array $row): void + { + $this->getAdapter()->insert($table, $row); + } + + /** + * @inheritDoc + */ + public function bulkinsert(Table $table, array $rows): void + { + $this->getAdapter()->bulkinsert($table, $rows); + } + + /** + * @inheritDoc + */ + public function fetchRow(string $sql) + { + return $this->getAdapter()->fetchRow($sql); + } + + /** + * @inheritDoc + */ + public function fetchAll(string $sql): array + { + return $this->getAdapter()->fetchAll($sql); + } + + /** + * @inheritDoc + */ + public function getVersions(): array + { + return $this->getAdapter()->getVersions(); + } + + /** + * @inheritDoc + */ + public function getVersionLog(): array + { + return $this->getAdapter()->getVersionLog(); + } + + /** + * @inheritDoc + */ + public function migrated(MigrationInterface $migration, string $direction, string $startTime, string $endTime): AdapterInterface + { + $this->getAdapter()->migrated($migration, $direction, $startTime, $endTime); + + return $this; + } + + /** + * @inheritDoc + */ + public function toggleBreakpoint(MigrationInterface $migration): AdapterInterface + { + $this->getAdapter()->toggleBreakpoint($migration); + + return $this; + } + + /** + * @inheritDoc + */ + public function resetAllBreakpoints(): int + { + return $this->getAdapter()->resetAllBreakpoints(); + } + + /** + * @inheritDoc + */ + public function setBreakpoint(MigrationInterface $migration): AdapterInterface + { + $this->getAdapter()->setBreakpoint($migration); + + return $this; + } + + /** + * @inheritDoc + */ + public function unsetBreakpoint(MigrationInterface $migration): AdapterInterface + { + $this->getAdapter()->unsetBreakpoint($migration); + + return $this; + } + + /** + * @inheritDoc + */ + public function createSchemaTable(): void + { + $this->getAdapter()->createSchemaTable(); + } + + /** + * @inheritDoc + */ + public function getColumnTypes(): array + { + return $this->getAdapter()->getColumnTypes(); + } + + /** + * @inheritDoc + */ + public function isValidColumnType(Column $column): bool + { + return $this->getAdapter()->isValidColumnType($column); + } + + /** + * @inheritDoc + */ + public function hasTransactions(): bool + { + return $this->getAdapter()->hasTransactions(); + } + + /** + * @inheritDoc + */ + public function beginTransaction(): void + { + $this->getAdapter()->beginTransaction(); + } + + /** + * @inheritDoc + */ + public function commitTransaction(): void + { + $this->getAdapter()->commitTransaction(); + } + + /** + * @inheritDoc + */ + public function rollbackTransaction(): void + { + $this->getAdapter()->rollbackTransaction(); + } + + /** + * @inheritDoc + */ + public function quoteTableName(string $tableName): string + { + return $this->getAdapter()->quoteTableName($tableName); + } + + /** + * @inheritDoc + */ + public function quoteColumnName(string $columnName): string + { + return $this->getAdapter()->quoteColumnName($columnName); + } + + /** + * @inheritDoc + */ + public function hasTable(string $tableName): bool + { + return $this->getAdapter()->hasTable($tableName); + } + + /** + * @inheritDoc + */ + public function createTable(Table $table, array $columns = [], array $indexes = []): void + { + $this->getAdapter()->createTable($table, $columns, $indexes); + } + + /** + * @inheritDoc + */ + public function getColumns(string $tableName): array + { + return $this->getAdapter()->getColumns($tableName); + } + + /** + * @inheritDoc + */ + public function hasColumn(string $tableName, string $columnName): bool + { + return $this->getAdapter()->hasColumn($tableName, $columnName); + } + + /** + * @inheritDoc + */ + public function hasIndex(string $tableName, $columns): bool + { + return $this->getAdapter()->hasIndex($tableName, $columns); + } + + /** + * @inheritDoc + */ + public function hasIndexByName(string $tableName, string $indexName): bool + { + return $this->getAdapter()->hasIndexByName($tableName, $indexName); + } + + /** + * @inheritDoc + */ + public function hasPrimaryKey(string $tableName, $columns, ?string $constraint = null): bool + { + return $this->getAdapter()->hasPrimaryKey($tableName, $columns, $constraint); + } + + /** + * @inheritDoc + */ + public function hasForeignKey(string $tableName, $columns, ?string $constraint = null): bool + { + return $this->getAdapter()->hasForeignKey($tableName, $columns, $constraint); + } + + /** + * @inheritDoc + */ + public function getSqlType($type, ?int $limit = null): array + { + return $this->getAdapter()->getSqlType($type, $limit); + } + + /** + * @inheritDoc + */ + public function createDatabase(string $name, array $options = []): void + { + $this->getAdapter()->createDatabase($name, $options); + } + + /** + * @inheritDoc + */ + public function hasDatabase(string $name): bool + { + return $this->getAdapter()->hasDatabase($name); + } + + /** + * @inheritDoc + */ + public function dropDatabase(string $name): void + { + $this->getAdapter()->dropDatabase($name); + } + + /** + * @inheritDoc + */ + public function createSchema(string $schemaName = 'public'): void + { + $this->getAdapter()->createSchema($schemaName); + } + + /** + * @inheritDoc + */ + public function dropSchema(string $schemaName): void + { + $this->getAdapter()->dropSchema($schemaName); + } + + /** + * @inheritDoc + */ + public function truncateTable(string $tableName): void + { + $this->getAdapter()->truncateTable($tableName); + } + + /** + * @inheritDoc + */ + public function castToBool($value) + { + return $this->getAdapter()->castToBool($value); + } + + /** + * @return \PDO + */ + public function getConnection() + { + return $this->getAdapter()->getConnection(); + } + + /** + * @inheritDoc + */ + public function executeActions(Table $table, array $actions): void + { + $this->getAdapter()->executeActions($table, $actions); + } + + /** + * @inheritDoc + */ + public function getQueryBuilder(): Query + { + return $this->getAdapter()->getQueryBuilder(); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/DirectActionInterface.php b/vendor/topthink/think-migration/phinx/Db/Adapter/DirectActionInterface.php new file mode 100644 index 0000000..64b30f6 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/DirectActionInterface.php @@ -0,0 +1,139 @@ + + */ +class MysqlAdapter extends PdoAdapter +{ + /** + * @var string[] + */ + protected static $specificColumnTypes = [ + self::PHINX_TYPE_ENUM, + self::PHINX_TYPE_SET, + self::PHINX_TYPE_YEAR, + self::PHINX_TYPE_JSON, + self::PHINX_TYPE_BINARYUUID, + self::PHINX_TYPE_TINYBLOB, + self::PHINX_TYPE_MEDIUMBLOB, + self::PHINX_TYPE_LONGBLOB, + self::PHINX_TYPE_MEDIUM_INTEGER, + ]; + + /** + * @var bool[] + */ + protected $signedColumnTypes = [ + self::PHINX_TYPE_INTEGER => true, + self::PHINX_TYPE_TINY_INTEGER => true, + self::PHINX_TYPE_SMALL_INTEGER => true, + self::PHINX_TYPE_MEDIUM_INTEGER => true, + self::PHINX_TYPE_BIG_INTEGER => true, + self::PHINX_TYPE_FLOAT => true, + self::PHINX_TYPE_DECIMAL => true, + self::PHINX_TYPE_DOUBLE => true, + self::PHINX_TYPE_BOOLEAN => true, + ]; + + // These constants roughly correspond to the maximum allowed value for each field, + // except for the `_LONG` and `_BIG` variants, which are maxed at 32-bit + // PHP_INT_MAX value. The `INT_REGULAR` field is just arbitrarily half of INT_BIG + // as its actual value is its regular value is larger than PHP_INT_MAX. We do this + // to keep consistent the type hints for getSqlType and Column::$limit being integers. + public const TEXT_TINY = 255; + public const TEXT_SMALL = 255; /* deprecated, alias of TEXT_TINY */ + public const TEXT_REGULAR = 65535; + public const TEXT_MEDIUM = 16777215; + public const TEXT_LONG = 2147483647; + + // According to https://dev.mysql.com/doc/refman/5.0/en/blob.html BLOB sizes are the same as TEXT + public const BLOB_TINY = 255; + public const BLOB_SMALL = 255; /* deprecated, alias of BLOB_TINY */ + public const BLOB_REGULAR = 65535; + public const BLOB_MEDIUM = 16777215; + public const BLOB_LONG = 2147483647; + + public const INT_TINY = 255; + public const INT_SMALL = 65535; + public const INT_MEDIUM = 16777215; + public const INT_REGULAR = 1073741823; + public const INT_BIG = 2147483647; + + public const INT_DISPLAY_TINY = 4; + public const INT_DISPLAY_SMALL = 6; + public const INT_DISPLAY_MEDIUM = 8; + public const INT_DISPLAY_REGULAR = 11; + public const INT_DISPLAY_BIG = 20; + + public const BIT = 64; + + public const TYPE_YEAR = 'year'; + + public const FIRST = 'FIRST'; + + /** + * {@inheritDoc} + * + * @throws \RuntimeException + * @throws \InvalidArgumentException + * @return void + */ + public function connect(): void + { + if ($this->connection === null) { + if (!class_exists('PDO') || !in_array('mysql', PDO::getAvailableDrivers(), true)) { + // @codeCoverageIgnoreStart + throw new RuntimeException('You need to enable the PDO_Mysql extension for Phinx to run properly.'); + // @codeCoverageIgnoreEnd + } + + $options = $this->getOptions(); + + $dsn = 'mysql:'; + + if (!empty($options['unix_socket'])) { + // use socket connection + $dsn .= 'unix_socket=' . $options['unix_socket']; + } else { + // use network connection + $dsn .= 'host=' . $options['host']; + if (!empty($options['port'])) { + $dsn .= ';port=' . $options['port']; + } + } + + $dsn .= ';dbname=' . $options['name']; + + // charset support + if (!empty($options['charset'])) { + $dsn .= ';charset=' . $options['charset']; + } + + $driverOptions = []; + + // use custom data fetch mode + if (!empty($options['fetch_mode'])) { + $driverOptions[PDO::ATTR_DEFAULT_FETCH_MODE] = constant('\PDO::FETCH_' . strtoupper($options['fetch_mode'])); + } + + // pass \PDO::ATTR_PERSISTENT to driver options instead of useless setting it after instantiation + if (isset($options['attr_persistent'])) { + $driverOptions[PDO::ATTR_PERSISTENT] = $options['attr_persistent']; + } + + // support arbitrary \PDO::MYSQL_ATTR_* driver options and pass them to PDO + // https://php.net/manual/en/ref.pdo-mysql.php#pdo-mysql.constants + foreach ($options as $key => $option) { + if (strpos($key, 'mysql_attr_') === 0) { + $pdoConstant = '\PDO::' . strtoupper($key); + if (!defined($pdoConstant)) { + throw new \UnexpectedValueException('Invalid PDO attribute: ' . $key . ' (' . $pdoConstant . ')'); + } + $driverOptions[constant($pdoConstant)] = $option; + } + } + + $db = $this->createPdoConnection($dsn, $options['user'] ?? null, $options['pass'] ?? null, $driverOptions); + + $this->setConnection($db); + } + } + + /** + * @inheritDoc + */ + public function disconnect(): void + { + $this->connection = null; + } + + /** + * @inheritDoc + */ + public function hasTransactions(): bool + { + return true; + } + + /** + * @inheritDoc + */ + public function beginTransaction(): void + { + $this->execute('START TRANSACTION'); + } + + /** + * @inheritDoc + */ + public function commitTransaction(): void + { + $this->execute('COMMIT'); + } + + /** + * @inheritDoc + */ + public function rollbackTransaction(): void + { + $this->execute('ROLLBACK'); + } + + /** + * @inheritDoc + */ + public function quoteTableName(string $tableName): string + { + return str_replace('.', '`.`', $this->quoteColumnName($tableName)); + } + + /** + * @inheritDoc + */ + public function quoteColumnName(string $columnName): string + { + return '`' . str_replace('`', '``', $columnName) . '`'; + } + + /** + * @inheritDoc + */ + public function hasTable(string $tableName): bool + { + if ($this->hasCreatedTable($tableName)) { + return true; + } + + if (strpos($tableName, '.') !== false) { + [$schema, $table] = explode('.', $tableName); + $exists = $this->hasTableWithSchema($schema, $table); + // Only break here on success, because it is possible for table names to contain a dot. + if ($exists) { + return true; + } + } + + $options = $this->getOptions(); + + return $this->hasTableWithSchema($options['name'], $tableName); + } + + /** + * @param string $schema The table schema + * @param string $tableName The table name + * @return bool + */ + protected function hasTableWithSchema(string $schema, string $tableName): bool + { + $result = $this->fetchRow(sprintf( + "SELECT TABLE_NAME + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'", + $schema, + $tableName + )); + + return !empty($result); + } + + /** + * @inheritDoc + */ + public function createTable(Table $table, array $columns = [], array $indexes = []): void + { + // This method is based on the MySQL docs here: https://dev.mysql.com/doc/refman/5.1/en/create-index.html + $defaultOptions = [ + 'engine' => 'InnoDB', + 'collation' => 'utf8mb4_unicode_ci', + ]; + + $options = array_merge( + $defaultOptions, + array_intersect_key($this->getOptions(), $defaultOptions), + $table->getOptions() + ); + + // Add the default primary key + if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { + $options['id'] = 'id'; + } + + if (isset($options['id']) && is_string($options['id'])) { + // Handle id => "field_name" to support AUTO_INCREMENT + $column = new Column(); + $column->setName($options['id']) + ->setType('integer') + ->setOptions([ + 'signed' => $options['signed'] ?? !FeatureFlags::$unsignedPrimaryKeys, + 'identity' => true, + ]); + + if (isset($options['limit'])) { + $column->setLimit($options['limit']); + } + + array_unshift($columns, $column); + if (isset($options['primary_key']) && (array)$options['id'] !== (array)$options['primary_key']) { + throw new InvalidArgumentException('You cannot enable an auto incrementing ID field and a primary key'); + } + $options['primary_key'] = $options['id']; + } + + // open: process table options like collation etc + + // process table engine (default to InnoDB) + $optionsStr = 'ENGINE = InnoDB'; + if (isset($options['engine'])) { + $optionsStr = sprintf('ENGINE = %s', $options['engine']); + } + + // process table collation + if (isset($options['collation'])) { + $charset = explode('_', $options['collation']); + $optionsStr .= sprintf(' CHARACTER SET %s', $charset[0]); + $optionsStr .= sprintf(' COLLATE %s', $options['collation']); + } + + // set the table comment + if (isset($options['comment'])) { + $optionsStr .= sprintf(' COMMENT=%s ', $this->getConnection()->quote($options['comment'])); + } + + // set the table row format + if (isset($options['row_format'])) { + $optionsStr .= sprintf(' ROW_FORMAT=%s ', $options['row_format']); + } + + $sql = 'CREATE TABLE '; + $sql .= $this->quoteTableName($table->getName()) . ' ('; + foreach ($columns as $column) { + $sql .= $this->quoteColumnName($column->getName()) . ' ' . $this->getColumnSqlDefinition($column) . ', '; + } + + // set the primary key(s) + if (isset($options['primary_key'])) { + $sql = rtrim($sql); + $sql .= ' PRIMARY KEY ('; + if (is_string($options['primary_key'])) { // handle primary_key => 'id' + $sql .= $this->quoteColumnName($options['primary_key']); + } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id') + $sql .= implode(',', array_map([$this, 'quoteColumnName'], (array)$options['primary_key'])); + } + $sql .= ')'; + } else { + $sql = substr(rtrim($sql), 0, -1); // no primary keys + } + + // set the indexes + foreach ($indexes as $index) { + $sql .= ', ' . $this->getIndexSqlDefinition($index); + } + + $sql .= ') ' . $optionsStr; + $sql = rtrim($sql); + + // execute the sql + $this->execute($sql); + + $this->addCreatedTable($table->getName()); + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getChangePrimaryKeyInstructions(Table $table, $newColumns): AlterInstructions + { + $instructions = new AlterInstructions(); + + // Drop the existing primary key + $primaryKey = $this->getPrimaryKey($table->getName()); + if (!empty($primaryKey['columns'])) { + $instructions->addAlter('DROP PRIMARY KEY'); + } + + // Add the primary key(s) + if (!empty($newColumns)) { + $sql = 'ADD PRIMARY KEY ('; + if (is_string($newColumns)) { // handle primary_key => 'id' + $sql .= $this->quoteColumnName($newColumns); + } elseif (is_array($newColumns)) { // handle primary_key => array('tag_id', 'resource_id') + $sql .= implode(',', array_map([$this, 'quoteColumnName'], $newColumns)); + } else { + throw new InvalidArgumentException(sprintf( + 'Invalid value for primary key: %s', + json_encode($newColumns) + )); + } + $sql .= ')'; + $instructions->addAlter($sql); + } + + return $instructions; + } + + /** + * @inheritDoc + */ + protected function getChangeCommentInstructions(Table $table, ?string $newComment): AlterInstructions + { + $instructions = new AlterInstructions(); + + // passing 'null' is to remove table comment + $newComment = $newComment ?? ''; + $sql = sprintf(' COMMENT=%s ', $this->getConnection()->quote($newComment)); + $instructions->addAlter($sql); + + return $instructions; + } + + /** + * @inheritDoc + */ + protected function getRenameTableInstructions(string $tableName, string $newTableName): AlterInstructions + { + $this->updateCreatedTableName($tableName, $newTableName); + $sql = sprintf( + 'RENAME TABLE %s TO %s', + $this->quoteTableName($tableName), + $this->quoteTableName($newTableName) + ); + + return new AlterInstructions([], [$sql]); + } + + /** + * @inheritDoc + */ + protected function getDropTableInstructions(string $tableName): AlterInstructions + { + $this->removeCreatedTable($tableName); + $sql = sprintf('DROP TABLE %s', $this->quoteTableName($tableName)); + + return new AlterInstructions([], [$sql]); + } + + /** + * @inheritDoc + */ + public function truncateTable(string $tableName): void + { + $sql = sprintf( + 'TRUNCATE TABLE %s', + $this->quoteTableName($tableName) + ); + + $this->execute($sql); + } + + /** + * @inheritDoc + */ + public function getColumns(string $tableName): array + { + $columns = []; + $rows = $this->fetchAll(sprintf('SHOW COLUMNS FROM %s', $this->quoteTableName($tableName))); + foreach ($rows as $columnInfo) { + $phinxType = $this->getPhinxType($columnInfo['Type']); + + $column = new Column(); + $column->setName($columnInfo['Field']) + ->setNull($columnInfo['Null'] !== 'NO') + ->setType($phinxType['name']) + ->setSigned(strpos($columnInfo['Type'], 'unsigned') === false) + ->setLimit($phinxType['limit']) + ->setScale($phinxType['scale']); + + if ($columnInfo['Extra'] === 'auto_increment') { + $column->setIdentity(true); + } + + if (isset($phinxType['values'])) { + $column->setValues($phinxType['values']); + } + + $default = $columnInfo['Default']; + if ( + is_string($default) && + in_array( + $column->getType(), + array_merge( + static::PHINX_TYPES_GEOSPATIAL, + [static::PHINX_TYPE_BLOB, static::PHINX_TYPE_JSON, static::PHINX_TYPE_TEXT] + ) + ) + ) { + // The default that comes back from MySQL for these types prefixes the collation type and + // surrounds the value with escaped single quotes, for example "_utf8mbf4\'abc\'", and so + // this converts that then down to the default value of "abc" to correspond to what the user + // would have specified in a migration. + $default = preg_replace("/^_(?:[a-zA-Z0-9]+?)\\\'(.*)\\\'$/", '\1', $default); + } + $column->setDefault($default); + + $columns[] = $column; + } + + return $columns; + } + + /** + * @inheritDoc + */ + public function hasColumn(string $tableName, string $columnName): bool + { + $rows = $this->fetchAll(sprintf('SHOW COLUMNS FROM %s', $this->quoteTableName($tableName))); + foreach ($rows as $column) { + if (strcasecmp($column['Field'], $columnName) === 0) { + return true; + } + } + + return false; + } + + /** + * @inheritDoc + */ + protected function getAddColumnInstructions(Table $table, Column $column): AlterInstructions + { + $alter = sprintf( + 'ADD %s %s', + $this->quoteColumnName($column->getName()), + $this->getColumnSqlDefinition($column) + ); + + $alter .= $this->afterClause($column); + + return new AlterInstructions([$alter]); + } + + /** + * Exposes the MySQL syntax to arrange a column `FIRST`. + * + * @param \Phinx\Db\Table\Column $column The column being altered. + * @return string The appropriate SQL fragment. + */ + protected function afterClause(Column $column): string + { + $after = $column->getAfter(); + if (empty($after)) { + return ''; + } + + if ($after === self::FIRST) { + return ' FIRST'; + } + + return ' AFTER ' . $this->quoteColumnName($after); + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getRenameColumnInstructions(string $tableName, string $columnName, string $newColumnName): AlterInstructions + { + $rows = $this->fetchAll(sprintf('SHOW FULL COLUMNS FROM %s', $this->quoteTableName($tableName))); + + foreach ($rows as $row) { + if (strcasecmp($row['Field'], $columnName) === 0) { + $null = $row['Null'] === 'NO' ? 'NOT NULL' : 'NULL'; + $comment = isset($row['Comment']) ? ' COMMENT ' . '\'' . addslashes($row['Comment']) . '\'' : ''; + $extra = ' ' . strtoupper($row['Extra']); + if (($row['Default'] !== null)) { + $extra .= $this->getDefaultValueDefinition($row['Default']); + } + $definition = $row['Type'] . ' ' . $null . $extra . $comment; + + $alter = sprintf( + 'CHANGE COLUMN %s %s %s', + $this->quoteColumnName($columnName), + $this->quoteColumnName($newColumnName), + $definition + ); + + return new AlterInstructions([$alter]); + } + } + + throw new InvalidArgumentException(sprintf( + "The specified column doesn't exist: " . + $columnName + )); + } + + /** + * @inheritDoc + */ + protected function getChangeColumnInstructions(string $tableName, string $columnName, Column $newColumn): AlterInstructions + { + $alter = sprintf( + 'CHANGE %s %s %s%s', + $this->quoteColumnName($columnName), + $this->quoteColumnName($newColumn->getName()), + $this->getColumnSqlDefinition($newColumn), + $this->afterClause($newColumn) + ); + + return new AlterInstructions([$alter]); + } + + /** + * @inheritDoc + */ + protected function getDropColumnInstructions(string $tableName, string $columnName): AlterInstructions + { + $alter = sprintf('DROP COLUMN %s', $this->quoteColumnName($columnName)); + + return new AlterInstructions([$alter]); + } + + /** + * Get an array of indexes from a particular table. + * + * @param string $tableName Table name + * @return array + */ + protected function getIndexes(string $tableName): array + { + $indexes = []; + $rows = $this->fetchAll(sprintf('SHOW INDEXES FROM %s', $this->quoteTableName($tableName))); + foreach ($rows as $row) { + if (!isset($indexes[$row['Key_name']])) { + $indexes[$row['Key_name']] = ['columns' => []]; + } + $indexes[$row['Key_name']]['columns'][] = strtolower($row['Column_name']); + } + + return $indexes; + } + + /** + * @inheritDoc + */ + public function hasIndex(string $tableName, $columns): bool + { + if (is_string($columns)) { + $columns = [$columns]; // str to array + } + + $columns = array_map('strtolower', $columns); + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $index) { + if ($columns == $index['columns']) { + return true; + } + } + + return false; + } + + /** + * @inheritDoc + */ + public function hasIndexByName(string $tableName, string $indexName): bool + { + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $name => $index) { + if ($name === $indexName) { + return true; + } + } + + return false; + } + + /** + * @inheritDoc + */ + protected function getAddIndexInstructions(Table $table, Index $index): AlterInstructions + { + $instructions = new AlterInstructions(); + + if ($index->getType() === Index::FULLTEXT) { + // Must be executed separately + // SQLSTATE[HY000]: General error: 1795 InnoDB presently supports one FULLTEXT index creation at a time + $alter = sprintf( + 'ALTER TABLE %s ADD %s', + $this->quoteTableName($table->getName()), + $this->getIndexSqlDefinition($index) + ); + + $instructions->addPostStep($alter); + } else { + $alter = sprintf( + 'ADD %s', + $this->getIndexSqlDefinition($index) + ); + + $instructions->addAlter($alter); + } + + return $instructions; + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getDropIndexByColumnsInstructions(string $tableName, $columns): AlterInstructions + { + if (is_string($columns)) { + $columns = [$columns]; // str to array + } + + $indexes = $this->getIndexes($tableName); + $columns = array_map('strtolower', $columns); + + foreach ($indexes as $indexName => $index) { + if ($columns == $index['columns']) { + return new AlterInstructions([sprintf( + 'DROP INDEX %s', + $this->quoteColumnName($indexName) + )]); + } + } + + throw new InvalidArgumentException(sprintf( + "The specified index on columns '%s' does not exist", + implode(',', $columns) + )); + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getDropIndexByNameInstructions(string $tableName, $indexName): AlterInstructions + { + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $name => $index) { + if ($name === $indexName) { + return new AlterInstructions([sprintf( + 'DROP INDEX %s', + $this->quoteColumnName($indexName) + )]); + } + } + + throw new InvalidArgumentException(sprintf( + "The specified index name '%s' does not exist", + $indexName + )); + } + + /** + * @inheritDoc + */ + public function hasPrimaryKey(string $tableName, $columns, ?string $constraint = null): bool + { + $primaryKey = $this->getPrimaryKey($tableName); + + if (empty($primaryKey['constraint'])) { + return false; + } + + if ($constraint) { + return $primaryKey['constraint'] === $constraint; + } else { + if (is_string($columns)) { + $columns = [$columns]; // str to array + } + $missingColumns = array_diff($columns, $primaryKey['columns']); + + return empty($missingColumns); + } + } + + /** + * Get the primary key from a particular table. + * + * @param string $tableName Table name + * @return array + */ + public function getPrimaryKey(string $tableName): array + { + $options = $this->getOptions(); + $rows = $this->fetchAll(sprintf( + "SELECT + k.CONSTRAINT_NAME, + k.COLUMN_NAME + FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS t + JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE k + USING(CONSTRAINT_NAME,TABLE_SCHEMA,TABLE_NAME) + WHERE t.CONSTRAINT_TYPE='PRIMARY KEY' + AND t.TABLE_SCHEMA='%s' + AND t.TABLE_NAME='%s'", + $options['name'], + $tableName + )); + + $primaryKey = [ + 'columns' => [], + ]; + foreach ($rows as $row) { + $primaryKey['constraint'] = $row['CONSTRAINT_NAME']; + $primaryKey['columns'][] = $row['COLUMN_NAME']; + } + + return $primaryKey; + } + + /** + * @inheritDoc + */ + public function hasForeignKey(string $tableName, $columns, ?string $constraint = null): bool + { + if (is_string($columns)) { + $columns = [$columns]; // str to array + } + $foreignKeys = $this->getForeignKeys($tableName); + if ($constraint) { + if (isset($foreignKeys[$constraint])) { + return !empty($foreignKeys[$constraint]); + } + + return false; + } + + foreach ($foreignKeys as $key) { + if ($columns == $key['columns']) { + return true; + } + } + + return false; + } + + /** + * Get an array of foreign keys from a particular table. + * + * @param string $tableName Table name + * @return array + */ + protected function getForeignKeys(string $tableName): array + { + if (strpos($tableName, '.') !== false) { + [$schema, $tableName] = explode('.', $tableName); + } + + $foreignKeys = []; + $rows = $this->fetchAll(sprintf( + "SELECT + CONSTRAINT_NAME, + CONCAT(TABLE_SCHEMA, '.', TABLE_NAME) AS TABLE_NAME, + COLUMN_NAME, + CONCAT(REFERENCED_TABLE_SCHEMA, '.', REFERENCED_TABLE_NAME) AS REFERENCED_TABLE_NAME, + REFERENCED_COLUMN_NAME + FROM information_schema.KEY_COLUMN_USAGE + WHERE REFERENCED_TABLE_NAME IS NOT NULL + AND TABLE_SCHEMA = %s + AND TABLE_NAME = '%s' + ORDER BY POSITION_IN_UNIQUE_CONSTRAINT", + empty($schema) ? 'DATABASE()' : "'$schema'", + $tableName + )); + foreach ($rows as $row) { + $foreignKeys[$row['CONSTRAINT_NAME']]['table'] = $row['TABLE_NAME']; + $foreignKeys[$row['CONSTRAINT_NAME']]['columns'][] = $row['COLUMN_NAME']; + $foreignKeys[$row['CONSTRAINT_NAME']]['referenced_table'] = $row['REFERENCED_TABLE_NAME']; + $foreignKeys[$row['CONSTRAINT_NAME']]['referenced_columns'][] = $row['REFERENCED_COLUMN_NAME']; + } + + return $foreignKeys; + } + + /** + * @inheritDoc + */ + protected function getAddForeignKeyInstructions(Table $table, ForeignKey $foreignKey): AlterInstructions + { + $alter = sprintf( + 'ADD %s', + $this->getForeignKeySqlDefinition($foreignKey) + ); + + return new AlterInstructions([$alter]); + } + + /** + * @inheritDoc + */ + protected function getDropForeignKeyInstructions(string $tableName, string $constraint): AlterInstructions + { + $alter = sprintf( + 'DROP FOREIGN KEY %s', + $constraint + ); + + return new AlterInstructions([$alter]); + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getDropForeignKeyByColumnsInstructions(string $tableName, array $columns): AlterInstructions + { + $instructions = new AlterInstructions(); + + foreach ($columns as $column) { + $rows = $this->fetchAll(sprintf( + "SELECT + CONSTRAINT_NAME + FROM information_schema.KEY_COLUMN_USAGE + WHERE REFERENCED_TABLE_SCHEMA = DATABASE() + AND REFERENCED_TABLE_NAME IS NOT NULL + AND TABLE_NAME = '%s' + AND COLUMN_NAME = '%s' + ORDER BY POSITION_IN_UNIQUE_CONSTRAINT", + $tableName, + $column + )); + + foreach ($rows as $row) { + $instructions->merge($this->getDropForeignKeyInstructions($tableName, $row['CONSTRAINT_NAME'])); + } + } + + if (empty($instructions->getAlterParts())) { + throw new InvalidArgumentException(sprintf( + "Not foreign key on columns '%s' exist", + implode(',', $columns) + )); + } + + return $instructions; + } + + /** + * {@inheritDoc} + * + * @throws \Phinx\Db\Adapter\UnsupportedColumnTypeException + */ + public function getSqlType($type, ?int $limit = null): array + { + switch ($type) { + case static::PHINX_TYPE_FLOAT: + case static::PHINX_TYPE_DOUBLE: + case static::PHINX_TYPE_DECIMAL: + case static::PHINX_TYPE_DATE: + case static::PHINX_TYPE_ENUM: + case static::PHINX_TYPE_SET: + case static::PHINX_TYPE_JSON: + // Geospatial database types + case static::PHINX_TYPE_GEOMETRY: + case static::PHINX_TYPE_POINT: + case static::PHINX_TYPE_LINESTRING: + case static::PHINX_TYPE_POLYGON: + return ['name' => $type]; + case static::PHINX_TYPE_DATETIME: + case static::PHINX_TYPE_TIMESTAMP: + case static::PHINX_TYPE_TIME: + return ['name' => $type, 'limit' => $limit]; + case static::PHINX_TYPE_STRING: + return ['name' => 'varchar', 'limit' => $limit ?: 255]; + case static::PHINX_TYPE_CHAR: + return ['name' => 'char', 'limit' => $limit ?: 255]; + case static::PHINX_TYPE_TEXT: + if ($limit) { + $sizes = [ + // Order matters! Size must always be tested from longest to shortest! + 'longtext' => static::TEXT_LONG, + 'mediumtext' => static::TEXT_MEDIUM, + 'text' => static::TEXT_REGULAR, + 'tinytext' => static::TEXT_SMALL, + ]; + foreach ($sizes as $name => $length) { + if ($limit >= $length) { + return ['name' => $name]; + } + } + } + + return ['name' => 'text']; + case static::PHINX_TYPE_BINARY: + if ($limit === null) { + $limit = 255; + } + + if ($limit > 255) { + return $this->getSqlType(static::PHINX_TYPE_BLOB, $limit); + } + + return ['name' => 'binary', 'limit' => $limit]; + case static::PHINX_TYPE_BINARYUUID: + return ['name' => 'binary', 'limit' => 16]; + case static::PHINX_TYPE_VARBINARY: + if ($limit === null) { + $limit = 255; + } + + if ($limit > 255) { + return $this->getSqlType(static::PHINX_TYPE_BLOB, $limit); + } + + return ['name' => 'varbinary', 'limit' => $limit]; + case static::PHINX_TYPE_BLOB: + if ($limit !== null) { + // Rework this part as the choosen types were always UNDER the required length + $sizes = [ + 'tinyblob' => static::BLOB_SMALL, + 'blob' => static::BLOB_REGULAR, + 'mediumblob' => static::BLOB_MEDIUM, + ]; + + foreach ($sizes as $name => $length) { + if ($limit <= $length) { + return ['name' => $name]; + } + } + + // For more length requirement, the longblob is used + return ['name' => 'longblob']; + } + + // If not limit is provided, fallback on blob + return ['name' => 'blob']; + case static::PHINX_TYPE_TINYBLOB: + // Automatically reprocess blob type to ensure that correct blob subtype is selected given provided limit + return $this->getSqlType(static::PHINX_TYPE_BLOB, $limit ?: static::BLOB_TINY); + case static::PHINX_TYPE_MEDIUMBLOB: + // Automatically reprocess blob type to ensure that correct blob subtype is selected given provided limit + return $this->getSqlType(static::PHINX_TYPE_BLOB, $limit ?: static::BLOB_MEDIUM); + case static::PHINX_TYPE_LONGBLOB: + // Automatically reprocess blob type to ensure that correct blob subtype is selected given provided limit + return $this->getSqlType(static::PHINX_TYPE_BLOB, $limit ?: static::BLOB_LONG); + case static::PHINX_TYPE_BIT: + return ['name' => 'bit', 'limit' => $limit ?: 64]; + case static::PHINX_TYPE_BIG_INTEGER: + if ($limit === static::INT_BIG) { + $limit = static::INT_DISPLAY_BIG; + } + + return ['name' => 'bigint', 'limit' => $limit ?: 20]; + case static::PHINX_TYPE_MEDIUM_INTEGER: + if ($limit === static::INT_MEDIUM) { + $limit = static::INT_DISPLAY_MEDIUM; + } + + return ['name' => 'mediumint', 'limit' => $limit ?: 8]; + case static::PHINX_TYPE_SMALL_INTEGER: + if ($limit === static::INT_SMALL) { + $limit = static::INT_DISPLAY_SMALL; + } + + return ['name' => 'smallint', 'limit' => $limit ?: 6]; + case static::PHINX_TYPE_TINY_INTEGER: + if ($limit === static::INT_TINY) { + $limit = static::INT_DISPLAY_TINY; + } + + return ['name' => 'tinyint', 'limit' => $limit ?: 4]; + case static::PHINX_TYPE_INTEGER: + if ($limit && $limit >= static::INT_TINY) { + $sizes = [ + // Order matters! Size must always be tested from longest to shortest! + 'bigint' => static::INT_BIG, + 'int' => static::INT_REGULAR, + 'mediumint' => static::INT_MEDIUM, + 'smallint' => static::INT_SMALL, + 'tinyint' => static::INT_TINY, + ]; + $limits = [ + 'tinyint' => static::INT_DISPLAY_TINY, + 'smallint' => static::INT_DISPLAY_SMALL, + 'mediumint' => static::INT_DISPLAY_MEDIUM, + 'int' => static::INT_DISPLAY_REGULAR, + 'bigint' => static::INT_DISPLAY_BIG, + ]; + foreach ($sizes as $name => $length) { + if ($limit >= $length) { + $def = ['name' => $name]; + if (isset($limits[$name])) { + $def['limit'] = $limits[$name]; + } + + return $def; + } + } + } elseif (!$limit) { + $limit = static::INT_DISPLAY_REGULAR; + } + + return ['name' => 'int', 'limit' => $limit]; + case static::PHINX_TYPE_BOOLEAN: + return ['name' => 'tinyint', 'limit' => 1]; + case static::PHINX_TYPE_UUID: + return ['name' => 'char', 'limit' => 36]; + case static::PHINX_TYPE_YEAR: + if (!$limit || in_array($limit, [2, 4])) { + $limit = 4; + } + + return ['name' => 'year', 'limit' => $limit]; + default: + throw new UnsupportedColumnTypeException('Column type "' . $type . '" is not supported by MySQL.'); + } + } + + /** + * Returns Phinx type by SQL type + * + * @internal param string $sqlType SQL type + * @param string $sqlTypeDef SQL Type definition + * @throws \Phinx\Db\Adapter\UnsupportedColumnTypeException + * @return array Phinx type + */ + public function getPhinxType($sqlTypeDef) + { + $matches = []; + if (!preg_match('/^([\w]+)(\(([\d]+)*(,([\d]+))*\))*(.+)*$/', $sqlTypeDef, $matches)) { + throw new UnsupportedColumnTypeException('Column type "' . $sqlTypeDef . '" is not supported by MySQL.'); + } + + $limit = null; + $scale = null; + $type = $matches[1]; + if (count($matches) > 2) { + $limit = $matches[3] ? (int)$matches[3] : null; + } + if (count($matches) > 4) { + $scale = (int)$matches[5]; + } + if ($type === 'tinyint' && $limit === 1) { + $type = static::PHINX_TYPE_BOOLEAN; + $limit = null; + } + switch ($type) { + case 'varchar': + $type = static::PHINX_TYPE_STRING; + if ($limit === 255) { + $limit = null; + } + break; + case 'char': + $type = static::PHINX_TYPE_CHAR; + if ($limit === 255) { + $limit = null; + } + if ($limit === 36) { + $type = static::PHINX_TYPE_UUID; + } + break; + case 'tinyint': + $type = static::PHINX_TYPE_TINY_INTEGER; + break; + case 'smallint': + $type = static::PHINX_TYPE_SMALL_INTEGER; + break; + case 'mediumint': + $type = static::PHINX_TYPE_MEDIUM_INTEGER; + break; + case 'int': + $type = static::PHINX_TYPE_INTEGER; + break; + case 'bigint': + $type = static::PHINX_TYPE_BIG_INTEGER; + break; + case 'bit': + $type = static::PHINX_TYPE_BIT; + if ($limit === 64) { + $limit = null; + } + break; + case 'blob': + $type = static::PHINX_TYPE_BLOB; + $limit = static::BLOB_REGULAR; + break; + case 'tinyblob': + $type = static::PHINX_TYPE_TINYBLOB; + $limit = static::BLOB_TINY; + break; + case 'mediumblob': + $type = static::PHINX_TYPE_MEDIUMBLOB; + $limit = static::BLOB_MEDIUM; + break; + case 'longblob': + $type = static::PHINX_TYPE_LONGBLOB; + $limit = static::BLOB_LONG; + break; + case 'tinytext': + $type = static::PHINX_TYPE_TEXT; + $limit = static::TEXT_TINY; + break; + case 'mediumtext': + $type = static::PHINX_TYPE_TEXT; + $limit = static::TEXT_MEDIUM; + break; + case 'longtext': + $type = static::PHINX_TYPE_TEXT; + $limit = static::TEXT_LONG; + break; + case 'binary': + if ($limit === null) { + $limit = 255; + } + + if ($limit > 255) { + $type = static::PHINX_TYPE_BLOB; + break; + } + + if ($limit === 16) { + $type = static::PHINX_TYPE_BINARYUUID; + } + break; + } + + try { + // Call this to check if parsed type is supported. + $this->getSqlType($type, $limit); + } catch (UnsupportedColumnTypeException $e) { + $type = Literal::from($type); + } + + $phinxType = [ + 'name' => $type, + 'limit' => $limit, + 'scale' => $scale, + ]; + + if ($type === static::PHINX_TYPE_ENUM || $type === static::PHINX_TYPE_SET) { + $values = trim($matches[6], '()'); + $phinxType['values'] = []; + $opened = false; + $escaped = false; + $wasEscaped = false; + $value = ''; + $valuesLength = strlen($values); + for ($i = 0; $i < $valuesLength; $i++) { + $char = $values[$i]; + if ($char === "'" && !$opened) { + $opened = true; + } elseif ( + !$escaped + && ($i + 1) < $valuesLength + && ( + $char === "'" && $values[$i + 1] === "'" + || $char === '\\' && $values[$i + 1] === '\\' + ) + ) { + $escaped = true; + } elseif ($char === "'" && $opened && !$escaped) { + $phinxType['values'][] = $value; + $value = ''; + $opened = false; + } elseif (($char === "'" || $char === '\\') && $opened && $escaped) { + $value .= $char; + $escaped = false; + $wasEscaped = true; + } elseif ($opened) { + if ($values[$i - 1] === '\\' && !$wasEscaped) { + if ($char === 'n') { + $char = "\n"; + } elseif ($char === 'r') { + $char = "\r"; + } elseif ($char === 't') { + $char = "\t"; + } + if ($values[$i] !== $char) { + $value = substr($value, 0, strlen($value) - 1); + } + } + $value .= $char; + $wasEscaped = false; + } + } + } + + return $phinxType; + } + + /** + * @inheritDoc + */ + public function createDatabase(string $name, array $options = []): void + { + $charset = $options['charset'] ?? 'utf8'; + + if (isset($options['collation'])) { + $this->execute(sprintf( + 'CREATE DATABASE `%s` DEFAULT CHARACTER SET `%s` COLLATE `%s`', + $name, + $charset, + $options['collation'] + )); + } else { + $this->execute(sprintf('CREATE DATABASE `%s` DEFAULT CHARACTER SET `%s`', $name, $charset)); + } + } + + /** + * @inheritDoc + */ + public function hasDatabase(string $name): bool + { + $rows = $this->fetchAll( + sprintf( + 'SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = \'%s\'', + $name + ) + ); + + foreach ($rows as $row) { + if (!empty($row)) { + return true; + } + } + + return false; + } + + /** + * @inheritDoc + */ + public function dropDatabase(string $name): void + { + $this->execute(sprintf('DROP DATABASE IF EXISTS `%s`', $name)); + $this->createdTables = []; + } + + /** + * Gets the MySQL Column Definition for a Column object. + * + * @param \Phinx\Db\Table\Column $column Column + * @return string + */ + protected function getColumnSqlDefinition(Column $column): string + { + if ($column->getType() instanceof Literal) { + $def = (string)$column->getType(); + } else { + $sqlType = $this->getSqlType($column->getType(), $column->getLimit()); + $def = strtoupper($sqlType['name']); + } + if ($column->getPrecision() && $column->getScale()) { + $def .= '(' . $column->getPrecision() . ',' . $column->getScale() . ')'; + } elseif (isset($sqlType['limit'])) { + $def .= '(' . $sqlType['limit'] . ')'; + } + + $values = $column->getValues(); + if ($values && is_array($values)) { + $def .= '(' . implode(', ', array_map(function ($value) { + // we special case NULL as it's not actually allowed an enum value, + // and we want MySQL to issue an error on the create statement, but + // quote coerces it to an empty string, which will not error + return $value === null ? 'NULL' : $this->getConnection()->quote($value); + }, $values)) . ')'; + } + + $def .= $column->getEncoding() ? ' CHARACTER SET ' . $column->getEncoding() : ''; + $def .= $column->getCollation() ? ' COLLATE ' . $column->getCollation() : ''; + $def .= !$column->isSigned() && isset($this->signedColumnTypes[$column->getType()]) ? ' unsigned' : ''; + $def .= $column->isNull() ? ' NULL' : ' NOT NULL'; + + if ( + version_compare($this->getAttribute(\PDO::ATTR_SERVER_VERSION), '8', '>=') + && in_array($column->getType(), static::PHINX_TYPES_GEOSPATIAL) + && !is_null($column->getSrid()) + ) { + $def .= " SRID {$column->getSrid()}"; + } + + $def .= $column->isIdentity() ? ' AUTO_INCREMENT' : ''; + + $default = $column->getDefault(); + // MySQL 8 supports setting default for the following tested types, but only if they are "cast as expressions" + if ( + version_compare($this->getAttribute(\PDO::ATTR_SERVER_VERSION), '8', '>=') && + is_string($default) && + in_array( + $column->getType(), + array_merge( + static::PHINX_TYPES_GEOSPATIAL, + [static::PHINX_TYPE_BLOB, static::PHINX_TYPE_JSON, static::PHINX_TYPE_TEXT] + ) + ) + ) { + $default = Literal::from('(' . $this->getConnection()->quote($column->getDefault()) . ')'); + } + $def .= $this->getDefaultValueDefinition($default, $column->getType()); + + if ($column->getComment()) { + $def .= ' COMMENT ' . $this->getConnection()->quote($column->getComment()); + } + + if ($column->getUpdate()) { + $def .= ' ON UPDATE ' . $column->getUpdate(); + } + + return $def; + } + + /** + * Gets the MySQL Index Definition for an Index object. + * + * @param \Phinx\Db\Table\Index $index Index + * @return string + */ + protected function getIndexSqlDefinition(Index $index): string + { + $def = ''; + $limit = ''; + + if ($index->getType() === Index::UNIQUE) { + $def .= ' UNIQUE'; + } + + if ($index->getType() === Index::FULLTEXT) { + $def .= ' FULLTEXT'; + } + + $def .= ' KEY'; + + if (is_string($index->getName())) { + $def .= ' `' . $index->getName() . '`'; + } + + $columnNames = $index->getColumns(); + $order = $index->getOrder() ?? []; + $columnNames = array_map(function ($columnName) use ($order) { + $ret = '`' . $columnName . '`'; + if (isset($order[$columnName])) { + $ret .= ' ' . $order[$columnName]; + } + + return $ret; + }, $columnNames); + + if (!is_array($index->getLimit())) { + if ($index->getLimit()) { + $limit = '(' . $index->getLimit() . ')'; + } + $def .= ' (' . implode(',', $columnNames) . $limit . ')'; + } else { + $columns = $index->getColumns(); + $limits = $index->getLimit(); + $def .= ' ('; + foreach ($columns as $column) { + $limit = !isset($limits[$column]) || $limits[$column] <= 0 ? '' : '(' . $limits[$column] . ')'; + $columnSort = isset($order[$column]) ?? ''; + $def .= '`' . $column . '`' . $limit . ' ' . $columnSort . ', '; + } + $def = rtrim($def, ', '); + $def .= ' )'; + } + + return $def; + } + + /** + * Gets the MySQL Foreign Key Definition for an ForeignKey object. + * + * @param \Phinx\Db\Table\ForeignKey $foreignKey Foreign key + * @return string + */ + protected function getForeignKeySqlDefinition(ForeignKey $foreignKey): string + { + $def = ''; + if ($foreignKey->getConstraint()) { + $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint()); + } + $columnNames = []; + foreach ($foreignKey->getColumns() as $column) { + $columnNames[] = $this->quoteColumnName($column); + } + $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')'; + $refColumnNames = []; + foreach ($foreignKey->getReferencedColumns() as $column) { + $refColumnNames[] = $this->quoteColumnName($column); + } + $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')'; + if ($foreignKey->getOnDelete()) { + $def .= ' ON DELETE ' . $foreignKey->getOnDelete(); + } + if ($foreignKey->getOnUpdate()) { + $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate(); + } + + return $def; + } + + /** + * Describes a database table. This is a MySQL adapter specific method. + * + * @param string $tableName Table name + * @return array + */ + public function describeTable(string $tableName): array + { + $options = $this->getOptions(); + + // mysql specific + $sql = sprintf( + "SELECT * + FROM information_schema.tables + WHERE table_schema = '%s' + AND table_name = '%s'", + $options['name'], + $tableName + ); + + $table = $this->fetchRow($sql); + + return $table !== false ? $table : []; + } + + /** + * Returns MySQL column types (inherited and MySQL specified). + * + * @return string[] + */ + public function getColumnTypes(): array + { + return array_merge(parent::getColumnTypes(), static::$specificColumnTypes); + } + + /** + * @inheritDoc + */ + public function getDecoratedConnection(): Connection + { + $options = $this->getOptions(); + $options = [ + 'username' => $options['user'] ?? null, + 'password' => $options['pass'] ?? null, + 'database' => $options['name'], + 'quoteIdentifiers' => true, + ] + $options; + + $driver = new MysqlDriver($options); + $driver->setConnection($this->connection); + + return new Connection(['driver' => $driver] + $options); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/PdoAdapter.php b/vendor/topthink/think-migration/phinx/Db/Adapter/PdoAdapter.php new file mode 100644 index 0000000..592297c --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/PdoAdapter.php @@ -0,0 +1,1003 @@ + + */ +abstract class PdoAdapter extends AbstractAdapter implements DirectActionInterface +{ + /** + * @var \PDO|null + */ + protected $connection; + + /** + * Writes a message to stdout if verbose output is on + * + * @param string $message The message to show + * @return void + */ + protected function verboseLog($message): void + { + if ( + !$this->isDryRunEnabled() && + $this->getOutput()->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE + ) { + return; + } + + $this->getOutput()->writeln($message); + } + + /** + * Create PDO connection + * + * @param string $dsn Connection string + * @param string|null $username Database username + * @param string|null $password Database password + * @param array $options Connection options + * @return \PDO + */ + protected function createPdoConnection(string $dsn, ?string $username = null, ?string $password = null, array $options = []): PDO + { + $adapterOptions = $this->getOptions() + [ + 'attr_errmode' => PDO::ERRMODE_EXCEPTION, + ]; + + try { + $db = new PDO($dsn, $username, $password, $options); + + foreach ($adapterOptions as $key => $option) { + if (strpos($key, 'attr_') === 0) { + $pdoConstant = '\PDO::' . strtoupper($key); + if (!defined($pdoConstant)) { + throw new \UnexpectedValueException('Invalid PDO attribute: ' . $key . ' (' . $pdoConstant . ')'); + } + $db->setAttribute(constant($pdoConstant), $option); + } + } + } catch (PDOException $e) { + throw new InvalidArgumentException(sprintf( + 'There was a problem connecting to the database: %s', + $e->getMessage() + ), 0, $e); + } + + return $db; + } + + /** + * @inheritDoc + */ + public function setOptions(array $options): AdapterInterface + { + parent::setOptions($options); + + if (isset($options['connection'])) { + $this->setConnection($options['connection']); + } + + return $this; + } + + /** + * Sets the database connection. + * + * @param \PDO $connection Connection + * @return \Phinx\Db\Adapter\AdapterInterface + */ + public function setConnection(PDO $connection): AdapterInterface + { + $this->connection = $connection; + + // Create the schema table if it doesn't already exist + if (!$this->hasTable($this->getSchemaTableName())) { + $this->createSchemaTable(); + } else { + $table = new DbTable($this->getSchemaTableName(), [], $this); + if (!$table->hasColumn('migration_name')) { + $table + ->addColumn( + 'migration_name', + 'string', + ['limit' => 100, 'after' => 'version', 'default' => null, 'null' => true] + ) + ->save(); + } + if (!$table->hasColumn('breakpoint')) { + $table + ->addColumn('breakpoint', 'boolean', ['default' => false, 'null' => false]) + ->save(); + } + } + + return $this; + } + + /** + * Gets the database connection + * + * @return \PDO + */ + public function getConnection(): PDO + { + if ($this->connection === null) { + $this->connect(); + } + + return $this->connection; + } + + /** + * @inheritDoc + */ + abstract public function connect(): void; + + /** + * @inheritDoc + */ + abstract public function disconnect(): void; + + /** + * @inheritDoc + */ + public function execute(string $sql, array $params = []): int + { + $sql = rtrim($sql, "; \t\n\r\0\x0B") . ';'; + $this->verboseLog($sql); + + if ($this->isDryRunEnabled()) { + return 0; + } + + if (empty($params)) { + return $this->getConnection()->exec($sql); + } + + $stmt = $this->getConnection()->prepare($sql); + $result = $stmt->execute($params); + + return $result ? $stmt->rowCount() : $result; + } + + /** + * Returns the Cake\Database connection object using the same underlying + * PDO object as this connection. + * + * @return \Cake\Database\Connection + */ + abstract public function getDecoratedConnection(): Connection; + + /** + * @inheritDoc + */ + public function getQueryBuilder(): Query + { + return $this->getDecoratedConnection()->newQuery(); + } + + /** + * Executes a query and returns PDOStatement. + * + * @param string $sql SQL + * @return \PDOStatement|false + */ + public function query(string $sql, array $params = []) + { + if (empty($params)) { + return $this->getConnection()->query($sql); + } + $stmt = $this->getConnection()->prepare($sql); + $result = $stmt->execute($params); + + return $result ? $stmt : false; + } + + /** + * @inheritDoc + */ + public function fetchRow(string $sql) + { + return $this->query($sql)->fetch(); + } + + /** + * @inheritDoc + */ + public function fetchAll(string $sql): array + { + return $this->query($sql)->fetchAll(); + } + + /** + * @inheritDoc + */ + public function insert(Table $table, array $row): void + { + $sql = sprintf( + 'INSERT INTO %s ', + $this->quoteTableName($table->getName()) + ); + $columns = array_keys($row); + $sql .= '(' . implode(', ', array_map([$this, 'quoteColumnName'], $columns)) . ')'; + + foreach ($row as $column => $value) { + if (is_bool($value)) { + $row[$column] = $this->castToBool($value); + } + } + + if ($this->isDryRunEnabled()) { + $sql .= ' VALUES (' . implode(', ', array_map([$this, 'quoteValue'], $row)) . ');'; + $this->output->writeln($sql); + } else { + $sql .= ' VALUES (' . implode(', ', array_fill(0, count($columns), '?')) . ')'; + $stmt = $this->getConnection()->prepare($sql); + $stmt->execute(array_values($row)); + } + } + + /** + * Quotes a database value. + * + * @param mixed $value The value to quote + * @return mixed + */ + protected function quoteValue($value) + { + if (is_numeric($value)) { + return $value; + } + + if ($value === null) { + return 'null'; + } + + return $this->getConnection()->quote($value); + } + + /** + * Quotes a database string. + * + * @param string $value The string to quote + * @return string + */ + protected function quoteString(string $value): string + { + return $this->getConnection()->quote($value); + } + + /** + * @inheritDoc + */ + public function bulkinsert(Table $table, array $rows): void + { + $sql = sprintf( + 'INSERT INTO %s ', + $this->quoteTableName($table->getName()) + ); + $current = current($rows); + $keys = array_keys($current); + $sql .= '(' . implode(', ', array_map([$this, 'quoteColumnName'], $keys)) . ') VALUES '; + + if ($this->isDryRunEnabled()) { + $values = array_map(function ($row) { + return '(' . implode(', ', array_map([$this, 'quoteValue'], $row)) . ')'; + }, $rows); + $sql .= implode(', ', $values) . ';'; + $this->output->writeln($sql); + } else { + $count_keys = count($keys); + $query = '(' . implode(', ', array_fill(0, $count_keys, '?')) . ')'; + $count_vars = count($rows); + $queries = array_fill(0, $count_vars, $query); + $sql .= implode(',', $queries); + $stmt = $this->getConnection()->prepare($sql); + $vals = []; + + foreach ($rows as $row) { + foreach ($row as $v) { + if (is_bool($v)) { + $vals[] = $this->castToBool($v); + } else { + $vals[] = $v; + } + } + } + + $stmt->execute($vals); + } + } + + /** + * @inheritDoc + */ + public function getVersions(): array + { + $rows = $this->getVersionLog(); + + return array_keys($rows); + } + + /** + * {@inheritDoc} + * + * @throws \RuntimeException + */ + public function getVersionLog(): array + { + $result = []; + + switch ($this->options['version_order']) { + case Config::VERSION_ORDER_CREATION_TIME: + $orderBy = 'version ASC'; + break; + case Config::VERSION_ORDER_EXECUTION_TIME: + $orderBy = 'start_time ASC, version ASC'; + break; + default: + throw new RuntimeException('Invalid version_order configuration option'); + } + + // This will throw an exception if doing a --dry-run without any migrations as phinxlog + // does not exist, so in that case, we can just expect to trivially return empty set + try { + $rows = $this->fetchAll(sprintf('SELECT * FROM %s ORDER BY %s', $this->quoteTableName($this->getSchemaTableName()), $orderBy)); + } catch (PDOException $e) { + if (!$this->isDryRunEnabled()) { + throw $e; + } + $rows = []; + } + + foreach ($rows as $version) { + $result[(int)$version['version']] = $version; + } + + return $result; + } + + /** + * @inheritDoc + */ + public function migrated(MigrationInterface $migration, string $direction, string $startTime, string $endTime): AdapterInterface + { + if (strcasecmp($direction, MigrationInterface::UP) === 0) { + // up + $sql = sprintf( + "INSERT INTO %s (%s, %s, %s, %s, %s) VALUES ('%s', '%s', '%s', '%s', %s);", + $this->quoteTableName($this->getSchemaTableName()), + $this->quoteColumnName('version'), + $this->quoteColumnName('migration_name'), + $this->quoteColumnName('start_time'), + $this->quoteColumnName('end_time'), + $this->quoteColumnName('breakpoint'), + $migration->getVersion(), + substr($migration->getName(), 0, 100), + $startTime, + $endTime, + $this->castToBool(false) + ); + + $this->execute($sql); + } else { + // down + $sql = sprintf( + "DELETE FROM %s WHERE %s = '%s'", + $this->quoteTableName($this->getSchemaTableName()), + $this->quoteColumnName('version'), + $migration->getVersion() + ); + + $this->execute($sql); + } + + return $this; + } + + /** + * @inheritDoc + */ + public function toggleBreakpoint(MigrationInterface $migration): AdapterInterface + { + $this->query( + sprintf( + 'UPDATE %1$s SET %2$s = CASE %2$s WHEN %3$s THEN %4$s ELSE %3$s END, %7$s = %7$s WHERE %5$s = \'%6$s\';', + $this->quoteTableName($this->getSchemaTableName()), + $this->quoteColumnName('breakpoint'), + $this->castToBool(true), + $this->castToBool(false), + $this->quoteColumnName('version'), + $migration->getVersion(), + $this->quoteColumnName('start_time') + ) + ); + + return $this; + } + + /** + * @inheritDoc + */ + public function resetAllBreakpoints(): int + { + return $this->execute( + sprintf( + 'UPDATE %1$s SET %2$s = %3$s, %4$s = %4$s WHERE %2$s <> %3$s;', + $this->quoteTableName($this->getSchemaTableName()), + $this->quoteColumnName('breakpoint'), + $this->castToBool(false), + $this->quoteColumnName('start_time') + ) + ); + } + + /** + * @inheritDoc + */ + public function setBreakpoint(MigrationInterface $migration): AdapterInterface + { + $this->markBreakpoint($migration, true); + + return $this; + } + + /** + * @inheritDoc + */ + public function unsetBreakpoint(MigrationInterface $migration): AdapterInterface + { + $this->markBreakpoint($migration, false); + + return $this; + } + + /** + * Mark a migration breakpoint. + * + * @param \Phinx\Migration\MigrationInterface $migration The migration target for the breakpoint + * @param bool $state The required state of the breakpoint + * @return \Phinx\Db\Adapter\AdapterInterface + */ + protected function markBreakpoint(MigrationInterface $migration, bool $state): AdapterInterface + { + $this->query( + sprintf( + 'UPDATE %1$s SET %2$s = %3$s, %4$s = %4$s WHERE %5$s = \'%6$s\';', + $this->quoteTableName($this->getSchemaTableName()), + $this->quoteColumnName('breakpoint'), + $this->castToBool($state), + $this->quoteColumnName('start_time'), + $this->quoteColumnName('version'), + $migration->getVersion() + ) + ); + + return $this; + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function createSchema(string $schemaName = 'public'): void + { + throw new BadMethodCallException('Creating a schema is not supported'); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function dropSchema(string $name): void + { + throw new BadMethodCallException('Dropping a schema is not supported'); + } + + /** + * @inheritDoc + */ + public function getColumnTypes(): array + { + return [ + 'string', + 'char', + 'text', + 'tinyinteger', + 'smallinteger', + 'integer', + 'biginteger', + 'bit', + 'float', + 'decimal', + 'double', + 'datetime', + 'timestamp', + 'time', + 'date', + 'blob', + 'binary', + 'varbinary', + 'boolean', + 'uuid', + // Geospatial data types + 'geometry', + 'point', + 'linestring', + 'polygon', + ]; + } + + /** + * @inheritDoc + */ + public function castToBool($value) + { + return (bool)$value ? 1 : 0; + } + + /** + * Retrieve a database connection attribute + * + * @see https://php.net/manual/en/pdo.getattribute.php + * @param int $attribute One of the PDO::ATTR_* constants + * @return mixed + */ + public function getAttribute(int $attribute) + { + return $this->connection->getAttribute($attribute); + } + + /** + * Get the definition for a `DEFAULT` statement. + * + * @param mixed $default Default value + * @param string|null $columnType column type added + * @return string + */ + protected function getDefaultValueDefinition($default, ?string $columnType = null): string + { + if ($default instanceof Literal) { + $default = (string)$default; + } elseif (is_string($default) && strpos($default, 'CURRENT_TIMESTAMP') !== 0) { + // Ensure a defaults of CURRENT_TIMESTAMP(3) is not quoted. + $default = $this->getConnection()->quote($default); + } elseif (is_bool($default)) { + $default = $this->castToBool($default); + } elseif ($default !== null && $columnType === static::PHINX_TYPE_BOOLEAN) { + $default = $this->castToBool((bool)$default); + } + + return isset($default) ? " DEFAULT $default" : ''; + } + + /** + * Executes all the ALTER TABLE instructions passed for the given table + * + * @param string $tableName The table name to use in the ALTER statement + * @param \Phinx\Db\Util\AlterInstructions $instructions The object containing the alter sequence + * @return void + */ + protected function executeAlterSteps(string $tableName, AlterInstructions $instructions): void + { + $alter = sprintf('ALTER TABLE %s %%s', $this->quoteTableName($tableName)); + $instructions->execute($alter, [$this, 'execute']); + } + + /** + * @inheritDoc + */ + public function addColumn(Table $table, Column $column): void + { + $instructions = $this->getAddColumnInstructions($table, $column); + $this->executeAlterSteps($table->getName(), $instructions); + } + + /** + * Returns the instructions to add the specified column to a database table. + * + * @param \Phinx\Db\Table\Table $table Table + * @param \Phinx\Db\Table\Column $column Column + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getAddColumnInstructions(Table $table, Column $column): AlterInstructions; + + /** + * @inheritdoc + */ + public function renameColumn(string $tableName, string $columnName, string $newColumnName): void + { + $instructions = $this->getRenameColumnInstructions($tableName, $columnName, $newColumnName); + $this->executeAlterSteps($tableName, $instructions); + } + + /** + * Returns the instructions to rename the specified column. + * + * @param string $tableName Table name + * @param string $columnName Column Name + * @param string $newColumnName New Column Name + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getRenameColumnInstructions(string $tableName, string $columnName, string $newColumnName): AlterInstructions; + + /** + * @inheritdoc + */ + public function changeColumn(string $tableName, string $columnName, Column $newColumn): void + { + $instructions = $this->getChangeColumnInstructions($tableName, $columnName, $newColumn); + $this->executeAlterSteps($tableName, $instructions); + } + + /** + * Returns the instructions to change a table column type. + * + * @param string $tableName Table name + * @param string $columnName Column Name + * @param \Phinx\Db\Table\Column $newColumn New Column + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getChangeColumnInstructions(string $tableName, string $columnName, Column $newColumn): AlterInstructions; + + /** + * @inheritdoc + */ + public function dropColumn(string $tableName, string $columnName): void + { + $instructions = $this->getDropColumnInstructions($tableName, $columnName); + $this->executeAlterSteps($tableName, $instructions); + } + + /** + * Returns the instructions to drop the specified column. + * + * @param string $tableName Table name + * @param string $columnName Column Name + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getDropColumnInstructions(string $tableName, string $columnName): AlterInstructions; + + /** + * @inheritdoc + */ + public function addIndex(Table $table, Index $index): void + { + $instructions = $this->getAddIndexInstructions($table, $index); + $this->executeAlterSteps($table->getName(), $instructions); + } + + /** + * Returns the instructions to add the specified index to a database table. + * + * @param \Phinx\Db\Table\Table $table Table + * @param \Phinx\Db\Table\Index $index Index + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getAddIndexInstructions(Table $table, Index $index): AlterInstructions; + + /** + * @inheritdoc + */ + public function dropIndex(string $tableName, $columns): void + { + $instructions = $this->getDropIndexByColumnsInstructions($tableName, $columns); + $this->executeAlterSteps($tableName, $instructions); + } + + /** + * Returns the instructions to drop the specified index from a database table. + * + * @param string $tableName The name of of the table where the index is + * @param string|string[] $columns Column(s) + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getDropIndexByColumnsInstructions(string $tableName, $columns): AlterInstructions; + + /** + * @inheritdoc + */ + public function dropIndexByName(string $tableName, string $indexName): void + { + $instructions = $this->getDropIndexByNameInstructions($tableName, $indexName); + $this->executeAlterSteps($tableName, $instructions); + } + + /** + * Returns the instructions to drop the index specified by name from a database table. + * + * @param string $tableName The table name whe the index is + * @param string $indexName The name of the index + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getDropIndexByNameInstructions(string $tableName, string $indexName): AlterInstructions; + + /** + * @inheritdoc + */ + public function addForeignKey(Table $table, ForeignKey $foreignKey): void + { + $instructions = $this->getAddForeignKeyInstructions($table, $foreignKey); + $this->executeAlterSteps($table->getName(), $instructions); + } + + /** + * Returns the instructions to adds the specified foreign key to a database table. + * + * @param \Phinx\Db\Table\Table $table The table to add the constraint to + * @param \Phinx\Db\Table\ForeignKey $foreignKey The foreign key to add + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getAddForeignKeyInstructions(Table $table, ForeignKey $foreignKey): AlterInstructions; + + /** + * @inheritDoc + */ + public function dropForeignKey(string $tableName, array $columns, ?string $constraint = null): void + { + if ($constraint) { + $instructions = $this->getDropForeignKeyInstructions($tableName, $constraint); + } else { + $instructions = $this->getDropForeignKeyByColumnsInstructions($tableName, $columns); + } + + $this->executeAlterSteps($tableName, $instructions); + } + + /** + * Returns the instructions to drop the specified foreign key from a database table. + * + * @param string $tableName The table where the foreign key constraint is + * @param string $constraint Constraint name + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getDropForeignKeyInstructions(string $tableName, string $constraint): AlterInstructions; + + /** + * Returns the instructions to drop the specified foreign key from a database table. + * + * @param string $tableName The table where the foreign key constraint is + * @param string[] $columns The list of column names + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getDropForeignKeyByColumnsInstructions(string $tableName, array $columns): AlterInstructions; + + /** + * @inheritdoc + */ + public function dropTable(string $tableName): void + { + $instructions = $this->getDropTableInstructions($tableName); + $this->executeAlterSteps($tableName, $instructions); + } + + /** + * Returns the instructions to drop the specified database table. + * + * @param string $tableName Table name + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getDropTableInstructions(string $tableName): AlterInstructions; + + /** + * @inheritdoc + */ + public function renameTable(string $tableName, string $newTableName): void + { + $instructions = $this->getRenameTableInstructions($tableName, $newTableName); + $this->executeAlterSteps($tableName, $instructions); + } + + /** + * Returns the instructions to rename the specified database table. + * + * @param string $tableName Table name + * @param string $newTableName New Name + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getRenameTableInstructions(string $tableName, string $newTableName): AlterInstructions; + + /** + * @inheritdoc + */ + public function changePrimaryKey(Table $table, $newColumns): void + { + $instructions = $this->getChangePrimaryKeyInstructions($table, $newColumns); + $this->executeAlterSteps($table->getName(), $instructions); + } + + /** + * Returns the instructions to change the primary key for the specified database table. + * + * @param \Phinx\Db\Table\Table $table Table + * @param string|string[]|null $newColumns Column name(s) to belong to the primary key, or null to drop the key + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getChangePrimaryKeyInstructions(Table $table, $newColumns): AlterInstructions; + + /** + * @inheritdoc + */ + public function changeComment(Table $table, $newComment): void + { + $instructions = $this->getChangeCommentInstructions($table, $newComment); + $this->executeAlterSteps($table->getName(), $instructions); + } + + /** + * Returns the instruction to change the comment for the specified database table. + * + * @param \Phinx\Db\Table\Table $table Table + * @param string|null $newComment New comment string, or null to drop the comment + * @return \Phinx\Db\Util\AlterInstructions + */ + abstract protected function getChangeCommentInstructions(Table $table, ?string $newComment): AlterInstructions; + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + * @return void + */ + public function executeActions(Table $table, array $actions): void + { + $instructions = new AlterInstructions(); + + foreach ($actions as $action) { + switch (true) { + case $action instanceof AddColumn: + /** @var \Phinx\Db\Action\AddColumn $action */ + $instructions->merge($this->getAddColumnInstructions($table, $action->getColumn())); + break; + + case $action instanceof AddIndex: + /** @var \Phinx\Db\Action\AddIndex $action */ + $instructions->merge($this->getAddIndexInstructions($table, $action->getIndex())); + break; + + case $action instanceof AddForeignKey: + /** @var \Phinx\Db\Action\AddForeignKey $action */ + $instructions->merge($this->getAddForeignKeyInstructions($table, $action->getForeignKey())); + break; + + case $action instanceof ChangeColumn: + /** @var \Phinx\Db\Action\ChangeColumn $action */ + $instructions->merge($this->getChangeColumnInstructions( + $table->getName(), + $action->getColumnName(), + $action->getColumn() + )); + break; + + case $action instanceof DropForeignKey && !$action->getForeignKey()->getConstraint(): + /** @var \Phinx\Db\Action\DropForeignKey $action */ + $instructions->merge($this->getDropForeignKeyByColumnsInstructions( + $table->getName(), + $action->getForeignKey()->getColumns() + )); + break; + + case $action instanceof DropForeignKey && $action->getForeignKey()->getConstraint(): + /** @var \Phinx\Db\Action\DropForeignKey $action */ + $instructions->merge($this->getDropForeignKeyInstructions( + $table->getName(), + $action->getForeignKey()->getConstraint() + )); + break; + + case $action instanceof DropIndex && $action->getIndex()->getName() !== null: + /** @var \Phinx\Db\Action\DropIndex $action */ + $instructions->merge($this->getDropIndexByNameInstructions( + $table->getName(), + $action->getIndex()->getName() + )); + break; + + case $action instanceof DropIndex && $action->getIndex()->getName() == null: + /** @var \Phinx\Db\Action\DropIndex $action */ + $instructions->merge($this->getDropIndexByColumnsInstructions( + $table->getName(), + $action->getIndex()->getColumns() + )); + break; + + case $action instanceof DropTable: + /** @var \Phinx\Db\Action\DropTable $action */ + $instructions->merge($this->getDropTableInstructions( + $table->getName() + )); + break; + + case $action instanceof RemoveColumn: + /** @var \Phinx\Db\Action\RemoveColumn $action */ + $instructions->merge($this->getDropColumnInstructions( + $table->getName(), + $action->getColumn()->getName() + )); + break; + + case $action instanceof RenameColumn: + /** @var \Phinx\Db\Action\RenameColumn $action */ + $instructions->merge($this->getRenameColumnInstructions( + $table->getName(), + $action->getColumn()->getName(), + $action->getNewName() + )); + break; + + case $action instanceof RenameTable: + /** @var \Phinx\Db\Action\RenameTable $action */ + $instructions->merge($this->getRenameTableInstructions( + $table->getName(), + $action->getNewName() + )); + break; + + case $action instanceof ChangePrimaryKey: + /** @var \Phinx\Db\Action\ChangePrimaryKey $action */ + $instructions->merge($this->getChangePrimaryKeyInstructions( + $table, + $action->getNewColumns() + )); + break; + + case $action instanceof ChangeComment: + /** @var \Phinx\Db\Action\ChangeComment $action */ + $instructions->merge($this->getChangeCommentInstructions( + $table, + $action->getNewComment() + )); + break; + + default: + throw new InvalidArgumentException( + sprintf("Don't know how to execute action: '%s'", get_class($action)) + ); + } + } + + $this->executeAlterSteps($table->getName(), $instructions); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/PostgresAdapter.php b/vendor/topthink/think-migration/phinx/Db/Adapter/PostgresAdapter.php new file mode 100644 index 0000000..1d17e5a --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/PostgresAdapter.php @@ -0,0 +1,1600 @@ += 10.0) + * + * @var bool + */ + protected $useIdentity; + + /** + * {@inheritDoc} + * + * @throws \RuntimeException + * @throws \InvalidArgumentException + * @return void + */ + public function connect(): void + { + if ($this->connection === null) { + if (!class_exists('PDO') || !in_array('pgsql', PDO::getAvailableDrivers(), true)) { + // @codeCoverageIgnoreStart + throw new RuntimeException('You need to enable the PDO_Pgsql extension for Phinx to run properly.'); + // @codeCoverageIgnoreEnd + } + + $options = $this->getOptions(); + $dsn = 'pgsql:dbname=' . $options['name']; + + if (isset($options['host'])) { + $dsn .= ';host=' . $options['host']; + } + + // if custom port is specified use it + if (isset($options['port'])) { + $dsn .= ';port=' . $options['port']; + } + + $driverOptions = []; + + // use custom data fetch mode + if (!empty($options['fetch_mode'])) { + $driverOptions[PDO::ATTR_DEFAULT_FETCH_MODE] = + constant('\PDO::FETCH_' . strtoupper($options['fetch_mode'])); + } + + // pass \PDO::ATTR_PERSISTENT to driver options instead of useless setting it after instantiation + if (isset($options['attr_persistent'])) { + $driverOptions[PDO::ATTR_PERSISTENT] = $options['attr_persistent']; + } + + $db = $this->createPdoConnection($dsn, $options['user'] ?? null, $options['pass'] ?? null, $driverOptions); + + try { + if (isset($options['schema'])) { + $db->exec('SET search_path TO ' . $this->quoteSchemaName($options['schema'])); + } + } catch (PDOException $exception) { + throw new InvalidArgumentException( + sprintf('Schema does not exists: %s', $options['schema']), + 0, + $exception + ); + } + + $this->useIdentity = (float)$db->getAttribute(PDO::ATTR_SERVER_VERSION) >= 10; + + $this->setConnection($db); + } + } + + /** + * @inheritDoc + */ + public function disconnect(): void + { + $this->connection = null; + } + + /** + * @inheritDoc + */ + public function hasTransactions(): bool + { + return true; + } + + /** + * @inheritDoc + */ + public function beginTransaction(): void + { + $this->execute('BEGIN'); + } + + /** + * @inheritDoc + */ + public function commitTransaction(): void + { + $this->execute('COMMIT'); + } + + /** + * @inheritDoc + */ + public function rollbackTransaction(): void + { + $this->execute('ROLLBACK'); + } + + /** + * Quotes a schema name for use in a query. + * + * @param string $schemaName Schema Name + * @return string + */ + public function quoteSchemaName(string $schemaName): string + { + return $this->quoteColumnName($schemaName); + } + + /** + * @inheritDoc + */ + public function quoteTableName(string $tableName): string + { + $parts = $this->getSchemaName($tableName); + + return $this->quoteSchemaName($parts['schema']) . '.' . $this->quoteColumnName($parts['table']); + } + + /** + * @inheritDoc + */ + public function quoteColumnName(string $columnName): string + { + return '"' . $columnName . '"'; + } + + /** + * @inheritDoc + */ + public function hasTable(string $tableName): bool + { + if ($this->hasCreatedTable($tableName)) { + return true; + } + + $parts = $this->getSchemaName($tableName); + $result = $this->getConnection()->query( + sprintf( + 'SELECT * + FROM information_schema.tables + WHERE table_schema = %s + AND table_name = %s', + $this->getConnection()->quote($parts['schema']), + $this->getConnection()->quote($parts['table']) + ) + ); + + return $result->rowCount() === 1; + } + + /** + * @inheritDoc + */ + public function createTable(Table $table, array $columns = [], array $indexes = []): void + { + $queries = []; + + $options = $table->getOptions(); + $parts = $this->getSchemaName($table->getName()); + + // Add the default primary key + if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { + $options['id'] = 'id'; + } + + if (isset($options['id']) && is_string($options['id'])) { + // Handle id => "field_name" to support AUTO_INCREMENT + $column = new Column(); + $column->setName($options['id']) + ->setType('integer') + ->setOptions(['identity' => true]); + + array_unshift($columns, $column); + if (isset($options['primary_key']) && (array)$options['id'] !== (array)$options['primary_key']) { + throw new InvalidArgumentException('You cannot enable an auto incrementing ID field and a primary key'); + } + $options['primary_key'] = $options['id']; + } + + // TODO - process table options like collation etc + $sql = 'CREATE TABLE '; + $sql .= $this->quoteTableName($table->getName()) . ' ('; + + $this->columnsWithComments = []; + foreach ($columns as $column) { + $sql .= $this->quoteColumnName($column->getName()) . ' ' . $this->getColumnSqlDefinition($column); + if ($this->useIdentity && $column->getIdentity() && $column->getGenerated() !== null) { + $sql .= sprintf(' GENERATED %s AS IDENTITY', $column->getGenerated()); + } + $sql .= ', '; + + // set column comments, if needed + if ($column->getComment()) { + $this->columnsWithComments[] = $column; + } + } + + // set the primary key(s) + if (isset($options['primary_key'])) { + $sql = rtrim($sql); + $sql .= sprintf(' CONSTRAINT %s PRIMARY KEY (', $this->quoteColumnName($parts['table'] . '_pkey')); + if (is_string($options['primary_key'])) { // handle primary_key => 'id' + $sql .= $this->quoteColumnName($options['primary_key']); + } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id') + $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key'])); + } + $sql .= ')'; + } else { + $sql = rtrim($sql, ', '); // no primary keys + } + + $sql .= ')'; + $queries[] = $sql; + + // process column comments + if (!empty($this->columnsWithComments)) { + foreach ($this->columnsWithComments as $column) { + $queries[] = $this->getColumnCommentSqlDefinition($column, $table->getName()); + } + } + + // set the indexes + if (!empty($indexes)) { + foreach ($indexes as $index) { + $queries[] = $this->getIndexSqlDefinition($index, $table->getName()); + } + } + + // process table comments + if (isset($options['comment'])) { + $queries[] = sprintf( + 'COMMENT ON TABLE %s IS %s', + $this->quoteTableName($table->getName()), + $this->getConnection()->quote($options['comment']) + ); + } + + foreach ($queries as $query) { + $this->execute($query); + } + + $this->addCreatedTable($table->getName()); + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getChangePrimaryKeyInstructions(Table $table, $newColumns): AlterInstructions + { + $parts = $this->getSchemaName($table->getName()); + + $instructions = new AlterInstructions(); + + // Drop the existing primary key + $primaryKey = $this->getPrimaryKey($table->getName()); + if (!empty($primaryKey['constraint'])) { + $sql = sprintf( + 'DROP CONSTRAINT %s', + $this->quoteColumnName($primaryKey['constraint']) + ); + $instructions->addAlter($sql); + } + + // Add the new primary key + if (!empty($newColumns)) { + $sql = sprintf( + 'ADD CONSTRAINT %s PRIMARY KEY (', + $this->quoteColumnName($parts['table'] . '_pkey') + ); + if (is_string($newColumns)) { // handle primary_key => 'id' + $sql .= $this->quoteColumnName($newColumns); + } elseif (is_array($newColumns)) { // handle primary_key => array('tag_id', 'resource_id') + $sql .= implode(',', array_map([$this, 'quoteColumnName'], $newColumns)); + } else { + throw new InvalidArgumentException(sprintf( + 'Invalid value for primary key: %s', + json_encode($newColumns) + )); + } + $sql .= ')'; + $instructions->addAlter($sql); + } + + return $instructions; + } + + /** + * @inheritDoc + */ + protected function getChangeCommentInstructions(Table $table, ?string $newComment): AlterInstructions + { + $instructions = new AlterInstructions(); + + // passing 'null' is to remove table comment + $newComment = $newComment !== null + ? $this->getConnection()->quote($newComment) + : 'NULL'; + $sql = sprintf( + 'COMMENT ON TABLE %s IS %s', + $this->quoteTableName($table->getName()), + $newComment + ); + $instructions->addPostStep($sql); + + return $instructions; + } + + /** + * @inheritDoc + */ + protected function getRenameTableInstructions(string $tableName, string $newTableName): AlterInstructions + { + $this->updateCreatedTableName($tableName, $newTableName); + $sql = sprintf( + 'ALTER TABLE %s RENAME TO %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($newTableName) + ); + + return new AlterInstructions([], [$sql]); + } + + /** + * @inheritDoc + */ + protected function getDropTableInstructions(string $tableName): AlterInstructions + { + $this->removeCreatedTable($tableName); + $sql = sprintf('DROP TABLE %s', $this->quoteTableName($tableName)); + + return new AlterInstructions([], [$sql]); + } + + /** + * @inheritDoc + */ + public function truncateTable(string $tableName): void + { + $sql = sprintf( + 'TRUNCATE TABLE %s RESTART IDENTITY', + $this->quoteTableName($tableName) + ); + + $this->execute($sql); + } + + /** + * @inheritDoc + */ + public function getColumns(string $tableName): array + { + $parts = $this->getSchemaName($tableName); + $columns = []; + $sql = sprintf( + 'SELECT column_name, data_type, udt_name, is_identity, is_nullable, + column_default, character_maximum_length, numeric_precision, numeric_scale, + datetime_precision + %s + FROM information_schema.columns + WHERE table_schema = %s AND table_name = %s + ORDER BY ordinal_position', + $this->useIdentity ? ', identity_generation' : '', + $this->getConnection()->quote($parts['schema']), + $this->getConnection()->quote($parts['table']) + ); + $columnsInfo = $this->fetchAll($sql); + foreach ($columnsInfo as $columnInfo) { + $isUserDefined = strtoupper(trim($columnInfo['data_type'])) === 'USER-DEFINED'; + + if ($isUserDefined) { + $columnType = Literal::from($columnInfo['udt_name']); + } else { + $columnType = $this->getPhinxType($columnInfo['data_type']); + } + + // If the default value begins with a ' or looks like a function mark it as literal + if (isset($columnInfo['column_default'][0]) && $columnInfo['column_default'][0] === "'") { + if (preg_match('/^\'(.*)\'::[^:]+$/', $columnInfo['column_default'], $match)) { + // '' and \' are replaced with a single ' + $columnDefault = preg_replace('/[\'\\\\]\'/', "'", $match[1]); + } else { + $columnDefault = Literal::from($columnInfo['column_default']); + } + } elseif ( + $columnInfo['column_default'] !== null && + preg_match('/^\D[a-z_\d]*\(.*\)$/', $columnInfo['column_default']) + ) { + $columnDefault = Literal::from($columnInfo['column_default']); + } else { + $columnDefault = $columnInfo['column_default']; + } + + $column = new Column(); + + $column->setName($columnInfo['column_name']) + ->setType($columnType) + ->setNull($columnInfo['is_nullable'] === 'YES') + ->setDefault($columnDefault) + ->setIdentity($columnInfo['is_identity'] === 'YES') + ->setScale($columnInfo['numeric_scale']); + + if ($this->useIdentity) { + $column->setGenerated($columnInfo['identity_generation']); + } + + if (preg_match('/\bwith time zone$/', $columnInfo['data_type'])) { + $column->setTimezone(true); + } + + if (isset($columnInfo['character_maximum_length'])) { + $column->setLimit($columnInfo['character_maximum_length']); + } + + if (in_array($columnType, [static::PHINX_TYPE_TIME, static::PHINX_TYPE_DATETIME], true)) { + $column->setPrecision($columnInfo['datetime_precision']); + } elseif ( + !in_array($columnType, [ + self::PHINX_TYPE_SMALL_INTEGER, + self::PHINX_TYPE_INTEGER, + self::PHINX_TYPE_BIG_INTEGER, + ], true) + ) { + $column->setPrecision($columnInfo['numeric_precision']); + } + $columns[] = $column; + } + + return $columns; + } + + /** + * @inheritDoc + */ + public function hasColumn(string $tableName, string $columnName): bool + { + $parts = $this->getSchemaName($tableName); + $sql = sprintf( + 'SELECT count(*) + FROM information_schema.columns + WHERE table_schema = %s AND table_name = %s AND column_name = %s', + $this->getConnection()->quote($parts['schema']), + $this->getConnection()->quote($parts['table']), + $this->getConnection()->quote($columnName) + ); + + $result = $this->fetchRow($sql); + + return $result['count'] > 0; + } + + /** + * @inheritDoc + */ + protected function getAddColumnInstructions(Table $table, Column $column): AlterInstructions + { + $instructions = new AlterInstructions(); + $instructions->addAlter(sprintf( + 'ADD %s %s %s', + $this->quoteColumnName($column->getName()), + $this->getColumnSqlDefinition($column), + $column->isIdentity() && $column->getGenerated() !== null && $this->useIdentity ? + sprintf('GENERATED %s AS IDENTITY', $column->getGenerated()) : '' + )); + + if ($column->getComment()) { + $instructions->addPostStep($this->getColumnCommentSqlDefinition($column, $table->getName())); + } + + return $instructions; + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getRenameColumnInstructions( + string $tableName, + string $columnName, + string $newColumnName + ): AlterInstructions { + $parts = $this->getSchemaName($tableName); + $sql = sprintf( + 'SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END AS column_exists + FROM information_schema.columns + WHERE table_schema = %s AND table_name = %s AND column_name = %s', + $this->getConnection()->quote($parts['schema']), + $this->getConnection()->quote($parts['table']), + $this->getConnection()->quote($columnName) + ); + + $result = $this->fetchRow($sql); + if (!(bool)$result['column_exists']) { + throw new InvalidArgumentException("The specified column does not exist: $columnName"); + } + + $instructions = new AlterInstructions(); + $instructions->addPostStep( + sprintf( + 'ALTER TABLE %s RENAME COLUMN %s TO %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName), + $this->quoteColumnName($newColumnName) + ) + ); + + return $instructions; + } + + /** + * @inheritDoc + */ + protected function getChangeColumnInstructions( + string $tableName, + string $columnName, + Column $newColumn + ): AlterInstructions { + $quotedColumnName = $this->quoteColumnName($columnName); + $instructions = new AlterInstructions(); + if ($newColumn->getType() === 'boolean') { + $sql = sprintf('ALTER COLUMN %s DROP DEFAULT', $quotedColumnName); + $instructions->addAlter($sql); + } + $sql = sprintf( + 'ALTER COLUMN %s TYPE %s', + $quotedColumnName, + $this->getColumnSqlDefinition($newColumn) + ); + if (in_array($newColumn->getType(), ['smallinteger', 'integer', 'biginteger'], true)) { + $sql .= sprintf( + ' USING (%s::bigint)', + $quotedColumnName + ); + } + if ($newColumn->getType() === 'uuid') { + $sql .= sprintf( + ' USING (%s::uuid)', + $quotedColumnName + ); + } + //NULL and DEFAULT cannot be set while changing column type + $sql = preg_replace('/ NOT NULL/', '', $sql); + $sql = preg_replace('/ NULL/', '', $sql); + //If it is set, DEFAULT is the last definition + $sql = preg_replace('/DEFAULT .*/', '', $sql); + if ($newColumn->getType() === 'boolean') { + $sql .= sprintf( + ' USING (CASE WHEN %s IS NULL THEN NULL WHEN %s::int=0 THEN FALSE ELSE TRUE END)', + $quotedColumnName, + $quotedColumnName + ); + } + $instructions->addAlter($sql); + + $column = $this->getColumn($tableName, $columnName); + + if ($this->useIdentity) { + // process identity + $sql = sprintf( + 'ALTER COLUMN %s', + $quotedColumnName + ); + if ($newColumn->isIdentity() && $newColumn->getGenerated() !== null) { + if ($column->isIdentity()) { + $sql .= sprintf(' SET GENERATED %s', $newColumn->getGenerated()); + } else { + $sql .= sprintf(' ADD GENERATED %s AS IDENTITY', $newColumn->getGenerated()); + } + } else { + $sql .= ' DROP IDENTITY IF EXISTS'; + } + $instructions->addAlter($sql); + } + + // process null + $sql = sprintf( + 'ALTER COLUMN %s', + $quotedColumnName + ); + + if (!$newColumn->getIdentity() && !$column->getIdentity() && $newColumn->isNull()) { + $sql .= ' DROP NOT NULL'; + } else { + $sql .= ' SET NOT NULL'; + } + + $instructions->addAlter($sql); + + if ($newColumn->getDefault() !== null) { + $instructions->addAlter(sprintf( + 'ALTER COLUMN %s SET %s', + $quotedColumnName, + $this->getDefaultValueDefinition($newColumn->getDefault(), $newColumn->getType()) + )); + } elseif (!$newColumn->getIdentity()) { + //drop default + $instructions->addAlter(sprintf( + 'ALTER COLUMN %s DROP DEFAULT', + $quotedColumnName + )); + } + + // rename column + if ($columnName !== $newColumn->getName()) { + $instructions->addPostStep(sprintf( + 'ALTER TABLE %s RENAME COLUMN %s TO %s', + $this->quoteTableName($tableName), + $quotedColumnName, + $this->quoteColumnName($newColumn->getName()) + )); + } + + // change column comment if needed + if ($newColumn->getComment()) { + $instructions->addPostStep($this->getColumnCommentSqlDefinition($newColumn, $tableName)); + } + + return $instructions; + } + + /** + * @param string $tableName Table name + * @param string $columnName Column name + * @return ?\Phinx\Db\Table\Column + */ + protected function getColumn(string $tableName, string $columnName): ?Column + { + $columns = $this->getColumns($tableName); + foreach ($columns as $column) { + if ($column->getName() === $columnName) { + return $column; + } + } + + return null; + } + + /** + * @inheritDoc + */ + protected function getDropColumnInstructions(string $tableName, string $columnName): AlterInstructions + { + $alter = sprintf( + 'DROP COLUMN %s', + $this->quoteColumnName($columnName) + ); + + return new AlterInstructions([$alter]); + } + + /** + * Get an array of indexes from a particular table. + * + * @param string $tableName Table name + * @return array + */ + protected function getIndexes($tableName) + { + $parts = $this->getSchemaName($tableName); + + $indexes = []; + $sql = sprintf( + "SELECT + i.relname AS index_name, + a.attname AS column_name + FROM + pg_class t, + pg_class i, + pg_index ix, + pg_attribute a, + pg_namespace nsp + WHERE + t.oid = ix.indrelid + AND i.oid = ix.indexrelid + AND a.attrelid = t.oid + AND a.attnum = ANY(ix.indkey) + AND t.relnamespace = nsp.oid + AND nsp.nspname = %s + AND t.relkind = 'r' + AND t.relname = %s + ORDER BY + t.relname, + i.relname", + $this->getConnection()->quote($parts['schema']), + $this->getConnection()->quote($parts['table']) + ); + $rows = $this->fetchAll($sql); + foreach ($rows as $row) { + if (!isset($indexes[$row['index_name']])) { + $indexes[$row['index_name']] = ['columns' => []]; + } + $indexes[$row['index_name']]['columns'][] = $row['column_name']; + } + + return $indexes; + } + + /** + * @inheritDoc + */ + public function hasIndex(string $tableName, $columns): bool + { + if (is_string($columns)) { + $columns = [$columns]; + } + $indexes = $this->getIndexes($tableName); + foreach ($indexes as $index) { + if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) { + return true; + } + } + + return false; + } + + /** + * @inheritDoc + */ + public function hasIndexByName(string $tableName, string $indexName): bool + { + $indexes = $this->getIndexes($tableName); + foreach ($indexes as $name => $index) { + if ($name === $indexName) { + return true; + } + } + + return false; + } + + /** + * @inheritDoc + */ + protected function getAddIndexInstructions(Table $table, Index $index): AlterInstructions + { + $instructions = new AlterInstructions(); + $instructions->addPostStep($this->getIndexSqlDefinition($index, $table->getName())); + + return $instructions; + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getDropIndexByColumnsInstructions(string $tableName, $columns): AlterInstructions + { + $parts = $this->getSchemaName($tableName); + + if (is_string($columns)) { + $columns = [$columns]; // str to array + } + + $indexes = $this->getIndexes($tableName); + foreach ($indexes as $indexName => $index) { + $a = array_diff($columns, $index['columns']); + if (empty($a)) { + return new AlterInstructions([], [sprintf( + 'DROP INDEX IF EXISTS %s', + '"' . ($parts['schema'] . '".' . $this->quoteColumnName($indexName)) + )]); + } + } + + throw new InvalidArgumentException(sprintf( + "The specified index on columns '%s' does not exist", + implode(',', $columns) + )); + } + + /** + * @inheritDoc + */ + protected function getDropIndexByNameInstructions(string $tableName, string $indexName): AlterInstructions + { + $parts = $this->getSchemaName($tableName); + + $sql = sprintf( + 'DROP INDEX IF EXISTS %s', + '"' . ($parts['schema'] . '".' . $this->quoteColumnName($indexName)) + ); + + return new AlterInstructions([], [$sql]); + } + + /** + * @inheritDoc + */ + public function hasPrimaryKey(string $tableName, $columns, ?string $constraint = null): bool + { + $primaryKey = $this->getPrimaryKey($tableName); + + if (empty($primaryKey)) { + return false; + } + + if ($constraint) { + return $primaryKey['constraint'] === $constraint; + } else { + if (is_string($columns)) { + $columns = [$columns]; // str to array + } + $missingColumns = array_diff($columns, $primaryKey['columns']); + + return empty($missingColumns); + } + } + + /** + * Get the primary key from a particular table. + * + * @param string $tableName Table name + * @return array + */ + public function getPrimaryKey(string $tableName): array + { + $parts = $this->getSchemaName($tableName); + $rows = $this->fetchAll(sprintf( + "SELECT + tc.constraint_name, + kcu.column_name + FROM information_schema.table_constraints AS tc + JOIN information_schema.key_column_usage AS kcu + ON tc.constraint_name = kcu.constraint_name + WHERE constraint_type = 'PRIMARY KEY' + AND tc.table_schema = %s + AND tc.table_name = %s + ORDER BY kcu.position_in_unique_constraint", + $this->getConnection()->quote($parts['schema']), + $this->getConnection()->quote($parts['table']) + )); + + $primaryKey = [ + 'columns' => [], + ]; + foreach ($rows as $row) { + $primaryKey['constraint'] = $row['constraint_name']; + $primaryKey['columns'][] = $row['column_name']; + } + + return $primaryKey; + } + + /** + * @inheritDoc + */ + public function hasForeignKey(string $tableName, $columns, ?string $constraint = null): bool + { + if (is_string($columns)) { + $columns = [$columns]; // str to array + } + $foreignKeys = $this->getForeignKeys($tableName); + if ($constraint) { + if (isset($foreignKeys[$constraint])) { + return !empty($foreignKeys[$constraint]); + } + + return false; + } + + foreach ($foreignKeys as $key) { + $a = array_diff($columns, $key['columns']); + if (empty($a)) { + return true; + } + } + + return false; + } + + /** + * Get an array of foreign keys from a particular table. + * + * @param string $tableName Table name + * @return array + */ + protected function getForeignKeys(string $tableName): array + { + $parts = $this->getSchemaName($tableName); + $foreignKeys = []; + $rows = $this->fetchAll(sprintf( + "SELECT + tc.constraint_name, + tc.table_name, kcu.column_name, + ccu.table_name AS referenced_table_name, + ccu.column_name AS referenced_column_name + FROM + information_schema.table_constraints AS tc + JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name + JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name + WHERE constraint_type = 'FOREIGN KEY' AND tc.table_schema = %s AND tc.table_name = %s + ORDER BY kcu.position_in_unique_constraint", + $this->getConnection()->quote($parts['schema']), + $this->getConnection()->quote($parts['table']) + )); + foreach ($rows as $row) { + $foreignKeys[$row['constraint_name']]['table'] = $row['table_name']; + $foreignKeys[$row['constraint_name']]['columns'][] = $row['column_name']; + $foreignKeys[$row['constraint_name']]['referenced_table'] = $row['referenced_table_name']; + $foreignKeys[$row['constraint_name']]['referenced_columns'][] = $row['referenced_column_name']; + } + + return $foreignKeys; + } + + /** + * @inheritDoc + */ + protected function getAddForeignKeyInstructions(Table $table, ForeignKey $foreignKey): AlterInstructions + { + $alter = sprintf( + 'ADD %s', + $this->getForeignKeySqlDefinition($foreignKey, $table->getName()) + ); + + return new AlterInstructions([$alter]); + } + + /** + * @inheritDoc + */ + protected function getDropForeignKeyInstructions($tableName, $constraint): AlterInstructions + { + $alter = sprintf( + 'DROP CONSTRAINT %s', + $this->quoteColumnName($constraint) + ); + + return new AlterInstructions([$alter]); + } + + /** + * @inheritDoc + */ + protected function getDropForeignKeyByColumnsInstructions(string $tableName, array $columns): AlterInstructions + { + $instructions = new AlterInstructions(); + + $parts = $this->getSchemaName($tableName); + $sql = 'SELECT c.CONSTRAINT_NAME + FROM ( + SELECT CONSTRAINT_NAME, array_agg(COLUMN_NAME::varchar) as columns + FROM information_schema.KEY_COLUMN_USAGE + WHERE TABLE_SCHEMA = %s + AND TABLE_NAME IS NOT NULL + AND TABLE_NAME = %s + AND POSITION_IN_UNIQUE_CONSTRAINT IS NOT NULL + GROUP BY CONSTRAINT_NAME + ) c + WHERE + ARRAY[%s]::varchar[] <@ c.columns AND + ARRAY[%s]::varchar[] @> c.columns'; + + $array = []; + foreach ($columns as $col) { + $array[] = "'$col'"; + } + + $rows = $this->fetchAll(sprintf( + $sql, + $this->getConnection()->quote($parts['schema']), + $this->getConnection()->quote($parts['table']), + implode(',', $array), + implode(',', $array) + )); + + foreach ($rows as $row) { + $newInstr = $this->getDropForeignKeyInstructions($tableName, $row['constraint_name']); + $instructions->merge($newInstr); + } + + return $instructions; + } + + /** + * {@inheritDoc} + * + * @throws \Phinx\Db\Adapter\UnsupportedColumnTypeException + */ + public function getSqlType($type, ?int $limit = null): array + { + switch ($type) { + case static::PHINX_TYPE_TEXT: + case static::PHINX_TYPE_TIME: + case static::PHINX_TYPE_DATE: + case static::PHINX_TYPE_BOOLEAN: + case static::PHINX_TYPE_JSON: + case static::PHINX_TYPE_JSONB: + case static::PHINX_TYPE_UUID: + case static::PHINX_TYPE_CIDR: + case static::PHINX_TYPE_INET: + case static::PHINX_TYPE_MACADDR: + case static::PHINX_TYPE_TIMESTAMP: + case static::PHINX_TYPE_INTEGER: + return ['name' => $type]; + case static::PHINX_TYPE_TINY_INTEGER: + return ['name' => 'smallint']; + case static::PHINX_TYPE_SMALL_INTEGER: + return ['name' => 'smallint']; + case static::PHINX_TYPE_DECIMAL: + return ['name' => $type, 'precision' => 18, 'scale' => 0]; + case static::PHINX_TYPE_DOUBLE: + return ['name' => 'double precision']; + case static::PHINX_TYPE_STRING: + return ['name' => 'character varying', 'limit' => 255]; + case static::PHINX_TYPE_CHAR: + return ['name' => 'character', 'limit' => 255]; + case static::PHINX_TYPE_BIG_INTEGER: + return ['name' => 'bigint']; + case static::PHINX_TYPE_FLOAT: + return ['name' => 'real']; + case static::PHINX_TYPE_DATETIME: + return ['name' => 'timestamp']; + case static::PHINX_TYPE_BINARYUUID: + return ['name' => 'uuid']; + case static::PHINX_TYPE_BLOB: + case static::PHINX_TYPE_BINARY: + return ['name' => 'bytea']; + case static::PHINX_TYPE_INTERVAL: + return ['name' => 'interval']; + // Geospatial database types + // Spatial storage in Postgres is done via the PostGIS extension, + // which enables the use of the "geography" type in combination + // with SRID 4326. + case static::PHINX_TYPE_GEOMETRY: + return ['name' => 'geography', 'type' => 'geometry', 'srid' => 4326]; + case static::PHINX_TYPE_POINT: + return ['name' => 'geography', 'type' => 'point', 'srid' => 4326]; + case static::PHINX_TYPE_LINESTRING: + return ['name' => 'geography', 'type' => 'linestring', 'srid' => 4326]; + case static::PHINX_TYPE_POLYGON: + return ['name' => 'geography', 'type' => 'polygon', 'srid' => 4326]; + default: + if ($this->isArrayType($type)) { + return ['name' => $type]; + } + // Return array type + throw new UnsupportedColumnTypeException('Column type `' . $type . '` is not supported by Postgresql.'); + } + } + + /** + * Returns Phinx type by SQL type + * + * @param string $sqlType SQL type + * @throws \Phinx\Db\Adapter\UnsupportedColumnTypeException + * @return string Phinx type + */ + public function getPhinxType(string $sqlType): string + { + switch ($sqlType) { + case 'character varying': + case 'varchar': + return static::PHINX_TYPE_STRING; + case 'character': + case 'char': + return static::PHINX_TYPE_CHAR; + case 'text': + return static::PHINX_TYPE_TEXT; + case 'json': + return static::PHINX_TYPE_JSON; + case 'jsonb': + return static::PHINX_TYPE_JSONB; + case 'smallint': + return static::PHINX_TYPE_SMALL_INTEGER; + case 'int': + case 'int4': + case 'integer': + return static::PHINX_TYPE_INTEGER; + case 'decimal': + case 'numeric': + return static::PHINX_TYPE_DECIMAL; + case 'bigint': + case 'int8': + return static::PHINX_TYPE_BIG_INTEGER; + case 'real': + case 'float4': + return static::PHINX_TYPE_FLOAT; + case 'double precision': + return static::PHINX_TYPE_DOUBLE; + case 'bytea': + return static::PHINX_TYPE_BINARY; + case 'interval': + return static::PHINX_TYPE_INTERVAL; + case 'time': + case 'timetz': + case 'time with time zone': + case 'time without time zone': + return static::PHINX_TYPE_TIME; + case 'date': + return static::PHINX_TYPE_DATE; + case 'timestamp': + case 'timestamptz': + case 'timestamp with time zone': + case 'timestamp without time zone': + return static::PHINX_TYPE_DATETIME; + case 'bool': + case 'boolean': + return static::PHINX_TYPE_BOOLEAN; + case 'uuid': + return static::PHINX_TYPE_UUID; + case 'cidr': + return static::PHINX_TYPE_CIDR; + case 'inet': + return static::PHINX_TYPE_INET; + case 'macaddr': + return static::PHINX_TYPE_MACADDR; + default: + throw new UnsupportedColumnTypeException( + 'Column type `' . $sqlType . '` is not supported by Postgresql.' + ); + } + } + + /** + * @inheritDoc + */ + public function createDatabase(string $name, array $options = []): void + { + $charset = $options['charset'] ?? 'utf8'; + $this->execute(sprintf("CREATE DATABASE %s WITH ENCODING = '%s'", $name, $charset)); + } + + /** + * @inheritDoc + */ + public function hasDatabase(string $name): bool + { + $sql = sprintf("SELECT count(*) FROM pg_database WHERE datname = '%s'", $name); + $result = $this->fetchRow($sql); + + return $result['count'] > 0; + } + + /** + * @inheritDoc + */ + public function dropDatabase($name): void + { + $this->disconnect(); + $this->execute(sprintf('DROP DATABASE IF EXISTS %s', $name)); + $this->createdTables = []; + $this->connect(); + } + + /** + * Gets the PostgreSQL Column Definition for a Column object. + * + * @param \Phinx\Db\Table\Column $column Column + * @return string + */ + protected function getColumnSqlDefinition(Column $column): string + { + $buffer = []; + + if ($column->isIdentity() && (!$this->useIdentity || $column->getGenerated() === null)) { + if ($column->getType() === 'smallinteger') { + $buffer[] = 'SMALLSERIAL'; + } elseif ($column->getType() === 'biginteger') { + $buffer[] = 'BIGSERIAL'; + } else { + $buffer[] = 'SERIAL'; + } + } elseif ($column->getType() instanceof Literal) { + $buffer[] = (string)$column->getType(); + } else { + $sqlType = $this->getSqlType($column->getType(), $column->getLimit()); + $buffer[] = strtoupper($sqlType['name']); + + // integers cant have limits in postgres + if ($sqlType['name'] === static::PHINX_TYPE_DECIMAL && ($column->getPrecision() || $column->getScale())) { + $buffer[] = sprintf( + '(%s, %s)', + $column->getPrecision() ?: $sqlType['precision'], + $column->getScale() ?: $sqlType['scale'] + ); + } elseif ($sqlType['name'] === self::PHINX_TYPE_GEOMETRY) { + // geography type must be written with geometry type and srid, like this: geography(POLYGON,4326) + $buffer[] = sprintf( + '(%s,%s)', + strtoupper($sqlType['type']), + $column->getSrid() ?: $sqlType['srid'] + ); + } elseif (in_array($sqlType['name'], [self::PHINX_TYPE_TIME, self::PHINX_TYPE_TIMESTAMP], true)) { + if (is_numeric($column->getPrecision())) { + $buffer[] = sprintf('(%s)', $column->getPrecision()); + } + + if ($column->isTimezone()) { + $buffer[] = strtoupper('with time zone'); + } + } elseif ( + !in_array($column->getType(), [ + self::PHINX_TYPE_TINY_INTEGER, + self::PHINX_TYPE_SMALL_INTEGER, + self::PHINX_TYPE_INTEGER, + self::PHINX_TYPE_BIG_INTEGER, + self::PHINX_TYPE_BOOLEAN, + self::PHINX_TYPE_TEXT, + self::PHINX_TYPE_BINARY, + ], true) + ) { + if ($column->getLimit() || isset($sqlType['limit'])) { + $buffer[] = sprintf('(%s)', $column->getLimit() ?: $sqlType['limit']); + } + } + } + + $buffer[] = $column->isNull() ? 'NULL' : 'NOT NULL'; + + if ($column->getDefault() !== null) { + $buffer[] = $this->getDefaultValueDefinition($column->getDefault(), $column->getType()); + } + + return implode(' ', $buffer); + } + + /** + * Gets the PostgreSQL Column Comment Definition for a column object. + * + * @param \Phinx\Db\Table\Column $column Column + * @param string $tableName Table name + * @return string + */ + protected function getColumnCommentSqlDefinition(Column $column, string $tableName): string + { + // passing 'null' is to remove column comment + $comment = strcasecmp($column->getComment(), 'NULL') !== 0 + ? $this->getConnection()->quote($column->getComment()) + : 'NULL'; + + return sprintf( + 'COMMENT ON COLUMN %s.%s IS %s;', + $this->quoteTableName($tableName), + $this->quoteColumnName($column->getName()), + $comment + ); + } + + /** + * Gets the PostgreSQL Index Definition for an Index object. + * + * @param \Phinx\Db\Table\Index $index Index + * @param string $tableName Table name + * @return string + */ + protected function getIndexSqlDefinition(Index $index, string $tableName): string + { + $parts = $this->getSchemaName($tableName); + $columnNames = $index->getColumns(); + + if (is_string($index->getName())) { + $indexName = $index->getName(); + } else { + $indexName = sprintf('%s_%s', $parts['table'], implode('_', $columnNames)); + } + + $order = $index->getOrder() ?? []; + $columnNames = array_map(function ($columnName) use ($order) { + $ret = '"' . $columnName . '"'; + if (isset($order[$columnName])) { + $ret .= ' ' . $order[$columnName]; + } + + return $ret; + }, $columnNames); + + $includedColumns = $index->getInclude() ? sprintf('INCLUDE ("%s")', implode('","', $index->getInclude())) : ''; + + $createIndexSentence = 'CREATE %s INDEX %s ON %s '; + if ($index->getType() === self::GIN_INDEX_TYPE) { + $createIndexSentence .= ' USING ' . $index->getType() . '(%s) %s;'; + } else { + $createIndexSentence .= '(%s) %s;'; + } + + return sprintf( + $createIndexSentence, + ($index->getType() === Index::UNIQUE ? 'UNIQUE' : ''), + $this->quoteColumnName($indexName), + $this->quoteTableName($tableName), + implode(',', $columnNames), + $includedColumns + ); + } + + /** + * Gets the MySQL Foreign Key Definition for an ForeignKey object. + * + * @param \Phinx\Db\Table\ForeignKey $foreignKey Foreign key + * @param string $tableName Table name + * @return string + */ + protected function getForeignKeySqlDefinition(ForeignKey $foreignKey, string $tableName): string + { + $parts = $this->getSchemaName($tableName); + + $constraintName = $foreignKey->getConstraint() ?: ( + $parts['table'] . '_' . implode('_', $foreignKey->getColumns()) . '_fkey' + ); + $def = ' CONSTRAINT ' . $this->quoteColumnName($constraintName) . + ' FOREIGN KEY ("' . implode('", "', $foreignKey->getColumns()) . '")' . + " REFERENCES {$this->quoteTableName($foreignKey->getReferencedTable()->getName())} (\"" . + implode('", "', $foreignKey->getReferencedColumns()) . '")'; + if ($foreignKey->getOnDelete()) { + $def .= " ON DELETE {$foreignKey->getOnDelete()}"; + } + if ($foreignKey->getOnUpdate()) { + $def .= " ON UPDATE {$foreignKey->getOnUpdate()}"; + } + + return $def; + } + + /** + * @inheritDoc + */ + public function createSchemaTable(): void + { + // Create the public/custom schema if it doesn't already exist + if ($this->hasSchema($this->getGlobalSchemaName()) === false) { + $this->createSchema($this->getGlobalSchemaName()); + } + + $this->setSearchPath(); + + parent::createSchemaTable(); + } + + /** + * @inheritDoc + */ + public function getVersions(): array + { + $this->setSearchPath(); + + return parent::getVersions(); + } + + /** + * @inheritDoc + */ + public function getVersionLog(): array + { + $this->setSearchPath(); + + return parent::getVersionLog(); + } + + /** + * Creates the specified schema. + * + * @param string $schemaName Schema Name + * @return void + */ + public function createSchema(string $schemaName = 'public'): void + { + // from postgres 9.3 we can use "CREATE SCHEMA IF NOT EXISTS schema_name" + $sql = sprintf('CREATE SCHEMA IF NOT EXISTS %s', $this->quoteSchemaName($schemaName)); + $this->execute($sql); + } + + /** + * Checks to see if a schema exists. + * + * @param string $schemaName Schema Name + * @return bool + */ + public function hasSchema(string $schemaName): bool + { + $sql = sprintf( + 'SELECT count(*) + FROM pg_namespace + WHERE nspname = %s', + $this->getConnection()->quote($schemaName) + ); + $result = $this->fetchRow($sql); + + return $result['count'] > 0; + } + + /** + * Drops the specified schema table. + * + * @param string $schemaName Schema name + * @return void + */ + public function dropSchema(string $schemaName): void + { + $sql = sprintf('DROP SCHEMA IF EXISTS %s CASCADE', $this->quoteSchemaName($schemaName)); + $this->execute($sql); + + foreach ($this->createdTables as $idx => $createdTable) { + if ($this->getSchemaName($createdTable)['schema'] === $this->quoteSchemaName($schemaName)) { + unset($this->createdTables[$idx]); + } + } + } + + /** + * Drops all schemas. + * + * @return void + */ + public function dropAllSchemas(): void + { + foreach ($this->getAllSchemas() as $schema) { + $this->dropSchema($schema); + } + } + + /** + * Returns schemas. + * + * @return array + */ + public function getAllSchemas(): array + { + $sql = "SELECT schema_name + FROM information_schema.schemata + WHERE schema_name <> 'information_schema' AND schema_name !~ '^pg_'"; + $items = $this->fetchAll($sql); + $schemaNames = []; + foreach ($items as $item) { + $schemaNames[] = $item['schema_name']; + } + + return $schemaNames; + } + + /** + * @inheritDoc + */ + public function getColumnTypes(): array + { + return array_merge(parent::getColumnTypes(), static::$specificColumnTypes); + } + + /** + * @inheritDoc + */ + public function isValidColumnType(Column $column): bool + { + // If not a standard column type, maybe it is array type? + return parent::isValidColumnType($column) || $this->isArrayType($column->getType()); + } + + /** + * Check if the given column is an array of a valid type. + * + * @param string|\Phinx\Util\Literal $columnType Column type + * @return bool + */ + protected function isArrayType($columnType): bool + { + if (!preg_match('/^([a-z]+)(?:\[\]){1,}$/', $columnType, $matches)) { + return false; + } + + $baseType = $matches[1]; + + return in_array($baseType, $this->getColumnTypes(), true); + } + + /** + * @param string $tableName Table name + * @return array + */ + protected function getSchemaName(string $tableName): array + { + $schema = $this->getGlobalSchemaName(); + $table = $tableName; + if (strpos($tableName, '.') !== false) { + [$schema, $table] = explode('.', $tableName); + } + + return [ + 'schema' => $schema, + 'table' => $table, + ]; + } + + /** + * Gets the schema name. + * + * @return string + */ + protected function getGlobalSchemaName(): string + { + $options = $this->getOptions(); + + return empty($options['schema']) ? 'public' : $options['schema']; + } + + /** + * @inheritDoc + */ + public function castToBool($value) + { + return (bool)$value ? 'TRUE' : 'FALSE'; + } + + /** + * @inheritDoc + */ + public function getDecoratedConnection(): Connection + { + $options = $this->getOptions(); + $options = [ + 'username' => $options['user'] ?? null, + 'password' => $options['pass'] ?? null, + 'database' => $options['name'], + 'quoteIdentifiers' => true, + ] + $options; + + $driver = new PostgresDriver($options); + + $driver->setConnection($this->connection); + + return new Connection(['driver' => $driver] + $options); + } + + /** + * Sets search path of schemas to look through for a table + * + * @return void + */ + public function setSearchPath(): void + { + $this->execute( + sprintf( + 'SET search_path TO %s,"$user",public', + $this->quoteSchemaName($this->getGlobalSchemaName()) + ) + ); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/ProxyAdapter.php b/vendor/topthink/think-migration/phinx/Db/Adapter/ProxyAdapter.php new file mode 100644 index 0000000..979700c --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/ProxyAdapter.php @@ -0,0 +1,129 @@ + + */ +class ProxyAdapter extends AdapterWrapper +{ + /** + * @var \Phinx\Db\Action\Action[] + */ + protected $commands = []; + + /** + * @inheritDoc + */ + public function getAdapterType(): string + { + return 'ProxyAdapter'; + } + + /** + * @inheritDoc + */ + public function createTable(Table $table, array $columns = [], array $indexes = []): void + { + $this->commands[] = new CreateTable($table); + } + + /** + * @inheritDoc + */ + public function executeActions(Table $table, array $actions): void + { + $this->commands = array_merge($this->commands, $actions); + } + + /** + * Gets an array of the recorded commands in reverse. + * + * @throws \Phinx\Migration\IrreversibleMigrationException if a command cannot be reversed. + * @return \Phinx\Db\Plan\Intent + */ + public function getInvertedCommands(): Intent + { + $inverted = new Intent(); + + foreach (array_reverse($this->commands) as $command) { + switch (true) { + case $command instanceof CreateTable: + /** @var \Phinx\Db\Action\CreateTable $command */ + $inverted->addAction(new DropTable($command->getTable())); + break; + + case $command instanceof RenameTable: + /** @var \Phinx\Db\Action\RenameTable $command */ + $inverted->addAction(new RenameTable(new Table($command->getNewName()), $command->getTable()->getName())); + break; + + case $command instanceof AddColumn: + /** @var \Phinx\Db\Action\AddColumn $command */ + $inverted->addAction(new RemoveColumn($command->getTable(), $command->getColumn())); + break; + + case $command instanceof RenameColumn: + /** @var \Phinx\Db\Action\RenameColumn $command */ + $column = clone $command->getColumn(); + $name = $column->getName(); + $column->setName($command->getNewName()); + $inverted->addAction(new RenameColumn($command->getTable(), $column, $name)); + break; + + case $command instanceof AddIndex: + /** @var \Phinx\Db\Action\AddIndex $command */ + $inverted->addAction(new DropIndex($command->getTable(), $command->getIndex())); + break; + + case $command instanceof AddForeignKey: + /** @var \Phinx\Db\Action\AddForeignKey $command */ + $inverted->addAction(new DropForeignKey($command->getTable(), $command->getForeignKey())); + break; + + default: + throw new IrreversibleMigrationException(sprintf( + 'Cannot reverse a "%s" command', + get_class($command) + )); + } + } + + return $inverted; + } + + /** + * Execute the recorded commands in reverse. + * + * @return void + */ + public function executeInvertedCommands(): void + { + $plan = new Plan($this->getInvertedCommands()); + $plan->executeInverse($this->getAdapter()); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/SQLiteAdapter.php b/vendor/topthink/think-migration/phinx/Db/Adapter/SQLiteAdapter.php new file mode 100644 index 0000000..f249071 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/SQLiteAdapter.php @@ -0,0 +1,1767 @@ + + * @author Richard McIntyre + */ +class SQLiteAdapter extends PdoAdapter +{ + public const MEMORY = ':memory:'; + + /** + * List of supported Phinx column types with their SQL equivalents + * some types have an affinity appended to ensure they do not receive NUMERIC affinity + * + * @var string[] + */ + protected static $supportedColumnTypes = [ + self::PHINX_TYPE_BIG_INTEGER => 'biginteger', + self::PHINX_TYPE_BINARY => 'binary_blob', + self::PHINX_TYPE_BINARYUUID => 'binary_blob', + self::PHINX_TYPE_BLOB => 'blob', + self::PHINX_TYPE_BOOLEAN => 'boolean_integer', + self::PHINX_TYPE_CHAR => 'char', + self::PHINX_TYPE_DATE => 'date_text', + self::PHINX_TYPE_DATETIME => 'datetime_text', + self::PHINX_TYPE_DECIMAL => 'decimal', + self::PHINX_TYPE_DOUBLE => 'double', + self::PHINX_TYPE_FLOAT => 'float', + self::PHINX_TYPE_INTEGER => 'integer', + self::PHINX_TYPE_JSON => 'json_text', + self::PHINX_TYPE_JSONB => 'jsonb_text', + self::PHINX_TYPE_SMALL_INTEGER => 'smallinteger', + self::PHINX_TYPE_STRING => 'varchar', + self::PHINX_TYPE_TEXT => 'text', + self::PHINX_TYPE_TIME => 'time_text', + self::PHINX_TYPE_TIMESTAMP => 'timestamp_text', + self::PHINX_TYPE_TINY_INTEGER => 'tinyinteger', + self::PHINX_TYPE_UUID => 'uuid_text', + self::PHINX_TYPE_VARBINARY => 'varbinary_blob', + ]; + + /** + * List of aliases of supported column types + * + * @var string[] + */ + protected static $supportedColumnTypeAliases = [ + 'varchar' => self::PHINX_TYPE_STRING, + 'tinyint' => self::PHINX_TYPE_TINY_INTEGER, + 'tinyinteger' => self::PHINX_TYPE_TINY_INTEGER, + 'smallint' => self::PHINX_TYPE_SMALL_INTEGER, + 'int' => self::PHINX_TYPE_INTEGER, + 'mediumint' => self::PHINX_TYPE_INTEGER, + 'mediuminteger' => self::PHINX_TYPE_INTEGER, + 'bigint' => self::PHINX_TYPE_BIG_INTEGER, + 'tinytext' => self::PHINX_TYPE_TEXT, + 'mediumtext' => self::PHINX_TYPE_TEXT, + 'longtext' => self::PHINX_TYPE_TEXT, + 'tinyblob' => self::PHINX_TYPE_BLOB, + 'mediumblob' => self::PHINX_TYPE_BLOB, + 'longblob' => self::PHINX_TYPE_BLOB, + 'real' => self::PHINX_TYPE_FLOAT, + ]; + + /** + * List of known but unsupported Phinx column types + * + * @var string[] + */ + protected static $unsupportedColumnTypes = [ + self::PHINX_TYPE_BIT, + self::PHINX_TYPE_CIDR, + self::PHINX_TYPE_ENUM, + self::PHINX_TYPE_FILESTREAM, + self::PHINX_TYPE_GEOMETRY, + self::PHINX_TYPE_INET, + self::PHINX_TYPE_INTERVAL, + self::PHINX_TYPE_LINESTRING, + self::PHINX_TYPE_MACADDR, + self::PHINX_TYPE_POINT, + self::PHINX_TYPE_POLYGON, + self::PHINX_TYPE_SET, + ]; + + /** + * @var string[] + */ + protected $definitionsWithLimits = [ + 'CHAR', + 'CHARACTER', + 'VARCHAR', + 'VARYING CHARACTER', + 'NCHAR', + 'NATIVE CHARACTER', + 'NVARCHAR', + ]; + + /** + * @var string + */ + protected $suffix = '.sqlite3'; + + /** + * Indicates whether the database library version is at least the specified version + * + * @param string $ver The version to check against e.g. '3.28.0' + * @return bool + */ + public function databaseVersionAtLeast($ver): bool + { + $actual = $this->query('SELECT sqlite_version()')->fetchColumn(); + + return version_compare($actual, $ver, '>='); + } + + /** + * {@inheritDoc} + * + * @throws \RuntimeException + * @throws \InvalidArgumentException + * @return void + */ + public function connect(): void + { + if ($this->connection === null) { + if (!class_exists('PDO') || !in_array('sqlite', PDO::getAvailableDrivers(), true)) { + // @codeCoverageIgnoreStart + throw new RuntimeException('You need to enable the PDO_SQLITE extension for Phinx to run properly.'); + // @codeCoverageIgnoreEnd + } + + $options = $this->getOptions(); + + if (PHP_VERSION_ID < 80100 && (!empty($options['mode']) || !empty($options['cache']))) { + throw new RuntimeException('SQLite URI support requires PHP 8.1.'); + } elseif ((!empty($options['mode']) || !empty($options['cache'])) && !empty($options['memory'])) { + throw new RuntimeException('Memory must not be set when cache or mode are.'); + } elseif (PHP_VERSION_ID >= 80100 && (!empty($options['mode']) || !empty($options['cache']))) { + $params = []; + if (!empty($options['cache'])) { + $params[] = 'cache=' . $options['cache']; + } + if (!empty($options['mode'])) { + $params[] = 'mode=' . $options['mode']; + } + $dsn = 'sqlite:file:' . ($options['name'] ?? '') . '?' . implode('&', $params); + } else { + // use a memory database if the option was specified + if (!empty($options['memory']) || $options['name'] === static::MEMORY) { + $dsn = 'sqlite:' . static::MEMORY; + } else { + $dsn = 'sqlite:' . $options['name'] . $this->suffix; + } + } + + $driverOptions = []; + + // use custom data fetch mode + if (!empty($options['fetch_mode'])) { + $driverOptions[PDO::ATTR_DEFAULT_FETCH_MODE] = constant('\PDO::FETCH_' . strtoupper($options['fetch_mode'])); + } + + // pass \PDO::ATTR_PERSISTENT to driver options instead of useless setting it after instantiation + if (isset($options['attr_persistent'])) { + $driverOptions[PDO::ATTR_PERSISTENT] = $options['attr_persistent']; + } + + $db = $this->createPdoConnection($dsn, null, null, $driverOptions); + + $this->setConnection($db); + } + } + + /** + * @inheritDoc + */ + public function setOptions(array $options): AdapterInterface + { + parent::setOptions($options); + + if (isset($options['suffix'])) { + $this->suffix = $options['suffix']; + } + //don't "fix" the file extension if it is blank, some people + //might want a SQLITE db file with absolutely no extension. + if ($this->suffix !== '' && strpos($this->suffix, '.') !== 0) { + $this->suffix = '.' . $this->suffix; + } + + return $this; + } + + /** + * @inheritDoc + */ + public function disconnect(): void + { + $this->connection = null; + } + + /** + * @inheritDoc + */ + public function hasTransactions(): bool + { + return true; + } + + /** + * @inheritDoc + */ + public function beginTransaction(): void + { + $this->getConnection()->beginTransaction(); + } + + /** + * @inheritDoc + */ + public function commitTransaction(): void + { + $this->getConnection()->commit(); + } + + /** + * @inheritDoc + */ + public function rollbackTransaction(): void + { + $this->getConnection()->rollBack(); + } + + /** + * @inheritDoc + */ + public function quoteTableName($tableName): string + { + return str_replace('.', '`.`', $this->quoteColumnName($tableName)); + } + + /** + * @inheritDoc + */ + public function quoteColumnName($columnName): string + { + return '`' . str_replace('`', '``', $columnName) . '`'; + } + + /** + * @param string $tableName Table name + * @param bool $quoted Whether to return the schema name and table name escaped and quoted. If quoted, the schema (if any) will also be appended with a dot + * @return array + */ + protected function getSchemaName(string $tableName, bool $quoted = false): array + { + if (preg_match("/.\.([^\.]+)$/", $tableName, $match)) { + $table = $match[1]; + $schema = substr($tableName, 0, strlen($tableName) - strlen($match[0]) + 1); + $result = ['schema' => $schema, 'table' => $table]; + } else { + $result = ['schema' => '', 'table' => $tableName]; + } + + if ($quoted) { + $result['schema'] = $result['schema'] !== '' ? $this->quoteColumnName($result['schema']) . '.' : ''; + $result['table'] = $this->quoteColumnName($result['table']); + } + + return $result; + } + + /** + * Retrieves information about a given table from one of the SQLite pragmas + * + * @param string $tableName The table to query + * @param string $pragma The pragma to query + * @return array + */ + protected function getTableInfo(string $tableName, string $pragma = 'table_info'): array + { + $info = $this->getSchemaName($tableName, true); + + return $this->fetchAll(sprintf('PRAGMA %s%s(%s)', $info['schema'], $pragma, $info['table'])); + } + + /** + * Searches through all available schemata to find a table and returns an array + * containing the bare schema name and whether the table exists at all. + * If no schema was specified and the table does not exist the "main" schema is returned + * + * @param string $tableName The name of the table to find + * @return array + */ + protected function resolveTable(string $tableName): array + { + $info = $this->getSchemaName($tableName); + if ($info['schema'] === '') { + // if no schema is specified we search all schemata + $rows = $this->fetchAll('PRAGMA database_list;'); + // the temp schema is always first to be searched + $schemata = ['temp']; + foreach ($rows as $row) { + if (strtolower($row['name']) !== 'temp') { + $schemata[] = $row['name']; + } + } + $defaultSchema = 'main'; + } else { + // otherwise we search just the specified schema + $schemata = (array)$info['schema']; + $defaultSchema = $info['schema']; + } + + $table = strtolower($info['table']); + foreach ($schemata as $schema) { + if (strtolower($schema) === 'temp') { + $master = 'sqlite_temp_master'; + } else { + $master = sprintf('%s.%s', $this->quoteColumnName($schema), 'sqlite_master'); + } + try { + $rows = $this->fetchAll(sprintf("SELECT name FROM %s WHERE type='table' AND lower(name) = %s", $master, $this->quoteString($table))); + } catch (PDOException $e) { + // an exception can occur if the schema part of the table refers to a database which is not attached + break; + } + + // this somewhat pedantic check with strtolower is performed because the SQL lower function may be redefined, + // and can act on all Unicode characters if the ICU extension is loaded, while SQL identifiers are only case-insensitive for ASCII + foreach ($rows as $row) { + if (strtolower($row['name']) === $table) { + return ['schema' => $schema, 'table' => $row['name'], 'exists' => true]; + } + } + } + + return ['schema' => $defaultSchema, 'table' => $info['table'], 'exists' => false]; + } + + /** + * @inheritDoc + */ + public function hasTable(string $tableName): bool + { + return $this->hasCreatedTable($tableName) || $this->resolveTable($tableName)['exists']; + } + + /** + * @inheritDoc + */ + public function createTable(Table $table, array $columns = [], array $indexes = []): void + { + // Add the default primary key + $options = $table->getOptions(); + if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { + $options['id'] = 'id'; + } + + if (isset($options['id']) && is_string($options['id'])) { + // Handle id => "field_name" to support AUTO_INCREMENT + $column = new Column(); + $column->setName($options['id']) + ->setType('integer') + ->setOptions(['identity' => true]); + + array_unshift($columns, $column); + } + + $sql = 'CREATE TABLE '; + $sql .= $this->quoteTableName($table->getName()) . ' ('; + foreach ($columns as $column) { + $sql .= $this->quoteColumnName($column->getName()) . ' ' . $this->getColumnSqlDefinition($column) . ', '; + + if (isset($options['primary_key']) && $column->getIdentity()) { + //remove column from the primary key array as it is already defined as an autoincrement + //primary id + $identityColumnIndex = array_search($column->getName(), $options['primary_key'], true); + if ($identityColumnIndex !== false) { + unset($options['primary_key'][$identityColumnIndex]); + + if (empty($options['primary_key'])) { + //The last primary key has been removed + unset($options['primary_key']); + } + } + } + } + + // set the primary key(s) + if (isset($options['primary_key'])) { + $sql = rtrim($sql); + $sql .= ' PRIMARY KEY ('; + if (is_string($options['primary_key'])) { // handle primary_key => 'id' + $sql .= $this->quoteColumnName($options['primary_key']); + } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id') + $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key'])); + } + $sql .= ')'; + } else { + $sql = substr(rtrim($sql), 0, -1); // no primary keys + } + + $sql = rtrim($sql) . ');'; + // execute the sql + $this->execute($sql); + + foreach ($indexes as $index) { + $this->addIndex($table, $index); + } + + $this->addCreatedTable($table->getName()); + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getChangePrimaryKeyInstructions(Table $table, $newColumns): AlterInstructions + { + $instructions = new AlterInstructions(); + + // Drop the existing primary key + $primaryKey = $this->getPrimaryKey($table->getName()); + if (!empty($primaryKey)) { + $instructions->merge( + // FIXME: array access is a hack to make this incomplete implementation work with a correct getPrimaryKey implementation + $this->getDropPrimaryKeyInstructions($table, $primaryKey[0], false) + ); + } + + // Add the primary key(s) + if (!empty($newColumns)) { + if (!is_string($newColumns)) { + throw new InvalidArgumentException(sprintf( + 'Invalid value for primary key: %s', + json_encode($newColumns) + )); + } + + $instructions->merge( + $this->getAddPrimaryKeyInstructions($table, $newColumns) + ); + } + + return $instructions; + } + + /** + * {@inheritDoc} + * + * SQLiteAdapter does not implement this functionality, and so will always throw an exception if used. + * + * @throws \BadMethodCallException + */ + protected function getChangeCommentInstructions(Table $table, $newComment): AlterInstructions + { + throw new BadMethodCallException('SQLite does not have table comments'); + } + + /** + * @inheritDoc + */ + protected function getRenameTableInstructions(string $tableName, string $newTableName): AlterInstructions + { + $this->updateCreatedTableName($tableName, $newTableName); + $sql = sprintf( + 'ALTER TABLE %s RENAME TO %s', + $this->quoteTableName($tableName), + $this->quoteTableName($newTableName) + ); + + return new AlterInstructions([], [$sql]); + } + + /** + * @inheritDoc + */ + protected function getDropTableInstructions(string $tableName): AlterInstructions + { + $this->removeCreatedTable($tableName); + $sql = sprintf('DROP TABLE %s', $this->quoteTableName($tableName)); + + return new AlterInstructions([], [$sql]); + } + + /** + * @inheritDoc + */ + public function truncateTable(string $tableName): void + { + $info = $this->resolveTable($tableName); + // first try deleting the rows + $this->execute(sprintf( + 'DELETE FROM %s.%s', + $this->quoteColumnName($info['schema']), + $this->quoteColumnName($info['table']) + )); + + // assuming no error occurred, reset the autoincrement (if any) + if ($this->hasTable($info['schema'] . '.sqlite_sequence')) { + $this->execute(sprintf( + 'DELETE FROM %s.%s where name = %s', + $this->quoteColumnName($info['schema']), + 'sqlite_sequence', + $this->quoteString($info['table']) + )); + } + } + + /** + * Parses a default-value expression to yield either a Literal representing + * a string value, a string representing an expression, or some other scalar + * + * @param mixed $default The default-value expression to interpret + * @param string $columnType The Phinx type of the column + * @return mixed + */ + protected function parseDefaultValue($default, string $columnType) + { + if ($default === null) { + return null; + } + + // split the input into tokens + $trimChars = " \t\n\r\0\x0B"; + $pattern = <<getTableInfo($tableName) as $col) { + $type = strtolower($col['type']); + if ($col['pk'] > 1) { + // the table has a composite primary key + return null; + } elseif ($col['pk'] == 0) { + // the column is not a primary key column and is thus not relevant + continue; + } elseif ($type !== 'integer') { + // if the primary key's type is not exactly INTEGER, it cannot be a row ID alias + return null; + } else { + // the column is a candidate for a row ID alias + $result = $col['name']; + } + } + // if there is no suitable PK column, stop now + if ($result === null) { + return null; + } + // make sure the table does not have a PK-origin autoindex + // such an autoindex would indicate either that the primary key was specified as descending, or that this is a WITHOUT ROWID table + foreach ($this->getTableInfo($tableName, 'index_list') as $idx) { + if ($idx['origin'] === 'pk') { + return null; + } + } + + return $result; + } + + /** + * @inheritDoc + */ + public function getColumns(string $tableName): array + { + $columns = []; + + $rows = $this->getTableInfo($tableName); + $identity = $this->resolveIdentity($tableName); + + foreach ($rows as $columnInfo) { + $column = new Column(); + $type = $this->getPhinxType($columnInfo['type']); + $default = $this->parseDefaultValue($columnInfo['dflt_value'], $type['name']); + + $column->setName($columnInfo['name']) + // SQLite on PHP 8.1 returns int for notnull, older versions return a string + ->setNull((int)$columnInfo['notnull'] !== 1) + ->setDefault($default) + ->setType($type['name']) + ->setLimit($type['limit']) + ->setScale($type['scale']) + ->setIdentity($columnInfo['name'] === $identity); + + $columns[] = $column; + } + + return $columns; + } + + /** + * @inheritDoc + */ + public function hasColumn(string $tableName, string $columnName): bool + { + $rows = $this->getTableInfo($tableName); + foreach ($rows as $column) { + if (strcasecmp($column['name'], $columnName) === 0) { + return true; + } + } + + return false; + } + + /** + * @inheritDoc + */ + protected function getAddColumnInstructions(Table $table, Column $column): AlterInstructions + { + $tableName = $table->getName(); + + $instructions = $this->beginAlterByCopyTable($tableName); + + $instructions->addPostStep(function ($state) use ($tableName, $column) { + // we use the final column to anchor our regex to insert the new column, + // as the alternative is unwinding all possible table constraints which + // gets messy quickly with CHECK constraints. + $columns = $this->getColumns($tableName); + if (!$columns) { + return $state; + } + $finalColumnName = end($columns)->getName(); + $sql = preg_replace( + sprintf( + "/(%s(?:\/\*.*?\*\/|\([^)]+\)|'[^']*?'|[^,])+)([,)])/", + $this->quoteColumnName($finalColumnName) + ), + sprintf( + '$1, %s %s$2', + $this->quoteColumnName($column->getName()), + $this->getColumnSqlDefinition($column) + ), + $state['createSQL'], + 1 + ); + $this->execute($sql); + + return $state; + }); + + $instructions->addPostStep(function ($state) use ($tableName) { + $newState = $this->calculateNewTableColumns($tableName, false, false); + + return $newState + $state; + }); + + return $this->copyAndDropTmpTable($instructions, $tableName); + } + + /** + * Returns the original CREATE statement for the give table + * + * @param string $tableName The table name to get the create statement for + * @return string + */ + protected function getDeclaringSql(string $tableName): string + { + $rows = $this->fetchAll("SELECT * FROM sqlite_master WHERE `type` = 'table'"); + + $sql = ''; + foreach ($rows as $table) { + if ($table['tbl_name'] === $tableName) { + $sql = $table['sql']; + } + } + + $columnsInfo = $this->getTableInfo($tableName); + + foreach ($columnsInfo as $column) { + $columnName = $column['name']; + $columnNamePattern = "\"$columnName\"|`$columnName`|\\[$columnName\\]|$columnName"; + $columnNamePattern = "#([\(,]+\\s*)($columnNamePattern)(\\s)#iU"; + + $sql = preg_replace($columnNamePattern, "$1`$columnName`$3", $sql); + } + + $tableNamePattern = "\"$tableName\"|`$tableName`|\\[$tableName\\]|$tableName"; + $tableNamePattern = "#^(CREATE TABLE)\s*($tableNamePattern)\s*(\()#Ui"; + + $sql = preg_replace($tableNamePattern, "$1 `$tableName` $3", $sql, 1); + + return $sql; + } + + /** + * Returns the original CREATE statement for the give index + * + * @param string $tableName The table name to get the create statement for + * @param string $indexName The table index + * @return string + */ + protected function getDeclaringIndexSql(string $tableName, string $indexName): string + { + $rows = $this->fetchAll("SELECT * FROM sqlite_master WHERE `type` = 'index'"); + + $sql = ''; + foreach ($rows as $table) { + if ($table['tbl_name'] === $tableName && $table['name'] === $indexName) { + $sql = $table['sql'] . '; '; + } + } + + return $sql; + } + + /** + * Copies all the data from a tmp table to another table + * + * @param string $tableName The table name to copy the data to + * @param string $tmpTableName The tmp table name where the data is stored + * @param string[] $writeColumns The list of columns in the target table + * @param string[] $selectColumns The list of columns in the tmp table + * @return void + */ + protected function copyDataToNewTable(string $tableName, string $tmpTableName, array $writeColumns, array $selectColumns): void + { + $sql = sprintf( + 'INSERT INTO %s(%s) SELECT %s FROM %s', + $this->quoteTableName($tableName), + implode(', ', $writeColumns), + implode(', ', $selectColumns), + $this->quoteTableName($tmpTableName) + ); + $this->execute($sql); + } + + /** + * Modifies the passed instructions to copy all data from the table into + * the provided tmp table and then drops the table and rename tmp table. + * + * @param \Phinx\Db\Util\AlterInstructions $instructions The instructions to modify + * @param string $tableName The table name to copy the data to + * @param bool $validateForeignKeys Whether to validate foreign keys after the copy and drop operations. Note that + * enabling this option only has an effect when the `foreign_keys` PRAGMA is set to `ON`! + * @return \Phinx\Db\Util\AlterInstructions + */ + protected function copyAndDropTmpTable( + AlterInstructions $instructions, + string $tableName, + bool $validateForeignKeys = true + ): AlterInstructions { + $instructions->addPostStep(function ($state) use ($tableName, $validateForeignKeys) { + $this->copyDataToNewTable( + $state['tmpTableName'], + $tableName, + $state['writeColumns'], + $state['selectColumns'] + ); + + $rows = $this->fetchAll( + sprintf( + " + SELECT * + FROM sqlite_master + WHERE + (`type` = 'index' OR `type` = 'trigger') + AND tbl_name = %s + AND sql IS NOT NULL + ", + $this->quoteValue($tableName) + ) + ); + + $foreignKeysEnabled = (bool)$this->fetchRow('PRAGMA foreign_keys')['foreign_keys']; + if ($foreignKeysEnabled) { + $this->execute('PRAGMA foreign_keys = OFF'); + } + $this->execute(sprintf('DROP TABLE %s', $this->quoteTableName($tableName))); + if ($foreignKeysEnabled) { + $this->execute('PRAGMA foreign_keys = ON'); + } + + $this->execute(sprintf( + 'ALTER TABLE %s RENAME TO %s', + $this->quoteTableName($state['tmpTableName']), + $this->quoteTableName($tableName) + )); + + foreach ($rows as $row) { + $this->execute($row['sql']); + } + + if ( + $foreignKeysEnabled && + $validateForeignKeys + ) { + $this->validateForeignKeys($tableName); + } + + return $state; + }); + + return $instructions; + } + + /** + * Validates the foreign key constraints of the given table, and of those + * tables whose constraints are targeting it. + * + * @param string $tableName The name of the table for which to check constraints. + * @return void + * @throws \RuntimeException In case of a foreign key constraint violation. + */ + protected function validateForeignKeys(string $tableName): void + { + $tablesToCheck = [ + $tableName, + ]; + + $otherTables = $this + ->query( + "SELECT name FROM sqlite_master WHERE type = 'table' AND name != ?", + [$tableName] + ) + ->fetchAll(); + + foreach ($otherTables as $otherTable) { + $foreignKeyList = $this->getTableInfo($otherTable['name'], 'foreign_key_list'); + foreach ($foreignKeyList as $foreignKey) { + if (strcasecmp($foreignKey['table'], $tableName) === 0) { + $tablesToCheck[] = $otherTable['name']; + break; + } + } + } + + $tablesToCheck = array_unique(array_map('strtolower', $tablesToCheck)); + + foreach ($tablesToCheck as $tableToCheck) { + $schema = $this->getSchemaName($tableToCheck, true)['schema']; + + $stmt = $this->query( + sprintf('PRAGMA %sforeign_key_check(%s)', $schema, $this->quoteTableName($tableToCheck)) + ); + $row = $stmt->fetch(); + $stmt->closeCursor(); + + if (is_array($row)) { + throw new RuntimeException(sprintf( + 'Integrity constraint violation: FOREIGN KEY constraint on `%s` failed.', + $tableToCheck + )); + } + } + } + + /** + * Returns the columns and type to use when copying a table to another in the process + * of altering a table + * + * @param string $tableName The table to modify + * @param string|false $columnName The column name that is about to change + * @param string|false $newColumnName Optionally the new name for the column + * @throws \InvalidArgumentException + * @return array + */ + protected function calculateNewTableColumns(string $tableName, $columnName, $newColumnName): array + { + $columns = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($tableName))); + $selectColumns = []; + $writeColumns = []; + $columnType = null; + $found = false; + + foreach ($columns as $column) { + $selectName = $column['name']; + $writeName = $selectName; + + if ($selectName === $columnName) { + $writeName = $newColumnName; + $found = true; + $columnType = $column['type']; + $selectName = $newColumnName === false ? $newColumnName : $selectName; + } + + $selectColumns[] = $selectName; + $writeColumns[] = $writeName; + } + + $selectColumns = array_filter($selectColumns, 'strlen'); + $writeColumns = array_filter($writeColumns, 'strlen'); + $selectColumns = array_map([$this, 'quoteColumnName'], $selectColumns); + $writeColumns = array_map([$this, 'quoteColumnName'], $writeColumns); + + if ($columnName && !$found) { + throw new InvalidArgumentException(sprintf( + 'The specified column doesn\'t exist: ' . $columnName + )); + } + + return compact('writeColumns', 'selectColumns', 'columnType'); + } + + /** + * Returns the initial instructions to alter a table using the + * create-copy-drop strategy + * + * @param string $tableName The table to modify + * @return \Phinx\Db\Util\AlterInstructions + */ + protected function beginAlterByCopyTable(string $tableName): AlterInstructions + { + $instructions = new AlterInstructions(); + $instructions->addPostStep(function ($state) use ($tableName) { + $tmpTableName = "tmp_{$tableName}"; + $createSQL = $this->getDeclaringSql($tableName); + + // Table name in SQLite can be hilarious inside declaring SQL: + // - tableName + // - `tableName` + // - "tableName" + // - [this is a valid table name too!] + // - etc. + // Just remove all characters before first "(" and build them again + $createSQL = preg_replace( + "/^CREATE TABLE .* \(/Ui", + '', + $createSQL + ); + + $createSQL = "CREATE TABLE {$this->quoteTableName($tmpTableName)} ({$createSQL}"; + + return compact('createSQL', 'tmpTableName') + $state; + }); + + return $instructions; + } + + /** + * @inheritDoc + */ + protected function getRenameColumnInstructions(string $tableName, string $columnName, string $newColumnName): AlterInstructions + { + $instructions = $this->beginAlterByCopyTable($tableName); + + $instructions->addPostStep(function ($state) use ($columnName, $newColumnName) { + $sql = str_replace( + $this->quoteColumnName($columnName), + $this->quoteColumnName($newColumnName), + $state['createSQL'] + ); + $this->execute($sql); + + return $state; + }); + + $instructions->addPostStep(function ($state) use ($columnName, $newColumnName, $tableName) { + $newState = $this->calculateNewTableColumns($tableName, $columnName, $newColumnName); + + return $newState + $state; + }); + + return $this->copyAndDropTmpTable($instructions, $tableName); + } + + /** + * @inheritDoc + */ + protected function getChangeColumnInstructions(string $tableName, string $columnName, Column $newColumn): AlterInstructions + { + $instructions = $this->beginAlterByCopyTable($tableName); + + $newColumnName = $newColumn->getName(); + $instructions->addPostStep(function ($state) use ($columnName, $newColumn) { + $sql = preg_replace( + sprintf("/%s(?:\/\*.*?\*\/|\([^)]+\)|'[^']*?'|[^,])+([,)])/", $this->quoteColumnName($columnName)), + sprintf('%s %s$1', $this->quoteColumnName($newColumn->getName()), $this->getColumnSqlDefinition($newColumn)), + $state['createSQL'], + 1 + ); + $this->execute($sql); + + return $state; + }); + + $instructions->addPostStep(function ($state) use ($columnName, $newColumnName, $tableName) { + $newState = $this->calculateNewTableColumns($tableName, $columnName, $newColumnName); + + return $newState + $state; + }); + + return $this->copyAndDropTmpTable($instructions, $tableName); + } + + /** + * @inheritDoc + */ + protected function getDropColumnInstructions(string $tableName, string $columnName): AlterInstructions + { + $instructions = $this->beginAlterByCopyTable($tableName); + + $instructions->addPostStep(function ($state) use ($tableName, $columnName) { + $newState = $this->calculateNewTableColumns($tableName, $columnName, false); + + return $newState + $state; + }); + + $instructions->addPostStep(function ($state) use ($columnName) { + $sql = preg_replace( + sprintf("/%s\s%s.*(,\s(?!')|\)$)/U", preg_quote($this->quoteColumnName($columnName)), preg_quote($state['columnType'])), + '', + $state['createSQL'] + ); + + if (substr($sql, -2) === ', ') { + $sql = substr($sql, 0, -2) . ')'; + } + + $this->execute($sql); + + return $state; + }); + + return $this->copyAndDropTmpTable($instructions, $tableName); + } + + /** + * Get an array of indexes from a particular table. + * + * @param string $tableName Table name + * @return array + */ + protected function getIndexes(string $tableName): array + { + $indexes = []; + $schema = $this->getSchemaName($tableName, true)['schema']; + $indexList = $this->getTableInfo($tableName, 'index_list'); + + foreach ($indexList as $index) { + $indexData = $this->fetchAll(sprintf('pragma %sindex_info(%s)', $schema, $this->quoteColumnName($index['name']))); + $cols = []; + foreach ($indexData as $indexItem) { + $cols[] = $indexItem['name']; + } + $indexes[$index['name']] = $cols; + } + + return $indexes; + } + + /** + * Finds the names of a table's indexes matching the supplied columns + * + * @param string $tableName The table to which the index belongs + * @param string|string[] $columns The columns of the index + * @return array + */ + protected function resolveIndex(string $tableName, $columns): array + { + $columns = array_map('strtolower', (array)$columns); + $indexes = $this->getIndexes($tableName); + $matches = []; + + foreach ($indexes as $name => $index) { + $indexCols = array_map('strtolower', $index); + if ($columns == $indexCols) { + $matches[] = $name; + } + } + + return $matches; + } + + /** + * @inheritDoc + */ + public function hasIndex(string $tableName, $columns): bool + { + return (bool)$this->resolveIndex($tableName, $columns); + } + + /** + * @inheritDoc + */ + public function hasIndexByName(string $tableName, string $indexName): bool + { + $indexName = strtolower($indexName); + $indexes = $this->getIndexes($tableName); + + foreach (array_keys($indexes) as $index) { + if ($indexName === strtolower($index)) { + return true; + } + } + + return false; + } + + /** + * @inheritDoc + */ + protected function getAddIndexInstructions(Table $table, Index $index): AlterInstructions + { + $indexColumnArray = []; + foreach ($index->getColumns() as $column) { + $indexColumnArray[] = sprintf('`%s` ASC', $column); + } + $indexColumns = implode(',', $indexColumnArray); + $sql = sprintf( + 'CREATE %s ON %s (%s)', + $this->getIndexSqlDefinition($table, $index), + $this->quoteTableName($table->getName()), + $indexColumns + ); + + return new AlterInstructions([], [$sql]); + } + + /** + * @inheritDoc + */ + protected function getDropIndexByColumnsInstructions(string $tableName, $columns): AlterInstructions + { + $instructions = new AlterInstructions(); + $indexNames = $this->resolveIndex($tableName, $columns); + $schema = $this->getSchemaName($tableName, true)['schema']; + foreach ($indexNames as $indexName) { + if (strpos($indexName, 'sqlite_autoindex_') !== 0) { + $instructions->addPostStep(sprintf( + 'DROP INDEX %s%s', + $schema, + $this->quoteColumnName($indexName) + )); + } + } + + return $instructions; + } + + /** + * @inheritDoc + */ + protected function getDropIndexByNameInstructions(string $tableName, string $indexName): AlterInstructions + { + $instructions = new AlterInstructions(); + $indexName = strtolower($indexName); + $indexes = $this->getIndexes($tableName); + + $found = false; + foreach (array_keys($indexes) as $index) { + if ($indexName === strtolower($index)) { + $found = true; + break; + } + } + + if ($found) { + $schema = $this->getSchemaName($tableName, true)['schema']; + $instructions->addPostStep(sprintf( + 'DROP INDEX %s%s', + $schema, + $this->quoteColumnName($indexName) + )); + } + + return $instructions; + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + public function hasPrimaryKey(string $tableName, $columns, ?string $constraint = null): bool + { + if ($constraint !== null) { + throw new InvalidArgumentException('SQLite does not support named constraints.'); + } + + $columns = array_map('strtolower', (array)$columns); + $primaryKey = array_map('strtolower', $this->getPrimaryKey($tableName)); + + if (array_diff($primaryKey, $columns) || array_diff($columns, $primaryKey)) { + return false; + } + + return true; + } + + /** + * Get the primary key from a particular table. + * + * @param string $tableName Table name + * @return string[] + */ + protected function getPrimaryKey(string $tableName): array + { + $primaryKey = []; + + $rows = $this->getTableInfo($tableName); + + foreach ($rows as $row) { + if ($row['pk'] > 0) { + $primaryKey[$row['pk'] - 1] = $row['name']; + } + } + + return $primaryKey; + } + + /** + * @inheritDoc + */ + public function hasForeignKey(string $tableName, $columns, ?string $constraint = null): bool + { + if ($constraint !== null) { + return preg_match( + "/,?\sCONSTRAINT\s" . preg_quote($this->quoteColumnName($constraint)) . ' FOREIGN KEY/', + $this->getDeclaringSql($tableName) + ) === 1; + } + + $columns = array_map('strtolower', (array)$columns); + $foreignKeys = $this->getForeignKeys($tableName); + + foreach ($foreignKeys as $key) { + $key = array_map('strtolower', $key); + if (array_diff($key, $columns) || array_diff($columns, $key)) { + continue; + } + + return true; + } + + return false; + } + + /** + * Get an array of foreign keys from a particular table. + * + * @param string $tableName Table name + * @return array + */ + protected function getForeignKeys(string $tableName): array + { + $foreignKeys = []; + + $rows = $this->getTableInfo($tableName, 'foreign_key_list'); + + foreach ($rows as $row) { + if (!isset($foreignKeys[$row['id']])) { + $foreignKeys[$row['id']] = []; + } + $foreignKeys[$row['id']][$row['seq']] = $row['from']; + } + + return $foreignKeys; + } + + /** + * @param \Phinx\Db\Table\Table $table The Table + * @param string $column Column Name + * @return \Phinx\Db\Util\AlterInstructions + */ + protected function getAddPrimaryKeyInstructions(Table $table, string $column): AlterInstructions + { + $instructions = $this->beginAlterByCopyTable($table->getName()); + + $tableName = $table->getName(); + $instructions->addPostStep(function ($state) use ($column) { + $matchPattern = "/(`$column`)\s+(\w+(\(\d+\))?)\s+((NOT )?NULL)/"; + + $sql = $state['createSQL']; + + if (preg_match($matchPattern, $state['createSQL'], $matches)) { + if (isset($matches[2])) { + if ($matches[2] === 'INTEGER') { + $replace = '$1 INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT'; + } else { + $replace = '$1 $2 NOT NULL PRIMARY KEY'; + } + + $sql = preg_replace($matchPattern, $replace, $state['createSQL'], 1); + } + } + + $this->execute($sql); + + return $state; + }); + + $instructions->addPostStep(function ($state) { + $columns = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($state['tmpTableName']))); + $names = array_map([$this, 'quoteColumnName'], array_column($columns, 'name')); + $selectColumns = $writeColumns = $names; + + return compact('selectColumns', 'writeColumns') + $state; + }); + + return $this->copyAndDropTmpTable($instructions, $tableName); + } + + /** + * @param \Phinx\Db\Table\Table $table Table + * @param string $column Column Name + * @param bool $validateForeignKeys Whether to validate foreign keys after the copy and drop operations. Note that + * enabling this option only has an effect when the `foreign_keys` PRAGMA is set to `ON`! + * @return \Phinx\Db\Util\AlterInstructions + */ + protected function getDropPrimaryKeyInstructions( + Table $table, + string $column, + bool $validateForeignKeys = true + ): AlterInstructions { + $instructions = $this->beginAlterByCopyTable($table->getName()); + + $instructions->addPostStep(function ($state) { + $search = "/(,?\s*PRIMARY KEY\s*\([^\)]*\)|\s+PRIMARY KEY(\s+AUTOINCREMENT)?)/"; + $sql = preg_replace($search, '', $state['createSQL'], 1); + + if ($sql) { + $this->execute($sql); + } + + return $state; + }); + + $instructions->addPostStep(function ($state) use ($column) { + $newState = $this->calculateNewTableColumns($state['tmpTableName'], $column, $column); + + return $newState + $state; + }); + + return $this->copyAndDropTmpTable($instructions, $table->getName(), $validateForeignKeys); + } + + /** + * @inheritDoc + */ + protected function getAddForeignKeyInstructions(Table $table, ForeignKey $foreignKey): AlterInstructions + { + $instructions = $this->beginAlterByCopyTable($table->getName()); + + $tableName = $table->getName(); + $instructions->addPostStep(function ($state) use ($foreignKey, $tableName) { + $this->execute('pragma foreign_keys = ON'); + $sql = substr($state['createSQL'], 0, -1) . ',' . $this->getForeignKeySqlDefinition($foreignKey) . '); '; + + //Delete indexes from original table and recreate them in temporary table + $schema = $this->getSchemaName($tableName, true)['schema']; + $tmpTableName = $state['tmpTableName']; + $indexes = $this->getIndexes($tableName); + foreach (array_keys($indexes) as $indexName) { + if (strpos($indexName, 'sqlite_autoindex_') !== 0) { + $sql .= sprintf( + 'DROP INDEX %s%s; ', + $schema, + $this->quoteColumnName($indexName) + ); + $createIndexSQL = $this->getDeclaringIndexSQL($tableName, $indexName); + $sql .= preg_replace( + "/\b{$tableName}\b/", + $tmpTableName, + $createIndexSQL + ); + } + } + + $this->execute($sql); + + return $state; + }); + + $instructions->addPostStep(function ($state) { + $columns = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($state['tmpTableName']))); + $names = array_map([$this, 'quoteColumnName'], array_column($columns, 'name')); + $selectColumns = $writeColumns = $names; + + return compact('selectColumns', 'writeColumns') + $state; + }); + + return $this->copyAndDropTmpTable($instructions, $tableName); + } + + /** + * {@inheritDoc} + * + * SQLiteAdapter does not implement this functionality, and so will always throw an exception if used. + * + * @throws \BadMethodCallException + */ + protected function getDropForeignKeyInstructions(string $tableName, string $constraint): AlterInstructions + { + throw new BadMethodCallException('SQLite does not have named foreign keys'); + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getDropForeignKeyByColumnsInstructions(string $tableName, array $columns): AlterInstructions + { + $instructions = $this->beginAlterByCopyTable($tableName); + + $instructions->addPostStep(function ($state) use ($columns) { + $sql = ''; + + foreach ($columns as $columnName) { + $search = sprintf( + "/,[^,]*\(%s(?:,`?(.*)`?)?\) REFERENCES[^,]*\([^\)]*\)[^,)]*/", + $this->quoteColumnName($columnName) + ); + $sql = preg_replace($search, '', $state['createSQL'], 1); + } + + if ($sql) { + $this->execute($sql); + } + + return $state; + }); + + $instructions->addPostStep(function ($state) use ($columns) { + $newState = $this->calculateNewTableColumns($state['tmpTableName'], $columns[0], $columns[0]); + + $selectColumns = $newState['selectColumns']; + $columns = array_map([$this, 'quoteColumnName'], $columns); + $diff = array_diff($columns, $selectColumns); + + if (!empty($diff)) { + throw new InvalidArgumentException(sprintf( + 'The specified columns don\'t exist: ' . implode(', ', $diff) + )); + } + + return $newState + $state; + }); + + return $this->copyAndDropTmpTable($instructions, $tableName); + } + + /** + * {@inheritDoc} + * + * @throws \Phinx\Db\Adapter\UnsupportedColumnTypeException + */ + public function getSqlType($type, ?int $limit = null): array + { + $typeLC = strtolower($type); + if ($type instanceof Literal) { + $name = $type; + } elseif (isset(static::$supportedColumnTypes[$typeLC])) { + $name = static::$supportedColumnTypes[$typeLC]; + } elseif (in_array($typeLC, static::$unsupportedColumnTypes, true)) { + throw new UnsupportedColumnTypeException('Column type "' . $type . '" is not supported by SQLite.'); + } else { + throw new UnsupportedColumnTypeException('Column type "' . $type . '" is not known by SQLite.'); + } + + return ['name' => $name, 'limit' => $limit]; + } + + /** + * Returns Phinx type by SQL type + * + * @param string|null $sqlTypeDef SQL Type definition + * @return array + */ + public function getPhinxType(?string $sqlTypeDef): array + { + $limit = null; + $scale = null; + if ($sqlTypeDef === null) { + // in SQLite columns can legitimately have null as a type, which is distinct from the empty string + $name = null; + } elseif (!preg_match('/^([a-z]+)(_(?:integer|float|text|blob))?(?:\((\d+)(?:,(\d+))?\))?$/i', $sqlTypeDef, $match)) { + // doesn't match the pattern of a type we'd know about + $name = Literal::from($sqlTypeDef); + } else { + // possibly a known type + $type = $match[1]; + $typeLC = strtolower($type); + $affinity = $match[2] ?? ''; + $limit = isset($match[3]) && strlen($match[3]) ? (int)$match[3] : null; + $scale = isset($match[4]) && strlen($match[4]) ? (int)$match[4] : null; + if (in_array($typeLC, ['tinyint', 'tinyinteger'], true) && $limit === 1) { + // the type is a MySQL-style boolean + $name = static::PHINX_TYPE_BOOLEAN; + $limit = null; + } elseif (isset(static::$supportedColumnTypes[$typeLC])) { + // the type is an explicitly supported type + $name = $typeLC; + } elseif (isset(static::$supportedColumnTypeAliases[$typeLC])) { + // the type is an alias for a supported type + $name = static::$supportedColumnTypeAliases[$typeLC]; + } elseif (in_array($typeLC, static::$unsupportedColumnTypes, true)) { + // unsupported but known types are passed through lowercased, and without appended affinity + $name = Literal::from($typeLC); + } else { + // unknown types are passed through as-is + $name = Literal::from($type . $affinity); + } + } + + return [ + 'name' => $name, + 'limit' => $limit, + 'scale' => $scale, + ]; + } + + /** + * @inheritDoc + */ + public function createDatabase(string $name, array $options = []): void + { + touch($name . $this->suffix); + } + + /** + * @inheritDoc + */ + public function hasDatabase(string $name): bool + { + return is_file($name . $this->suffix); + } + + /** + * @inheritDoc + */ + public function dropDatabase(string $name): void + { + $this->createdTables = []; + if ($this->getOption('memory')) { + $this->disconnect(); + $this->connect(); + } + if (file_exists($name . $this->suffix)) { + unlink($name . $this->suffix); + } + } + + /** + * Gets the SQLite Column Definition for a Column object. + * + * @param \Phinx\Db\Table\Column $column Column + * @return string + */ + protected function getColumnSqlDefinition(Column $column): string + { + $isLiteralType = $column->getType() instanceof Literal; + if ($isLiteralType) { + $def = (string)$column->getType(); + } else { + $sqlType = $this->getSqlType($column->getType()); + $def = strtoupper($sqlType['name']); + + $limitable = in_array(strtoupper($sqlType['name']), $this->definitionsWithLimits, true); + if (($column->getLimit() || isset($sqlType['limit'])) && $limitable) { + $def .= '(' . ($column->getLimit() ?: $sqlType['limit']) . ')'; + } + } + if ($column->getPrecision() && $column->getScale()) { + $def .= '(' . $column->getPrecision() . ',' . $column->getScale() . ')'; + } + + $default = $column->getDefault(); + + $def .= $column->isNull() ? ' NULL' : ' NOT NULL'; + $def .= $this->getDefaultValueDefinition($default, $column->getType()); + $def .= $column->isIdentity() ? ' PRIMARY KEY AUTOINCREMENT' : ''; + + $def .= $this->getCommentDefinition($column); + + return $def; + } + + /** + * Gets the comment Definition for a Column object. + * + * @param \Phinx\Db\Table\Column $column Column + * @return string + */ + protected function getCommentDefinition(Column $column): string + { + if ($column->getComment()) { + return ' /* ' . $column->getComment() . ' */ '; + } + + return ''; + } + + /** + * Gets the SQLite Index Definition for an Index object. + * + * @param \Phinx\Db\Table\Table $table Table + * @param \Phinx\Db\Table\Index $index Index + * @return string + */ + protected function getIndexSqlDefinition(Table $table, Index $index): string + { + if ($index->getType() === Index::UNIQUE) { + $def = 'UNIQUE INDEX'; + } else { + $def = 'INDEX'; + } + if (is_string($index->getName())) { + $indexName = $index->getName(); + } else { + $indexName = $table->getName() . '_'; + foreach ($index->getColumns() as $column) { + $indexName .= $column . '_'; + } + $indexName .= 'index'; + } + $def .= ' `' . $indexName . '`'; + + return $def; + } + + /** + * @inheritDoc + */ + public function getColumnTypes(): array + { + return array_keys(static::$supportedColumnTypes); + } + + /** + * Gets the SQLite Foreign Key Definition for an ForeignKey object. + * + * @param \Phinx\Db\Table\ForeignKey $foreignKey Foreign key + * @return string + */ + protected function getForeignKeySqlDefinition(ForeignKey $foreignKey): string + { + $def = ''; + if ($foreignKey->getConstraint()) { + $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint()); + } + $columnNames = []; + foreach ($foreignKey->getColumns() as $column) { + $columnNames[] = $this->quoteColumnName($column); + } + $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')'; + $refColumnNames = []; + foreach ($foreignKey->getReferencedColumns() as $column) { + $refColumnNames[] = $this->quoteColumnName($column); + } + $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')'; + if ($foreignKey->getOnDelete()) { + $def .= ' ON DELETE ' . $foreignKey->getOnDelete(); + } + if ($foreignKey->getOnUpdate()) { + $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate(); + } + + return $def; + } + + /** + * @inheritDoc + */ + public function getDecoratedConnection(): Connection + { + $options = $this->getOptions(); + $options['quoteIdentifiers'] = true; + + if (!empty($options['name'])) { + $options['database'] = $options['name']; + + if (file_exists($options['name'] . $this->suffix)) { + $options['database'] = $options['name'] . $this->suffix; + } + } + + if ($this->connection === null) { + throw new RuntimeException('You need to connect first.'); + } + + $driver = new SqliteDriver($options); + $driver->setConnection($this->connection); + + return new Connection(['driver' => $driver] + $options); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/SqlServerAdapter.php b/vendor/topthink/think-migration/phinx/Db/Adapter/SqlServerAdapter.php new file mode 100644 index 0000000..0fe02f0 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/SqlServerAdapter.php @@ -0,0 +1,1377 @@ + + */ +class SqlServerAdapter extends PdoAdapter +{ + /** + * @var string[] + */ + protected static $specificColumnTypes = [ + self::PHINX_TYPE_FILESTREAM, + self::PHINX_TYPE_BINARYUUID, + ]; + + /** + * @var string + */ + protected $schema = 'dbo'; + + /** + * @var bool[] + */ + protected $signedColumnTypes = [ + self::PHINX_TYPE_INTEGER => true, + self::PHINX_TYPE_BIG_INTEGER => true, + self::PHINX_TYPE_FLOAT => true, + self::PHINX_TYPE_DECIMAL => true, + ]; + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + * @return void + */ + public function connect(): void + { + if ($this->connection === null) { + if (!class_exists('PDO') || !in_array('sqlsrv', PDO::getAvailableDrivers(), true)) { + // try our connection via freetds (Mac/Linux) + $this->connectDblib(); + + return; + } + + $options = $this->getOptions(); + + $dsn = 'sqlsrv:server=' . $options['host']; + // if port is specified use it, otherwise use the SqlServer default + if (!empty($options['port'])) { + $dsn .= ',' . $options['port']; + } + $dsn .= ';database=' . $options['name'] . ';MultipleActiveResultSets=false'; + + // option to add additional connection options + // https://docs.microsoft.com/en-us/sql/connect/php/connection-options?view=sql-server-ver15 + if (isset($options['dsn_options'])) { + foreach ($options['dsn_options'] as $key => $option) { + $dsn .= ';' . $key . '=' . $option; + } + } + + $driverOptions = []; + + // charset support + if (isset($options['charset'])) { + $driverOptions[PDO::SQLSRV_ATTR_ENCODING] = $options['charset']; + } + + // use custom data fetch mode + if (!empty($options['fetch_mode'])) { + $driverOptions[PDO::ATTR_DEFAULT_FETCH_MODE] = constant('\PDO::FETCH_' . strtoupper($options['fetch_mode'])); + } + + // Note, the PDO::ATTR_PERSISTENT attribute is not supported for sqlsrv and will throw an error when used + // See https://github.com/Microsoft/msphpsql/issues/65 + + // support arbitrary \PDO::SQLSRV_ATTR_* driver options and pass them to PDO + // https://php.net/manual/en/ref.pdo-sqlsrv.php#pdo-sqlsrv.constants + foreach ($options as $key => $option) { + if (strpos($key, 'sqlsrv_attr_') === 0) { + $pdoConstant = '\PDO::' . strtoupper($key); + if (!defined($pdoConstant)) { + throw new \UnexpectedValueException('Invalid PDO attribute: ' . $key . ' (' . $pdoConstant . ')'); + } + $driverOptions[constant($pdoConstant)] = $option; + } + } + + $db = $this->createPdoConnection($dsn, $options['user'] ?? null, $options['pass'] ?? null, $driverOptions); + + $this->setConnection($db); + } + } + + /** + * Connect to MSSQL using dblib/freetds. + * + * The "sqlsrv" driver is not available on Unix machines. + * + * @throws \InvalidArgumentException + * @throws \RuntimeException + * @return void + */ + protected function connectDblib(): void + { + if (!class_exists('PDO') || !in_array('dblib', PDO::getAvailableDrivers(), true)) { + // @codeCoverageIgnoreStart + throw new RuntimeException('You need to enable the PDO_Dblib extension for Phinx to run properly.'); + // @codeCoverageIgnoreEnd + } + + $options = $this->getOptions(); + + // if port is specified use it, otherwise use the SqlServer default + if (empty($options['port'])) { + $dsn = 'dblib:host=' . $options['host'] . ';dbname=' . $options['name']; + } else { + $dsn = 'dblib:host=' . $options['host'] . ':' . $options['port'] . ';dbname=' . $options['name']; + } + + $driverOptions = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]; + + try { + $db = new PDO($dsn, $options['user'], $options['pass'], $driverOptions); + } catch (PDOException $exception) { + throw new InvalidArgumentException(sprintf( + 'There was a problem connecting to the database: %s', + $exception->getMessage() + ), 0, $exception); + } + + $this->setConnection($db); + } + + /** + * @inheritDoc + */ + public function disconnect(): void + { + $this->connection = null; + } + + /** + * @inheritDoc + */ + public function hasTransactions(): bool + { + return true; + } + + /** + * @inheritDoc + */ + public function beginTransaction(): void + { + $this->execute('BEGIN TRANSACTION'); + } + + /** + * @inheritDoc + */ + public function commitTransaction(): void + { + $this->execute('COMMIT TRANSACTION'); + } + + /** + * @inheritDoc + */ + public function rollbackTransaction(): void + { + $this->execute('ROLLBACK TRANSACTION'); + } + + /** + * @inheritDoc + */ + public function quoteTableName(string $tableName): string + { + return str_replace('.', '].[', $this->quoteColumnName($tableName)); + } + + /** + * @inheritDoc + */ + public function quoteColumnName(string $columnName): string + { + return '[' . str_replace(']', '\]', $columnName) . ']'; + } + + /** + * @inheritDoc + */ + public function hasTable(string $tableName): bool + { + if ($this->hasCreatedTable($tableName)) { + return true; + } + + /** @var array $result */ + $result = $this->fetchRow(sprintf("SELECT count(*) as [count] FROM information_schema.tables WHERE table_name = '%s';", $tableName)); + + return $result['count'] > 0; + } + + /** + * @inheritDoc + */ + public function createTable(Table $table, array $columns = [], array $indexes = []): void + { + $options = $table->getOptions(); + + // Add the default primary key + if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { + $options['id'] = 'id'; + } + + if (isset($options['id']) && is_string($options['id'])) { + // Handle id => "field_name" to support AUTO_INCREMENT + $column = new Column(); + $column->setName($options['id']) + ->setType('integer') + ->setOptions(['identity' => true]); + + array_unshift($columns, $column); + if (isset($options['primary_key']) && (array)$options['id'] !== (array)$options['primary_key']) { + throw new InvalidArgumentException('You cannot enable an auto incrementing ID field and a primary key'); + } + $options['primary_key'] = $options['id']; + } + + $sql = 'CREATE TABLE '; + $sql .= $this->quoteTableName($table->getName()) . ' ('; + $sqlBuffer = []; + $columnsWithComments = []; + foreach ($columns as $column) { + $sqlBuffer[] = $this->quoteColumnName($column->getName()) . ' ' . $this->getColumnSqlDefinition($column); + + // set column comments, if needed + if ($column->getComment()) { + $columnsWithComments[] = $column; + } + } + + // set the primary key(s) + if (isset($options['primary_key'])) { + $pkSql = sprintf('CONSTRAINT PK_%s PRIMARY KEY (', $table->getName()); + if (is_string($options['primary_key'])) { // handle primary_key => 'id' + $pkSql .= $this->quoteColumnName($options['primary_key']); + } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id') + $pkSql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key'])); + } + $pkSql .= ')'; + $sqlBuffer[] = $pkSql; + } + + $sql .= implode(', ', $sqlBuffer); + $sql .= ');'; + + // process column comments + foreach ($columnsWithComments as $column) { + $sql .= $this->getColumnCommentSqlDefinition($column, $table->getName()); + } + + // set the indexes + foreach ($indexes as $index) { + $sql .= $this->getIndexSqlDefinition($index, $table->getName()); + } + + // execute the sql + $this->execute($sql); + + $this->addCreatedTable($table->getName()); + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getChangePrimaryKeyInstructions(Table $table, $newColumns): AlterInstructions + { + $instructions = new AlterInstructions(); + + // Drop the existing primary key + $primaryKey = $this->getPrimaryKey($table->getName()); + if (!empty($primaryKey['constraint'])) { + $sql = sprintf( + 'DROP CONSTRAINT %s', + $this->quoteColumnName($primaryKey['constraint']) + ); + $instructions->addAlter($sql); + } + + // Add the primary key(s) + if (!empty($newColumns)) { + $sql = sprintf( + 'ALTER TABLE %s ADD CONSTRAINT %s PRIMARY KEY (', + $this->quoteTableName($table->getName()), + $this->quoteColumnName('PK_' . $table->getName()) + ); + if (is_string($newColumns)) { // handle primary_key => 'id' + $sql .= $this->quoteColumnName($newColumns); + } elseif (is_array($newColumns)) { // handle primary_key => array('tag_id', 'resource_id') + $sql .= implode(',', array_map([$this, 'quoteColumnName'], $newColumns)); + } else { + throw new InvalidArgumentException(sprintf( + 'Invalid value for primary key: %s', + json_encode($newColumns) + )); + } + $sql .= ')'; + $instructions->addPostStep($sql); + } + + return $instructions; + } + + /** + * @inheritDoc + * + * SqlServer does not implement this functionality, and so will always throw an exception if used. + * @throws \BadMethodCallException + */ + protected function getChangeCommentInstructions(Table $table, ?string $newComment): AlterInstructions + { + throw new BadMethodCallException('SqlServer does not have table comments'); + } + + /** + * Gets the SqlServer Column Comment Defininition for a column object. + * + * @param \Phinx\Db\Table\Column $column Column + * @param string $tableName Table name + * @return string + */ + protected function getColumnCommentSqlDefinition(Column $column, $tableName): string + { + // passing 'null' is to remove column comment + $currentComment = $this->getColumnComment($tableName, $column->getName()); + + $comment = strcasecmp($column->getComment(), 'NULL') !== 0 ? $this->getConnection()->quote($column->getComment()) : '\'\''; + $command = $currentComment === null ? 'sp_addextendedproperty' : 'sp_updateextendedproperty'; + + return sprintf( + "EXECUTE %s N'MS_Description', N%s, N'SCHEMA', N'%s', N'TABLE', N'%s', N'COLUMN', N'%s';", + $command, + $comment, + $this->schema, + $tableName, + $column->getName() + ); + } + + /** + * @inheritDoc + */ + protected function getRenameTableInstructions(string $tableName, string $newTableName): AlterInstructions + { + $this->updateCreatedTableName($tableName, $newTableName); + $sql = sprintf( + "EXEC sp_rename '%s', '%s'", + $tableName, + $newTableName + ); + + return new AlterInstructions([], [$sql]); + } + + /** + * @inheritDoc + */ + protected function getDropTableInstructions(string $tableName): AlterInstructions + { + $this->removeCreatedTable($tableName); + $sql = sprintf('DROP TABLE %s', $this->quoteTableName($tableName)); + + return new AlterInstructions([], [$sql]); + } + + /** + * @inheritDoc + */ + public function truncateTable(string $tableName): void + { + $sql = sprintf( + 'TRUNCATE TABLE %s', + $this->quoteTableName($tableName) + ); + + $this->execute($sql); + } + + /** + * @param string $tableName Table name + * @param string $columnName Column name + * @return string|null + */ + public function getColumnComment(string $tableName, string $columnName): ?string + { + $sql = sprintf("SELECT cast(extended_properties.[value] as nvarchar(4000)) comment + FROM sys.schemas + INNER JOIN sys.tables + ON schemas.schema_id = tables.schema_id + INNER JOIN sys.columns + ON tables.object_id = columns.object_id + INNER JOIN sys.extended_properties + ON tables.object_id = extended_properties.major_id + AND columns.column_id = extended_properties.minor_id + AND extended_properties.name = 'MS_Description' + WHERE schemas.[name] = '%s' AND tables.[name] = '%s' AND columns.[name] = '%s'", $this->schema, $tableName, $columnName); + $row = $this->fetchRow($sql); + + if ($row) { + return trim($row['comment']); + } + + return null; + } + + /** + * @inheritDoc + */ + public function getColumns(string $tableName): array + { + $columns = []; + $sql = sprintf( + "SELECT DISTINCT TABLE_SCHEMA AS [schema], TABLE_NAME as [table_name], COLUMN_NAME AS [name], DATA_TYPE AS [type], + IS_NULLABLE AS [null], COLUMN_DEFAULT AS [default], + CHARACTER_MAXIMUM_LENGTH AS [char_length], + NUMERIC_PRECISION AS [precision], + NUMERIC_SCALE AS [scale], ORDINAL_POSITION AS [ordinal_position], + COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as [identity] + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME = '%s' + ORDER BY ordinal_position", + $tableName + ); + $rows = $this->fetchAll($sql); + foreach ($rows as $columnInfo) { + try { + $type = $this->getPhinxType($columnInfo['type']); + } catch (UnsupportedColumnTypeException $e) { + $type = Literal::from($columnInfo['type']); + } + + $column = new Column(); + $column->setName($columnInfo['name']) + ->setType($type) + ->setNull($columnInfo['null'] !== 'NO') + ->setDefault($this->parseDefault($columnInfo['default'])) + ->setIdentity($columnInfo['identity'] === '1') + ->setComment($this->getColumnComment($columnInfo['table_name'], $columnInfo['name'])); + + if (!empty($columnInfo['char_length'])) { + $column->setLimit($columnInfo['char_length']); + } + + $columns[$columnInfo['name']] = $column; + } + + return $columns; + } + + /** + * @param string|null $default Default + * @return int|string|null + */ + protected function parseDefault(?string $default) + { + // if a column is non-nullable and has no default, the value of column_default is null, + // otherwise it should be a string value that we parse below, including "(NULL)" which + // also stands for a null default + if ($default === null) { + return null; + } + + $result = preg_replace(["/\('(.*)'\)/", "/\(\((.*)\)\)/", "/\((.*)\)/"], '$1', $default); + + if (strtoupper($result) === 'NULL') { + $result = null; + } elseif (is_numeric($result)) { + $result = (int)$result; + } + + return $result; + } + + /** + * @inheritDoc + */ + public function hasColumn(string $tableName, string $columnName): bool + { + $sql = sprintf( + "SELECT count(*) as [count] + FROM information_schema.columns + WHERE table_name = '%s' AND column_name = '%s'", + $tableName, + $columnName + ); + /** @var array $result */ + $result = $this->fetchRow($sql); + + return $result['count'] > 0; + } + + /** + * @inheritDoc + */ + protected function getAddColumnInstructions(Table $table, Column $column): AlterInstructions + { + $alter = sprintf( + 'ALTER TABLE %s ADD %s %s', + $table->getName(), + $this->quoteColumnName($column->getName()), + $this->getColumnSqlDefinition($column) + ); + + return new AlterInstructions([], [$alter]); + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getRenameColumnInstructions(string $tableName, string $columnName, string $newColumnName): AlterInstructions + { + if (!$this->hasColumn($tableName, $columnName)) { + throw new InvalidArgumentException("The specified column does not exist: $columnName"); + } + + $instructions = new AlterInstructions(); + + $oldConstraintName = "DF_{$tableName}_{$columnName}"; + $newConstraintName = "DF_{$tableName}_{$newColumnName}"; + $sql = <<addPostStep(sprintf( + $sql, + $oldConstraintName, + $newConstraintName + )); + + $instructions->addPostStep(sprintf( + "EXECUTE sp_rename N'%s.%s', N'%s', 'COLUMN' ", + $tableName, + $columnName, + $newColumnName + )); + + return $instructions; + } + + /** + * Returns the instructions to change a column default value + * + * @param string $tableName The table where the column is + * @param \Phinx\Db\Table\Column $newColumn The column to alter + * @return \Phinx\Db\Util\AlterInstructions + */ + protected function getChangeDefault(string $tableName, Column $newColumn): AlterInstructions + { + $constraintName = "DF_{$tableName}_{$newColumn->getName()}"; + $default = $newColumn->getDefault(); + $instructions = new AlterInstructions(); + + if ($default === null) { + $default = 'DEFAULT NULL'; + } else { + $default = ltrim($this->getDefaultValueDefinition($default)); + } + + if (empty($default)) { + return $instructions; + } + + $instructions->addPostStep(sprintf( + 'ALTER TABLE %s ADD CONSTRAINT %s %s FOR %s', + $this->quoteTableName($tableName), + $constraintName, + $default, + $this->quoteColumnName($newColumn->getName()) + )); + + return $instructions; + } + + /** + * @inheritDoc + */ + protected function getChangeColumnInstructions(string $tableName, string $columnName, Column $newColumn): AlterInstructions + { + $columns = $this->getColumns($tableName); + $changeDefault = + $newColumn->getDefault() !== $columns[$columnName]->getDefault() || + $newColumn->getType() !== $columns[$columnName]->getType(); + + $instructions = new AlterInstructions(); + + if ($columnName !== $newColumn->getName()) { + $instructions->merge( + $this->getRenameColumnInstructions($tableName, $columnName, $newColumn->getName()) + ); + } + + if ($changeDefault) { + $instructions->merge($this->getDropDefaultConstraint($tableName, $newColumn->getName())); + } + + $instructions->addPostStep(sprintf( + 'ALTER TABLE %s ALTER COLUMN %s %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($newColumn->getName()), + $this->getColumnSqlDefinition($newColumn, false) + )); + // change column comment if needed + if ($newColumn->getComment()) { + $instructions->addPostStep($this->getColumnCommentSqlDefinition($newColumn, $tableName)); + } + + if ($changeDefault) { + $instructions->merge($this->getChangeDefault($tableName, $newColumn)); + } + + return $instructions; + } + + /** + * @inheritDoc + */ + protected function getDropColumnInstructions(string $tableName, string $columnName): AlterInstructions + { + $instructions = $this->getDropDefaultConstraint($tableName, $columnName); + + $instructions->addPostStep(sprintf( + 'ALTER TABLE %s DROP COLUMN %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName) + )); + + return $instructions; + } + + /** + * @param string $tableName Table name + * @param string|null $columnName Column name + * @return \Phinx\Db\Util\AlterInstructions + */ + protected function getDropDefaultConstraint(string $tableName, ?string $columnName): AlterInstructions + { + $defaultConstraint = $this->getDefaultConstraint($tableName, $columnName); + + if (!$defaultConstraint) { + return new AlterInstructions(); + } + + return $this->getDropForeignKeyInstructions($tableName, $defaultConstraint); + } + + /** + * @param string $tableName Table name + * @param string $columnName Column name + * @return string|false + */ + protected function getDefaultConstraint(string $tableName, string $columnName) + { + $sql = "SELECT + default_constraints.name +FROM + sys.all_columns + + INNER JOIN + sys.tables + ON all_columns.object_id = tables.object_id + + INNER JOIN + sys.schemas + ON tables.schema_id = schemas.schema_id + + INNER JOIN + sys.default_constraints + ON all_columns.default_object_id = default_constraints.object_id + +WHERE + schemas.name = 'dbo' + AND tables.name = '{$tableName}' + AND all_columns.name = '{$columnName}'"; + + $rows = $this->fetchAll($sql); + + return empty($rows) ? false : $rows[0]['name']; + } + + /** + * @param int $tableId Table ID + * @param int $indexId Index ID + * @return array + */ + protected function getIndexColums(int $tableId, int $indexId): array + { + $sql = "SELECT AC.[name] AS [column_name] +FROM sys.[index_columns] IC + INNER JOIN sys.[all_columns] AC ON IC.[column_id] = AC.[column_id] +WHERE AC.[object_id] = {$tableId} AND IC.[index_id] = {$indexId} AND IC.[object_id] = {$tableId} +ORDER BY IC.[key_ordinal];"; + + $rows = $this->fetchAll($sql); + $columns = []; + foreach ($rows as $row) { + $columns[] = strtolower($row['column_name']); + } + + return $columns; + } + + /** + * Get an array of indexes from a particular table. + * + * @param string $tableName Table name + * @return array + */ + public function getIndexes(string $tableName): array + { + $indexes = []; + $sql = "SELECT I.[name] AS [index_name], I.[index_id] as [index_id], T.[object_id] as [table_id] +FROM sys.[tables] AS T + INNER JOIN sys.[indexes] I ON T.[object_id] = I.[object_id] +WHERE T.[is_ms_shipped] = 0 AND I.[type_desc] <> 'HEAP' AND T.[name] = '{$tableName}' +ORDER BY T.[name], I.[index_id];"; + + $rows = $this->fetchAll($sql); + foreach ($rows as $row) { + $columns = $this->getIndexColums($row['table_id'], $row['index_id']); + $indexes[$row['index_name']] = ['columns' => $columns]; + } + + return $indexes; + } + + /** + * @inheritDoc + */ + public function hasIndex(string $tableName, $columns): bool + { + if (is_string($columns)) { + $columns = [$columns]; // str to array + } + + $columns = array_map('strtolower', $columns); + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $index) { + $a = array_diff($columns, $index['columns']); + + if (empty($a)) { + return true; + } + } + + return false; + } + + /** + * @inheritDoc + */ + public function hasIndexByName(string $tableName, string $indexName): bool + { + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $name => $index) { + if ($name === $indexName) { + return true; + } + } + + return false; + } + + /** + * @inheritDoc + */ + protected function getAddIndexInstructions(Table $table, Index $index): AlterInstructions + { + $sql = $this->getIndexSqlDefinition($index, $table->getName()); + + return new AlterInstructions([], [$sql]); + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getDropIndexByColumnsInstructions(string $tableName, $columns): AlterInstructions + { + if (is_string($columns)) { + $columns = [$columns]; // str to array + } + + $indexes = $this->getIndexes($tableName); + $columns = array_map('strtolower', $columns); + $instructions = new AlterInstructions(); + + foreach ($indexes as $indexName => $index) { + $a = array_diff($columns, $index['columns']); + if (empty($a)) { + $instructions->addPostStep(sprintf( + 'DROP INDEX %s ON %s', + $this->quoteColumnName($indexName), + $this->quoteTableName($tableName) + )); + + return $instructions; + } + } + + throw new InvalidArgumentException(sprintf( + "The specified index on columns '%s' does not exist", + implode(',', $columns) + )); + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + */ + protected function getDropIndexByNameInstructions(string $tableName, string $indexName): AlterInstructions + { + $indexes = $this->getIndexes($tableName); + $instructions = new AlterInstructions(); + + foreach ($indexes as $name => $index) { + if ($name === $indexName) { + $instructions->addPostStep(sprintf( + 'DROP INDEX %s ON %s', + $this->quoteColumnName($indexName), + $this->quoteTableName($tableName) + )); + + return $instructions; + } + } + + throw new InvalidArgumentException(sprintf( + "The specified index name '%s' does not exist", + $indexName + )); + } + + /** + * @inheritDoc + */ + public function hasPrimaryKey(string $tableName, $columns, ?string $constraint = null): bool + { + $primaryKey = $this->getPrimaryKey($tableName); + + if (empty($primaryKey)) { + return false; + } + + if ($constraint) { + return $primaryKey['constraint'] === $constraint; + } + + if (is_string($columns)) { + $columns = [$columns]; // str to array + } + $missingColumns = array_diff($columns, $primaryKey['columns']); + + return empty($missingColumns); + } + + /** + * Get the primary key from a particular table. + * + * @param string $tableName Table name + * @return array + */ + public function getPrimaryKey(string $tableName): array + { + $rows = $this->fetchAll(sprintf( + "SELECT + tc.constraint_name, + kcu.column_name + FROM information_schema.table_constraints AS tc + JOIN information_schema.key_column_usage AS kcu + ON tc.constraint_name = kcu.constraint_name + WHERE constraint_type = 'PRIMARY KEY' + AND tc.table_name = '%s' + ORDER BY kcu.ordinal_position", + $tableName + )); + + $primaryKey = [ + 'columns' => [], + ]; + foreach ($rows as $row) { + $primaryKey['constraint'] = $row['constraint_name']; + $primaryKey['columns'][] = $row['column_name']; + } + + return $primaryKey; + } + + /** + * @inheritDoc + */ + public function hasForeignKey(string $tableName, $columns, ?string $constraint = null): bool + { + if (is_string($columns)) { + $columns = [$columns]; // str to array + } + $foreignKeys = $this->getForeignKeys($tableName); + if ($constraint) { + if (isset($foreignKeys[$constraint])) { + return !empty($foreignKeys[$constraint]); + } + + return false; + } + + foreach ($foreignKeys as $key) { + $a = array_diff($columns, $key['columns']); + if (empty($a)) { + return true; + } + } + + return false; + } + + /** + * Get an array of foreign keys from a particular table. + * + * @param string $tableName Table name + * @return array + */ + protected function getForeignKeys(string $tableName): array + { + $foreignKeys = []; + $rows = $this->fetchAll(sprintf( + "SELECT + tc.constraint_name, + tc.table_name, kcu.column_name, + ccu.table_name AS referenced_table_name, + ccu.column_name AS referenced_column_name + FROM + information_schema.table_constraints AS tc + JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name + JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name + WHERE constraint_type = 'FOREIGN KEY' AND tc.table_name = '%s' + ORDER BY kcu.ordinal_position", + $tableName + )); + foreach ($rows as $row) { + $foreignKeys[$row['constraint_name']]['table'] = $row['table_name']; + $foreignKeys[$row['constraint_name']]['columns'][] = $row['column_name']; + $foreignKeys[$row['constraint_name']]['referenced_table'] = $row['referenced_table_name']; + $foreignKeys[$row['constraint_name']]['referenced_columns'][] = $row['referenced_column_name']; + } + + return $foreignKeys; + } + + /** + * @inheritDoc + */ + protected function getAddForeignKeyInstructions(Table $table, ForeignKey $foreignKey): AlterInstructions + { + $instructions = new AlterInstructions(); + $instructions->addPostStep(sprintf( + 'ALTER TABLE %s ADD %s', + $this->quoteTableName($table->getName()), + $this->getForeignKeySqlDefinition($foreignKey, $table->getName()) + )); + + return $instructions; + } + + /** + * @inheritDoc + */ + protected function getDropForeignKeyInstructions(string $tableName, string $constraint): AlterInstructions + { + $instructions = new AlterInstructions(); + $instructions->addPostStep(sprintf( + 'ALTER TABLE %s DROP CONSTRAINT %s', + $this->quoteTableName($tableName), + $constraint + )); + + return $instructions; + } + + /** + * @inheritDoc + */ + protected function getDropForeignKeyByColumnsInstructions(string $tableName, array $columns): AlterInstructions + { + $instructions = new AlterInstructions(); + + foreach ($columns as $column) { + $rows = $this->fetchAll(sprintf( + "SELECT + tc.constraint_name, + tc.table_name, kcu.column_name, + ccu.table_name AS referenced_table_name, + ccu.column_name AS referenced_column_name + FROM + information_schema.table_constraints AS tc + JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name + JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name + WHERE constraint_type = 'FOREIGN KEY' AND tc.table_name = '%s' and ccu.column_name='%s' + ORDER BY kcu.ordinal_position", + $tableName, + $column + )); + foreach ($rows as $row) { + $instructions->merge( + $this->getDropForeignKeyInstructions($tableName, $row['constraint_name']) + ); + } + } + + return $instructions; + } + + /** + * {@inheritDoc} + * + * @throws \Phinx\Db\Adapter\UnsupportedColumnTypeException + */ + public function getSqlType($type, ?int $limit = null): array + { + switch ($type) { + case static::PHINX_TYPE_FLOAT: + case static::PHINX_TYPE_DECIMAL: + case static::PHINX_TYPE_DATETIME: + case static::PHINX_TYPE_TIME: + case static::PHINX_TYPE_DATE: + return ['name' => $type]; + case static::PHINX_TYPE_STRING: + return ['name' => 'nvarchar', 'limit' => 255]; + case static::PHINX_TYPE_CHAR: + return ['name' => 'nchar', 'limit' => 255]; + case static::PHINX_TYPE_TEXT: + return ['name' => 'ntext']; + case static::PHINX_TYPE_INTEGER: + return ['name' => 'int']; + case static::PHINX_TYPE_TINY_INTEGER: + return ['name' => 'tinyint']; + case static::PHINX_TYPE_SMALL_INTEGER: + return ['name' => 'smallint']; + case static::PHINX_TYPE_BIG_INTEGER: + return ['name' => 'bigint']; + case static::PHINX_TYPE_TIMESTAMP: + return ['name' => 'datetime']; + case static::PHINX_TYPE_BLOB: + case static::PHINX_TYPE_BINARY: + return ['name' => 'varbinary']; + case static::PHINX_TYPE_BOOLEAN: + return ['name' => 'bit']; + case static::PHINX_TYPE_BINARYUUID: + case static::PHINX_TYPE_UUID: + return ['name' => 'uniqueidentifier']; + case static::PHINX_TYPE_FILESTREAM: + return ['name' => 'varbinary', 'limit' => 'max']; + // Geospatial database types + case static::PHINX_TYPE_GEOGRAPHY: + case static::PHINX_TYPE_POINT: + case static::PHINX_TYPE_LINESTRING: + case static::PHINX_TYPE_POLYGON: + // SQL Server stores all spatial data using a single data type. + // Specific types (point, polygon, etc) are set at insert time. + return ['name' => 'geography']; + // Geometry specific type + case static::PHINX_TYPE_GEOMETRY: + return ['name' => 'geometry']; + default: + throw new UnsupportedColumnTypeException('Column type "' . $type . '" is not supported by SqlServer.'); + } + } + + /** + * Returns Phinx type by SQL type + * + * @internal param string $sqlType SQL type + * @param string $sqlType SQL Type definition + * @throws \Phinx\Db\Adapter\UnsupportedColumnTypeException + * @return string Phinx type + */ + public function getPhinxType(string $sqlType): string + { + switch ($sqlType) { + case 'nvarchar': + case 'varchar': + return static::PHINX_TYPE_STRING; + case 'char': + case 'nchar': + return static::PHINX_TYPE_CHAR; + case 'text': + case 'ntext': + return static::PHINX_TYPE_TEXT; + case 'int': + case 'integer': + return static::PHINX_TYPE_INTEGER; + case 'decimal': + case 'numeric': + case 'money': + return static::PHINX_TYPE_DECIMAL; + case 'tinyint': + return static::PHINX_TYPE_TINY_INTEGER; + case 'smallint': + return static::PHINX_TYPE_SMALL_INTEGER; + case 'bigint': + return static::PHINX_TYPE_BIG_INTEGER; + case 'real': + case 'float': + return static::PHINX_TYPE_FLOAT; + case 'binary': + case 'image': + case 'varbinary': + return static::PHINX_TYPE_BINARY; + case 'time': + return static::PHINX_TYPE_TIME; + case 'date': + return static::PHINX_TYPE_DATE; + case 'datetime': + case 'timestamp': + return static::PHINX_TYPE_DATETIME; + case 'bit': + return static::PHINX_TYPE_BOOLEAN; + case 'uniqueidentifier': + return static::PHINX_TYPE_UUID; + case 'filestream': + return static::PHINX_TYPE_FILESTREAM; + default: + throw new UnsupportedColumnTypeException('Column type "' . $sqlType . '" is not supported by SqlServer.'); + } + } + + /** + * @inheritDoc + */ + public function createDatabase(string $name, array $options = []): void + { + if (isset($options['collation'])) { + $this->execute(sprintf('CREATE DATABASE [%s] COLLATE [%s]', $name, $options['collation'])); + } else { + $this->execute(sprintf('CREATE DATABASE [%s]', $name)); + } + $this->execute(sprintf('USE [%s]', $name)); + } + + /** + * @inheritDoc + */ + public function hasDatabase(string $name): bool + { + /** @var array $result */ + $result = $this->fetchRow( + sprintf( + "SELECT count(*) as [count] FROM master.dbo.sysdatabases WHERE [name] = '%s'", + $name + ) + ); + + return $result['count'] > 0; + } + + /** + * @inheritDoc + */ + public function dropDatabase(string $name): void + { + $sql = <<execute($sql); + $this->createdTables = []; + } + + /** + * Gets the SqlServer Column Definition for a Column object. + * + * @param \Phinx\Db\Table\Column $column Column + * @param bool $create Create column flag + * @return string + */ + protected function getColumnSqlDefinition(Column $column, bool $create = true): string + { + $buffer = []; + if ($column->getType() instanceof Literal) { + $buffer[] = (string)$column->getType(); + } else { + $sqlType = $this->getSqlType($column->getType()); + $buffer[] = strtoupper($sqlType['name']); + // integers cant have limits in SQlServer + $noLimits = [ + 'bigint', + 'int', + 'tinyint', + 'smallint', + ]; + if ($sqlType['name'] === static::PHINX_TYPE_DECIMAL && $column->getPrecision() && $column->getScale()) { + $buffer[] = sprintf( + '(%s, %s)', + $column->getPrecision() ?: $sqlType['precision'], + $column->getScale() ?: $sqlType['scale'] + ); + } elseif (!in_array($sqlType['name'], $noLimits) && ($column->getLimit() || isset($sqlType['limit']))) { + $buffer[] = sprintf('(%s)', $column->getLimit() ?: $sqlType['limit']); + } + } + + $properties = $column->getProperties(); + $buffer[] = $column->getType() === 'filestream' ? 'FILESTREAM' : ''; + $buffer[] = isset($properties['rowguidcol']) ? 'ROWGUIDCOL' : ''; + + $buffer[] = $column->isNull() ? 'NULL' : 'NOT NULL'; + + if ($create === true) { + if ($column->getDefault() === null && $column->isNull()) { + $buffer[] = ' DEFAULT NULL'; + } else { + $buffer[] = $this->getDefaultValueDefinition($column->getDefault()); + } + } + + if ($column->isIdentity()) { + $seed = $column->getSeed() ?: 1; + $increment = $column->getIncrement() ?: 1; + $buffer[] = sprintf('IDENTITY(%d,%d)', $seed, $increment); + } + + return implode(' ', $buffer); + } + + /** + * Gets the SqlServer Index Definition for an Index object. + * + * @param \Phinx\Db\Table\Index $index Index + * @param string $tableName Table name + * @return string + */ + protected function getIndexSqlDefinition(Index $index, string $tableName): string + { + $columnNames = $index->getColumns(); + if (is_string($index->getName())) { + $indexName = $index->getName(); + } else { + $indexName = sprintf('%s_%s', $tableName, implode('_', $columnNames)); + } + $order = $index->getOrder() ?? []; + $columnNames = array_map(function ($columnName) use ($order) { + $ret = '[' . $columnName . ']'; + if (isset($order[$columnName])) { + $ret .= ' ' . $order[$columnName]; + } + + return $ret; + }, $columnNames); + + $includedColumns = $index->getInclude() ? sprintf('INCLUDE ([%s])', implode('],[', $index->getInclude())) : ''; + + return sprintf( + 'CREATE %s INDEX %s ON %s (%s) %s;', + ($index->getType() === Index::UNIQUE ? 'UNIQUE' : ''), + $indexName, + $this->quoteTableName($tableName), + implode(',', $columnNames), + $includedColumns + ); + } + + /** + * Gets the SqlServer Foreign Key Definition for an ForeignKey object. + * + * @param \Phinx\Db\Table\ForeignKey $foreignKey Foreign key + * @param string $tableName Table name + * @return string + */ + protected function getForeignKeySqlDefinition(ForeignKey $foreignKey, string $tableName): string + { + $constraintName = $foreignKey->getConstraint() ?: $tableName . '_' . implode('_', $foreignKey->getColumns()); + $def = ' CONSTRAINT ' . $this->quoteColumnName($constraintName); + $def .= ' FOREIGN KEY ("' . implode('", "', $foreignKey->getColumns()) . '")'; + $def .= " REFERENCES {$this->quoteTableName($foreignKey->getReferencedTable()->getName())} (\"" . implode('", "', $foreignKey->getReferencedColumns()) . '")'; + if ($foreignKey->getOnDelete()) { + $def .= " ON DELETE {$foreignKey->getOnDelete()}"; + } + if ($foreignKey->getOnUpdate()) { + $def .= " ON UPDATE {$foreignKey->getOnUpdate()}"; + } + + return $def; + } + + /** + * @inheritDoc + */ + public function getColumnTypes(): array + { + return array_merge(parent::getColumnTypes(), static::$specificColumnTypes); + } + + /** + * Records a migration being run. + * + * @param \Phinx\Migration\MigrationInterface $migration Migration + * @param string $direction Direction + * @param string $startTime Start Time + * @param string $endTime End Time + * @return \Phinx\Db\Adapter\AdapterInterface + */ + public function migrated(MigrationInterface $migration, string $direction, string $startTime, string $endTime): AdapterInterface + { + $startTime = str_replace(' ', 'T', $startTime); + $endTime = str_replace(' ', 'T', $endTime); + + return parent::migrated($migration, $direction, $startTime, $endTime); + } + + /** + * @inheritDoc + */ + public function getDecoratedConnection(): Connection + { + $options = $this->getOptions(); + $options = [ + 'username' => $options['user'] ?? null, + 'password' => $options['pass'] ?? null, + 'database' => $options['name'], + 'quoteIdentifiers' => true, + ] + $options; + + $driver = new SqlServerDriver($options); + $driver->setConnection($this->connection); + + return new Connection(['driver' => $driver] + $options); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/TablePrefixAdapter.php b/vendor/topthink/think-migration/phinx/Db/Adapter/TablePrefixAdapter.php new file mode 100644 index 0000000..dafc840 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/TablePrefixAdapter.php @@ -0,0 +1,494 @@ + + */ +class TablePrefixAdapter extends AdapterWrapper implements DirectActionInterface +{ + /** + * @inheritDoc + */ + public function getAdapterType(): string + { + return 'TablePrefixAdapter'; + } + + /** + * @inheritDoc + */ + public function hasTable(string $tableName): bool + { + $adapterTableName = $this->getAdapterTableName($tableName); + + return parent::hasTable($adapterTableName); + } + + /** + * @inheritDoc + */ + public function createTable(Table $table, array $columns = [], array $indexes = []): void + { + $adapterTable = new Table( + $this->getAdapterTableName($table->getName()), + $table->getOptions() + ); + parent::createTable($adapterTable, $columns, $indexes); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function changePrimaryKey(Table $table, $newColumns): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + + $adapterTable = new Table( + $this->getAdapterTableName($table->getName()), + $table->getOptions() + ); + $adapter->changePrimaryKey($adapterTable, $newColumns); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function changeComment(Table $table, ?string $newComment): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + + $adapterTable = new Table( + $this->getAdapterTableName($table->getName()), + $table->getOptions() + ); + $adapter->changeComment($adapterTable, $newComment); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function renameTable(string $tableName, string $newTableName): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + + $adapterTableName = $this->getAdapterTableName($tableName); + $adapterNewTableName = $this->getAdapterTableName($newTableName); + $adapter->renameTable($adapterTableName, $adapterNewTableName); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function dropTable(string $tableName): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + $adapterTableName = $this->getAdapterTableName($tableName); + $adapter->dropTable($adapterTableName); + } + + /** + * @inheritDoc + */ + public function truncateTable(string $tableName): void + { + $adapterTableName = $this->getAdapterTableName($tableName); + parent::truncateTable($adapterTableName); + } + + /** + * @inheritDoc + */ + public function getColumns(string $tableName): array + { + $adapterTableName = $this->getAdapterTableName($tableName); + + return parent::getColumns($adapterTableName); + } + + /** + * @inheritDoc + */ + public function hasColumn(string $tableName, string $columnName): bool + { + $adapterTableName = $this->getAdapterTableName($tableName); + + return parent::hasColumn($adapterTableName, $columnName); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function addColumn(Table $table, Column $column): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + $adapterTableName = $this->getAdapterTableName($table->getName()); + $adapterTable = new Table($adapterTableName, $table->getOptions()); + $adapter->addColumn($adapterTable, $column); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function renameColumn(string $tableName, string $columnName, string $newColumnName): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + $adapterTableName = $this->getAdapterTableName($tableName); + $adapter->renameColumn($adapterTableName, $columnName, $newColumnName); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function changeColumn(string $tableName, string $columnName, Column $newColumn): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + $adapterTableName = $this->getAdapterTableName($tableName); + $adapter->changeColumn($adapterTableName, $columnName, $newColumn); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function dropColumn(string $tableName, string $columnName): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + $adapterTableName = $this->getAdapterTableName($tableName); + $adapter->dropColumn($adapterTableName, $columnName); + } + + /** + * @inheritDoc + */ + public function hasIndex(string $tableName, $columns): bool + { + $adapterTableName = $this->getAdapterTableName($tableName); + + return parent::hasIndex($adapterTableName, $columns); + } + + /** + * @inheritDoc + */ + public function hasIndexByName(string $tableName, string $indexName): bool + { + $adapterTableName = $this->getAdapterTableName($tableName); + + return parent::hasIndexByName($adapterTableName, $indexName); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function addIndex(Table $table, Index $index): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + $adapterTable = new Table($table->getName(), $table->getOptions()); + $adapter->addIndex($adapterTable, $index); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function dropIndex(string $tableName, $columns): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + $adapterTableName = $this->getAdapterTableName($tableName); + $adapter->dropIndex($adapterTableName, $columns); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function dropIndexByName(string $tableName, string $indexName): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + $adapterTableName = $this->getAdapterTableName($tableName); + $adapter->dropIndexByName($adapterTableName, $indexName); + } + + /** + * @inheritDoc + */ + public function hasPrimaryKey(string $tableName, $columns, ?string $constraint = null): bool + { + $adapterTableName = $this->getAdapterTableName($tableName); + + return parent::hasPrimaryKey($adapterTableName, $columns, $constraint); + } + + /** + * @inheritDoc + */ + public function hasForeignKey(string $tableName, $columns, ?string $constraint = null): bool + { + $adapterTableName = $this->getAdapterTableName($tableName); + + return parent::hasForeignKey($adapterTableName, $columns, $constraint); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function addForeignKey(Table $table, ForeignKey $foreignKey): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + $adapterTableName = $this->getAdapterTableName($table->getName()); + $adapterTable = new Table($adapterTableName, $table->getOptions()); + $adapter->addForeignKey($adapterTable, $foreignKey); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function dropForeignKey(string $tableName, array $columns, ?string $constraint = null): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The underlying adapter does not implement DirectActionInterface'); + } + $adapterTableName = $this->getAdapterTableName($tableName); + $adapter->dropForeignKey($adapterTableName, $columns, $constraint); + } + + /** + * @inheritDoc + */ + public function insert(Table $table, array $row): void + { + $adapterTableName = $this->getAdapterTableName($table->getName()); + $adapterTable = new Table($adapterTableName, $table->getOptions()); + parent::insert($adapterTable, $row); + } + + /** + * @inheritDoc + */ + public function bulkinsert(Table $table, array $rows): void + { + $adapterTableName = $this->getAdapterTableName($table->getName()); + $adapterTable = new Table($adapterTableName, $table->getOptions()); + parent::bulkinsert($adapterTable, $rows); + } + + /** + * Gets the table prefix. + * + * @return string + */ + public function getPrefix(): string + { + return (string)$this->getOption('table_prefix'); + } + + /** + * Gets the table suffix. + * + * @return string + */ + public function getSuffix(): string + { + return (string)$this->getOption('table_suffix'); + } + + /** + * Applies the prefix and suffix to the table name. + * + * @param string $tableName Table name + * @return string + */ + public function getAdapterTableName(string $tableName): string + { + return $this->getPrefix() . $tableName . $this->getSuffix(); + } + + /** + * {@inheritDoc} + * + * @throws \InvalidArgumentException + * @return void + */ + public function executeActions(Table $table, array $actions): void + { + $adapterTableName = $this->getAdapterTableName($table->getName()); + $adapterTable = new Table($adapterTableName, $table->getOptions()); + + foreach ($actions as $k => $action) { + switch (true) { + case $action instanceof AddColumn: + /** @var \Phinx\Db\Action\AddColumn $action */ + $actions[$k] = new AddColumn($adapterTable, $action->getColumn()); + break; + + case $action instanceof AddIndex: + /** @var \Phinx\Db\Action\AddIndex $action */ + $actions[$k] = new AddIndex($adapterTable, $action->getIndex()); + break; + + case $action instanceof AddForeignKey: + /** @var \Phinx\Db\Action\AddForeignKey $action */ + $foreignKey = clone $action->getForeignKey(); + $refTable = $foreignKey->getReferencedTable(); + $refTableName = $this->getAdapterTableName($refTable->getName()); + $foreignKey->setReferencedTable(new Table($refTableName, $refTable->getOptions())); + $actions[$k] = new AddForeignKey($adapterTable, $foreignKey); + break; + + case $action instanceof ChangeColumn: + /** @var \Phinx\Db\Action\ChangeColumn $action */ + $actions[$k] = new ChangeColumn($adapterTable, $action->getColumnName(), $action->getColumn()); + break; + + case $action instanceof DropForeignKey: + /** @var \Phinx\Db\Action\DropForeignKey $action */ + $actions[$k] = new DropForeignKey($adapterTable, $action->getForeignKey()); + break; + + case $action instanceof DropIndex: + /** @var \Phinx\Db\Action\DropIndex $action */ + $actions[$k] = new DropIndex($adapterTable, $action->getIndex()); + break; + + case $action instanceof DropTable: + /** @var \Phinx\Db\Action\DropTable $action */ + $actions[$k] = new DropTable($adapterTable); + break; + + case $action instanceof RemoveColumn: + /** @var \Phinx\Db\Action\RemoveColumn $action */ + $actions[$k] = new RemoveColumn($adapterTable, $action->getColumn()); + break; + + case $action instanceof RenameColumn: + /** @var \Phinx\Db\Action\RenameColumn $action */ + $actions[$k] = new RenameColumn($adapterTable, $action->getColumn(), $action->getNewName()); + break; + + case $action instanceof RenameTable: + /** @var \Phinx\Db\Action\RenameTable $action */ + $actions[$k] = new RenameTable($adapterTable, $this->getAdapterTableName($action->getNewName())); + break; + + case $action instanceof ChangePrimaryKey: + /** @var \Phinx\Db\Action\ChangePrimaryKey $action */ + $actions[$k] = new ChangePrimaryKey($adapterTable, $action->getNewColumns()); + break; + + case $action instanceof ChangeComment: + /** @var \Phinx\Db\Action\ChangeComment $action */ + $actions[$k] = new ChangeComment($adapterTable, $action->getNewComment()); + break; + + default: + throw new InvalidArgumentException( + sprintf("Forgot to implement table prefixing for action: '%s'", get_class($action)) + ); + } + } + + parent::executeActions($adapterTable, $actions); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/TimedOutputAdapter.php b/vendor/topthink/think-migration/phinx/Db/Adapter/TimedOutputAdapter.php new file mode 100644 index 0000000..839a998 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/TimedOutputAdapter.php @@ -0,0 +1,423 @@ +getAdapter()->getAdapterType(); + } + + /** + * Start timing a command. + * + * @return callable A function that is to be called when the command finishes + */ + public function startCommandTimer(): callable + { + $started = microtime(true); + + return function () use ($started) { + $end = microtime(true); + if (OutputInterface::VERBOSITY_VERBOSE <= $this->getOutput()->getVerbosity()) { + $this->getOutput()->writeln(' -> ' . sprintf('%.4fs', $end - $started)); + } + }; + } + + /** + * Write a Phinx command to the output. + * + * @param string $command Command Name + * @param array $args Command Args + * @return void + */ + public function writeCommand(string $command, array $args = []): void + { + if (OutputInterface::VERBOSITY_VERBOSE > $this->getOutput()->getVerbosity()) { + return; + } + + if (count($args)) { + $outArr = []; + foreach ($args as $arg) { + if (is_array($arg)) { + $arg = array_map( + function ($value) { + return '\'' . $value . '\''; + }, + $arg + ); + $outArr[] = '[' . implode(', ', $arg) . ']'; + continue; + } + + $outArr[] = '\'' . $arg . '\''; + } + $this->getOutput()->writeln(' -- ' . $command . '(' . implode(', ', $outArr) . ')'); + + return; + } + + $this->getOutput()->writeln(' -- ' . $command); + } + + /** + * @inheritDoc + */ + public function insert(Table $table, array $row): void + { + $end = $this->startCommandTimer(); + $this->writeCommand('insert', [$table->getName()]); + parent::insert($table, $row); + $end(); + } + + /** + * @inheritDoc + */ + public function bulkinsert(Table $table, array $rows): void + { + $end = $this->startCommandTimer(); + $this->writeCommand('bulkinsert', [$table->getName()]); + parent::bulkinsert($table, $rows); + $end(); + } + + /** + * @inheritDoc + */ + public function createTable(Table $table, array $columns = [], array $indexes = []): void + { + $end = $this->startCommandTimer(); + $this->writeCommand('createTable', [$table->getName()]); + parent::createTable($table, $columns, $indexes); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function changePrimaryKey(Table $table, $newColumns): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand('changePrimaryKey', [$table->getName()]); + $adapter->changePrimaryKey($table, $newColumns); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function changeComment(Table $table, ?string $newComment): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand('changeComment', [$table->getName()]); + $adapter->changeComment($table, $newComment); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function renameTable(string $tableName, string $newTableName): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand('renameTable', [$tableName, $newTableName]); + $adapter->renameTable($tableName, $newTableName); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function dropTable(string $tableName): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand('dropTable', [$tableName]); + $adapter->dropTable($tableName); + $end(); + } + + /** + * @inheritDoc + */ + public function truncateTable(string $tableName): void + { + $end = $this->startCommandTimer(); + $this->writeCommand('truncateTable', [$tableName]); + parent::truncateTable($tableName); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function addColumn(Table $table, Column $column): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand( + 'addColumn', + [ + $table->getName(), + $column->getName(), + $column->getType(), + ] + ); + $adapter->addColumn($table, $column); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function renameColumn(string $tableName, string $columnName, string $newColumnName): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand('renameColumn', [$tableName, $columnName, $newColumnName]); + $adapter->renameColumn($tableName, $columnName, $newColumnName); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function changeColumn(string $tableName, string $columnName, Column $newColumn): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand('changeColumn', [$tableName, $columnName, $newColumn->getType()]); + $adapter->changeColumn($tableName, $columnName, $newColumn); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function dropColumn(string $tableName, string $columnName): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand('dropColumn', [$tableName, $columnName]); + $adapter->dropColumn($tableName, $columnName); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function addIndex(Table $table, Index $index): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand('addIndex', [$table->getName(), $index->getColumns()]); + $adapter->addIndex($table, $index); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function dropIndex(string $tableName, $columns): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand('dropIndex', [$tableName, $columns]); + $adapter->dropIndex($tableName, $columns); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function dropIndexByName(string $tableName, string $indexName): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand('dropIndexByName', [$tableName, $indexName]); + $adapter->dropIndexByName($tableName, $indexName); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function addForeignKey(Table $table, ForeignKey $foreignKey): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand('addForeignKey', [$table->getName(), $foreignKey->getColumns()]); + $adapter->addForeignKey($table, $foreignKey); + $end(); + } + + /** + * {@inheritDoc} + * + * @throws \BadMethodCallException + * @return void + */ + public function dropForeignKey(string $tableName, array $columns, ?string $constraint = null): void + { + $adapter = $this->getAdapter(); + if (!$adapter instanceof DirectActionInterface) { + throw new BadMethodCallException('The adapter needs to implement DirectActionInterface'); + } + $end = $this->startCommandTimer(); + $this->writeCommand('dropForeignKey', [$tableName, $columns]); + $adapter->dropForeignKey($tableName, $columns, $constraint); + $end(); + } + + /** + * @inheritDoc + */ + public function createDatabase(string $name, array $options = []): void + { + $end = $this->startCommandTimer(); + $this->writeCommand('createDatabase', [$name]); + parent::createDatabase($name, $options); + $end(); + } + + /** + * @inheritDoc + */ + public function dropDatabase(string $name): void + { + $end = $this->startCommandTimer(); + $this->writeCommand('dropDatabase', [$name]); + parent::dropDatabase($name); + $end(); + } + + /** + * @inheritDoc + */ + public function createSchema(string $name = 'public'): void + { + $end = $this->startCommandTimer(); + $this->writeCommand('createSchema', [$name]); + parent::createSchema($name); + $end(); + } + + /** + * @inheritDoc + */ + public function dropSchema(string $name): void + { + $end = $this->startCommandTimer(); + $this->writeCommand('dropSchema', [$name]); + parent::dropSchema($name); + $end(); + } + + /** + * @inheritDoc + */ + public function executeActions(Table $table, array $actions): void + { + $end = $this->startCommandTimer(); + $this->writeCommand(sprintf('Altering table %s', $table->getName())); + parent::executeActions($table, $actions); + $end(); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/UnsupportedColumnTypeException.php b/vendor/topthink/think-migration/phinx/Db/Adapter/UnsupportedColumnTypeException.php new file mode 100644 index 0000000..5ef75e9 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/UnsupportedColumnTypeException.php @@ -0,0 +1,19 @@ + + */ +class UnsupportedColumnTypeException extends RuntimeException +{ +} diff --git a/vendor/topthink/think-migration/phinx/Db/Adapter/WrapperInterface.php b/vendor/topthink/think-migration/phinx/Db/Adapter/WrapperInterface.php new file mode 100644 index 0000000..669d0d2 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Adapter/WrapperInterface.php @@ -0,0 +1,39 @@ + + */ +interface WrapperInterface +{ + /** + * Class constructor, must always wrap another adapter. + * + * @param \Phinx\Db\Adapter\AdapterInterface $adapter Adapter + */ + public function __construct(AdapterInterface $adapter); + + /** + * Sets the database adapter to proxy commands to. + * + * @param \Phinx\Db\Adapter\AdapterInterface $adapter Adapter + * @return \Phinx\Db\Adapter\AdapterInterface + */ + public function setAdapter(AdapterInterface $adapter): AdapterInterface; + + /** + * Gets the database adapter. + * + * @throws \RuntimeException if the adapter has not been set + * @return \Phinx\Db\Adapter\AdapterInterface + */ + public function getAdapter(): AdapterInterface; +} diff --git a/vendor/topthink/think-migration/phinx/Db/Plan/AlterTable.php b/vendor/topthink/think-migration/phinx/Db/Plan/AlterTable.php new file mode 100644 index 0000000..1746e15 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Plan/AlterTable.php @@ -0,0 +1,72 @@ +table = $table; + } + + /** + * Adds another action to the collection + * + * @param \Phinx\Db\Action\Action $action The action to add + * @return void + */ + public function addAction(Action $action): void + { + $this->actions[] = $action; + } + + /** + * Returns the table associated to this collection + * + * @return \Phinx\Db\Table\Table + */ + public function getTable(): Table + { + return $this->table; + } + + /** + * Returns an array with all collected actions + * + * @return \Phinx\Db\Action\Action[] + */ + public function getActions(): array + { + return $this->actions; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Plan/Intent.php b/vendor/topthink/think-migration/phinx/Db/Plan/Intent.php new file mode 100644 index 0000000..eadd344 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Plan/Intent.php @@ -0,0 +1,55 @@ +actions[] = $action; + } + + /** + * Returns the full list of actions + * + * @return \Phinx\Db\Action\Action[] + */ + public function getActions(): array + { + return $this->actions; + } + + /** + * Merges another Intent object with this one + * + * @param \Phinx\Db\Plan\Intent $another The other intent to merge in + * @return void + */ + public function merge(Intent $another): void + { + $this->actions = array_merge($this->actions, $another->getActions()); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Plan/NewTable.php b/vendor/topthink/think-migration/phinx/Db/Plan/NewTable.php new file mode 100644 index 0000000..0ac62fc --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Plan/NewTable.php @@ -0,0 +1,101 @@ +table = $table; + } + + /** + * Adds a column to the collection + * + * @param \Phinx\Db\Table\Column $column The column description + * @return void + */ + public function addColumn(Column $column): void + { + $this->columns[] = $column; + } + + /** + * Adds an index to the collection + * + * @param \Phinx\Db\Table\Index $index The index description + * @return void + */ + public function addIndex(Index $index): void + { + $this->indexes[] = $index; + } + + /** + * Returns the table object associated to this collection + * + * @return \Phinx\Db\Table\Table + */ + public function getTable(): Table + { + return $this->table; + } + + /** + * Returns the columns collection + * + * @return \Phinx\Db\Table\Column[] + */ + public function getColumns(): array + { + return $this->columns; + } + + /** + * Returns the indexes collection + * + * @return \Phinx\Db\Table\Index[] + */ + public function getIndexes(): array + { + return $this->indexes; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Plan/Plan.php b/vendor/topthink/think-migration/phinx/Db/Plan/Plan.php new file mode 100644 index 0000000..4e0b6fd --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Plan/Plan.php @@ -0,0 +1,492 @@ +createPlan($intent->getActions()); + } + + /** + * Parses the given Intent and creates the separate steps to execute + * + * @param \Phinx\Db\Action\Action[] $actions The actions to use for the plan + * @return void + */ + protected function createPlan(array $actions): void + { + $this->gatherCreates($actions); + $this->gatherUpdates($actions); + $this->gatherTableMoves($actions); + $this->gatherIndexes($actions); + $this->gatherConstraints($actions); + $this->resolveConflicts(); + } + + /** + * Returns a nested list of all the steps to execute + * + * @return \Phinx\Db\Plan\AlterTable[][] + */ + protected function updatesSequence(): array + { + return [ + $this->tableUpdates, + $this->constraints, + $this->indexes, + $this->columnRemoves, + $this->tableMoves, + ]; + } + + /** + * Returns a nested list of all the steps to execute in inverse order + * + * @return \Phinx\Db\Plan\AlterTable[][] + */ + protected function inverseUpdatesSequence(): array + { + return [ + $this->constraints, + $this->tableMoves, + $this->indexes, + $this->columnRemoves, + $this->tableUpdates, + ]; + } + + /** + * Executes this plan using the given AdapterInterface + * + * @param \Phinx\Db\Adapter\AdapterInterface $executor The executor object for the plan + * @return void + */ + public function execute(AdapterInterface $executor): void + { + foreach ($this->tableCreates as $newTable) { + $executor->createTable($newTable->getTable(), $newTable->getColumns(), $newTable->getIndexes()); + } + + foreach ($this->updatesSequence() as $updates) { + foreach ($updates as $update) { + $executor->executeActions($update->getTable(), $update->getActions()); + } + } + } + + /** + * Executes the inverse plan (rollback the actions) with the given AdapterInterface:w + * + * @param \Phinx\Db\Adapter\AdapterInterface $executor The executor object for the plan + * @return void + */ + public function executeInverse(AdapterInterface $executor): void + { + foreach ($this->inverseUpdatesSequence() as $updates) { + foreach ($updates as $update) { + $executor->executeActions($update->getTable(), $update->getActions()); + } + } + + foreach ($this->tableCreates as $newTable) { + $executor->createTable($newTable->getTable(), $newTable->getColumns(), $newTable->getIndexes()); + } + } + + /** + * Deletes certain actions from the plan if they are found to be conflicting or redundant. + * + * @return void + */ + protected function resolveConflicts(): void + { + foreach ($this->tableMoves as $alterTable) { + foreach ($alterTable->getActions() as $action) { + if ($action instanceof DropTable) { + $this->tableUpdates = $this->forgetTable($action->getTable(), $this->tableUpdates); + $this->constraints = $this->forgetTable($action->getTable(), $this->constraints); + $this->indexes = $this->forgetTable($action->getTable(), $this->indexes); + $this->columnRemoves = $this->forgetTable($action->getTable(), $this->columnRemoves); + } + } + } + + // Renaming a column and then changing the renamed column is something people do, + // but it is a conflicting action. Luckily solving the conflict can be done by moving + // the ChangeColumn action to another AlterTable. + $splitter = new ActionSplitter( + RenameColumn::class, + ChangeColumn::class, + function (RenameColumn $a, ChangeColumn $b) { + return $a->getNewName() === $b->getColumnName(); + } + ); + $tableUpdates = []; + foreach ($this->tableUpdates as $update) { + $tableUpdates = array_merge($tableUpdates, $splitter($update)); + } + $this->tableUpdates = $tableUpdates; + + // Dropping indexes used by foreign keys is a conflict, but one we can resolve + // if the foreign key is also scheduled to be dropped. If we can find such a a case, + // we force the execution of the index drop after the foreign key is dropped. + // Changing constraint properties sometimes require dropping it and then + // creating it again with the new stuff. Unfortunately, we have already bundled + // everything together in as few AlterTable statements as we could, so we need to + // resolve this conflict manually. + $splitter = new ActionSplitter( + DropForeignKey::class, + AddForeignKey::class, + function (DropForeignKey $a, AddForeignKey $b) { + return $a->getForeignKey()->getColumns() === $b->getForeignKey()->getColumns(); + } + ); + $constraints = []; + foreach ($this->constraints as $constraint) { + $constraints = array_merge( + $constraints, + $splitter($this->remapContraintAndIndexConflicts($constraint)) + ); + } + $this->constraints = $constraints; + } + + /** + * Deletes all actions related to the given table and keeps the + * rest + * + * @param \Phinx\Db\Table\Table $table The table to find in the list of actions + * @param \Phinx\Db\Plan\AlterTable[] $actions The actions to transform + * @return \Phinx\Db\Plan\AlterTable[] The list of actions without actions for the given table + */ + protected function forgetTable(Table $table, array $actions): array + { + $result = []; + foreach ($actions as $action) { + if ($action->getTable()->getName() === $table->getName()) { + continue; + } + $result[] = $action; + } + + return $result; + } + + /** + * Finds all DropForeignKey actions in an AlterTable and moves + * all conflicting DropIndex action in `$this->indexes` into the + * given AlterTable. + * + * @param \Phinx\Db\Plan\AlterTable $alter The collection of actions to inspect + * @return \Phinx\Db\Plan\AlterTable The updated AlterTable object. This function + * has the side effect of changing the `$this->indexes` property. + */ + protected function remapContraintAndIndexConflicts(AlterTable $alter): AlterTable + { + $newAlter = new AlterTable($alter->getTable()); + + foreach ($alter->getActions() as $action) { + $newAlter->addAction($action); + if ($action instanceof DropForeignKey) { + [$this->indexes, $dropIndexActions] = $this->forgetDropIndex( + $action->getTable(), + $action->getForeignKey()->getColumns(), + $this->indexes + ); + foreach ($dropIndexActions as $dropIndexAction) { + $newAlter->addAction($dropIndexAction); + } + } + } + + return $newAlter; + } + + /** + * Deletes any DropIndex actions for the given table and exact columns + * + * @param \Phinx\Db\Table\Table $table The table to find in the list of actions + * @param string[] $columns The column names to match + * @param \Phinx\Db\Plan\AlterTable[] $actions The actions to transform + * @return array A tuple containing the list of actions without actions for dropping the index + * and a list of drop index actions that were removed. + */ + protected function forgetDropIndex(Table $table, array $columns, array $actions): array + { + $dropIndexActions = new ArrayObject(); + $indexes = array_map(function ($alter) use ($table, $columns, $dropIndexActions) { + if ($alter->getTable()->getName() !== $table->getName()) { + return $alter; + } + + $newAlter = new AlterTable($table); + foreach ($alter->getActions() as $action) { + if ($action instanceof DropIndex && $action->getIndex()->getColumns() === $columns) { + $dropIndexActions->append($action); + } else { + $newAlter->addAction($action); + } + } + + return $newAlter; + }, $actions); + + return [$indexes, $dropIndexActions->getArrayCopy()]; + } + + /** + * Deletes any RemoveColumn actions for the given table and exact columns + * + * @param \Phinx\Db\Table\Table $table The table to find in the list of actions + * @param string[] $columns The column names to match + * @param \Phinx\Db\Plan\AlterTable[] $actions The actions to transform + * @return array A tuple containing the list of actions without actions for removing the column + * and a list of remove column actions that were removed. + */ + protected function forgetRemoveColumn(Table $table, array $columns, array $actions): array + { + $removeColumnActions = new ArrayObject(); + $indexes = array_map(function ($alter) use ($table, $columns, $removeColumnActions) { + if ($alter->getTable()->getName() !== $table->getName()) { + return $alter; + } + + $newAlter = new AlterTable($table); + foreach ($alter->getActions() as $action) { + if ($action instanceof RemoveColumn && in_array($action->getColumn()->getName(), $columns, true)) { + $removeColumnActions->append($action); + } else { + $newAlter->addAction($action); + } + } + + return $newAlter; + }, $actions); + + return [$indexes, $removeColumnActions->getArrayCopy()]; + } + + /** + * Collects all table creation actions from the given intent + * + * @param \Phinx\Db\Action\Action[] $actions The actions to parse + * @return void + */ + protected function gatherCreates(array $actions): void + { + foreach ($actions as $action) { + if ($action instanceof CreateTable) { + $this->tableCreates[$action->getTable()->getName()] = new NewTable($action->getTable()); + } + } + + foreach ($actions as $action) { + if ( + ($action instanceof AddColumn || $action instanceof AddIndex) + && isset($this->tableCreates[$action->getTable()->getName()]) + ) { + $table = $action->getTable(); + + if ($action instanceof AddColumn) { + $this->tableCreates[$table->getName()]->addColumn($action->getColumn()); + } + + if ($action instanceof AddIndex) { + $this->tableCreates[$table->getName()]->addIndex($action->getIndex()); + } + } + } + } + + /** + * Collects all alter table actions from the given intent + * + * @param \Phinx\Db\Action\Action[] $actions The actions to parse + * @return void + */ + protected function gatherUpdates(array $actions): void + { + foreach ($actions as $action) { + if ( + !($action instanceof AddColumn) + && !($action instanceof ChangeColumn) + && !($action instanceof RemoveColumn) + && !($action instanceof RenameColumn) + ) { + continue; + } elseif (isset($this->tableCreates[$action->getTable()->getName()])) { + continue; + } + $table = $action->getTable(); + $name = $table->getName(); + + if ($action instanceof RemoveColumn) { + if (!isset($this->columnRemoves[$name])) { + $this->columnRemoves[$name] = new AlterTable($table); + } + $this->columnRemoves[$name]->addAction($action); + } else { + if (!isset($this->tableUpdates[$name])) { + $this->tableUpdates[$name] = new AlterTable($table); + } + $this->tableUpdates[$name]->addAction($action); + } + } + } + + /** + * Collects all alter table drop and renames from the given intent + * + * @param \Phinx\Db\Action\Action[] $actions The actions to parse + * @return void + */ + protected function gatherTableMoves(array $actions): void + { + foreach ($actions as $action) { + if ( + !($action instanceof DropTable) + && !($action instanceof RenameTable) + && !($action instanceof ChangePrimaryKey) + && !($action instanceof ChangeComment) + ) { + continue; + } + $table = $action->getTable(); + $name = $table->getName(); + + if (!isset($this->tableMoves[$name])) { + $this->tableMoves[$name] = new AlterTable($table); + } + + $this->tableMoves[$name]->addAction($action); + } + } + + /** + * Collects all index creation and drops from the given intent + * + * @param \Phinx\Db\Action\Action[] $actions The actions to parse + * @return void + */ + protected function gatherIndexes(array $actions): void + { + foreach ($actions as $action) { + if (!($action instanceof AddIndex) && !($action instanceof DropIndex)) { + continue; + } elseif (isset($this->tableCreates[$action->getTable()->getName()])) { + continue; + } + + $table = $action->getTable(); + $name = $table->getName(); + + if (!isset($this->indexes[$name])) { + $this->indexes[$name] = new AlterTable($table); + } + + $this->indexes[$name]->addAction($action); + } + } + + /** + * Collects all foreign key creation and drops from the given intent + * + * @param \Phinx\Db\Action\Action[] $actions The actions to parse + * @return void + */ + protected function gatherConstraints(array $actions): void + { + foreach ($actions as $action) { + if (!($action instanceof AddForeignKey || $action instanceof DropForeignKey)) { + continue; + } + $table = $action->getTable(); + $name = $table->getName(); + + if (!isset($this->constraints[$name])) { + $this->constraints[$name] = new AlterTable($table); + } + + $this->constraints[$name]->addAction($action); + } + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Plan/Solver/ActionSplitter.php b/vendor/topthink/think-migration/phinx/Db/Plan/Solver/ActionSplitter.php new file mode 100644 index 0000000..a9a157a --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Plan/Solver/ActionSplitter.php @@ -0,0 +1,103 @@ +conflictClass = $conflictClass; + $this->conflictClassDual = $conflictClassDual; + $this->conflictFilter = $conflictFilter; + } + + /** + * Returs a sequence of AlterTable instructions that are non conflicting + * based on the constructor parameters. + * + * @param \Phinx\Db\Plan\AlterTable $alter The collection of actions to inspect + * @return \Phinx\Db\Plan\AlterTable[] A list of AlterTable that can be executed without + * this type of conflict + */ + public function __invoke(AlterTable $alter): array + { + $conflictActions = array_filter($alter->getActions(), function ($action) { + return $action instanceof $this->conflictClass; + }); + + $originalAlter = new AlterTable($alter->getTable()); + $newAlter = new AlterTable($alter->getTable()); + + foreach ($alter->getActions() as $action) { + if (!$action instanceof $this->conflictClassDual) { + $originalAlter->addAction($action); + continue; + } + + $found = false; + $matches = $this->conflictFilter; + foreach ($conflictActions as $ca) { + if ($matches($ca, $action)) { + $found = true; + break; + } + } + + if ($found) { + $newAlter->addAction($action); + } else { + $originalAlter->addAction($action); + } + } + + return [$originalAlter, $newAlter]; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Table.php b/vendor/topthink/think-migration/phinx/Db/Table.php new file mode 100644 index 0000000..e532517 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Table.php @@ -0,0 +1,721 @@ + $options Options + * @param \Phinx\Db\Adapter\AdapterInterface|null $adapter Database Adapter + */ + public function __construct(string $name, array $options = [], ?AdapterInterface $adapter = null) + { + $this->table = new TableValue($name, $options); + $this->actions = new Intent(); + + if ($adapter !== null) { + $this->setAdapter($adapter); + } + } + + /** + * Gets the table name. + * + * @return string + */ + public function getName(): string + { + return $this->table->getName(); + } + + /** + * Gets the table options. + * + * @return array + */ + public function getOptions(): array + { + return $this->table->getOptions(); + } + + /** + * Gets the table name and options as an object + * + * @return \Phinx\Db\Table\Table + */ + public function getTable(): TableValue + { + return $this->table; + } + + /** + * Sets the database adapter. + * + * @param \Phinx\Db\Adapter\AdapterInterface $adapter Database Adapter + * @return $this + */ + public function setAdapter(AdapterInterface $adapter) + { + $this->adapter = $adapter; + + return $this; + } + + /** + * Gets the database adapter. + * + * @throws \RuntimeException + * @return \Phinx\Db\Adapter\AdapterInterface + */ + public function getAdapter(): AdapterInterface + { + if (!$this->adapter) { + throw new RuntimeException('There is no database adapter set yet, cannot proceed'); + } + + return $this->adapter; + } + + /** + * Does the table have pending actions? + * + * @return bool + */ + public function hasPendingActions(): bool + { + return count($this->actions->getActions()) > 0 || count($this->data) > 0; + } + + /** + * Does the table exist? + * + * @return bool + */ + public function exists(): bool + { + return $this->getAdapter()->hasTable($this->getName()); + } + + /** + * Drops the database table. + * + * @return $this + */ + public function drop() + { + $this->actions->addAction(new DropTable($this->table)); + + return $this; + } + + /** + * Renames the database table. + * + * @param string $newTableName New Table Name + * @return $this + */ + public function rename(string $newTableName) + { + $this->actions->addAction(new RenameTable($this->table, $newTableName)); + + return $this; + } + + /** + * Changes the primary key of the database table. + * + * @param string|string[]|null $columns Column name(s) to belong to the primary key, or null to drop the key + * @return $this + */ + public function changePrimaryKey($columns) + { + $this->actions->addAction(new ChangePrimaryKey($this->table, $columns)); + + return $this; + } + + /** + * Checks to see if a primary key exists. + * + * @param string|string[] $columns Column(s) + * @param string|null $constraint Constraint names + * @return bool + */ + public function hasPrimaryKey($columns, ?string $constraint = null): bool + { + return $this->getAdapter()->hasPrimaryKey($this->getName(), $columns, $constraint); + } + + /** + * Changes the comment of the database table. + * + * @param string|null $comment New comment string, or null to drop the comment + * @return $this + */ + public function changeComment(?string $comment) + { + $this->actions->addAction(new ChangeComment($this->table, $comment)); + + return $this; + } + + /** + * Gets an array of the table columns. + * + * @return \Phinx\Db\Table\Column[] + */ + public function getColumns(): array + { + return $this->getAdapter()->getColumns($this->getName()); + } + + /** + * Gets a table column if it exists. + * + * @param string $name Column name + * @return \Phinx\Db\Table\Column|null + */ + public function getColumn(string $name): ?Column + { + $columns = array_filter( + $this->getColumns(), + function ($column) use ($name) { + return $column->getName() === $name; + } + ); + + return array_pop($columns); + } + + /** + * Sets an array of data to be inserted. + * + * @param array $data Data + * @return $this + */ + public function setData(array $data) + { + $this->data = $data; + + return $this; + } + + /** + * Gets the data waiting to be inserted. + * + * @return array + */ + public function getData(): array + { + return $this->data; + } + + /** + * Resets all of the pending data to be inserted + * + * @return void + */ + public function resetData(): void + { + $this->setData([]); + } + + /** + * Resets all of the pending table changes. + * + * @return void + */ + public function reset(): void + { + $this->actions = new Intent(); + $this->resetData(); + } + + /** + * Add a table column. + * + * Type can be: string, text, integer, float, decimal, datetime, timestamp, + * time, date, binary, boolean. + * + * Valid options can be: limit, default, null, precision or scale. + * + * @param string|\Phinx\Db\Table\Column $columnName Column Name + * @param string|\Phinx\Util\Literal|null $type Column Type + * @param array $options Column Options + * @throws \InvalidArgumentException + * @return $this + */ + public function addColumn($columnName, $type = null, array $options = []) + { + if ($columnName instanceof Column) { + $action = new AddColumn($this->table, $columnName); + } elseif ($type instanceof Literal) { + $action = AddColumn::build($this->table, $columnName, $type, $options); + } else { + $action = new AddColumn($this->table, $this->getAdapter()->getColumnForType($columnName, $type, $options)); + } + + // Delegate to Adapters to check column type + if (!$this->getAdapter()->isValidColumnType($action->getColumn())) { + throw new InvalidArgumentException(sprintf( + 'An invalid column type "%s" was specified for column "%s".', + $type, + $action->getColumn()->getName() + )); + } + + $this->actions->addAction($action); + + return $this; + } + + /** + * Remove a table column. + * + * @param string $columnName Column Name + * @return $this + */ + public function removeColumn(string $columnName) + { + $action = RemoveColumn::build($this->table, $columnName); + $this->actions->addAction($action); + + return $this; + } + + /** + * Rename a table column. + * + * @param string $oldName Old Column Name + * @param string $newName New Column Name + * @return $this + */ + public function renameColumn(string $oldName, string $newName) + { + $action = RenameColumn::build($this->table, $oldName, $newName); + $this->actions->addAction($action); + + return $this; + } + + /** + * Change a table column type. + * + * @param string $columnName Column Name + * @param string|\Phinx\Db\Table\Column|\Phinx\Util\Literal $newColumnType New Column Type + * @param array $options Options + * @return $this + */ + public function changeColumn(string $columnName, $newColumnType, array $options = []) + { + if ($newColumnType instanceof Column) { + $action = new ChangeColumn($this->table, $columnName, $newColumnType); + } else { + $action = ChangeColumn::build($this->table, $columnName, $newColumnType, $options); + } + $this->actions->addAction($action); + + return $this; + } + + /** + * Checks to see if a column exists. + * + * @param string $columnName Column Name + * @return bool + */ + public function hasColumn(string $columnName): bool + { + return $this->getAdapter()->hasColumn($this->getName(), $columnName); + } + + /** + * Add an index to a database table. + * + * In $options you can specify unique = true/false, and name (index name). + * + * @param string|array|\Phinx\Db\Table\Index $columns Table Column(s) + * @param array $options Index Options + * @return $this + */ + public function addIndex($columns, array $options = []) + { + $action = AddIndex::build($this->table, $columns, $options); + $this->actions->addAction($action); + + return $this; + } + + /** + * Removes the given index from a table. + * + * @param string|string[] $columns Columns + * @return $this + */ + public function removeIndex($columns) + { + $action = DropIndex::build($this->table, is_string($columns) ? [$columns] : $columns); + $this->actions->addAction($action); + + return $this; + } + + /** + * Removes the given index identified by its name from a table. + * + * @param string $name Index name + * @return $this + */ + public function removeIndexByName(string $name) + { + $action = DropIndex::buildFromName($this->table, $name); + $this->actions->addAction($action); + + return $this; + } + + /** + * Checks to see if an index exists. + * + * @param string|string[] $columns Columns + * @return bool + */ + public function hasIndex($columns): bool + { + return $this->getAdapter()->hasIndex($this->getName(), $columns); + } + + /** + * Checks to see if an index specified by name exists. + * + * @param string $indexName Index name + * @return bool + */ + public function hasIndexByName($indexName): bool + { + return $this->getAdapter()->hasIndexByName($this->getName(), $indexName); + } + + /** + * Add a foreign key to a database table. + * + * In $options you can specify on_delete|on_delete = cascade|no_action .., + * on_update, constraint = constraint name. + * + * @param string|string[] $columns Columns + * @param string|\Phinx\Db\Table\Table $referencedTable Referenced Table + * @param string|string[] $referencedColumns Referenced Columns + * @param array $options Options + * @return $this + */ + public function addForeignKey($columns, $referencedTable, $referencedColumns = ['id'], array $options = []) + { + $action = AddForeignKey::build($this->table, $columns, $referencedTable, $referencedColumns, $options); + $this->actions->addAction($action); + + return $this; + } + + /** + * Add a foreign key to a database table with a given name. + * + * In $options you can specify on_delete|on_delete = cascade|no_action .., + * on_update, constraint = constraint name. + * + * @param string $name The constraint name + * @param string|string[] $columns Columns + * @param string|\Phinx\Db\Table\Table $referencedTable Referenced Table + * @param string|string[] $referencedColumns Referenced Columns + * @param array $options Options + * @return $this + */ + public function addForeignKeyWithName(string $name, $columns, $referencedTable, $referencedColumns = ['id'], array $options = []) + { + $action = AddForeignKey::build( + $this->table, + $columns, + $referencedTable, + $referencedColumns, + $options, + $name + ); + $this->actions->addAction($action); + + return $this; + } + + /** + * Removes the given foreign key from the table. + * + * @param string|string[] $columns Column(s) + * @param string|null $constraint Constraint names + * @return $this + */ + public function dropForeignKey($columns, ?string $constraint = null) + { + $action = DropForeignKey::build($this->table, $columns, $constraint); + $this->actions->addAction($action); + + return $this; + } + + /** + * Checks to see if a foreign key exists. + * + * @param string|string[] $columns Column(s) + * @param string|null $constraint Constraint names + * @return bool + */ + public function hasForeignKey($columns, ?string $constraint = null): bool + { + return $this->getAdapter()->hasForeignKey($this->getName(), $columns, $constraint); + } + + /** + * Add timestamp columns created_at and updated_at to the table. + * + * @param string|false|null $createdAt Alternate name for the created_at column + * @param string|false|null $updatedAt Alternate name for the updated_at column + * @param bool $withTimezone Whether to set the timezone option on the added columns + * @return $this + */ + public function addTimestamps($createdAt = 'created_at', $updatedAt = 'updated_at', bool $withTimezone = false) + { + $createdAt = $createdAt ?? 'created_at'; + $updatedAt = $updatedAt ?? 'updated_at'; + + if (!$createdAt && !$updatedAt) { + throw new \RuntimeException('Cannot set both created_at and updated_at columns to false'); + } + + if ($createdAt) { + $this->addColumn($createdAt, 'timestamp', [ + 'null' => false, + 'default' => 'CURRENT_TIMESTAMP', + 'update' => '', + 'timezone' => $withTimezone, + ]); + } + if ($updatedAt) { + $this->addColumn($updatedAt, 'timestamp', [ + 'null' => true, + 'default' => null, + 'update' => 'CURRENT_TIMESTAMP', + 'timezone' => $withTimezone, + ]); + } + + return $this; + } + + /** + * Alias that always sets $withTimezone to true + * + * @see addTimestamps + * @param string|false|null $createdAt Alternate name for the created_at column + * @param string|false|null $updatedAt Alternate name for the updated_at column + * @return $this + */ + public function addTimestampsWithTimezone($createdAt = null, $updatedAt = null) + { + $this->addTimestamps($createdAt, $updatedAt, true); + + return $this; + } + + /** + * Insert data into the table. + * + * @param array $data array of data in the form: + * array( + * array("col1" => "value1", "col2" => "anotherValue1"), + * array("col2" => "value2", "col2" => "anotherValue2"), + * ) + * or array("col1" => "value1", "col2" => "anotherValue1") + * @return $this + */ + public function insert(array $data) + { + // handle array of array situations + $keys = array_keys($data); + $firstKey = array_shift($keys); + if ($firstKey !== null && is_array($data[$firstKey])) { + foreach ($data as $row) { + $this->data[] = $row; + } + + return $this; + } + + if (count($data) > 0) { + $this->data[] = $data; + } + + return $this; + } + + /** + * Creates a table from the object instance. + * + * @return void + */ + public function create(): void + { + $this->executeActions(false); + $this->saveData(); + $this->reset(); // reset pending changes + } + + /** + * Updates a table from the object instance. + * + * @return void + */ + public function update(): void + { + $this->executeActions(true); + $this->saveData(); + $this->reset(); // reset pending changes + } + + /** + * Commit the pending data waiting for insertion. + * + * @return void + */ + public function saveData(): void + { + $rows = $this->getData(); + if (empty($rows)) { + return; + } + + $bulk = true; + $row = current($rows); + $c = array_keys($row); + foreach ($this->getData() as $row) { + $k = array_keys($row); + if ($k != $c) { + $bulk = false; + break; + } + } + + if ($bulk) { + $this->getAdapter()->bulkinsert($this->table, $this->getData()); + } else { + foreach ($this->getData() as $row) { + $this->getAdapter()->insert($this->table, $row); + } + } + + $this->resetData(); + } + + /** + * Immediately truncates the table. This operation cannot be undone + * + * @return void + */ + public function truncate(): void + { + $this->getAdapter()->truncateTable($this->getName()); + } + + /** + * Commits the table changes. + * + * If the table doesn't exist it is created otherwise it is updated. + * + * @return void + */ + public function save(): void + { + if ($this->exists()) { + $this->update(); // update the table + } else { + $this->create(); // create the table + } + } + + /** + * Executes all the pending actions for this table + * + * @param bool $exists Whether or not the table existed prior to executing this method + * @return void + */ + protected function executeActions(bool $exists): void + { + // Renaming a table is tricky, specially when running a reversible migration + // down. We will just assume the table already exists if the user commands a + // table rename. + if (!$exists) { + foreach ($this->actions->getActions() as $action) { + if ($action instanceof RenameTable) { + $exists = true; + break; + } + } + } + + // If the table does not exist, the last command in the chain needs to be + // a CreateTable action. + if (!$exists) { + $this->actions->addAction(new CreateTable($this->table)); + } + + $plan = new Plan($this->actions); + $plan->execute($this->getAdapter()); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Table/Column.php b/vendor/topthink/think-migration/phinx/Db/Table/Column.php new file mode 100644 index 0000000..f70ffa7 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Table/Column.php @@ -0,0 +1,801 @@ +null = FeatureFlags::$columnNullDefault; + } + + /** + * Sets the column name. + * + * @param string $name Name + * @return $this + */ + public function setName(string $name) + { + $this->name = $name; + + return $this; + } + + /** + * Gets the column name. + * + * @return string|null + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets the column type. + * + * @param string|\Phinx\Util\Literal $type Column type + * @return $this + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Gets the column type. + * + * @return string|\Phinx\Util\Literal + */ + public function getType() + { + return $this->type; + } + + /** + * Sets the column limit. + * + * @param int|null $limit Limit + * @return $this + */ + public function setLimit(?int $limit) + { + $this->limit = $limit; + + return $this; + } + + /** + * Gets the column limit. + * + * @return int|null + */ + public function getLimit(): ?int + { + return $this->limit; + } + + /** + * Sets whether the column allows nulls. + * + * @param bool $null Null + * @return $this + */ + public function setNull(bool $null) + { + $this->null = (bool)$null; + + return $this; + } + + /** + * Gets whether the column allows nulls. + * + * @return bool + */ + public function getNull(): bool + { + return $this->null; + } + + /** + * Does the column allow nulls? + * + * @return bool + */ + public function isNull(): bool + { + return $this->getNull(); + } + + /** + * Sets the default column value. + * + * @param mixed $default Default + * @return $this + */ + public function setDefault($default) + { + $this->default = $default; + + return $this; + } + + /** + * Gets the default column value. + * + * @return mixed + */ + public function getDefault() + { + return $this->default; + } + + /** + * Sets generated option for identity columns. Ignored otherwise. + * + * @param string|null $generated Generated option + * @return $this + */ + public function setGenerated(?string $generated) + { + $this->generated = $generated; + + return $this; + } + + /** + * Gets generated option for identity columns. Null otherwise + * + * @return string|null + */ + public function getGenerated(): ?string + { + return $this->generated; + } + + /** + * Sets whether or not the column is an identity column. + * + * @param bool $identity Identity + * @return $this + */ + public function setIdentity(bool $identity) + { + $this->identity = $identity; + + return $this; + } + + /** + * Gets whether or not the column is an identity column. + * + * @return bool + */ + public function getIdentity(): bool + { + return $this->identity; + } + + /** + * Is the column an identity column? + * + * @return bool + */ + public function isIdentity(): bool + { + return $this->getIdentity(); + } + + /** + * Sets the name of the column to add this column after. + * + * @param string $after After + * @return $this + */ + public function setAfter(string $after) + { + $this->after = $after; + + return $this; + } + + /** + * Returns the name of the column to add this column after. + * + * @return string|null + */ + public function getAfter(): ?string + { + return $this->after; + } + + /** + * Sets the 'ON UPDATE' mysql column function. + * + * @param string $update On Update function + * @return $this + */ + public function setUpdate(string $update) + { + $this->update = $update; + + return $this; + } + + /** + * Returns the value of the ON UPDATE column function. + * + * @return string|null + */ + public function getUpdate(): ?string + { + return $this->update; + } + + /** + * Sets the number precision for decimal or float column. + * + * For example `DECIMAL(5,2)`, 5 is the precision and 2 is the scale, + * and the column could store value from -999.99 to 999.99. + * + * @param int|null $precision Number precision + * @return $this + */ + public function setPrecision(?int $precision) + { + $this->setLimit($precision); + + return $this; + } + + /** + * Gets the number precision for decimal or float column. + * + * For example `DECIMAL(5,2)`, 5 is the precision and 2 is the scale, + * and the column could store value from -999.99 to 999.99. + * + * @return int|null + */ + public function getPrecision(): ?int + { + return $this->limit; + } + + /** + * Sets the column identity increment. + * + * @param int $increment Number increment + * @return $this + */ + public function setIncrement(int $increment) + { + $this->increment = $increment; + + return $this; + } + + /** + * Gets the column identity increment. + * + * @return int|null + */ + public function getIncrement(): ?int + { + return $this->increment; + } + + /** + * Sets the column identity seed. + * + * @param int $seed Number seed + * @return $this + */ + public function setSeed(int $seed) + { + $this->seed = $seed; + + return $this; + } + + /** + * Gets the column identity seed. + * + * @return int + */ + public function getSeed(): ?int + { + return $this->seed; + } + + /** + * Sets the number scale for decimal or float column. + * + * For example `DECIMAL(5,2)`, 5 is the precision and 2 is the scale, + * and the column could store value from -999.99 to 999.99. + * + * @param int|null $scale Number scale + * @return $this + */ + public function setScale(?int $scale) + { + $this->scale = $scale; + + return $this; + } + + /** + * Gets the number scale for decimal or float column. + * + * For example `DECIMAL(5,2)`, 5 is the precision and 2 is the scale, + * and the column could store value from -999.99 to 999.99. + * + * @return int + */ + public function getScale(): ?int + { + return $this->scale; + } + + /** + * Sets the number precision and scale for decimal or float column. + * + * For example `DECIMAL(5,2)`, 5 is the precision and 2 is the scale, + * and the column could store value from -999.99 to 999.99. + * + * @param int $precision Number precision + * @param int $scale Number scale + * @return $this + */ + public function setPrecisionAndScale(int $precision, int $scale) + { + $this->setLimit($precision); + $this->scale = $scale; + + return $this; + } + + /** + * Sets the column comment. + * + * @param string|null $comment Comment + * @return $this + */ + public function setComment(?string $comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Gets the column comment. + * + * @return string + */ + public function getComment(): ?string + { + return $this->comment; + } + + /** + * Sets whether field should be signed. + * + * @param bool $signed Signed + * @return $this + */ + public function setSigned(bool $signed) + { + $this->signed = (bool)$signed; + + return $this; + } + + /** + * Gets whether field should be signed. + * + * @return bool + */ + public function getSigned(): bool + { + return $this->signed; + } + + /** + * Should the column be signed? + * + * @return bool + */ + public function isSigned(): bool + { + return $this->getSigned(); + } + + /** + * Sets whether the field should have a timezone identifier. + * Used for date/time columns only! + * + * @param bool $timezone Timezone + * @return $this + */ + public function setTimezone(bool $timezone) + { + $this->timezone = (bool)$timezone; + + return $this; + } + + /** + * Gets whether field has a timezone identifier. + * + * @return bool + */ + public function getTimezone(): bool + { + return $this->timezone; + } + + /** + * Should the column have a timezone? + * + * @return bool + */ + public function isTimezone(): bool + { + return $this->getTimezone(); + } + + /** + * Sets field properties. + * + * @param array $properties Properties + * @return $this + */ + public function setProperties(array $properties) + { + $this->properties = $properties; + + return $this; + } + + /** + * Gets field properties + * + * @return array + */ + public function getProperties(): array + { + return $this->properties; + } + + /** + * Sets field values. + * + * @param string[]|string $values Value(s) + * @return $this + */ + public function setValues($values) + { + if (!is_array($values)) { + $values = preg_split('/,\s*/', $values) ?: []; + } + $this->values = $values; + + return $this; + } + + /** + * Gets field values + * + * @return array|null + */ + public function getValues(): ?array + { + return $this->values; + } + + /** + * Sets the column collation. + * + * @param string $collation Collation + * @return $this + */ + public function setCollation(string $collation) + { + $this->collation = $collation; + + return $this; + } + + /** + * Gets the column collation. + * + * @return string|null + */ + public function getCollation(): ?string + { + return $this->collation; + } + + /** + * Sets the column character set. + * + * @param string $encoding Encoding + * @return $this + */ + public function setEncoding(string $encoding) + { + $this->encoding = $encoding; + + return $this; + } + + /** + * Gets the column character set. + * + * @return string|null + */ + public function getEncoding(): ?string + { + return $this->encoding; + } + + /** + * Sets the column SRID. + * + * @param int $srid SRID + * @return $this + */ + public function setSrid(int $srid) + { + $this->srid = $srid; + + return $this; + } + + /** + * Gets the column SRID. + * + * @return int|null + */ + public function getSrid(): ?int + { + return $this->srid; + } + + /** + * Gets all allowed options. Each option must have a corresponding `setFoo` method. + * + * @return array + */ + protected function getValidOptions(): array + { + return [ + 'limit', + 'default', + 'null', + 'identity', + 'scale', + 'after', + 'update', + 'comment', + 'signed', + 'timezone', + 'properties', + 'values', + 'collation', + 'encoding', + 'srid', + 'seed', + 'increment', + 'generated', + ]; + } + + /** + * Gets all aliased options. Each alias must reference a valid option. + * + * @return array + */ + protected function getAliasedOptions(): array + { + return [ + 'length' => 'limit', + 'precision' => 'limit', + ]; + } + + /** + * Utility method that maps an array of column options to this objects methods. + * + * @param array $options Options + * @throws \RuntimeException + * @return $this + */ + public function setOptions(array $options) + { + $validOptions = $this->getValidOptions(); + $aliasOptions = $this->getAliasedOptions(); + + if (isset($options['identity']) && $options['identity'] && !isset($options['null'])) { + $options['null'] = false; + } + + foreach ($options as $option => $value) { + if (isset($aliasOptions[$option])) { + // proxy alias -> option + $option = $aliasOptions[$option]; + } + + if (!in_array($option, $validOptions, true)) { + throw new RuntimeException(sprintf('"%s" is not a valid column option.', $option)); + } + + $method = 'set' . ucfirst($option); + $this->$method($value); + } + + return $this; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Table/ForeignKey.php b/vendor/topthink/think-migration/phinx/Db/Table/ForeignKey.php new file mode 100644 index 0000000..cd14893 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Table/ForeignKey.php @@ -0,0 +1,237 @@ + + */ + protected static $validOptions = ['delete', 'update', 'constraint']; + + /** + * @var string[] + */ + protected $columns = []; + + /** + * @var \Phinx\Db\Table\Table + */ + protected $referencedTable; + + /** + * @var string[] + */ + protected $referencedColumns = []; + + /** + * @var string|null + */ + protected $onDelete; + + /** + * @var string|null + */ + protected $onUpdate; + + /** + * @var string|null + */ + protected $constraint; + + /** + * Sets the foreign key columns. + * + * @param string[]|string $columns Columns + * @return $this + */ + public function setColumns($columns) + { + $this->columns = is_string($columns) ? [$columns] : $columns; + + return $this; + } + + /** + * Gets the foreign key columns. + * + * @return string[] + */ + public function getColumns(): array + { + return $this->columns; + } + + /** + * Sets the foreign key referenced table. + * + * @param \Phinx\Db\Table\Table $table The table this KEY is pointing to + * @return $this + */ + public function setReferencedTable(Table $table) + { + $this->referencedTable = $table; + + return $this; + } + + /** + * Gets the foreign key referenced table. + * + * @return \Phinx\Db\Table\Table + */ + public function getReferencedTable(): Table + { + return $this->referencedTable; + } + + /** + * Sets the foreign key referenced columns. + * + * @param string[] $referencedColumns Referenced columns + * @return $this + */ + public function setReferencedColumns(array $referencedColumns) + { + $this->referencedColumns = $referencedColumns; + + return $this; + } + + /** + * Gets the foreign key referenced columns. + * + * @return string[] + */ + public function getReferencedColumns(): array + { + return $this->referencedColumns; + } + + /** + * Sets ON DELETE action for the foreign key. + * + * @param string $onDelete On Delete + * @return $this + */ + public function setOnDelete(string $onDelete) + { + $this->onDelete = $this->normalizeAction($onDelete); + + return $this; + } + + /** + * Gets ON DELETE action for the foreign key. + * + * @return string|null + */ + public function getOnDelete(): ?string + { + return $this->onDelete; + } + + /** + * Gets ON UPDATE action for the foreign key. + * + * @return string|null + */ + public function getOnUpdate(): ?string + { + return $this->onUpdate; + } + + /** + * Sets ON UPDATE action for the foreign key. + * + * @param string $onUpdate On Update + * @return $this + */ + public function setOnUpdate(string $onUpdate) + { + $this->onUpdate = $this->normalizeAction($onUpdate); + + return $this; + } + + /** + * Sets constraint for the foreign key. + * + * @param string $constraint Constraint + * @return $this + */ + public function setConstraint(string $constraint) + { + $this->constraint = $constraint; + + return $this; + } + + /** + * Gets constraint name for the foreign key. + * + * @return string|null + */ + public function getConstraint(): ?string + { + return $this->constraint; + } + + /** + * Utility method that maps an array of index options to this objects methods. + * + * @param array $options Options + * @throws \RuntimeException + * @return $this + */ + public function setOptions(array $options) + { + foreach ($options as $option => $value) { + if (!in_array($option, static::$validOptions, true)) { + throw new RuntimeException(sprintf('"%s" is not a valid foreign key option.', $option)); + } + + // handle $options['delete'] as $options['update'] + if ($option === 'delete') { + $this->setOnDelete($value); + } elseif ($option === 'update') { + $this->setOnUpdate($value); + } else { + $method = 'set' . ucfirst($option); + $this->$method($value); + } + } + + return $this; + } + + /** + * From passed value checks if it's correct and fixes if needed + * + * @param string $action Action + * @throws \InvalidArgumentException + * @return string + */ + protected function normalizeAction(string $action): string + { + $constantName = 'static::' . str_replace(' ', '_', strtoupper(trim($action))); + if (!defined($constantName)) { + throw new InvalidArgumentException('Unknown action passed: ' . $action); + } + + return constant($constantName); + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Table/Index.php b/vendor/topthink/think-migration/phinx/Db/Table/Index.php new file mode 100644 index 0000000..f405f02 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Table/Index.php @@ -0,0 +1,227 @@ +columns = is_string($columns) ? [$columns] : $columns; + + return $this; + } + + /** + * Gets the index columns. + * + * @return string[]|null + */ + public function getColumns(): ?array + { + return $this->columns; + } + + /** + * Sets the index type. + * + * @param string $type Type + * @return $this + */ + public function setType(string $type) + { + $this->type = $type; + + return $this; + } + + /** + * Gets the index type. + * + * @return string + */ + public function getType(): string + { + return $this->type; + } + + /** + * Sets the index name. + * + * @param string $name Name + * @return $this + */ + public function setName(string $name) + { + $this->name = $name; + + return $this; + } + + /** + * Gets the index name. + * + * @return string|null + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets the index limit. + * + * @param int|array $limit limit value or array of limit value + * @return $this + */ + public function setLimit($limit) + { + $this->limit = $limit; + + return $this; + } + + /** + * Gets the index limit. + * + * @return int|array|null + */ + public function getLimit() + { + return $this->limit; + } + + /** + * Sets the index columns sort order. + * + * @param string[] $order column name sort order key value pair + * @return $this + */ + public function setOrder(array $order) + { + $this->order = $order; + + return $this; + } + + /** + * Gets the index columns sort order. + * + * @return string[]|null + */ + public function getOrder(): ?array + { + return $this->order; + } + + /** + * Sets the index included columns. + * + * @param string[] $includedColumns Columns + * @return $this + */ + public function setInclude(array $includedColumns) + { + $this->includedColumns = $includedColumns; + + return $this; + } + + /** + * Gets the index included columns. + * + * @return string[]|null + */ + public function getInclude(): ?array + { + return $this->includedColumns; + } + + /** + * Utility method that maps an array of index options to this objects methods. + * + * @param array $options Options + * @throws \RuntimeException + * @return $this + */ + public function setOptions(array $options) + { + // Valid Options + $validOptions = ['type', 'unique', 'name', 'limit', 'order', 'include']; + foreach ($options as $option => $value) { + if (!in_array($option, $validOptions, true)) { + throw new RuntimeException(sprintf('"%s" is not a valid index option.', $option)); + } + + // handle $options['unique'] + if (strcasecmp($option, self::UNIQUE) === 0) { + if ((bool)$value) { + $this->setType(self::UNIQUE); + } + continue; + } + + $method = 'set' . ucfirst($option); + $this->$method($value); + } + + return $this; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Table/Table.php b/vendor/topthink/think-migration/phinx/Db/Table/Table.php new file mode 100644 index 0000000..0352157 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Table/Table.php @@ -0,0 +1,84 @@ + + */ + protected $options; + + /** + * @param string $name The table name + * @param array $options The creation options for this table + * @throws \InvalidArgumentException + */ + public function __construct($name, array $options = []) + { + if (empty($name)) { + throw new InvalidArgumentException('Cannot use an empty table name'); + } + + $this->name = $name; + $this->options = $options; + } + + /** + * Sets the table name. + * + * @param string $name The name of the table + * @return $this + */ + public function setName(string $name) + { + $this->name = $name; + + return $this; + } + + /** + * Gets the table name. + * + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * Gets the table options + * + * @return array + */ + public function getOptions(): array + { + return $this->options; + } + + /** + * Sets the table options + * + * @param array $options The options for the table creation + * @return $this + */ + public function setOptions(array $options) + { + $this->options = $options; + + return $this; + } +} diff --git a/vendor/topthink/think-migration/phinx/Db/Util/AlterInstructions.php b/vendor/topthink/think-migration/phinx/Db/Util/AlterInstructions.php new file mode 100644 index 0000000..ddc49fc --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Db/Util/AlterInstructions.php @@ -0,0 +1,122 @@ +alterParts = $alterParts; + $this->postSteps = $postSteps; + } + + /** + * Adds another part to the single ALTER instruction + * + * @param string $part The SQL snipped to add as part of the ALTER instruction + * @return void + */ + public function addAlter(string $part): void + { + $this->alterParts[] = $part; + } + + /** + * Adds a SQL command to be executed after the ALTER instruction. + * This method allows a callable, with will get an empty array as state + * for the first time and will pass the return value of the callable to + * the next callable, if present. + * + * This allows to keep a single state across callbacks. + * + * @param string|callable $sql The SQL to run after, or a callable to execute + * @return void + */ + public function addPostStep($sql): void + { + $this->postSteps[] = $sql; + } + + /** + * Returns the alter SQL snippets + * + * @return string[] + */ + public function getAlterParts(): array + { + return $this->alterParts; + } + + /** + * Returns the SQL commands to run after the ALTER instruction + * + * @return (string|callable)[] + */ + public function getPostSteps(): array + { + return $this->postSteps; + } + + /** + * Merges another AlterInstructions object to this one + * + * @param \Phinx\Db\Util\AlterInstructions $other The other collection of instructions to merge in + * @return void + */ + public function merge(AlterInstructions $other): void + { + $this->alterParts = array_merge($this->alterParts, $other->getAlterParts()); + $this->postSteps = array_merge($this->postSteps, $other->getPostSteps()); + } + + /** + * Executes the ALTER instruction and all of the post steps. + * + * @param string $alterTemplate The template for the alter instruction + * @param callable $executor The function to be used to execute all instructions + * @return void + */ + public function execute(string $alterTemplate, callable $executor): void + { + if ($this->alterParts) { + $alter = sprintf($alterTemplate, implode(', ', $this->alterParts)); + $executor($alter); + } + + $state = []; + + foreach ($this->postSteps as $instruction) { + if (is_callable($instruction)) { + $state = $instruction($state); + continue; + } + + $executor($instruction); + } + } +} diff --git a/vendor/topthink/think-migration/phinx/LICENSE b/vendor/topthink/think-migration/phinx/LICENSE index 26ade90..983a906 100644 --- a/vendor/topthink/think-migration/phinx/LICENSE +++ b/vendor/topthink/think-migration/phinx/LICENSE @@ -1,9 +1,9 @@ (The MIT license) -Copyright (c) 2014 Rob Morgan +Copyright (c) 2012-present Rob Morgan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/topthink/think-migration/phinx/Migration/AbstractMigration.php b/vendor/topthink/think-migration/phinx/Migration/AbstractMigration.php new file mode 100644 index 0000000..d2b2601 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Migration/AbstractMigration.php @@ -0,0 +1,338 @@ + + */ +abstract class AbstractMigration implements MigrationInterface +{ + /** + * @var string + */ + protected $environment; + + /** + * @var int + */ + protected $version; + + /** + * @var \Phinx\Db\Adapter\AdapterInterface|null + */ + protected $adapter; + + /** + * @var \think\console\Output|null + */ + protected $output; + + /** + * @var \think\console\Input|null + */ + protected $input; + + /** + * Whether this migration is being applied or reverted + * + * @var bool + */ + protected $isMigratingUp = true; + + /** + * List of all the table objects created by this migration + * + * @var array<\Phinx\Db\Table> + */ + protected $tables = []; + + /** + * @param string $environment Environment Detected + * @param int $version Migration Version + * @param \think\console\Input|null $input Input + * @param \think\console\Output|null $output Output + */ + final public function __construct(string $environment, int $version, ?InputInterface $input = null, ?OutputInterface $output = null) + { + $this->environment = $environment; + $this->version = $version; + + if ($input !== null) { + $this->setInput($input); + } + + if ($output !== null) { + $this->setOutput($output); + } + } + + /** + * @inheritDoc + */ + public function setAdapter(AdapterInterface $adapter): MigrationInterface + { + $this->adapter = $adapter; + + return $this; + } + + /** + * @inheritDoc + */ + public function getAdapter(): ?AdapterInterface + { + return $this->adapter; + } + + /** + * @inheritDoc + */ + public function setInput(InputInterface $input): MigrationInterface + { + $this->input = $input; + + return $this; + } + + /** + * @inheritDoc + */ + public function getInput(): ?InputInterface + { + return $this->input; + } + + /** + * @inheritDoc + */ + public function setOutput(OutputInterface $output): MigrationInterface + { + $this->output = $output; + + return $this; + } + + /** + * @inheritDoc + */ + public function getOutput(): ?OutputInterface + { + return $this->output; + } + + /** + * @inheritDoc + */ + public function getName(): string + { + return static::class; + } + + /** + * @inheritDoc + */ + public function getEnvironment(): string + { + return $this->environment; + } + + /** + * @inheritDoc + */ + public function setVersion($version): MigrationInterface + { + $this->version = $version; + + return $this; + } + + /** + * @inheritDoc + */ + public function getVersion(): int + { + return $this->version; + } + + /** + * @inheritDoc + */ + public function setMigratingUp(bool $isMigratingUp): MigrationInterface + { + $this->isMigratingUp = $isMigratingUp; + + return $this; + } + + /** + * @inheritDoc + */ + public function isMigratingUp(): bool + { + return $this->isMigratingUp; + } + + /** + * @inheritDoc + */ + public function execute(string $sql, array $params = []): int + { + return $this->getAdapter()->execute($sql, $params); + } + + /** + * @inheritDoc + */ + public function query(string $sql, array $params = []) + { + return $this->getAdapter()->query($sql, $params); + } + + /** + * @inheritDoc + */ + public function getQueryBuilder(): Query + { + return $this->getAdapter()->getQueryBuilder(); + } + + /** + * @inheritDoc + */ + public function fetchRow(string $sql) + { + return $this->getAdapter()->fetchRow($sql); + } + + /** + * @inheritDoc + */ + public function fetchAll(string $sql): array + { + return $this->getAdapter()->fetchAll($sql); + } + + /** + * @inheritDoc + */ + public function createDatabase(string $name, array $options): void + { + $this->getAdapter()->createDatabase($name, $options); + } + + /** + * @inheritDoc + */ + public function dropDatabase(string $name): void + { + $this->getAdapter()->dropDatabase($name); + } + + /** + * @inheritDoc + */ + public function createSchema(string $name): void + { + $this->getAdapter()->createSchema($name); + } + + /** + * @inheritDoc + */ + public function dropSchema(string $name): void + { + $this->getAdapter()->dropSchema($name); + } + + /** + * @inheritDoc + */ + public function hasTable(string $tableName): bool + { + return $this->getAdapter()->hasTable($tableName); + } + + /** + * @inheritDoc + */ + public function table(string $tableName, array $options = []): Table + { + $table = new Table($tableName, $options, $this->getAdapter()); + $this->tables[] = $table; + + return $table; + } + + /** + * Perform checks on the migration, print a warning + * if there are potential problems. + * + * Right now, the only check is if there is both a `change()` and + * an `up()` or a `down()` method. + * + * @return void + */ + public function preFlightCheck(): void + { + if (method_exists($this, MigrationInterface::CHANGE)) { + if ( + method_exists($this, MigrationInterface::UP) || + method_exists($this, MigrationInterface::DOWN) + ) { + $this->output->writeln(sprintf( + 'warning Migration contains both change() and up()/down() methods. Ignoring up() and down().' + )); + } + } + } + + /** + * Perform checks on the migration after completion + * + * Right now, the only check is whether all changes were committed + * + * @throws \RuntimeException + * @return void + */ + public function postFlightCheck(): void + { + foreach ($this->tables as $table) { + if ($table->hasPendingActions()) { + throw new RuntimeException('Migration has pending actions after execution!'); + } + } + } + + /** + * Checks to see if the migration should be executed. + * + * Returns true by default. + * + * You can use this to prevent a migration from executing. + * + * @return bool + */ + public function shouldExecute(): bool + { + return true; + } +} diff --git a/vendor/topthink/think-migration/phinx/Migration/AbstractTemplateCreation.php b/vendor/topthink/think-migration/phinx/Migration/AbstractTemplateCreation.php new file mode 100644 index 0000000..95a9a28 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Migration/AbstractTemplateCreation.php @@ -0,0 +1,74 @@ +setInput($input); + } + if ($output !== null) { + $this->setOutput($output); + } + } + + /** + * @inheritDoc + */ + public function getInput(): InputInterface + { + return $this->input; + } + + /** + * @inheritDoc + */ + public function setInput(InputInterface $input): CreationInterface + { + $this->input = $input; + + return $this; + } + + /** + * @inheritDoc + */ + public function getOutput(): OutputInterface + { + return $this->output; + } + + /** + * @inheritDoc + */ + public function setOutput(OutputInterface $output): CreationInterface + { + $this->output = $output; + + return $this; + } +} diff --git a/vendor/topthink/think-migration/phinx/Migration/CreationInterface.php b/vendor/topthink/think-migration/phinx/Migration/CreationInterface.php new file mode 100644 index 0000000..6a622af --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Migration/CreationInterface.php @@ -0,0 +1,69 @@ + + */ +interface CreationInterface +{ + /** + * @param \think\console\Input|null $input Input + * @param \think\console\Output|null $output Output + */ + public function __construct(?InputInterface $input = null, ?OutputInterface $output = null); + + /** + * @param \think\console\Input $input Input + * @return $this + */ + public function setInput(InputInterface $input); + + /** + * @param \think\console\Output $output Output + * @return $this + */ + public function setOutput(OutputInterface $output); + + /** + * @return \think\console\Input + */ + public function getInput(): InputInterface; + + /** + * @return \think\console\Output + */ + public function getOutput(): OutputInterface; + + /** + * Get the migration template. + * + * This will be the content that Phinx will amend to generate the migration file. + * + * @return string The content of the template for Phinx to amend. + */ + public function getMigrationTemplate(): string; + + /** + * Post Migration Creation. + * + * Once the migration file has been created, this method will be called, allowing any additional + * processing, specific to the template to be performed. + * + * @param string $migrationFilename The name of the newly created migration. + * @param string $className The class name. + * @param string $baseClassName The name of the base class. + * @return void + */ + public function postMigrationCreation(string $migrationFilename, string $className, string $baseClassName): void; +} diff --git a/vendor/topthink/think-migration/phinx/Migration/IrreversibleMigrationException.php b/vendor/topthink/think-migration/phinx/Migration/IrreversibleMigrationException.php new file mode 100644 index 0000000..376bcdc --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Migration/IrreversibleMigrationException.php @@ -0,0 +1,20 @@ + + */ +class IrreversibleMigrationException extends Exception +{ +} diff --git a/vendor/topthink/think-migration/phinx/Migration/Manager.php b/vendor/topthink/think-migration/phinx/Migration/Manager.php new file mode 100644 index 0000000..c6cd9bf --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Migration/Manager.php @@ -0,0 +1,1141 @@ +setConfig($config); + $this->setInput($input); + $this->setOutput($output); + } + + /** + * Prints the specified environment's migration status. + * + * @param string $environment environment to print status of + * @param string|null $format format to print status in (either text, json, or null) + * @throws \RuntimeException + * @return array array indicating if there are any missing or down migrations + */ + public function printStatus(string $environment, ?string $format = null): array + { + $output = $this->getOutput(); + $hasDownMigration = false; + $hasMissingMigration = false; + $migrations = $this->getMigrations($environment); + $migrationCount = 0; + $missingCount = 0; + $pendingMigrationCount = 0; + $finalMigrations = []; + $verbosity = $output->getVerbosity(); + if ($format === 'json') { + $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); + } + if (count($migrations)) { + // rewrite using Symfony Table Helper as we already have this library + // included and it will fix formatting issues (e.g drawing the lines) + $output->writeln('', $this->verbosityLevel); + + switch ($this->getConfig()->getVersionOrder()) { + case Config::VERSION_ORDER_CREATION_TIME: + $migrationIdAndStartedHeader = '[Migration ID] Started '; + break; + case Config::VERSION_ORDER_EXECUTION_TIME: + $migrationIdAndStartedHeader = 'Migration ID [Started ]'; + break; + default: + throw new RuntimeException('Invalid version_order configuration option'); + } + + $output->writeln(" Status $migrationIdAndStartedHeader Finished Migration Name ", $this->verbosityLevel); + $output->writeln('----------------------------------------------------------------------------------', $this->verbosityLevel); + + $env = $this->getEnvironment($environment); + $versions = $env->getVersionLog(); + + $maxNameLength = $versions ? max(array_map(function ($version) { + return strlen($version['migration_name']); + }, $versions)) : 0; + + $missingVersions = array_diff_key($versions, $migrations); + $missingCount = count($missingVersions); + + $hasMissingMigration = !empty($missingVersions); + + // get the migrations sorted in the same way as the versions + /** @var \Phinx\Migration\AbstractMigration[] $sortedMigrations */ + $sortedMigrations = []; + + foreach ($versions as $versionCreationTime => $version) { + if (isset($migrations[$versionCreationTime])) { + array_push($sortedMigrations, $migrations[$versionCreationTime]); + unset($migrations[$versionCreationTime]); + } + } + + if (empty($sortedMigrations) && !empty($missingVersions)) { + // this means we have no up migrations, so we write all the missing versions already so they show up + // before any possible down migration + foreach ($missingVersions as $missingVersionCreationTime => $missingVersion) { + $this->printMissingVersion($missingVersion, $maxNameLength); + + unset($missingVersions[$missingVersionCreationTime]); + } + } + + // any migration left in the migrations (ie. not unset when sorting the migrations by the version order) is + // a migration that is down, so we add them to the end of the sorted migrations list + if (!empty($migrations)) { + $sortedMigrations = array_merge($sortedMigrations, $migrations); + } + + $migrationCount = count($sortedMigrations); + foreach ($sortedMigrations as $migration) { + $version = array_key_exists($migration->getVersion(), $versions) ? $versions[$migration->getVersion()] : false; + if ($version) { + // check if there are missing versions before this version + foreach ($missingVersions as $missingVersionCreationTime => $missingVersion) { + if ($this->getConfig()->isVersionOrderCreationTime()) { + if ($missingVersion['version'] > $version['version']) { + break; + } + } else { + if ($missingVersion['start_time'] > $version['start_time']) { + break; + } elseif ( + $missingVersion['start_time'] == $version['start_time'] && + $missingVersion['version'] > $version['version'] + ) { + break; + } + } + + $this->printMissingVersion($missingVersion, $maxNameLength); + + unset($missingVersions[$missingVersionCreationTime]); + } + + $status = ' up '; + } else { + $pendingMigrationCount++; + $hasDownMigration = true; + $status = ' down '; + } + $maxNameLength = max($maxNameLength, strlen($migration->getName())); + + $output->writeln( + sprintf( + '%s %14.0f %19s %19s %s', + $status, + $migration->getVersion(), + ($version ? $version['start_time'] : ''), + ($version ? $version['end_time'] : ''), + $migration->getName() + ), + $this->verbosityLevel + ); + + if ($version && $version['breakpoint']) { + $output->writeln(' BREAKPOINT SET', $this->verbosityLevel); + } + + $finalMigrations[] = ['migration_status' => trim(strip_tags($status)), 'migration_id' => sprintf('%14.0f', $migration->getVersion()), 'migration_name' => $migration->getName()]; + unset($versions[$migration->getVersion()]); + } + + // and finally add any possibly-remaining missing migrations + foreach ($missingVersions as $missingVersionCreationTime => $missingVersion) { + $this->printMissingVersion($missingVersion, $maxNameLength); + + unset($missingVersions[$missingVersionCreationTime]); + } + } else { + // there are no migrations + $output->writeln('', $this->verbosityLevel); + $output->writeln('There are no available migrations. Try creating one using the create command.', $this->verbosityLevel); + } + + // write an empty line + $output->writeln('', $this->verbosityLevel); + + if ($format !== null) { + switch ($format) { + case AbstractCommand::FORMAT_JSON: + $output->setVerbosity($verbosity); + $output->writeln(json_encode( + [ + 'pending_count' => $pendingMigrationCount, + 'missing_count' => $missingCount, + 'total_count' => $migrationCount + $missingCount, + 'migrations' => $finalMigrations, + ] + )); + break; + default: + $output->writeln('Unsupported format: ' . $format . ''); + } + } + + return [ + 'hasMissingMigration' => $hasMissingMigration, + 'hasDownMigration' => $hasDownMigration, + ]; + } + + /** + * Print Missing Version + * + * @param array $version The missing version to print (in the format returned by Environment.getVersionLog). + * @param int $maxNameLength The maximum migration name length. + * @return void + */ + protected function printMissingVersion(array $version, int $maxNameLength): void + { + $this->getOutput()->writeln(sprintf( + ' up %14.0f %19s %19s %s ** MISSING MIGRATION FILE **', + $version['version'], + $version['start_time'], + $version['end_time'], + str_pad($version['migration_name'], $maxNameLength, ' ') + )); + + if ($version && $version['breakpoint']) { + $this->getOutput()->writeln(' BREAKPOINT SET'); + } + } + + /** + * Migrate to the version of the database on a given date. + * + * @param string $environment Environment + * @param \DateTime $dateTime Date to migrate to + * @param bool $fake flag that if true, we just record running the migration, but not actually do the + * migration + * @return void + */ + public function migrateToDateTime(string $environment, DateTime $dateTime, bool $fake = false): void + { + $versions = array_keys($this->getMigrations($environment)); + $dateString = $dateTime->format('YmdHis'); + + $outstandingMigrations = array_filter($versions, function ($version) use ($dateString) { + return $version <= $dateString; + }); + + if (count($outstandingMigrations) > 0) { + $migration = max($outstandingMigrations); + $this->getOutput()->writeln('Migrating to version ' . $migration, $this->verbosityLevel); + $this->migrate($environment, $migration, $fake); + } + } + + /** + * Migrate an environment to the specified version. + * + * @param string $environment Environment + * @param int|null $version version to migrate to + * @param bool $fake flag that if true, we just record running the migration, but not actually do the migration + * @return void + */ + public function migrate(string $environment, ?int $version = null, bool $fake = false): void + { + $migrations = $this->getMigrations($environment); + $env = $this->getEnvironment($environment); + $versions = $env->getVersions(); + $current = $env->getCurrentVersion(); + + if (empty($versions) && empty($migrations)) { + return; + } + + if ($version === null) { + $version = max(array_merge($versions, array_keys($migrations))); + } else { + if ($version != 0 && !isset($migrations[$version])) { + $this->output->writeln(sprintf( + 'warning %s is not a valid version', + $version + )); + + return; + } + } + + // are we migrating up or down? + $direction = $version > $current ? MigrationInterface::UP : MigrationInterface::DOWN; + + if ($direction === MigrationInterface::DOWN) { + // run downs first + krsort($migrations); + foreach ($migrations as $migration) { + if ($migration->getVersion() <= $version) { + break; + } + + if (in_array($migration->getVersion(), $versions)) { + $this->executeMigration($environment, $migration, MigrationInterface::DOWN, $fake); + } + } + } + + ksort($migrations); + foreach ($migrations as $migration) { + if ($migration->getVersion() > $version) { + break; + } + + if (!in_array($migration->getVersion(), $versions)) { + $this->executeMigration($environment, $migration, MigrationInterface::UP, $fake); + } + } + } + + /** + * Execute a migration against the specified environment. + * + * @param string $name Environment Name + * @param \Phinx\Migration\MigrationInterface $migration Migration + * @param string $direction Direction + * @param bool $fake flag that if true, we just record running the migration, but not actually do the migration + * @return void + */ + public function executeMigration(string $name, MigrationInterface $migration, string $direction = MigrationInterface::UP, bool $fake = false): void + { + $this->getOutput()->writeln('', $this->verbosityLevel); + + // Skip the migration if it should not be executed + if (!$migration->shouldExecute()) { + $this->printMigrationStatus($migration, 'skipped'); + + return; + } + + $this->printMigrationStatus($migration, ($direction === MigrationInterface::UP ? 'migrating' : 'reverting')); + + // Execute the migration and log the time elapsed. + $start = microtime(true); + $this->getEnvironment($name)->executeMigration($migration, $direction, $fake); + $end = microtime(true); + + $this->printMigrationStatus( + $migration, + ($direction === MigrationInterface::UP ? 'migrated' : 'reverted'), + sprintf('%.4fs', $end - $start) + ); + } + + /** + * Execute a seeder against the specified environment. + * + * @param string $name Environment Name + * @param \Phinx\Seed\SeedInterface $seed Seed + * @return void + */ + public function executeSeed(string $name, SeedInterface $seed): void + { + $this->getOutput()->writeln('', $this->verbosityLevel); + + // Skip the seed if it should not be executed + if (!$seed->shouldExecute()) { + $this->printSeedStatus($seed, 'skipped'); + + return; + } + + $this->printSeedStatus($seed, 'seeding'); + + // Execute the seeder and log the time elapsed. + $start = microtime(true); + $this->getEnvironment($name)->executeSeed($seed); + $end = microtime(true); + + $this->printSeedStatus( + $seed, + 'seeded', + sprintf('%.4fs', $end - $start) + ); + } + + /** + * Print Migration Status + * + * @param \Phinx\Migration\MigrationInterface $migration Migration + * @param string $status Status of the migration + * @param string|null $duration Duration the migration took the be executed + * @return void + */ + protected function printMigrationStatus(MigrationInterface $migration, string $status, ?string $duration = null): void + { + $this->printStatusOutput( + $migration->getVersion() . ' ' . $migration->getName(), + $status, + $duration + ); + } + + /** + * Print Seed Status + * + * @param \Phinx\Seed\SeedInterface $seed Seed + * @param string $status Status of the seed + * @param string|null $duration Duration the seed took the be executed + * @return void + */ + protected function printSeedStatus(SeedInterface $seed, string $status, ?string $duration = null): void + { + $this->printStatusOutput( + $seed->getName(), + $status, + $duration + ); + } + + /** + * Print Status in Output + * + * @param string $name Name of the migration or seed + * @param string $status Status of the migration or seed + * @param string|null $duration Duration the migration or seed took the be executed + * @return void + */ + protected function printStatusOutput(string $name, string $status, ?string $duration = null): void + { + $this->getOutput()->writeln( + ' ==' . + ' ' . $name . ':' . + ' ' . $status . ' ' . $duration . '', + $this->verbosityLevel + ); + } + + /** + * Rollback an environment to the specified version. + * + * @param string $environment Environment + * @param int|string|null $target Target + * @param bool $force Force + * @param bool $targetMustMatchVersion Target must match version + * @param bool $fake Flag that if true, we just record running the migration, but not actually do the migration + * @return void + */ + public function rollback(string $environment, $target = null, bool $force = false, bool $targetMustMatchVersion = true, bool $fake = false): void + { + // note that the migrations are indexed by name (aka creation time) in ascending order + $migrations = $this->getMigrations($environment); + + // note that the version log are also indexed by name with the proper ascending order according to the version order + $executedVersions = $this->getEnvironment($environment)->getVersionLog(); + + // get a list of migrations sorted in the opposite way of the executed versions + $sortedMigrations = []; + + foreach ($executedVersions as $versionCreationTime => &$executedVersion) { + // if we have a date (ie. the target must not match a version) and we are sorting by execution time, we + // convert the version start time so we can compare directly with the target date + if (!$this->getConfig()->isVersionOrderCreationTime() && !$targetMustMatchVersion) { + /** @var \DateTime $dateTime */ + $dateTime = DateTime::createFromFormat('Y-m-d H:i:s', $executedVersion['start_time']); + $executedVersion['start_time'] = $dateTime->format('YmdHis'); + } + + if (isset($migrations[$versionCreationTime])) { + array_unshift($sortedMigrations, $migrations[$versionCreationTime]); + } else { + // this means the version is missing so we unset it so that we don't consider it when rolling back + // migrations (or choosing the last up version as target) + unset($executedVersions[$versionCreationTime]); + } + } + + if ($target === 'all' || $target === '0') { + $target = 0; + } elseif (!is_numeric($target) && $target !== null) { // try to find a target version based on name + // search through the migrations using the name + $migrationNames = array_map(function ($item) { + return $item['migration_name']; + }, $executedVersions); + $found = array_search($target, $migrationNames, true); + + // check on was found + if ($found !== false) { + $target = (string)$found; + } else { + $this->getOutput()->writeln("No migration found with name ($target)"); + + return; + } + } + + // Check we have at least 1 migration to revert + $executedVersionCreationTimes = array_keys($executedVersions); + if (empty($executedVersionCreationTimes) || $target == end($executedVersionCreationTimes)) { + $this->getOutput()->writeln('No migrations to rollback'); + + return; + } + + // If no target was supplied, revert the last migration + if ($target === null) { + // Get the migration before the last run migration + $prev = count($executedVersionCreationTimes) - 2; + $target = $prev >= 0 ? $executedVersionCreationTimes[$prev] : 0; + } + + // If the target must match a version, check the target version exists + if ($targetMustMatchVersion && $target !== 0 && !isset($migrations[$target])) { + $this->getOutput()->writeln("Target version ($target) not found"); + + return; + } + + // Rollback all versions until we find the wanted rollback target + $rollbacked = false; + + foreach ($sortedMigrations as $migration) { + if ($targetMustMatchVersion && $migration->getVersion() == $target) { + break; + } + + if (in_array($migration->getVersion(), $executedVersionCreationTimes)) { + $executedVersion = $executedVersions[$migration->getVersion()]; + + if (!$targetMustMatchVersion) { + if ( + ($this->getConfig()->isVersionOrderCreationTime() && $executedVersion['version'] <= $target) || + (!$this->getConfig()->isVersionOrderCreationTime() && $executedVersion['start_time'] <= $target) + ) { + break; + } + } + + if ($executedVersion['breakpoint'] != 0 && !$force) { + $this->getOutput()->writeln('Breakpoint reached. Further rollbacks inhibited.'); + break; + } + $this->executeMigration($environment, $migration, MigrationInterface::DOWN, $fake); + $rollbacked = true; + } + } + + if (!$rollbacked) { + $this->getOutput()->writeln('No migrations to rollback'); + } + } + + /** + * Run database seeders against an environment. + * + * @param string $environment Environment + * @param string|null $seed Seeder + * @throws \InvalidArgumentException + * @return void + */ + public function seed(string $environment, ?string $seed = null): void + { + $seeds = $this->getSeeds($environment); + + if ($seed === null) { + // run all seeders + foreach ($seeds as $seeder) { + if (array_key_exists($seeder->getName(), $seeds)) { + $this->executeSeed($environment, $seeder); + } + } + } else { + // run only one seeder + if (array_key_exists($seed, $seeds)) { + $this->executeSeed($environment, $seeds[$seed]); + } else { + throw new InvalidArgumentException(sprintf('The seed class "%s" does not exist', $seed)); + } + } + } + + /** + * Sets the environments. + * + * @param \Phinx\Migration\Manager\Environment[] $environments Environments + * @return $this + */ + public function setEnvironments(array $environments = []) + { + $this->environments = $environments; + + return $this; + } + + /** + * Gets the manager class for the given environment. + * + * @param string $name Environment Name + * @throws \InvalidArgumentException + * @return \Phinx\Migration\Manager\Environment + */ + public function getEnvironment(string $name): Environment + { + if (isset($this->environments[$name])) { + return $this->environments[$name]; + } + + // check the environment exists + if (!$this->getConfig()->hasEnvironment($name)) { + throw new InvalidArgumentException(sprintf( + 'The environment "%s" does not exist', + $name + )); + } + + // create an environment instance and cache it + $envOptions = $this->getConfig()->getEnvironment($name); + $envOptions['version_order'] = $this->getConfig()->getVersionOrder(); + $envOptions['data_domain'] = $this->getConfig()->getDataDomain(); + + $environment = new Environment($name, $envOptions); + $this->environments[$name] = $environment; + $environment->setInput($this->getInput()); + $environment->setOutput($this->getOutput()); + + return $environment; + } + + /** + * Sets the user defined PSR-11 container + * + * @param \Psr\Container\ContainerInterface $container Container + * @return $this + */ + public function setContainer(ContainerInterface $container) + { + $this->container = $container; + + return $this; + } + + /** + * Sets the console input. + * + * @param \think\console\Input $input Input + * @return $this + */ + public function setInput(InputInterface $input) + { + $this->input = $input; + + return $this; + } + + /** + * Gets the console input. + * + * @return \think\console\Input + */ + public function getInput(): InputInterface + { + return $this->input; + } + + /** + * Sets the console output. + * + * @param \think\console\Output $output Output + * @return $this + */ + public function setOutput(OutputInterface $output) + { + $this->output = $output; + + return $this; + } + + /** + * Gets the console output. + * + * @return \think\console\Output + */ + public function getOutput(): OutputInterface + { + return $this->output; + } + + /** + * Sets the database migrations. + * + * @param \Phinx\Migration\AbstractMigration[] $migrations Migrations + * @return $this + */ + public function setMigrations(array $migrations) + { + $this->migrations = $migrations; + + return $this; + } + + /** + * Gets an array of the database migrations, indexed by migration name (aka creation time) and sorted in ascending + * order + * + * @param string $environment Environment + * @throws \InvalidArgumentException + * @return \Phinx\Migration\MigrationInterface[] + */ + public function getMigrations(string $environment): array + { + if ($this->migrations === null) { + $phpFiles = $this->getMigrationFiles(); + + if ($this->getOutput()->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) { + $this->getOutput()->writeln('Migration file'); + $this->getOutput()->writeln( + array_map( + function ($phpFile) { + return " {$phpFile}"; + }, + $phpFiles + ) + ); + } + + // filter the files to only get the ones that match our naming scheme + $fileNames = []; + /** @var \Phinx\Migration\AbstractMigration[] $versions */ + $versions = []; + + foreach ($phpFiles as $filePath) { + if (Util::isValidMigrationFileName(basename($filePath))) { + if ($this->getOutput()->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) { + $this->getOutput()->writeln("Valid migration file {$filePath}."); + } + + $version = Util::getVersionFromFileName(basename($filePath)); + + if (isset($versions[$version])) { + throw new InvalidArgumentException(sprintf('Duplicate migration - "%s" has the same version as "%s"', $filePath, $versions[$version]->getVersion())); + } + + $config = $this->getConfig(); + $namespace = $config instanceof NamespaceAwareInterface ? $config->getMigrationNamespaceByPath(dirname($filePath)) : null; + + // convert the filename to a class name + $class = ($namespace === null ? '' : $namespace . '\\') . Util::mapFileNameToClassName(basename($filePath)); + + if (isset($fileNames[$class])) { + throw new InvalidArgumentException(sprintf( + 'Migration "%s" has the same name as "%s"', + basename($filePath), + $fileNames[$class] + )); + } + + $fileNames[$class] = basename($filePath); + + if ($this->getOutput()->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) { + $this->getOutput()->writeln("Loading class $class from $filePath."); + } + + // load the migration file + $orig_display_errors_setting = ini_get('display_errors'); + ini_set('display_errors', 'On'); + /** @noinspection PhpIncludeInspection */ + require_once $filePath; + ini_set('display_errors', $orig_display_errors_setting); + if (!class_exists($class)) { + throw new InvalidArgumentException(sprintf( + 'Could not find class "%s" in file "%s"', + $class, + $filePath + )); + } + + if ($this->getOutput()->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) { + $this->getOutput()->writeln("Running $class."); + } + + // instantiate it + $migration = new $class($environment, $version, $this->getInput(), $this->getOutput()); + + if (!($migration instanceof AbstractMigration)) { + throw new InvalidArgumentException(sprintf( + 'The class "%s" in file "%s" must extend \Phinx\Migration\AbstractMigration', + $class, + $filePath + )); + } + + $versions[$version] = $migration; + } else { + if ($this->getOutput()->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) { + $this->getOutput()->writeln("Invalid migration file {$filePath}."); + } + } + } + + ksort($versions); + $this->setMigrations($versions); + } + + return $this->migrations; + } + + /** + * Returns a list of migration files found in the provided migration paths. + * + * @return string[] + */ + protected function getMigrationFiles(): array + { + return Util::getFiles($this->getConfig()->getMigrationPaths()); + } + + /** + * Sets the database seeders. + * + * @param \Phinx\Seed\SeedInterface[] $seeds Seeders + * @return $this + */ + public function setSeeds(array $seeds) + { + $this->seeds = $seeds; + + return $this; + } + + /** + * Get seed dependencies instances from seed dependency array + * + * @param \Phinx\Seed\SeedInterface $seed Seed + * @return \Phinx\Seed\SeedInterface[] + */ + protected function getSeedDependenciesInstances(SeedInterface $seed): array + { + $dependenciesInstances = []; + $dependencies = $seed->getDependencies(); + if (!empty($dependencies)) { + foreach ($dependencies as $dependency) { + foreach ($this->seeds as $seed) { + if (get_class($seed) === $dependency) { + $dependenciesInstances[get_class($seed)] = $seed; + } + } + } + } + + return $dependenciesInstances; + } + + /** + * Order seeds by dependencies + * + * @param \Phinx\Seed\SeedInterface[] $seeds Seeds + * @return \Phinx\Seed\SeedInterface[] + */ + protected function orderSeedsByDependencies(array $seeds): array + { + $orderedSeeds = []; + foreach ($seeds as $seed) { + $orderedSeeds[get_class($seed)] = $seed; + $dependencies = $this->getSeedDependenciesInstances($seed); + if (!empty($dependencies)) { + $orderedSeeds = array_merge($this->orderSeedsByDependencies($dependencies), $orderedSeeds); + } + } + + return $orderedSeeds; + } + + /** + * Gets an array of database seeders. + * + * @param string $environment Environment + * @throws \InvalidArgumentException + * @return \Phinx\Seed\SeedInterface[] + */ + public function getSeeds(string $environment): array + { + if ($this->seeds === null) { + $phpFiles = $this->getSeedFiles(); + + // filter the files to only get the ones that match our naming scheme + $fileNames = []; + /** @var \Phinx\Seed\SeedInterface[] $seeds */ + $seeds = []; + + foreach ($phpFiles as $filePath) { + if (Util::isValidSeedFileName(basename($filePath))) { + $config = $this->getConfig(); + $namespace = $config instanceof NamespaceAwareInterface ? $config->getSeedNamespaceByPath(dirname($filePath)) : null; + + // convert the filename to a class name + $class = ($namespace === null ? '' : $namespace . '\\') . pathinfo($filePath, PATHINFO_FILENAME); + $fileNames[$class] = basename($filePath); + + // load the seed file + /** @noinspection PhpIncludeInspection */ + require_once $filePath; + if (!class_exists($class)) { + throw new InvalidArgumentException(sprintf( + 'Could not find class "%s" in file "%s"', + $class, + $filePath + )); + } + + // instantiate it + /** @var \Phinx\Seed\AbstractSeed $seed */ + if ($this->container !== null) { + $seed = $this->container->get($class); + } else { + $seed = new $class(); + } + $seed->setEnvironment($environment); + $input = $this->getInput(); + if ($input !== null) { + $seed->setInput($input); + } + $output = $this->getOutput(); + if ($output !== null) { + $seed->setOutput($output); + } + + if (!($seed instanceof AbstractSeed)) { + throw new InvalidArgumentException(sprintf( + 'The class "%s" in file "%s" must extend \Phinx\Seed\AbstractSeed', + $class, + $filePath + )); + } + + $seeds[$class] = $seed; + } + } + + ksort($seeds); + $this->setSeeds($seeds); + } + + $this->seeds = $this->orderSeedsByDependencies($this->seeds); + + return $this->seeds; + } + + /** + * Returns a list of seed files found in the provided seed paths. + * + * @return string[] + */ + protected function getSeedFiles(): array + { + return Util::getFiles($this->getConfig()->getSeedPaths()); + } + + /** + * Sets the config. + * + * @param \Phinx\Config\ConfigInterface $config Configuration Object + * @return $this + */ + public function setConfig(ConfigInterface $config) + { + $this->config = $config; + + return $this; + } + + /** + * Gets the config. + * + * @return \Phinx\Config\ConfigInterface + */ + public function getConfig(): ConfigInterface + { + return $this->config; + } + + /** + * Toggles the breakpoint for a specific version. + * + * @param string $environment Environment name + * @param int|null $version Version + * @return void + */ + public function toggleBreakpoint(string $environment, ?int $version): void + { + $this->markBreakpoint($environment, $version, self::BREAKPOINT_TOGGLE); + } + + /** + * Updates the breakpoint for a specific version. + * + * @param string $environment The required environment + * @param int|null $version The version of the target migration + * @param int $mark The state of the breakpoint as defined by self::BREAKPOINT_xxxx constants. + * @return void + */ + protected function markBreakpoint(string $environment, ?int $version, int $mark): void + { + $migrations = $this->getMigrations($environment); + $env = $this->getEnvironment($environment); + $versions = $env->getVersionLog(); + + if (empty($versions) || empty($migrations)) { + return; + } + + if ($version === null) { + $lastVersion = end($versions); + $version = $lastVersion['version']; + } + + if ($version != 0 && (!isset($versions[$version]) || !isset($migrations[$version]))) { + $this->output->writeln(sprintf( + 'warning %s is not a valid version', + $version + )); + + return; + } + + switch ($mark) { + case self::BREAKPOINT_TOGGLE: + $env->getAdapter()->toggleBreakpoint($migrations[$version]); + break; + case self::BREAKPOINT_SET: + if ($versions[$version]['breakpoint'] == 0) { + $env->getAdapter()->setBreakpoint($migrations[$version]); + } + break; + case self::BREAKPOINT_UNSET: + if ($versions[$version]['breakpoint'] == 1) { + $env->getAdapter()->unsetBreakpoint($migrations[$version]); + } + break; + } + + $versions = $env->getVersionLog(); + + $this->getOutput()->writeln( + ' Breakpoint ' . ($versions[$version]['breakpoint'] ? 'set' : 'cleared') . + ' for ' . $version . '' . + ' ' . $migrations[$version]->getName() . '' + ); + } + + /** + * Remove all breakpoints + * + * @param string $environment The required environment + * @return void + */ + public function removeBreakpoints(string $environment): void + { + $this->getOutput()->writeln(sprintf( + ' %d breakpoints cleared.', + $this->getEnvironment($environment)->getAdapter()->resetAllBreakpoints() + )); + } + + /** + * Set the breakpoint for a specific version. + * + * @param string $environment The required environment + * @param int|null $version The version of the target migration + * @return void + */ + public function setBreakpoint(string $environment, ?int $version): void + { + $this->markBreakpoint($environment, $version, self::BREAKPOINT_SET); + } + + /** + * Unset the breakpoint for a specific version. + * + * @param string $environment The required environment + * @param int|null $version The version of the target migration + * @return void + */ + public function unsetBreakpoint(string $environment, ?int $version): void + { + $this->markBreakpoint($environment, $version, self::BREAKPOINT_UNSET); + } + + /** + * @param int $verbosityLevel Verbosity level for info messages + * @return $this + */ + public function setVerbosityLevel(int $verbosityLevel) + { + $this->verbosityLevel = $verbosityLevel; + + return $this; + } +} diff --git a/vendor/topthink/think-migration/phinx/Migration/Manager/Environment.php b/vendor/topthink/think-migration/phinx/Migration/Manager/Environment.php new file mode 100644 index 0000000..9993ebc --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Migration/Manager/Environment.php @@ -0,0 +1,398 @@ + + */ + protected $options; + + /** + * @var \think\console\Input|null + */ + protected $input; + + /** + * @var \think\console\Output|null + */ + protected $output; + + /** + * @var int + */ + protected $currentVersion; + + /** + * @var string + */ + protected $schemaTableName = 'phinxlog'; + + /** + * @var \Phinx\Db\Adapter\AdapterInterface + */ + protected $adapter; + + /** + * @param string $name Environment Name + * @param array $options Options + */ + public function __construct(string $name, array $options) + { + $this->name = $name; + $this->options = $options; + } + + /** + * Executes the specified migration on this environment. + * + * @param \Phinx\Migration\MigrationInterface $migration Migration + * @param string $direction Direction + * @param bool $fake flag that if true, we just record running the migration, but not actually do the migration + * @return void + */ + public function executeMigration(MigrationInterface $migration, string $direction = MigrationInterface::UP, bool $fake = false): void + { + $direction = $direction === MigrationInterface::UP ? MigrationInterface::UP : MigrationInterface::DOWN; + $migration->setMigratingUp($direction === MigrationInterface::UP); + + $startTime = time(); + $migration->setAdapter($this->getAdapter()); + + $migration->preFlightCheck(); + + if (method_exists($migration, MigrationInterface::INIT)) { + $migration->{MigrationInterface::INIT}(); + } + + if (!$fake) { + // begin the transaction if the adapter supports it + if ($this->getAdapter()->hasTransactions()) { + $this->getAdapter()->beginTransaction(); + } + + // Run the migration + if (method_exists($migration, MigrationInterface::CHANGE)) { + if ($direction === MigrationInterface::DOWN) { + // Create an instance of the ProxyAdapter so we can record all + // of the migration commands for reverse playback + + /** @var \Phinx\Db\Adapter\ProxyAdapter $proxyAdapter */ + $proxyAdapter = AdapterFactory::instance() + ->getWrapper('proxy', $this->getAdapter()); + $migration->setAdapter($proxyAdapter); + $migration->{MigrationInterface::CHANGE}(); + $proxyAdapter->executeInvertedCommands(); + $migration->setAdapter($this->getAdapter()); + } else { + $migration->{MigrationInterface::CHANGE}(); + } + } else { + $migration->{$direction}(); + } + + // commit the transaction if the adapter supports it + if ($this->getAdapter()->hasTransactions()) { + $this->getAdapter()->commitTransaction(); + } + } + + $migration->postFlightCheck(); + + // Record it in the database + $this->getAdapter()->migrated($migration, $direction, date('Y-m-d H:i:s', $startTime), date('Y-m-d H:i:s', time())); + } + + /** + * Executes the specified seeder on this environment. + * + * @param \Phinx\Seed\SeedInterface $seed Seed + * @return void + */ + public function executeSeed(SeedInterface $seed): void + { + $seed->setAdapter($this->getAdapter()); + if (method_exists($seed, SeedInterface::INIT)) { + $seed->{SeedInterface::INIT}(); + } + + // begin the transaction if the adapter supports it + if ($this->getAdapter()->hasTransactions()) { + $this->getAdapter()->beginTransaction(); + } + + // Run the seeder + if (method_exists($seed, SeedInterface::RUN)) { + $seed->{SeedInterface::RUN}(); + } + + // commit the transaction if the adapter supports it + if ($this->getAdapter()->hasTransactions()) { + $this->getAdapter()->commitTransaction(); + } + } + + /** + * Sets the environment's name. + * + * @param string $name Environment Name + * @return $this + */ + public function setName(string $name) + { + $this->name = $name; + + return $this; + } + + /** + * Gets the environment name. + * + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * Sets the environment's options. + * + * @param array $options Environment Options + * @return $this + */ + public function setOptions(array $options) + { + $this->options = $options; + + return $this; + } + + /** + * Gets the environment's options. + * + * @return array + */ + public function getOptions(): array + { + return $this->options; + } + + /** + * Sets the console input. + * + * @param \think\console\Input $input Input + * @return $this + */ + public function setInput(InputInterface $input) + { + $this->input = $input; + + return $this; + } + + /** + * Gets the console input. + * + * @return \think\console\Input|null + */ + public function getInput(): ?InputInterface + { + return $this->input; + } + + /** + * Sets the console output. + * + * @param \think\console\Output $output Output + * @return $this + */ + public function setOutput(OutputInterface $output) + { + $this->output = $output; + + return $this; + } + + /** + * Gets the console output. + * + * @return \think\console\Output|null + */ + public function getOutput(): ?OutputInterface + { + return $this->output; + } + + /** + * Gets all migrated version numbers. + * + * @return array + */ + public function getVersions(): array + { + return $this->getAdapter()->getVersions(); + } + + /** + * Get all migration log entries, indexed by version creation time and sorted in ascending order by the configuration's + * version_order option + * + * @return array + */ + public function getVersionLog(): array + { + return $this->getAdapter()->getVersionLog(); + } + + /** + * Sets the current version of the environment. + * + * @param int $version Environment Version + * @return $this + */ + public function setCurrentVersion(int $version) + { + $this->currentVersion = $version; + + return $this; + } + + /** + * Gets the current version of the environment. + * + * @return int + */ + public function getCurrentVersion(): int + { + // We don't cache this code as the current version is pretty volatile. + // that means they're no point in a setter then? + // maybe we should cache and call a reset() method every time a migration is run + $versions = $this->getVersions(); + $version = 0; + + if (!empty($versions)) { + $version = end($versions); + } + + $this->setCurrentVersion($version); + + return $this->currentVersion; + } + + /** + * Sets the database adapter. + * + * @param \Phinx\Db\Adapter\AdapterInterface $adapter Database Adapter + * @return $this + */ + public function setAdapter(AdapterInterface $adapter) + { + $this->adapter = $adapter; + + return $this; + } + + /** + * Gets the database adapter. + * + * @throws \RuntimeException + * @return \Phinx\Db\Adapter\AdapterInterface + */ + public function getAdapter(): AdapterInterface + { + if (isset($this->adapter)) { + return $this->adapter; + } + + $options = $this->getOptions(); + if (isset($options['connection'])) { + if (!($options['connection'] instanceof PDO)) { + throw new RuntimeException('The specified connection is not a PDO instance'); + } + + $options['connection']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $options['adapter'] = $options['connection']->getAttribute(PDO::ATTR_DRIVER_NAME); + } + if (!isset($options['adapter'])) { + throw new RuntimeException('No adapter was specified for environment: ' . $this->getName()); + } + + $factory = AdapterFactory::instance(); + $adapter = $factory + ->getAdapter($options['adapter'], $options); + + // Automatically time the executed commands + $adapter = $factory->getWrapper('timed', $adapter); + + if (isset($options['wrapper'])) { + $adapter = $factory + ->getWrapper($options['wrapper'], $adapter); + } + + /** @var \think\console\Input|null $input */ + $input = $this->getInput(); + if ($input) { + $adapter->setInput($this->getInput()); + } + + /** @var \think\console\Output|null $output */ + $output = $this->getOutput(); + if ($output) { + $adapter->setOutput($this->getOutput()); + } + + // Use the TablePrefixAdapter if table prefix/suffixes are in use + if ($adapter->hasOption('table_prefix') || $adapter->hasOption('table_suffix')) { + $adapter = AdapterFactory::instance() + ->getWrapper('prefix', $adapter); + } + + $this->setAdapter($adapter); + + return $adapter; + } + + /** + * Sets the schema table name. + * + * @param string $schemaTableName Schema Table Name + * @return $this + */ + public function setSchemaTableName($schemaTableName) + { + $this->schemaTableName = $schemaTableName; + + return $this; + } + + /** + * Gets the schema table name. + * + * @return string + */ + public function getSchemaTableName(): string + { + return $this->schemaTableName; + } +} diff --git a/vendor/topthink/think-migration/phinx/Migration/Migration.change.template.php.dist b/vendor/topthink/think-migration/phinx/Migration/Migration.change.template.php.dist new file mode 100644 index 0000000..12eb6fb --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Migration/Migration.change.template.php.dist @@ -0,0 +1,23 @@ + + */ +interface MigrationInterface +{ + /** + * @var string + */ + public const CHANGE = 'change'; + + /** + * @var string + */ + public const UP = 'up'; + + /** + * @var string + */ + public const DOWN = 'down'; + + /** + * @var string + */ + public const INIT = 'init'; + + /** + * Sets the database adapter. + * + * @param \Phinx\Db\Adapter\AdapterInterface $adapter Database Adapter + * @return $this + */ + public function setAdapter(AdapterInterface $adapter); + + /** + * Gets the database adapter. + * + * @return \Phinx\Db\Adapter\AdapterInterface|null + */ + public function getAdapter(): ?AdapterInterface; + + /** + * Sets the input object to be used in migration object + * + * @param \think\console\Input $input Input + * @return $this + */ + public function setInput(InputInterface $input); + + /** + * Gets the input object to be used in migration object + * + * @return \think\console\Input|null + */ + public function getInput(): ?InputInterface; + + /** + * Sets the output object to be used in migration object + * + * @param \think\console\Output $output Output + * @return $this + */ + public function setOutput(OutputInterface $output); + + /** + * Gets the output object to be used in migration object + * + * @return \think\console\Output|null + */ + public function getOutput(): ?OutputInterface; + + /** + * Gets the name. + * + * @return string + */ + public function getName(): string; + + /** + * Gets the detected environment + * + * @return string + */ + public function getEnvironment(): string; + + /** + * Sets the migration version number. + * + * @param int $version Version + * @return $this + */ + public function setVersion(int $version); + + /** + * Gets the migration version number. + * + * @return int + */ + public function getVersion(): int; + + /** + * Sets whether this migration is being applied or reverted + * + * @param bool $isMigratingUp True if the migration is being applied + * @return $this + */ + public function setMigratingUp(bool $isMigratingUp); + + /** + * Gets whether this migration is being applied or reverted. + * True means that the migration is being applied. + * + * @return bool + */ + public function isMigratingUp(): bool; + + /** + * Executes a SQL statement and returns the number of affected rows. + * + * @param string $sql SQL + * @param array $params parameters to use for prepared query + * @return int + */ + public function execute(string $sql, array $params = []): int; + + /** + * Executes a SQL statement. + * + * The return type depends on the underlying adapter being used. To improve + * IDE auto-completion possibility, you can overwrite the query method + * phpDoc in your (typically custom abstract parent) migration class, where + * you can set the return type by the adapter in your current use. + * + * @param string $sql SQL + * @param array $params parameters to use for prepared query + * @return mixed + */ + public function query(string $sql, array $params = []); + + /** + * Returns a new Query object that can be used to build complex SELECT, UPDATE, INSERT or DELETE + * queries and execute them against the current database. + * + * Queries executed through the query builder are always sent to the database, regardless of the + * the dry-run settings. + * + * @see https://api.cakephp.org/3.6/class-Cake.Database.Query.html + * @return \Cake\Database\Query + */ + public function getQueryBuilder(): Query; + + /** + * Executes a query and returns only one row as an array. + * + * @param string $sql SQL + * @return array|false + */ + public function fetchRow(string $sql); + + /** + * Executes a query and returns an array of rows. + * + * @param string $sql SQL + * @return array + */ + public function fetchAll(string $sql): array; + + /** + * Create a new database. + * + * @param string $name Database Name + * @param array $options Options + * @return void + */ + public function createDatabase(string $name, array $options): void; + + /** + * Drop a database. + * + * @param string $name Database Name + * @return void + */ + public function dropDatabase(string $name): void; + + /** + * Creates schema. + * + * This will thrown an error for adapters that do not support schemas. + * + * @param string $name Schema name + * @return void + * @throws \BadMethodCallException + */ + public function createSchema(string $name): void; + + /** + * Drops schema. + * + * This will thrown an error for adapters that do not support schemas. + * + * @param string $name Schema name + * @return void + * @throws \BadMethodCallException + */ + public function dropSchema(string $name): void; + + /** + * Checks to see if a table exists. + * + * @param string $tableName Table name + * @return bool + */ + public function hasTable(string $tableName): bool; + + /** + * Returns an instance of the \Table class. + * + * You can use this class to create and manipulate tables. + * + * @param string $tableName Table name + * @param array $options Options + * @return \Phinx\Db\Table + */ + public function table(string $tableName, array $options): Table; + + /** + * Perform checks on the migration, printing a warning + * if there are potential problems. + * + * @return void + */ + public function preFlightCheck(): void; + + /** + * Perform checks on the migration after completion + * + * Right now, the only check is whether all changes were committed + * + * @return void + */ + public function postFlightCheck(): void; + + /** + * Checks to see if the migration should be executed. + * + * Returns true by default. + * + * You can use this to prevent a migration from executing. + * + * @return bool + */ + public function shouldExecute(): bool; +} diff --git a/vendor/topthink/think-migration/phinx/README.md b/vendor/topthink/think-migration/phinx/README.md index ed1badc..410ef99 100644 --- a/vendor/topthink/think-migration/phinx/README.md +++ b/vendor/topthink/think-migration/phinx/README.md @@ -1,14 +1,16 @@ # [Phinx](https://phinx.org): Simple PHP Database Migrations -[![Build Status](https://travis-ci.org/robmorgan/phinx.png?branch=master)](https://travis-ci.org/robmorgan/phinx) -[![Build status](https://ci.appveyor.com/api/projects/status/9vag4892hfq6effr)](https://ci.appveyor.com/project/robmorgan/phinx) -[![Code Coverage](https://scrutinizer-ci.com/g/robmorgan/phinx/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/robmorgan/phinx/) +[![Build Status](https://github.com/cakephp/phinx/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/cakephp/phinx/actions?query=workflow%3A%22CI%22+branch%3Amaster+event%3Apush) +[![Code Coverage](https://codecov.io/gh/cakephp/phinx/branch/master/graph/badge.svg)](https://codecov.io/gh/cakephp/phinx) [![Latest Stable Version](https://poser.pugx.org/robmorgan/phinx/version.png)](https://packagist.org/packages/robmorgan/phinx) +[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.2-8892BF.svg)](https://php.net/) [![Total Downloads](https://poser.pugx.org/robmorgan/phinx/d/total.png)](https://packagist.org/packages/robmorgan/phinx) -Phinx makes it ridiculously easy to manage the database migrations for your PHP app. In less than 5 minutes you can install Phinx and create your first database migration. Phinx is just about migrations without all the bloat of a database ORM system or framework. +## Intro -**Check out http://docs.phinx.org for the comprehensive documentation.** +Phinx makes it ridiculously easy to manage the database migrations for your PHP app. In less than 5 minutes, you can install Phinx and create your first database migration. Phinx is just about migrations without all the bloat of a database ORM system or framework. + +**Check out [book.cakephp.org/phinx](https://book.cakephp.org/phinx) ([EN](https://book.cakephp.org/phinx), [ZH](https://tsy12321.gitbooks.io/phinx-doc/)) for the comprehensive documentation.** ![phinxterm](https://cloud.githubusercontent.com/assets/178939/3887559/e6b5e524-21f2-11e4-8256-0ba6040725fc.gif) @@ -34,9 +36,11 @@ Phinx natively supports the following database adapters: ## Install & Run +See [version and branch overview](https://github.com/cakephp/phinx/wiki#version-and-branch-overview) for branch and PHP compatibility. + ### Composer -The fastest way to install Phinx is to add it to your project using Composer (http://getcomposer.org/). +The fastest way to install Phinx is to add it to your project using Composer (https://getcomposer.org/). 1. Install Composer: @@ -69,7 +73,7 @@ You can also use the Box application to build Phinx as a Phar archive (https://b 1. Clone Phinx from GitHub ``` - git clone git://github.com/robmorgan/phinx.git + git clone https://github.com/cakephp/phinx.git cd phinx ``` @@ -99,7 +103,11 @@ You can also use the Box application to build Phinx as a Phar archive (https://b ## Documentation -Check out http://docs.phinx.org for the comprehensive documentation. +Check out https://book.cakephp.org/phinx for the comprehensive documentation. + +Other translations include: + + * [Chinese](https://tsy12321.gitbooks.io/phinx-doc/) (Maintained by [@tsy12321](https://github.com/tsy12321/phinx-doc)) ## Contributing @@ -107,19 +115,26 @@ Please read the [CONTRIBUTING](CONTRIBUTING.md) document. ## News & Updates -Follow Rob (@\_rjm\_) on Twitter to stay up to date (http://twitter.com/_rjm_) +Follow [@CakePHP](https://twitter.com/cakephp) on Twitter to stay up to date. + +## Limitations + +### PostgreSQL + +- Not able to set a unique constraint on a table (). + ## Misc ### Version History -Please read the [CHANGELOG](CHANGELOG.md) document. +Please read the [release notes](https://github.com/cakephp/phinx/releases). ### License (The MIT license) -Copyright (c) 2016 Rob Morgan +Copyright (c) 2017 Rob Morgan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/vendor/topthink/think-migration/phinx/Seed/AbstractSeed.php b/vendor/topthink/think-migration/phinx/Seed/AbstractSeed.php new file mode 100644 index 0000000..f4e13e4 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Seed/AbstractSeed.php @@ -0,0 +1,222 @@ + + */ +abstract class AbstractSeed implements SeedInterface +{ + /** + * @var string + */ + protected $environment; + + /** + * @var \Phinx\Db\Adapter\AdapterInterface + */ + protected $adapter; + + /** + * @var \think\console\Input + */ + protected $input; + + /** + * @var \think\console\Output + */ + protected $output; + + /** + * Override to specify dependencies for dependency injection from the configured PSR-11 container + */ + public function __construct() + { + } + + /** + * @inheritDoc + */ + public function run(): void + { + } + + /** + * @inheritDoc + */ + public function getDependencies(): array + { + return []; + } + + /** + * @inheritDoc + */ + public function setEnvironment(string $environment) + { + $this->environment = $environment; + + return $this; + } + + /** + * @inheritDoc + */ + public function getEnvironment(): string + { + return $this->environment; + } + + /** + * @inheritDoc + */ + public function setAdapter(AdapterInterface $adapter): SeedInterface + { + $this->adapter = $adapter; + + return $this; + } + + /** + * @inheritDoc + */ + public function getAdapter(): AdapterInterface + { + return $this->adapter; + } + + /** + * @inheritDoc + */ + public function setInput(InputInterface $input) + { + $this->input = $input; + + return $this; + } + + /** + * @inheritDoc + */ + public function getInput(): InputInterface + { + return $this->input; + } + + /** + * @inheritDoc + */ + public function setOutput(OutputInterface $output): SeedInterface + { + $this->output = $output; + + return $this; + } + + /** + * @inheritDoc + */ + public function getOutput(): OutputInterface + { + return $this->output; + } + + /** + * @inheritDoc + */ + public function getName(): string + { + return static::class; + } + + /** + * @inheritDoc + */ + public function execute(string $sql, array $params = []) + { + return $this->getAdapter()->execute($sql, $params); + } + + /** + * @inheritDoc + */ + public function query(string $sql, array $params = []) + { + return $this->getAdapter()->query($sql, $params); + } + + /** + * @inheritDoc + */ + public function fetchRow(string $sql) + { + return $this->getAdapter()->fetchRow($sql); + } + + /** + * @inheritDoc + */ + public function fetchAll(string $sql): array + { + return $this->getAdapter()->fetchAll($sql); + } + + /** + * @inheritDoc + */ + public function insert(string $table, array $data): void + { + // convert to table object + if (is_string($table)) { + $table = new Table($table, [], $this->getAdapter()); + } + $table->insert($data)->save(); + } + + /** + * @inheritDoc + */ + public function hasTable(string $tableName): bool + { + return $this->getAdapter()->hasTable($tableName); + } + + /** + * @inheritDoc + */ + public function table(string $tableName, array $options = []): Table + { + return new Table($tableName, $options, $this->getAdapter()); + } + + /** + * Checks to see if the seed should be executed. + * + * Returns true by default. + * + * You can use this to prevent a seed from executing. + * + * @return bool + */ + public function shouldExecute(): bool + { + return true; + } +} diff --git a/vendor/topthink/think-migration/phinx/Seed/Seed.template.php.dist b/vendor/topthink/think-migration/phinx/Seed/Seed.template.php.dist new file mode 100644 index 0000000..74ba622 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Seed/Seed.template.php.dist @@ -0,0 +1,20 @@ + + */ +interface SeedInterface +{ + /** + * @var string + */ + public const RUN = 'run'; + + /** + * @var string + */ + public const INIT = 'init'; + + /** + * Run the seeder. + * + * @return void + */ + public function run(): void; + + /** + * Return seeds dependencies. + * + * @return array + */ + public function getDependencies(): array; + + /** + * Sets the environment. + * + * @return $this + */ + public function setEnvironment(string $environment); + + /** + * Gets the environment. + * + * @return string + */ + public function getEnvironment(): string; + + /** + * Sets the database adapter. + * + * @param \Phinx\Db\Adapter\AdapterInterface $adapter Database Adapter + * @return $this + */ + public function setAdapter(AdapterInterface $adapter); + + /** + * Gets the database adapter. + * + * @return \Phinx\Db\Adapter\AdapterInterface + */ + public function getAdapter(): AdapterInterface; + + /** + * Sets the input object to be used in migration object + * + * @param \think\console\Input $input Input + * @return $this + */ + public function setInput(InputInterface $input); + + /** + * Gets the input object to be used in migration object + * + * @return \think\console\Input + */ + public function getInput(): InputInterface; + + /** + * Sets the output object to be used in migration object + * + * @param \think\console\Output $output Output + * @return $this + */ + public function setOutput(OutputInterface $output); + + /** + * Gets the output object to be used in migration object + * + * @return \think\console\Output + */ + public function getOutput(): OutputInterface; + + /** + * Gets the name. + * + * @return string + */ + public function getName(): string; + + /** + * Executes a SQL statement and returns the number of affected rows. + * + * @param string $sql SQL + * @param array $params parameters to use for prepared query + * @return int + */ + public function execute(string $sql, array $params = []); + + /** + * Executes a SQL statement. + * + * The return type depends on the underlying adapter being used. To improve + * IDE auto-completion possibility, you can overwrite the query method + * phpDoc in your (typically custom abstract parent) seed class, where + * you can set the return type by the adapter in your current use. + * + * @param string $sql SQL + * @param array $params parameters to use for prepared query + * @return mixed + */ + public function query(string $sql, array $params = []); + + /** + * Executes a query and returns only one row as an array. + * + * @param string $sql SQL + * @return array|false + */ + public function fetchRow(string $sql); + + /** + * Executes a query and returns an array of rows. + * + * @param string $sql SQL + * @return array + */ + public function fetchAll(string $sql): array; + + /** + * Insert data into a table. + * + * @param string $tableName Table name + * @param array $data Data + * @return void + */ + public function insert(string $tableName, array $data): void; + + /** + * Checks to see if a table exists. + * + * @param string $tableName Table name + * @return bool + */ + public function hasTable(string $tableName): bool; + + /** + * Returns an instance of the \Table class. + * + * You can use this class to create and manipulate tables. + * + * @param string $tableName Table name + * @param array $options Options + * @return \Phinx\Db\Table + */ + public function table(string $tableName, array $options): \Phinx\Db\Table; + + /** + * Checks to see if the seed should be executed. + * + * Returns true by default. + * + * You can use this to prevent a seed from executing. + * + * @return bool + */ + public function shouldExecute(): bool; +} diff --git a/vendor/topthink/think-migration/phinx/Util/Expression.php b/vendor/topthink/think-migration/phinx/Util/Expression.php new file mode 100644 index 0000000..23a6b9e --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Util/Expression.php @@ -0,0 +1,41 @@ +value = $value; + } + + /** + * @return string Returns the expression + */ + public function __toString(): string + { + return $this->value; + } + + /** + * @param string $value The expression + * @return self + */ + public static function from(string $value): Expression + { + return new self($value); + } +} diff --git a/vendor/topthink/think-migration/phinx/Util/Literal.php b/vendor/topthink/think-migration/phinx/Util/Literal.php new file mode 100644 index 0000000..5889832 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Util/Literal.php @@ -0,0 +1,41 @@ +value = $value; + } + + /** + * @return string Returns the literal's value + */ + public function __toString(): string + { + return $this->value; + } + + /** + * @param string $value The literal's value + * @return self + */ + public static function from(string $value): Literal + { + return new self($value); + } +} diff --git a/vendor/topthink/think-migration/phinx/Util/Util.php b/vendor/topthink/think-migration/phinx/Util/Util.php new file mode 100644 index 0000000..442f6d5 --- /dev/null +++ b/vendor/topthink/think-migration/phinx/Util/Util.php @@ -0,0 +1,361 @@ +format(static::DATE_FORMAT); + } + + /** + * Gets an array of all the existing migration class names. + * + * @param string $path Path + * @return string[] + */ + public static function getExistingMigrationClassNames(string $path): array + { + $classNames = []; + + if (!is_dir($path)) { + return $classNames; + } + + // filter the files to only get the ones that match our naming scheme + $phpFiles = static::getFiles($path); + + foreach ($phpFiles as $filePath) { + $fileName = basename($filePath); + if (preg_match(static::MIGRATION_FILE_NAME_PATTERN, $fileName)) { + $classNames[] = static::mapFileNameToClassName($fileName); + } + } + + return $classNames; + } + + /** + * Get the version from the beginning of a file name. + * + * @param string $fileName File Name + * @return int + */ + public static function getVersionFromFileName(string $fileName): int + { + $matches = []; + preg_match('/^[0-9]+/', basename($fileName), $matches); + $value = (int)($matches[0] ?? null); + if (!$value) { + throw new RuntimeException(sprintf('Cannot get a valid version from filename `%s`', $fileName)); + } + + return $value; + } + + /** + * Turn migration names like 'CreateUserTable' into file names like + * '12345678901234_create_user_table.php' or 'LimitResourceNamesTo30Chars' into + * '12345678901234_limit_resource_names_to_30_chars.php'. + * + * @param string $className Class Name + * @return string + */ + public static function mapClassNameToFileName(string $className): string + { + $snake = function ($matches) { + return '_' . strtolower($matches[0]); + }; + $fileName = preg_replace_callback('/\d+|[A-Z]/', $snake, $className); + $fileName = static::getCurrentTimestamp() . "$fileName.php"; + + return $fileName; + } + + /** + * Turn file names like '12345678901234_create_user_table.php' into class + * names like 'CreateUserTable'. + * + * @param string $fileName File Name + * @return string + */ + public static function mapFileNameToClassName(string $fileName): string + { + $matches = []; + if (preg_match(static::MIGRATION_FILE_NAME_PATTERN, $fileName, $matches)) { + $fileName = $matches[1]; + } elseif (preg_match(static::MIGRATION_FILE_NAME_NO_NAME_PATTERN, $fileName)) { + return 'V' . substr($fileName, 0, strlen($fileName) - 4); + } + + $className = str_replace('_', '', ucwords($fileName, '_')); + + return $className; + } + + /** + * Check if a migration class name is unique regardless of the + * timestamp. + * + * This method takes a class name and a path to a migrations directory. + * + * Migration class names must be in PascalCase format but consecutive + * capitals are allowed. + * e.g: AddIndexToPostsTable or CustomHTMLTitle. + * + * @param string $className Class Name + * @param string $path Path + * @return bool + */ + public static function isUniqueMigrationClassName(string $className, string $path): bool + { + $existingClassNames = static::getExistingMigrationClassNames($path); + + return !in_array($className, $existingClassNames, true); + } + + /** + * Check if a migration/seed class name is valid. + * + * Migration & Seed class names must be in CamelCase format. + * e.g: CreateUserTable, AddIndexToPostsTable or UserSeeder. + * + * Single words are not allowed on their own. + * + * @param string $className Class Name + * @return bool + */ + public static function isValidPhinxClassName(string $className): bool + { + return (bool)preg_match(static::CLASS_NAME_PATTERN, $className); + } + + /** + * Check if a migration file name is valid. + * + * @param string $fileName File Name + * @return bool + */ + public static function isValidMigrationFileName(string $fileName): bool + { + return (bool)preg_match(static::MIGRATION_FILE_NAME_PATTERN, $fileName) + || (bool)preg_match(static::MIGRATION_FILE_NAME_NO_NAME_PATTERN, $fileName); + } + + /** + * Check if a seed file name is valid. + * + * @param string $fileName File Name + * @return bool + */ + public static function isValidSeedFileName(string $fileName): bool + { + return (bool)preg_match(static::SEED_FILE_NAME_PATTERN, $fileName); + } + + /** + * Expands a set of paths with curly braces (if supported by the OS). + * + * @param string[] $paths Paths + * @return string[] + */ + public static function globAll(array $paths): array + { + $result = []; + + foreach ($paths as $path) { + $result = array_merge($result, static::glob($path)); + } + + return $result; + } + + /** + * Expands a path with curly braces (if supported by the OS). + * + * @param string $path Path + * @return string[] + */ + public static function glob(string $path): array + { + return glob($path, defined('GLOB_BRACE') ? GLOB_BRACE : 0); + } + + /** + * Takes the path to a php file and attempts to include it if readable + * + * @param string $filename Filename + * @param \think\console\Input|null $input Input + * @param \think\console\Output|null $output Output + * @param \Phinx\Console\Command\AbstractCommand|mixed|null $context Context + * @throws \Exception + * @return string + */ + public static function loadPhpFile(string $filename, ?InputInterface $input = null, ?OutputInterface $output = null, $context = null): string + { + $filePath = realpath($filename); + if (!file_exists($filePath)) { + throw new Exception(sprintf("File does not exist: %s \n", $filename)); + } + + /** + * I lifed this from phpunits FileLoader class + * + * @see https://github.com/sebastianbergmann/phpunit/pull/2751 + */ + $isReadable = @fopen($filePath, 'r') !== false; + + if (!$isReadable) { + throw new Exception(sprintf("Cannot open file %s \n", $filename)); + } + + // prevent this to be propagated to the included file + unset($isReadable); + + include_once $filePath; + + return $filePath; + } + + /** + * Given an array of paths, return all unique PHP files that are in them + * + * @param string|string[] $paths Path or array of paths to get .php files. + * @return string[] + */ + public static function getFiles($paths): array + { + $files = static::globAll(array_map(function ($path) { + return $path . DIRECTORY_SEPARATOR . '*.php'; + }, (array)$paths)); + // glob() can return the same file multiple times + // This will cause the migration to fail with a + // false assumption of duplicate migrations + // https://php.net/manual/en/function.glob.php#110340 + $files = array_unique($files); + + return $files; + } + + /** + * Attempt to remove the current working directory from a path for output. + * + * @param string $path Path to remove cwd prefix from + * @return string + */ + public static function relativePath(string $path): string + { + $realpath = realpath($path); + if ($realpath !== false) { + $path = $realpath; + } + + $cwd = getcwd(); + if ($cwd !== false) { + $cwd .= DIRECTORY_SEPARATOR; + $cwdLen = strlen($cwd); + + if (substr($path, 0, $cwdLen) === $cwd) { + $path = substr($path, $cwdLen); + } + } + + return $path; + } + + /** + * Parses DSN string into db config array. + * + * @param string $dsn DSN string + * @return array + */ + public static function parseDsn(string $dsn): array + { + $pattern = <<<'REGEXP' +{ + ^ + (?: + (?P[\w\\\\]+):// + ) + (?: + (?P.*?) + (?: + :(?P.*?) + )? + @ + )? + (?: + (?P[^?#/:@]+) + (?: + :(?P\d+) + )? + )? + (?: + /(?P[^?#]*) + )? + (?: + \?(?P[^#]*) + )? + $ +}x +REGEXP; + + if (!preg_match($pattern, $dsn, $parsed)) { + return []; + } + + // filter out everything except the matched groups + $config = array_intersect_key($parsed, array_flip(['adapter', 'user', 'pass', 'host', 'port', 'name'])); + $config = array_filter($config); + + parse_str($parsed['query'] ?? '', $query); + $config = array_merge($query, $config); + + return $config; + } +} diff --git a/vendor/topthink/think-migration/src/Command.php b/vendor/topthink/think-migration/src/Command.php index 6551897..339796f 100644 --- a/vendor/topthink/think-migration/src/Command.php +++ b/vendor/topthink/think-migration/src/Command.php @@ -11,12 +11,13 @@ namespace think\migration; use InvalidArgumentException; +use Phinx\Config\Config; use Phinx\Db\Adapter\AdapterFactory; abstract class Command extends \think\console\Command { protected $adapter; - + public function getAdapter() { if (isset($this->adapter)) { @@ -31,6 +32,9 @@ abstract class Command extends \think\console\Command $adapter = AdapterFactory::instance()->getWrapper('prefix', $adapter); } + $adapter->setInput($this->input); + $adapter->setOutput($this->output); + $this->adapter = $adapter; return $adapter; @@ -55,6 +59,7 @@ abstract class Command extends \think\console\Command 'pass' => $config['password'], 'port' => $config['hostport'], 'charset' => $config['charset'], + 'suffix' => $config['suffix'] ?? '', 'table_prefix' => $config['prefix'], ]; } else { @@ -66,13 +71,15 @@ abstract class Command extends \think\console\Command 'pass' => explode(',', $config['password'])[0], 'port' => explode(',', $config['hostport'])[0], 'charset' => explode(',', $config['charset'])[0], + 'suffix' => explode(',', $config['suffix'] ?? '')[0], 'table_prefix' => explode(',', $config['prefix'])[0], ]; } $table = $this->app->config->get('database.migration_table', 'migrations'); - $dbConfig['default_migration_table'] = $dbConfig['table_prefix'] . $table; + $dbConfig['migration_table'] = $dbConfig['table_prefix'] . $table; + $dbConfig['version_order'] = Config::VERSION_ORDER_CREATION_TIME; return $dbConfig; } diff --git a/vendor/topthink/think-migration/src/Migrator.php b/vendor/topthink/think-migration/src/Migrator.php index 1965953..a7707c0 100644 --- a/vendor/topthink/think-migration/src/Migrator.php +++ b/vendor/topthink/think-migration/src/Migrator.php @@ -17,10 +17,10 @@ class Migrator extends AbstractMigration { /** * @param string $tableName - * @param array $options + * @param array $options * @return Table */ - public function table($tableName, $options = []) + public function table($tableName, $options = []): \Phinx\Db\Table { return new Table($tableName, $options, $this->getAdapter()); } diff --git a/vendor/topthink/think-migration/src/NullOutput.php b/vendor/topthink/think-migration/src/NullOutput.php new file mode 100644 index 0000000..d750595 --- /dev/null +++ b/vendor/topthink/think-migration/src/NullOutput.php @@ -0,0 +1,13 @@ +isDevMode()) { + return; + } + + $files = [ + 'vendor/robmorgan/phinx/LICENSE' => 'phinx/LICENSE', + 'vendor/robmorgan/phinx/README.md' => 'phinx/README.md', + 'vendor/robmorgan/phinx/src/Phinx/Config/' => 'phinx/Config/', + 'vendor/robmorgan/phinx/src/Phinx/Db/' => 'phinx/Db/', + 'vendor/robmorgan/phinx/src/Phinx/Migration/' => 'phinx/Migration/', + 'vendor/robmorgan/phinx/src/Phinx/Seed/' => 'phinx/Seed/', + 'vendor/robmorgan/phinx/src/Phinx/Util/' => 'phinx/Util/', + ]; + + $io = $event->getIO(); + + $fs = new Filesystem; + + //clear + $fs->remove('phinx'); + + foreach ($files as $from => $to) { + // check pattern + $pattern = null; + if (strpos($from, '#') > 0) { + [$from, $pattern] = explode('#', $from, 2); + } + + // check the overwrite newer files disable flag (? in end of path) + $overwriteNewerFiles = substr($to, -1) != '?'; + if (!$overwriteNewerFiles) { + $to = substr($to, 0, -1); + } + + // Check the renaming of file for direct moving (file-to-file) + $isRenameFile = substr($to, -1) != '/' && !is_dir($from); + + if (file_exists($to) && !is_dir($to) && !$isRenameFile) { + throw new \InvalidArgumentException('Destination directory is not a directory.'); + } + + try { + if ($isRenameFile) { + $fs->mkdir(dirname($to)); + } else { + $fs->mkdir($to); + } + } catch (IOException $e) { + throw new \InvalidArgumentException(sprintf('Could not create directory %s.', $to), $e->getCode(), $e); + } + + if (false === file_exists($from)) { + throw new \InvalidArgumentException(sprintf('Source directory or file "%s" does not exist.', $from)); + } + + if (is_dir($from)) { + $finder = new Finder; + $finder->files()->ignoreDotFiles(false)->in($from); + + if ($pattern) { + $finder->path("#{$pattern}#"); + } + + foreach ($finder as $file) { + $dest = sprintf('%s/%s', $to, $file->getRelativePathname()); + + try { + $fs->copy($file, $dest, $overwriteNewerFiles); + + // replace namespace + $content = file_get_contents($dest); + $replaces = [ + 'use Symfony\Component\Console\Input\InputInterface;' => 'use think\console\Input as InputInterface;', + 'use Symfony\Component\Console\Output\OutputInterface;' => 'use think\console\Output as OutputInterface;', + '\Symfony\Component\Console\Output\OutputInterface' => '\think\console\Output', + '\Symfony\Component\Console\Input\InputInterface' => '\think\console\Input', + 'use Symfony\Component\Console\Output\NullOutput;' => 'use think\migration\NullOutput;', + ]; + $content = str_replace(array_keys($replaces), array_values($replaces), $content); + file_put_contents($dest, $content); + } catch (IOException $e) { + throw new \InvalidArgumentException(sprintf('Could not copy %s', $file->getBaseName()), $e->getCode(), $e); + } + } + } else { + try { + if ($isRenameFile) { + $fs->copy($from, $to, $overwriteNewerFiles); + } else { + $fs->copy($from, $to . '/' . basename($from), $overwriteNewerFiles); + } + } catch (IOException $e) { + throw new \InvalidArgumentException(sprintf('Could not copy %s', $from), $e->getCode(), $e); + } + } + + $io->write(sprintf('Copied file(s) from %s to %s.', $from, $to)); + } + + //clear + $fs->remove('vendor/robmorgan/phinx'); + } +} diff --git a/vendor/topthink/think-migration/src/command/Migrate.php b/vendor/topthink/think-migration/src/command/Migrate.php index 1d97973..b16619a 100644 --- a/vendor/topthink/think-migration/src/command/Migrate.php +++ b/vendor/topthink/think-migration/src/command/Migrate.php @@ -12,7 +12,6 @@ namespace think\migration\command; use Phinx\Db\Adapter\AdapterFactory; -use Phinx\Db\Adapter\ProxyAdapter; use Phinx\Migration\AbstractMigration; use Phinx\Migration\MigrationInterface; use Phinx\Util\Util; @@ -41,8 +40,15 @@ abstract class Migrate extends Command $startTime = time(); $direction = (MigrationInterface::UP === $direction) ? MigrationInterface::UP : MigrationInterface::DOWN; + $migration->setMigratingUp($direction === MigrationInterface::UP); $migration->setAdapter($this->getAdapter()); + $migration->preFlightCheck(); + + if (method_exists($migration, MigrationInterface::INIT)) { + $migration->{MigrationInterface::INIT}(); + } + // begin the transaction if the adapter supports it if ($this->getAdapter()->hasTransactions()) { $this->getAdapter()->beginTransaction(); @@ -53,11 +59,10 @@ abstract class Migrate extends Command if (MigrationInterface::DOWN === $direction) { // Create an instance of the ProxyAdapter so we can record all // of the migration commands for reverse playback - /** @var ProxyAdapter $proxyAdapter */ + /** @var \Phinx\Db\Adapter\ProxyAdapter $proxyAdapter */ $proxyAdapter = AdapterFactory::instance()->getWrapper('proxy', $this->getAdapter()); $migration->setAdapter($proxyAdapter); - /** @noinspection PhpUndefinedMethodInspection */ - $migration->change(); + $migration->{MigrationInterface::CHANGE}(); $proxyAdapter->executeInvertedCommands(); $migration->setAdapter($this->getAdapter()); } else { @@ -73,6 +78,8 @@ abstract class Migrate extends Command $this->getAdapter()->commitTransaction(); } + $migration->postFlightCheck(); + // Record it in the database $this->getAdapter() ->migrated($migration, $direction, date('Y-m-d H:i:s', $startTime), date('Y-m-d H:i:s', time())); @@ -127,7 +134,7 @@ abstract class Migrate extends Command } // instantiate it - $migration = new $class($version, $this->input, $this->output); + $migration = new $class('default', $version, $this->input, $this->output); if (!($migration instanceof AbstractMigration)) { throw new \InvalidArgumentException(sprintf('The class "%s" in file "%s" must extend \Phinx\Migration\AbstractMigration', $class, $filePath)); diff --git a/vendor/topthink/think-migration/src/db/Column.php b/vendor/topthink/think-migration/src/db/Column.php index 3b5cb04..d020960 100644 --- a/vendor/topthink/think-migration/src/db/Column.php +++ b/vendor/topthink/think-migration/src/db/Column.php @@ -160,7 +160,7 @@ class Column extends \Phinx\Db\Table\Column public static function timestamp($name) { - return self::make($name, AdapterInterface::PHINX_TYPE_TIMESTAMP); + return self::make($name, AdapterInterface::PHINX_TYPE_TIMESTAMP, ['null' => true, 'default' => null]); } public static function uuid($name) diff --git a/vendor/topthink/think-migration/src/db/Table.php b/vendor/topthink/think-migration/src/db/Table.php index cf4daa9..be66cd9 100644 --- a/vendor/topthink/think-migration/src/db/Table.php +++ b/vendor/topthink/think-migration/src/db/Table.php @@ -15,6 +15,18 @@ use Phinx\Db\Table\Index; class Table extends \Phinx\Db\Table { + + protected function setOption($name, $value) + { + $options = $this->getOptions(); + + $options[$name] = $value; + + $this->table->setOptions($options); + + return $this; + } + /** * 设置id * @param $id @@ -22,8 +34,7 @@ class Table extends \Phinx\Db\Table */ public function setId($id) { - $this->options['id'] = $id; - return $this; + return $this->setOption('id', $id); } /** @@ -33,8 +44,7 @@ class Table extends \Phinx\Db\Table */ public function setPrimaryKey($key) { - $this->options['primary_key'] = $key; - return $this; + return $this->setOption('primary_key', $key); } /** @@ -44,8 +54,7 @@ class Table extends \Phinx\Db\Table */ public function setEngine($engine) { - $this->options['engine'] = $engine; - return $this; + return $this->setOption('engine', $engine); } /** @@ -55,8 +64,7 @@ class Table extends \Phinx\Db\Table */ public function setComment($comment) { - $this->options['comment'] = $comment; - return $this; + return $this->setOption('comment', $comment); } /** @@ -66,8 +74,7 @@ class Table extends \Phinx\Db\Table */ public function setCollation($collation) { - $this->options['collation'] = $collation; - return $this; + return $this->setOption('collation', $collation); } public function addSoftDelete() @@ -93,20 +100,37 @@ class Table extends \Phinx\Db\Table } /** - * @param string $createdAtColumnName - * @param string $updatedAtColumnName - * @return \Phinx\Db\Table|Table + * @param string $createdAt + * @param string $updatedAt + * @return $this */ - public function addTimestamps($createdAtColumnName = 'create_time', $updatedAtColumnName = 'update_time') + public function addTimestamps($createdAt = 'create_time', $updatedAt = 'update_time', bool $withTimezone = false) { - return parent::addTimestamps($createdAtColumnName, $updatedAtColumnName); + if ($createdAt) { + $this->addColumn($createdAt, 'timestamp', [ + 'null' => false, + 'default' => 'CURRENT_TIMESTAMP', + 'update' => '', + 'timezone' => $withTimezone, + ]); + } + if ($updatedAt) { + $this->addColumn($updatedAt, 'timestamp', [ + 'null' => true, + 'default' => null, + 'update' => '', + 'timezone' => $withTimezone, + ]); + } + + return $this; } /** * @param \Phinx\Db\Table\Column|string $columnName - * @param null $type - * @param array $options - * @return \Phinx\Db\Table|Table + * @param null $type + * @param array $options + * @return $this */ public function addColumn($columnName, $type = null, $options = []) { @@ -121,9 +145,9 @@ class Table extends \Phinx\Db\Table /** * @param string $columnName - * @param null $newColumnType - * @param array $options - * @return \Phinx\Db\Table|Table + * @param null $newColumnType + * @param array $options + * @return $this */ public function changeColumn($columnName, $newColumnType = null, $options = []) { diff --git a/vendor/yzh52521/easyhttp/composer.json b/vendor/yzh52521/easyhttp/composer.json index 872bfdf..862a47f 100644 --- a/vendor/yzh52521/easyhttp/composer.json +++ b/vendor/yzh52521/easyhttp/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": "^7.2.5|^8.0", + "php": ">=7.2.5", "guzzlehttp/guzzle": "^6.0|^7.0", "psr/log":"^1.0|^2.0|^3.0" }, diff --git a/vendor/yzh52521/easyhttp/src/Http.php b/vendor/yzh52521/easyhttp/src/Http.php index 46b2969..4685e05 100644 --- a/vendor/yzh52521/easyhttp/src/Http.php +++ b/vendor/yzh52521/easyhttp/src/Http.php @@ -14,6 +14,7 @@ namespace yzh52521\EasyHttp; * @method static \yzh52521\EasyHttp\Request withVerify(bool|string $verify) * @method static \yzh52521\EasyHttp\Request withHost(string $host) * @method static \yzh52521\EasyHttp\Request withHeaders(array $headers) + * @method static \yzh52521\EasyHttp\Request withBody($content,$contentType='application/json') * @method static \yzh52521\EasyHttp\Request withBasicAuth(string $username, string $password) * @method static \yzh52521\EasyHttp\Request withDigestAuth(string $username, string $password) * @method static \yzh52521\EasyHttp\Request withUA(string $ua) @@ -22,15 +23,19 @@ namespace yzh52521\EasyHttp; * @method static \yzh52521\EasyHttp\Request withProxy(string|array $proxy) * @method static \yzh52521\EasyHttp\Request withVersion(string $version) * @method static \yzh52521\EasyHttp\Request withOptions(array $options) + * @method static \yzh52521\EasyHttp\Request withMiddleware(callable $middleware) + * @method static \yzh52521\EasyHttp\Request withRequestMiddleware(callable $middleware) + * @method static \yzh52521\EasyHttp\Request withResponseMiddleware(callable $middleware) * * @method static \yzh52521\EasyHttp\Request debug($class) * @method static \yzh52521\EasyHttp\Request retry(int $retries=1,int $sleep=0) * @method static \yzh52521\EasyHttp\Request delay(int $seconds) - * @method static \yzh52521\EasyHttp\Request timeout(int $seconds) + * @method static \yzh52521\EasyHttp\Request timeout(float $seconds) + * @method static \yzh52521\EasyHttp\Request connectTimeout(float $seconds) + * @method static \yzh52521\EasyHttp\Request sink(string|resource $to) * @method static \yzh52521\EasyHttp\Request concurrency(int $times) - * @method static \yzh52521\EasyHttp\Response client(string $method, string $url, array $options = []) - * @method static \yzh52521\EasyHttp\Response clientAsync(string $method, string $url, array $options = []) * @method static \yzh52521\EasyHttp\Request removeBodyFormat() + * @method static \yzh52521\EasyHttp\Request maxRedirects(int $max) * * @method static \yzh52521\EasyHttp\Response get(string $url, array $query = []) * @method static \yzh52521\EasyHttp\Response post(string $url, array $data = []) @@ -39,6 +44,8 @@ namespace yzh52521\EasyHttp; * @method static \yzh52521\EasyHttp\Response delete(string $url, array $data = []) * @method static \yzh52521\EasyHttp\Response head(string $url, array $data = []) * @method static \yzh52521\EasyHttp\Response options(string $url, array $data = []) + * @method static \yzh52521\EasyHttp\Response client(string $method, string $url, array $options = []) + * @method static \yzh52521\EasyHttp\Response clientAsync(string $method, string $url, array $options = []) * * @method static \GuzzleHttp\Promise\PromiseInterface getAsync(string $url, array|null $query = null, callable $success = null, callable $fail = null) * @method static \GuzzleHttp\Promise\PromiseInterface postAsync(string $url, array|null $data = null, callable $success = null, callable $fail = null) diff --git a/vendor/yzh52521/easyhttp/src/Request.php b/vendor/yzh52521/easyhttp/src/Request.php index f4ca880..43b5d73 100644 --- a/vendor/yzh52521/easyhttp/src/Request.php +++ b/vendor/yzh52521/easyhttp/src/Request.php @@ -5,6 +5,7 @@ namespace yzh52521\EasyHttp; use GuzzleHttp\Handler\CurlHandler; use GuzzleHttp\HandlerStack; +use GuzzleHttp\Middleware; use GuzzleHttp\Pool; use GuzzleHttp\Client; use GuzzleHttp\Promise; @@ -44,6 +45,13 @@ class Request */ protected $bodyFormat; + /** + * The raw body for the request. + * + * @var string + */ + protected $pendingBody; + protected $isRemoveBodyFormat = false; /** @@ -80,10 +88,7 @@ class Request $this->options = [ 'http_errors' => false, ]; - if (!$this->handlerStack instanceof HandlerStack) { - $this->handlerStack = HandlerStack::create( new CurlHandler() ); - } - $this->options['handler'] = $this->handlerStack; + $this->handlerStack = HandlerStack::create( new CurlHandler() ); } /** @@ -141,6 +146,33 @@ class Request return $this; } + public function withMiddleware(callable $middleware) + { + $this->handlerStack->push($middleware); + + $this->options['handler'] = $this->handlerStack; + + return $this; + } + + public function withRequestMiddleware(callable $middleware) + { + $this->handlerStack->push(Middleware::mapRequest($middleware)); + + $this->options['handler'] = $this->handlerStack; + + return $this; + } + + public function withResponseMiddleware(callable $middleware) + { + $this->handlerStack->push(Middleware::mapResponse($middleware)); + + $this->options['handler'] = $this->handlerStack; + + return $this; + } + public function withHost(string $host) { $this->options['base_uri'] = $host; @@ -173,6 +205,17 @@ class Request return $this; } + public function withBody($content, $contentType = 'application/json') + { + $this->bodyFormat = 'body'; + + $this->options['headers']['Content-Type'] = $contentType; + + $this->pendingBody = $content; + + return $this; + } + public function withBasicAuth(string $username,string $password) { $this->options['auth'] = [$username,$password]; @@ -224,6 +267,13 @@ class Request return $this; } + public function maxRedirects(int $max) + { + $this->options['allow_redirects']['max'] = $max; + + return $this; + } + public function withRedirect($redirect = false) { $this->options['allow_redirects'] = $redirect; @@ -255,6 +305,7 @@ class Request public function retry(int $retries = 1,int $sleep = 0) { $this->handlerStack->push( ( new Retry() )->handle( $retries,$sleep ) ); + $this->options['handler'] = $this->handlerStack; return $this; @@ -267,9 +318,27 @@ class Request return $this; } - public function timeout(int $seconds) + public function timeout(float $seconds) { - $this->options['timeout'] = $seconds * 1000; + $this->options['timeout'] = $seconds; + + return $this; + } + + public function connectTimeout(float $seconds) + { + $this->options['connect_timeout'] = $seconds; + + return $this; + } + + /** + * @param string|resource $to + * @return $this + */ + public function sink($to) + { + $this->options['sink'] = $to; return $this; } @@ -489,7 +558,11 @@ class Request protected function request(string $method,string $url,array $options = []) { - isset( $this->options[$this->bodyFormat] ) && $this->options[$this->bodyFormat] = $options; + if (isset($this->options[$this->bodyFormat])) { + $this->options[$this->bodyFormat] = $options; + } else { + $this->options[$this->bodyFormat] = $this->pendingBody; + } if ($this->isRemoveBodyFormat) { unset( $this->options[$this->bodyFormat] ); } @@ -512,6 +585,14 @@ class Request */ public function client(string $method,string $url,array $options = []) { + if (isset($this->options[$this->bodyFormat])) { + $this->options[$this->bodyFormat] = $options; + } else { + $this->options[$this->bodyFormat] = $this->pendingBody; + } + if ($this->isRemoveBodyFormat) { + unset( $this->options[$this->bodyFormat] ); + } try { if (empty( $options )) { $options = $this->options; @@ -533,6 +614,14 @@ class Request */ public function clientAsync(string $method,string $url,array $options = []) { + if (isset($this->options[$this->bodyFormat])) { + $this->options[$this->bodyFormat] = $options; + } else { + $this->options[$this->bodyFormat] = $this->pendingBody; + } + if ($this->isRemoveBodyFormat) { + unset( $this->options[$this->bodyFormat] ); + } try { if (empty( $options )) { $options = $this->options; @@ -545,13 +634,7 @@ class Request } - protected function requestAsync( - string $method, - string $url, - $options = null, - callable $success = null, - callable $fail = null - ) + protected function requestAsync(string $method, string $url, $options = null, callable $success = null, callable $fail = null) { if (is_callable( $options )) { $successCallback = $options; @@ -561,7 +644,11 @@ class Request $failCallback = $fail; } - isset( $this->options[$this->bodyFormat] ) && $this->options[$this->bodyFormat] = $options; + if (isset($this->options[$this->bodyFormat])) { + $this->options[$this->bodyFormat] = $options; + } else { + $this->options[$this->bodyFormat] = $this->pendingBody; + } if ($this->isRemoveBodyFormat) { unset( $this->options[$this->bodyFormat] );